wiki-graph-sdk 0.8.4 → 0.9.0
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/archives.cjs +41 -19
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.js +43 -19
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs +3 -2
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.js +3 -2
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +22 -9
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +23 -9
- package/dist/default-worker.js.map +1 -1
- package/dist/index.cjs +116 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +121 -79
- package/dist/index.js.map +1 -1
- package/dist/maintenance.cjs +3 -2
- package/dist/maintenance.cjs.map +1 -1
- package/dist/maintenance.js +3 -2
- package/dist/maintenance.js.map +1 -1
- package/dist/worker.cjs +22 -9
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +23 -9
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/archives.cjs
CHANGED
|
@@ -1273,6 +1273,9 @@ function resolveWikiGraphRuntimePath(path) {
|
|
|
1273
1273
|
var import_promises3 = require("fs/promises");
|
|
1274
1274
|
var import_path3 = require("path");
|
|
1275
1275
|
var import_wiki_graph_core2 = require("wiki-graph-core");
|
|
1276
|
+
function requireWikiGraphArchiveFile(location) {
|
|
1277
|
+
return location.archiveFile;
|
|
1278
|
+
}
|
|
1276
1279
|
var WikiGraphArchiveOwnershipError = class extends Error {
|
|
1277
1280
|
code = "WIKI_GRAPH_ARCHIVE_OWNERSHIP_MISMATCH";
|
|
1278
1281
|
constructor(message) {
|
|
@@ -1389,11 +1392,12 @@ async function findMatchingMembers(libraries, candidate, candidateIdentity) {
|
|
|
1389
1392
|
...library.isDefault ? {} : { publicId: library.publicId }
|
|
1390
1393
|
});
|
|
1391
1394
|
for (const archive of archives) {
|
|
1392
|
-
|
|
1395
|
+
const physical = archive.file ?? archive.directory;
|
|
1396
|
+
if (physical === void 0) continue;
|
|
1393
1397
|
members.push({
|
|
1394
1398
|
archive,
|
|
1395
1399
|
library,
|
|
1396
|
-
memberPath: getNodeResourcePath(
|
|
1400
|
+
memberPath: getNodeResourcePath(physical)
|
|
1397
1401
|
});
|
|
1398
1402
|
}
|
|
1399
1403
|
}
|
|
@@ -1879,13 +1883,25 @@ function formatLocatedChapterUri(archiveUri, chapter) {
|
|
|
1879
1883
|
var import_wiki_graph_core6 = require("wiki-graph-core");
|
|
1880
1884
|
async function writeWikiGraphArchiveLocation(location, operation, options = {}) {
|
|
1881
1885
|
const cacheOnly = options.searchIndexWritebackPolicy === "cache";
|
|
1882
|
-
const write = async (archiveFile = location.archiveFile) =>
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
invalidateContinuationCursors:
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1886
|
+
const write = async (archiveFile = location.archiveFile) => {
|
|
1887
|
+
const writeOptions = {
|
|
1888
|
+
...cacheOnly ? {} : { derivedStateKeys: [location.archiveKey, location.archivePath] },
|
|
1889
|
+
...options.invalidateContinuationCursors === void 0 ? {} : {
|
|
1890
|
+
invalidateContinuationCursors: options.invalidateContinuationCursors
|
|
1891
|
+
},
|
|
1892
|
+
...options.searchIndexWritebackPolicy === void 0 ? {} : { searchIndexWritebackPolicy: options.searchIndexWritebackPolicy }
|
|
1893
|
+
};
|
|
1894
|
+
if (archiveFile.kind === "directory") {
|
|
1895
|
+
return await new import_wiki_graph_core6.WikiGraphDirectoryFile(archiveFile).write(
|
|
1896
|
+
operation,
|
|
1897
|
+
writeOptions
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
return await new import_wiki_graph_core6.WikiGraphArchiveFile(archiveFile).write(
|
|
1901
|
+
operation,
|
|
1902
|
+
writeOptions
|
|
1903
|
+
);
|
|
1904
|
+
};
|
|
1889
1905
|
if (location.libraryArchiveTarget === void 0 || cacheOnly || options.refreshLibraryIndex === false) {
|
|
1890
1906
|
return await write();
|
|
1891
1907
|
}
|
|
@@ -2539,7 +2555,7 @@ var WikiGraphArchiveHandle = class {
|
|
|
2539
2555
|
return await this.#writeDocument(async (document) => {
|
|
2540
2556
|
const chapterId = await (0, import_wiki_graph_core7.resolveChapterPathReadonly)(document, path);
|
|
2541
2557
|
await assertChapterResetAllowed(
|
|
2542
|
-
this.#location
|
|
2558
|
+
requireWikiGraphArchiveFile(this.#location),
|
|
2543
2559
|
chapterId,
|
|
2544
2560
|
stage
|
|
2545
2561
|
);
|
|
@@ -2785,14 +2801,18 @@ var WikiGraphArchiveHandle = class {
|
|
|
2785
2801
|
}, options);
|
|
2786
2802
|
}
|
|
2787
2803
|
async readCover(options = {}) {
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2804
|
+
return await this.#runtime.run(async () => {
|
|
2805
|
+
if (this.#location.archiveFile.kind === "directory") {
|
|
2806
|
+
return await this.#readDocument(
|
|
2807
|
+
async (document) => await document.readCover()
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
const app = new import_wiki_graph_core7.WikiGraph({});
|
|
2811
|
+
return await app.openSession(
|
|
2791
2812
|
this.#location.archiveFile,
|
|
2792
2813
|
async (archive) => await archive.readCover()
|
|
2793
|
-
)
|
|
2794
|
-
|
|
2795
|
-
);
|
|
2814
|
+
);
|
|
2815
|
+
}, options.signal);
|
|
2796
2816
|
}
|
|
2797
2817
|
async replaceMetadata(objectPath, value, options = {}) {
|
|
2798
2818
|
return await this.#writeDocument(async (document) => {
|
|
@@ -2833,9 +2853,11 @@ var WikiGraphArchiveHandle = class {
|
|
|
2833
2853
|
}
|
|
2834
2854
|
async #readDocument(operation, options = {}) {
|
|
2835
2855
|
return await this.#runtime.run(
|
|
2836
|
-
async () => await new import_wiki_graph_core7.
|
|
2837
|
-
|
|
2838
|
-
)
|
|
2856
|
+
async () => this.#location.archiveFile.kind === "directory" ? await new import_wiki_graph_core7.WikiGraphDirectoryFile(
|
|
2857
|
+
this.#location.archiveFile
|
|
2858
|
+
).readDocument(operation) : await new import_wiki_graph_core7.WikiGraphArchiveFile(
|
|
2859
|
+
this.#location.archiveFile
|
|
2860
|
+
).readDocument(operation),
|
|
2839
2861
|
options.signal
|
|
2840
2862
|
);
|
|
2841
2863
|
}
|