update: deps

This commit is contained in:
windingwind 2024-11-09 17:33:08 +01:00
parent df1f5c58d6
commit fccdd28677
7 changed files with 16 additions and 32 deletions

8
package-lock.json generated
View File

@ -35,7 +35,7 @@
"unist-util-visit": "^5.0.0",
"unist-util-visit-parents": "^6.0.1",
"yamljs": "^0.3.0",
"zotero-plugin-toolkit": "^4.0.7"
"zotero-plugin-toolkit": "^4.0.8"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
@ -13588,9 +13588,9 @@
}
},
"node_modules/zotero-plugin-toolkit": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-4.0.7.tgz",
"integrity": "sha512-9bAXXJTgH5SkyauGft50EerudZYGYzN/T3kPgi7udB8lScVyO+HkYERxJqnFuvk2gHzV+stqeaKaX9a0ODTxEQ==",
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-4.0.8.tgz",
"integrity": "sha512-uro188jzhAY+6EB2N9Kx0Vn5ITazwljJOragMi7PjrcRQrEi/R350eT+MAFrDR+pMzEOltrKtz6W7aSvMd9iqA==",
"dependencies": {
"zotero-types": "^2.2.0"
},

View File

@ -56,7 +56,7 @@
"unist-util-visit": "^5.0.0",
"unist-util-visit-parents": "^6.0.1",
"yamljs": "^0.3.0",
"zotero-plugin-toolkit": "^4.0.7"
"zotero-plugin-toolkit": "^4.0.8"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",

View File

@ -97,12 +97,10 @@ function parseHTMLLines(html: string): string[] {
return parsedLines;
}
const funcs = {
const handlers = {
parseHTMLLines,
};
const handlers = MessageHelper.wrapHandlers(funcs);
const messageServer = new MessageHelper({
canBeDestroyed: true,
dev: true,

View File

@ -15,7 +15,7 @@ db.version(2).stores({
log("Using Dexie v" + Dexie.semVer, db);
const funcs = {
const handlers = {
addLink,
bulkAddLink,
rebuildLinkForNote,
@ -26,8 +26,6 @@ const funcs = {
getAnnotationByLinkTarget,
};
const handlers = MessageHelper.wrapHandlers(funcs);
const messageServer = new MessageHelper({
canBeDestroyed: true,
dev: true,

View File

@ -20,7 +20,7 @@ export {
async function parseHTMLLines(html: string) {
const server = await getParsingServer();
return await server.exec("parseHTMLLines", [html]);
return await server.proxy.parseHTMLLines(html);
}
async function getLinesInNote(
@ -58,8 +58,7 @@ async function setLinesToNote(note: Zotero.Item, lines: string[]) {
} else {
const noteHead = noteText.substring(0, containerIndex);
note.setNote(
`${noteHead}data-schema-version="${
config.dataSchemaVersion
`${noteHead}data-schema-version="${config.dataSchemaVersion
}">${lines.join("\n")}</div>`,
);
}

View File

@ -25,7 +25,7 @@ async function getParsingServer() {
handlers: {},
});
server.start();
await server.exec("_ping");
await server.proxy._ping();
addon.data.parsing.server = server;
return server;
}

View File

@ -73,9 +73,7 @@ async function updateNoteLinkRelation(noteID: number) {
}
}
}
const result = await (
await getRelationServer()
).exec("rebuildLinkForNote", [fromLibID, fromKey, linkToData]);
const result = await (await getRelationServer()).proxy.rebuildLinkForNote(fromLibID, fromKey, linkToData);
for (const link of result.oldOutboundLinks as LinkModel[]) {
const item = Zotero.Items.getByLibraryAndKey(link.toLibID, link.toKey);
@ -98,17 +96,14 @@ async function getNoteLinkOutboundRelation(noteID: number) {
const note = Zotero.Items.get(noteID);
const fromLibID = note.libraryID;
const fromKey = note.key;
return (await getRelationServer()).exec("getOutboundLinks", [
fromLibID,
fromKey,
]);
return await (await getRelationServer()).proxy.getOutboundLinks(fromLibID, fromKey);
}
async function getNoteLinkInboundRelation(noteID: number) {
const note = Zotero.Items.get(noteID);
const toLibID = note.libraryID;
const toKey = note.key;
return (await getRelationServer()).exec("getInboundLinks", [toLibID, toKey]);
return await (await getRelationServer()).proxy.getInboundLinks(toLibID, toKey);
}
function decodeHTMLEntities(text: string) {
@ -130,21 +125,15 @@ interface LinkModel {
}
async function linkAnnotationToTarget(model: AnnotationModel) {
return (await getRelationServer()).exec("linkAnnotationToTarget", [model]);
return await (await getRelationServer()).proxy.linkAnnotationToTarget(model);
}
async function getLinkTargetByAnnotation(fromLibID: number, fromKey: string) {
return (await getRelationServer()).exec("getLinkTargetByAnnotation", [
fromLibID,
fromKey,
]);
return await (await getRelationServer()).proxy.getLinkTargetByAnnotation(fromLibID, fromKey);
}
async function getAnnotationByLinkTarget(toLibID: number, toKey: string) {
return (await getRelationServer()).exec("getAnnotationByLinkTarget", [
toLibID,
toKey,
]);
return await (await getRelationServer()).proxy.getAnnotationByLinkTarget(toLibID, toKey);
}
interface AnnotationModel {