wiki-graph-sdk 0.8.1 → 0.8.3
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 +30 -0
- package/dist/archives.cjs +25 -19
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.d.ts +2 -0
- package/dist/archives.js +14 -7
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs +11 -12
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.js +7 -7
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +83 -20
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +84 -17
- package/dist/default-worker.js.map +1 -1
- package/dist/embedding.cjs +6 -7
- package/dist/embedding.cjs.map +1 -1
- package/dist/embedding.js +7 -7
- package/dist/embedding.js.map +1 -1
- package/dist/gc.cjs +106 -12
- package/dist/gc.cjs.map +1 -1
- package/dist/gc.d.ts +3 -0
- package/dist/gc.js +110 -12
- package/dist/gc.js.map +1 -1
- package/dist/host-IbqJ8WSV.d.ts +18 -0
- package/dist/index.cjs +127 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +119 -21
- package/dist/index.js.map +1 -1
- package/dist/local-config.cjs +6 -7
- package/dist/local-config.cjs.map +1 -1
- package/dist/local-config.js +7 -7
- 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 +6 -7
- package/dist/runtime-config.cjs.map +1 -1
- package/dist/runtime-config.js +7 -7
- package/dist/runtime-config.js.map +1 -1
- package/dist/stage.cjs +6 -7
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.js +7 -7
- package/dist/stage.js.map +1 -1
- package/dist/worker.cjs +113 -50
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +7 -2
- package/dist/worker.js +125 -58
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/archives.d.ts
CHANGED
|
@@ -175,6 +175,8 @@ declare class WikiGraphArchiveHandle {
|
|
|
175
175
|
readonly rebuilt: boolean;
|
|
176
176
|
}>;
|
|
177
177
|
cleanSearchIndex(options?: WikiGraphOperationOptions): Promise<WikiGraphArchiveIndexStatus>;
|
|
178
|
+
/** Clear cached search sessions without changing the archive index. */
|
|
179
|
+
clearSearchSessions(options?: WikiGraphOperationOptions): Promise<void>;
|
|
178
180
|
listChapters(options?: WikiGraphOperationOptions): Promise<readonly ChapterEntry[]>;
|
|
179
181
|
getChapter(path: string, options?: WikiGraphOperationOptions): Promise<ChapterEntry>;
|
|
180
182
|
addChapter(options: {
|
package/dist/archives.js
CHANGED
|
@@ -142,6 +142,7 @@ import * as yauzl from "yauzl";
|
|
|
142
142
|
import * as yazl from "yazl";
|
|
143
143
|
import { Environment, Loader } from "nunjucks";
|
|
144
144
|
import {
|
|
145
|
+
getWikiGraphPlatform,
|
|
145
146
|
getWikiGraphStorage,
|
|
146
147
|
installWikiGraphPlatform,
|
|
147
148
|
installWikiGraphStorage,
|
|
@@ -838,13 +839,15 @@ function getWikiGraphSDKRuntimeContext() {
|
|
|
838
839
|
};
|
|
839
840
|
}
|
|
840
841
|
function getWikiGraphSDKStateDir() {
|
|
841
|
-
|
|
842
|
+
const context = getWikiGraphSDKRuntimeContext();
|
|
843
|
+
return context.host?.stateDir ?? context.stateDir;
|
|
842
844
|
}
|
|
843
845
|
function getWikiGraphSDKProviders() {
|
|
844
846
|
return getWikiGraphSDKRuntimeContext().providers ?? {};
|
|
845
847
|
}
|
|
846
848
|
|
|
847
849
|
// src/local-config.ts
|
|
850
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
848
851
|
import { join as join2 } from "path";
|
|
849
852
|
import { homedir as homedir2 } from "os";
|
|
850
853
|
var LOCAL_CONFIG_SCHEMA_SQL = `
|
|
@@ -874,13 +877,10 @@ function validateLocalConfigSection(section, value) {
|
|
|
874
877
|
}
|
|
875
878
|
}
|
|
876
879
|
async function withLocalConfigDatabase(operation) {
|
|
880
|
+
const stateDir = getWikiGraphSDKStateDir() ?? join2(homedir2(), ".wikigraph");
|
|
881
|
+
await mkdir2(stateDir, { recursive: true });
|
|
877
882
|
const database = await openSharedStateDatabase(
|
|
878
|
-
new NodeFile(
|
|
879
|
-
join2(
|
|
880
|
-
getWikiGraphSDKStateDir() ?? join2(homedir2(), ".wikigraph"),
|
|
881
|
-
"core.sqlite"
|
|
882
|
-
)
|
|
883
|
-
),
|
|
883
|
+
new NodeFile(join2(stateDir, "core.sqlite")),
|
|
884
884
|
LOCAL_CONFIG_SCHEMA_SQL
|
|
885
885
|
);
|
|
886
886
|
try {
|
|
@@ -2138,6 +2138,13 @@ var WikiGraphArchiveHandle = class {
|
|
|
2138
2138
|
);
|
|
2139
2139
|
return status;
|
|
2140
2140
|
}
|
|
2141
|
+
/** Clear cached search sessions without changing the archive index. */
|
|
2142
|
+
async clearSearchSessions(options = {}) {
|
|
2143
|
+
await this.#runtime.run(
|
|
2144
|
+
async () => await deleteArchiveSearchSessions(this.path),
|
|
2145
|
+
options.signal
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2141
2148
|
async listChapters(options = {}) {
|
|
2142
2149
|
return await this.#readDocument(
|
|
2143
2150
|
async (document) => await listChapters2(document),
|