@ncukondo/reference-manager 0.23.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{action-menu-C0-X1ndf.js → action-menu-7QLr1lTM.js} +3 -3
- package/dist/chunks/{action-menu-C0-X1ndf.js.map → action-menu-7QLr1lTM.js.map} +1 -1
- package/dist/chunks/{format-CBbnqK3-.js → format-0YxykmO-.js} +2 -2
- package/dist/chunks/{format-CBbnqK3-.js.map → format-0YxykmO-.js.map} +1 -1
- package/dist/chunks/{index-BSWbcT3c.js → index-BZDH5KRo.js} +4 -4
- package/dist/chunks/{index-BSWbcT3c.js.map → index-BZDH5KRo.js.map} +1 -1
- package/dist/chunks/{index-BrETQT0g.js → index-C5G3Nm7i.js} +25 -25
- package/dist/chunks/{index-BrETQT0g.js.map → index-C5G3Nm7i.js.map} +1 -1
- package/dist/chunks/{index-BVDVqLTl.js → index-COAh_acl.js} +3 -3
- package/dist/chunks/index-COAh_acl.js.map +1 -0
- package/dist/chunks/{index-eZatWPDi.js → index-sH2o68X1.js} +56 -24
- package/dist/chunks/index-sH2o68X1.js.map +1 -0
- package/dist/chunks/{reference-select-CogjIATu.js → reference-select-D0qAyipM.js} +3 -3
- package/dist/chunks/{reference-select-CogjIATu.js.map → reference-select-D0qAyipM.js.map} +1 -1
- package/dist/chunks/{style-select-CJzZczSq.js → style-select-CcVzhqgU.js} +3 -3
- package/dist/chunks/{style-select-CJzZczSq.js.map → style-select-CcVzhqgU.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/features/operations/attachments/add.d.ts.map +1 -1
- package/dist/features/operations/fulltext/fetch.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/index-BVDVqLTl.js.map +0 -1
- package/dist/chunks/index-eZatWPDi.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a } from "./index-
|
|
2
|
-
import { d, g, l, o, s } from "./index-
|
|
1
|
+
import { a } from "./index-sH2o68X1.js";
|
|
2
|
+
import { d, g, l, o, s } from "./index-C5G3Nm7i.js";
|
|
3
3
|
export {
|
|
4
4
|
a as addAttachment,
|
|
5
5
|
d as detachAttachment,
|
|
@@ -8,4 +8,4 @@ export {
|
|
|
8
8
|
o as openAttachment,
|
|
9
9
|
s as syncAttachments
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=index-
|
|
11
|
+
//# sourceMappingURL=index-COAh_acl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-COAh_acl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -11,7 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
import * as path from "node:path";
|
|
12
12
|
import path__default, { extname, join, dirname } from "node:path";
|
|
13
13
|
import "@citation-js/plugin-csl";
|
|
14
|
-
import fs__default, { stat, rename, copyFile, rm, readFile, mkdir, writeFile, mkdtemp, access,
|
|
14
|
+
import fs__default, { stat, rename, copyFile, unlink, rm, readFile, mkdir, writeFile, mkdtemp, access, rmdir } from "node:fs/promises";
|
|
15
15
|
import { tmpdir } from "node:os";
|
|
16
16
|
import "node:child_process";
|
|
17
17
|
import "node:crypto";
|
|
@@ -156,7 +156,16 @@ function findExistingFile(files, filename) {
|
|
|
156
156
|
async function copyOrMoveFile(sourcePath, destPath, move) {
|
|
157
157
|
try {
|
|
158
158
|
if (move) {
|
|
159
|
-
|
|
159
|
+
try {
|
|
160
|
+
await rename(sourcePath, destPath);
|
|
161
|
+
} catch (renameError) {
|
|
162
|
+
if (renameError instanceof Error && "code" in renameError && renameError.code === "EXDEV") {
|
|
163
|
+
await copyFile(sourcePath, destPath);
|
|
164
|
+
await unlink(sourcePath);
|
|
165
|
+
} else {
|
|
166
|
+
throw renameError;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
160
169
|
} else {
|
|
161
170
|
await copyFile(sourcePath, destPath);
|
|
162
171
|
}
|
|
@@ -9510,6 +9519,29 @@ function parseSection(secChildren, level) {
|
|
|
9510
9519
|
}
|
|
9511
9520
|
return { title, level, content, subsections };
|
|
9512
9521
|
}
|
|
9522
|
+
function flushBlockBuffer(buffer, sections) {
|
|
9523
|
+
const content = parseBlockContent(buffer);
|
|
9524
|
+
if (content.length > 0) {
|
|
9525
|
+
sections.push({ title: "", level: 2, content, subsections: [] });
|
|
9526
|
+
}
|
|
9527
|
+
}
|
|
9528
|
+
function parseMixedBodyChildren(children, sections) {
|
|
9529
|
+
let blockBuffer = [];
|
|
9530
|
+
for (const child of children) {
|
|
9531
|
+
if (getTagName(child) === "sec") {
|
|
9532
|
+
if (blockBuffer.length > 0) {
|
|
9533
|
+
flushBlockBuffer(blockBuffer, sections);
|
|
9534
|
+
blockBuffer = [];
|
|
9535
|
+
}
|
|
9536
|
+
sections.push(parseSection(getChildren(child), 2));
|
|
9537
|
+
} else {
|
|
9538
|
+
blockBuffer.push(child);
|
|
9539
|
+
}
|
|
9540
|
+
}
|
|
9541
|
+
if (blockBuffer.length > 0) {
|
|
9542
|
+
flushBlockBuffer(blockBuffer, sections);
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9513
9545
|
function parseJatsBody(xml) {
|
|
9514
9546
|
const parsed = parser.parse(xml);
|
|
9515
9547
|
const article = findArticle(parsed);
|
|
@@ -9521,14 +9553,9 @@ function parseJatsBody(xml) {
|
|
|
9521
9553
|
const sections = [];
|
|
9522
9554
|
const secs = findChildren(body.children, "sec");
|
|
9523
9555
|
if (secs.length > 0) {
|
|
9524
|
-
|
|
9525
|
-
sections.push(parseSection(sec.children, 2));
|
|
9526
|
-
}
|
|
9556
|
+
parseMixedBodyChildren(body.children, sections);
|
|
9527
9557
|
} else {
|
|
9528
|
-
|
|
9529
|
-
if (content.length > 0) {
|
|
9530
|
-
sections.push({ title: "", level: 2, content, subsections: [] });
|
|
9531
|
-
}
|
|
9558
|
+
flushBlockBuffer(body.children, sections);
|
|
9532
9559
|
}
|
|
9533
9560
|
return sections;
|
|
9534
9561
|
}
|
|
@@ -10239,21 +10266,26 @@ function buildDiscoveryConfig(fulltextConfig) {
|
|
|
10239
10266
|
return config;
|
|
10240
10267
|
}
|
|
10241
10268
|
async function tryDownloadPdf(locations, tempDir, ctx) {
|
|
10242
|
-
const
|
|
10243
|
-
if (
|
|
10269
|
+
const pdfLocations = locations.filter((loc) => loc.urlType === "pdf");
|
|
10270
|
+
if (pdfLocations.length === 0) return { attached: false, source: "" };
|
|
10244
10271
|
const pdfPath = join(tempDir, "fulltext.pdf");
|
|
10245
|
-
const
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10272
|
+
for (const pdfLocation of pdfLocations) {
|
|
10273
|
+
const pdfResult = await downloadPdf(pdfLocation.url, pdfPath);
|
|
10274
|
+
if (!pdfResult.success) continue;
|
|
10275
|
+
const attachResult = await fulltextAttach(ctx.library, {
|
|
10276
|
+
identifier: ctx.identifier,
|
|
10277
|
+
idType: ctx.idType,
|
|
10278
|
+
filePath: pdfPath,
|
|
10279
|
+
type: "pdf",
|
|
10280
|
+
force: ctx.force,
|
|
10281
|
+
move: true,
|
|
10282
|
+
fulltextDirectory: ctx.fulltextDirectory
|
|
10283
|
+
});
|
|
10284
|
+
if (attachResult.success) {
|
|
10285
|
+
return { attached: true, source: pdfLocation.source };
|
|
10286
|
+
}
|
|
10287
|
+
}
|
|
10288
|
+
return { attached: false, source: pdfLocations[0]?.source ?? "" };
|
|
10257
10289
|
}
|
|
10258
10290
|
async function tryDownloadPmcXmlAndConvert(pmcid, tempDir, ctx) {
|
|
10259
10291
|
const xmlPath = join(tempDir, "fulltext.xml");
|
|
@@ -12522,4 +12554,4 @@ export {
|
|
|
12522
12554
|
cite as y,
|
|
12523
12555
|
list as z
|
|
12524
12556
|
};
|
|
12525
|
-
//# sourceMappingURL=index-
|
|
12557
|
+
//# sourceMappingURL=index-sH2o68X1.js.map
|