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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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