wiki-graph-sdk 0.8.1 → 0.8.2
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/README.md +25 -0
- package/dist/archives.cjs +7 -0
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.d.ts +2 -0
- package/dist/archives.js +8 -0
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.js +1 -0
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +50 -10
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +54 -10
- package/dist/default-worker.js.map +1 -1
- package/dist/embedding.cjs.map +1 -1
- package/dist/embedding.js +1 -0
- package/dist/embedding.js.map +1 -1
- package/dist/gc.cjs +52 -10
- package/dist/gc.cjs.map +1 -1
- package/dist/gc.d.ts +3 -0
- package/dist/gc.js +56 -10
- package/dist/gc.js.map +1 -1
- package/dist/host-pQiVAKEY.d.ts +10 -0
- package/dist/index.cjs +86 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +90 -12
- package/dist/index.js.map +1 -1
- package/dist/local-config.cjs.map +1 -1
- package/dist/local-config.js +1 -0
- package/dist/local-config.js.map +1 -1
- package/dist/maintenance.cjs.map +1 -1
- package/dist/maintenance.js +1 -0
- package/dist/maintenance.js.map +1 -1
- package/dist/node-platform.cjs +18 -4
- package/dist/node-platform.cjs.map +1 -1
- package/dist/node-platform.d.ts +12 -3
- package/dist/node-platform.js +18 -4
- package/dist/node-platform.js.map +1 -1
- package/dist/runtime-config.cjs.map +1 -1
- package/dist/runtime-config.js +1 -0
- package/dist/runtime-config.js.map +1 -1
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.js +1 -0
- package/dist/stage.js.map +1 -1
- package/dist/worker.cjs +81 -42
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +7 -2
- package/dist/worker.js +85 -42
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/default-worker.js
CHANGED
|
@@ -75,6 +75,7 @@ import * as yauzl from "yauzl";
|
|
|
75
75
|
import * as yazl from "yazl";
|
|
76
76
|
import { Environment, Loader } from "nunjucks";
|
|
77
77
|
import {
|
|
78
|
+
getWikiGraphPlatform,
|
|
78
79
|
getWikiGraphStorage,
|
|
79
80
|
installWikiGraphPlatform,
|
|
80
81
|
installWikiGraphStorage,
|
|
@@ -736,15 +737,28 @@ function resolveNodeDataDirectory() {
|
|
|
736
737
|
directory = parent;
|
|
737
738
|
}
|
|
738
739
|
}
|
|
739
|
-
function createNodeWikiGraphStorage(
|
|
740
|
+
function createNodeWikiGraphStorage(stateRootOrOptions = pathModule.join(
|
|
741
|
+
os.homedir(),
|
|
742
|
+
".wikigraph"
|
|
743
|
+
)) {
|
|
744
|
+
const libraryRoot = typeof stateRootOrOptions === "string" ? stateRootOrOptions : stateRootOrOptions.libraryRoot;
|
|
745
|
+
const documentStoreRoot = typeof stateRootOrOptions === "string" ? pathModule.join(stateRootOrOptions, "documents") : stateRootOrOptions.documentStoreRoot;
|
|
740
746
|
return {
|
|
741
|
-
library: new NodeDirectory(
|
|
742
|
-
documentStore: new NodeDirectory(
|
|
747
|
+
library: new NodeDirectory(libraryRoot),
|
|
748
|
+
documentStore: new NodeDirectory(documentStoreRoot)
|
|
743
749
|
};
|
|
744
750
|
}
|
|
745
|
-
function
|
|
746
|
-
|
|
747
|
-
|
|
751
|
+
function ensureNodeWikiGraphPlatform() {
|
|
752
|
+
try {
|
|
753
|
+
getWikiGraphPlatform();
|
|
754
|
+
} catch {
|
|
755
|
+
installWikiGraphPlatform(nodeWikiGraphPlatform);
|
|
756
|
+
}
|
|
757
|
+
try {
|
|
758
|
+
getWikiGraphStorage();
|
|
759
|
+
} catch {
|
|
760
|
+
installWikiGraphStorage(createNodeWikiGraphStorage());
|
|
761
|
+
}
|
|
748
762
|
}
|
|
749
763
|
async function withNodeWikiGraphStorage(stateRoot, operation) {
|
|
750
764
|
return await withWikiGraphStorage(
|
|
@@ -1466,6 +1480,34 @@ import {
|
|
|
1466
1480
|
WikiGraphArchiveFile as WikiGraphArchiveFile2
|
|
1467
1481
|
} from "wiki-graph-core";
|
|
1468
1482
|
|
|
1483
|
+
// src/host.ts
|
|
1484
|
+
import {
|
|
1485
|
+
installWikiGraphPlatform as installWikiGraphPlatform2,
|
|
1486
|
+
withWikiGraphStorage as withWikiGraphStorage2
|
|
1487
|
+
} from "wiki-graph-core/platform";
|
|
1488
|
+
function prepareWikiGraphSDKHost(host) {
|
|
1489
|
+
if (host?.platform === void 0) {
|
|
1490
|
+
ensureNodeWikiGraphPlatform();
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
installWikiGraphPlatform2(host.platform);
|
|
1494
|
+
}
|
|
1495
|
+
function assertWikiGraphSDKHostOptions(options) {
|
|
1496
|
+
if (options.host?.storage !== void 0 && options.stateDir !== void 0) {
|
|
1497
|
+
throw new TypeError(
|
|
1498
|
+
"Wiki Graph SDK host.storage and stateDir cannot be used together."
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
async function withWikiGraphSDKHost(options, operation) {
|
|
1503
|
+
assertWikiGraphSDKHostOptions(options);
|
|
1504
|
+
prepareWikiGraphSDKHost(options.host);
|
|
1505
|
+
if (options.host?.storage !== void 0) {
|
|
1506
|
+
return await withWikiGraphStorage2(options.host.storage, operation);
|
|
1507
|
+
}
|
|
1508
|
+
return await withNodeWikiGraphStorage(options.stateDir, operation);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1469
1511
|
// src/archive/target.ts
|
|
1470
1512
|
import { realpath, stat as stat2 } from "fs/promises";
|
|
1471
1513
|
import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute3, join as join3, relative, resolve as resolve3 } from "path";
|
|
@@ -1697,10 +1739,12 @@ import {
|
|
|
1697
1739
|
writeChapterJobInputFile as writeChapterJobInputFile2
|
|
1698
1740
|
} from "wiki-graph-core/worker";
|
|
1699
1741
|
async function runBuildJobWorker(options) {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1742
|
+
const { host, stateDir, ...coreOptions } = options;
|
|
1743
|
+
await withWikiGraphSDKHost(
|
|
1744
|
+
{
|
|
1745
|
+
...host === void 0 ? {} : { host },
|
|
1746
|
+
...stateDir === void 0 ? {} : { stateDir }
|
|
1747
|
+
},
|
|
1704
1748
|
async () => await runCoreBuildJobWorker(coreOptions)
|
|
1705
1749
|
);
|
|
1706
1750
|
}
|