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.cjs
CHANGED
|
@@ -750,15 +750,28 @@ function resolveNodeDataDirectory() {
|
|
|
750
750
|
directory = parent;
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
function createNodeWikiGraphStorage(
|
|
753
|
+
function createNodeWikiGraphStorage(stateRootOrOptions = pathModule.join(
|
|
754
|
+
os.homedir(),
|
|
755
|
+
".wikigraph"
|
|
756
|
+
)) {
|
|
757
|
+
const libraryRoot = typeof stateRootOrOptions === "string" ? stateRootOrOptions : stateRootOrOptions.libraryRoot;
|
|
758
|
+
const documentStoreRoot = typeof stateRootOrOptions === "string" ? pathModule.join(stateRootOrOptions, "documents") : stateRootOrOptions.documentStoreRoot;
|
|
754
759
|
return {
|
|
755
|
-
library: new NodeDirectory(
|
|
756
|
-
documentStore: new NodeDirectory(
|
|
760
|
+
library: new NodeDirectory(libraryRoot),
|
|
761
|
+
documentStore: new NodeDirectory(documentStoreRoot)
|
|
757
762
|
};
|
|
758
763
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
|
|
764
|
+
function ensureNodeWikiGraphPlatform() {
|
|
765
|
+
try {
|
|
766
|
+
(0, import_platform.getWikiGraphPlatform)();
|
|
767
|
+
} catch {
|
|
768
|
+
(0, import_platform.installWikiGraphPlatform)(nodeWikiGraphPlatform);
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
(0, import_platform.getWikiGraphStorage)();
|
|
772
|
+
} catch {
|
|
773
|
+
(0, import_platform.installWikiGraphStorage)(createNodeWikiGraphStorage());
|
|
774
|
+
}
|
|
762
775
|
}
|
|
763
776
|
async function withNodeWikiGraphStorage(stateRoot, operation) {
|
|
764
777
|
return await (0, import_platform.withWikiGraphStorage)(
|
|
@@ -1468,6 +1481,31 @@ function abortError(signal) {
|
|
|
1468
1481
|
var import_worker = require("wiki-graph-core/worker");
|
|
1469
1482
|
var import_wiki_graph_core7 = require("wiki-graph-core");
|
|
1470
1483
|
|
|
1484
|
+
// src/host.ts
|
|
1485
|
+
var import_platform2 = require("wiki-graph-core/platform");
|
|
1486
|
+
function prepareWikiGraphSDKHost(host) {
|
|
1487
|
+
if (host?.platform === void 0) {
|
|
1488
|
+
ensureNodeWikiGraphPlatform();
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
(0, import_platform2.installWikiGraphPlatform)(host.platform);
|
|
1492
|
+
}
|
|
1493
|
+
function assertWikiGraphSDKHostOptions(options) {
|
|
1494
|
+
if (options.host?.storage !== void 0 && options.stateDir !== void 0) {
|
|
1495
|
+
throw new TypeError(
|
|
1496
|
+
"Wiki Graph SDK host.storage and stateDir cannot be used together."
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
async function withWikiGraphSDKHost(options, operation) {
|
|
1501
|
+
assertWikiGraphSDKHostOptions(options);
|
|
1502
|
+
prepareWikiGraphSDKHost(options.host);
|
|
1503
|
+
if (options.host?.storage !== void 0) {
|
|
1504
|
+
return await (0, import_platform2.withWikiGraphStorage)(options.host.storage, operation);
|
|
1505
|
+
}
|
|
1506
|
+
return await withNodeWikiGraphStorage(options.stateDir, operation);
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1471
1509
|
// src/archive/target.ts
|
|
1472
1510
|
var import_promises2 = require("fs/promises");
|
|
1473
1511
|
var import_path3 = require("path");
|
|
@@ -1683,10 +1721,12 @@ async function writeWikiGraphArchiveLocation(location, operation, options = {})
|
|
|
1683
1721
|
// src/worker.ts
|
|
1684
1722
|
var import_worker2 = require("wiki-graph-core/worker");
|
|
1685
1723
|
async function runBuildJobWorker(options) {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1724
|
+
const { host, stateDir, ...coreOptions } = options;
|
|
1725
|
+
await withWikiGraphSDKHost(
|
|
1726
|
+
{
|
|
1727
|
+
...host === void 0 ? {} : { host },
|
|
1728
|
+
...stateDir === void 0 ? {} : { stateDir }
|
|
1729
|
+
},
|
|
1690
1730
|
async () => await (0, import_worker.runBuildJobWorker)(coreOptions)
|
|
1691
1731
|
);
|
|
1692
1732
|
}
|