@dikolab/kbdb 0.1.1 → 0.1.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/dist/{chunk-QCCN7OZH.mjs → chunk-JG2UCKLI.mjs} +21 -8
- package/dist/chunk-JG2UCKLI.mjs.map +7 -0
- package/dist/cli.cjs +16 -4
- package/dist/cli.cjs.map +3 -3
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/kbdb-worker.cjs +38 -18
- package/dist/kbdb-worker.cjs.map +4 -4
- package/dist/mod.cjs +1 -1
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.mjs +1 -1
- package/dist/mod.mjs.map +1 -1
- package/dist/src/shared/dir-resolver/functions/join-path.function.d.ts +2 -0
- package/dist/src/shared/dir-resolver/index.d.ts +1 -0
- package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
- package/dist/src/shared/worker-daemon/functions/load-wasm-modules.function.d.ts +0 -16
- package/dist/wasm/fs-database/kbdb_fs_database.d.ts +220 -0
- package/dist/wasm/fs-database/kbdb_fs_database.js +458 -0
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm.d.ts +32 -0
- package/dist/wasm/fs-database/package.json +13 -0
- package/dist/wasm/kb-worker/kbdb_worker.d.ts +565 -0
- package/dist/wasm/kb-worker/kbdb_worker.js +1066 -0
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm.d.ts +72 -0
- package/dist/wasm/kb-worker/package.json +13 -0
- package/dist/wasm/query-parser/kbdb_query_parser.d.ts +195 -0
- package/dist/wasm/query-parser/kbdb_query_parser.js +403 -0
- package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
- package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm.d.ts +25 -0
- package/dist/wasm/query-parser/package.json +13 -0
- package/dist/worker.mjs +23 -13
- package/dist/worker.mjs.map +3 -3
- package/package.json +1 -1
- package/src/shared/dir-resolver/functions/join-path.function.ts +13 -0
- package/src/shared/dir-resolver/functions/resolve-wasm-dir.function.ts +2 -2
- package/src/shared/dir-resolver/functions/resolve-worker-script.function.ts +3 -3
- package/src/shared/dir-resolver/index.ts +4 -0
- package/src/shared/version/constants/version.constant.ts +1 -1
- package/src/shared/worker-daemon/functions/load-wasm-modules.function.ts +17 -20
- package/src/wasm/fs-database/kbdb_fs_database.d.ts +220 -0
- package/src/wasm/fs-database/kbdb_fs_database.js +458 -0
- package/src/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/src/wasm/fs-database/kbdb_fs_database_bg.wasm.d.ts +32 -0
- package/src/wasm/fs-database/package.json +13 -0
- package/src/wasm/kb-worker/kbdb_worker.d.ts +565 -0
- package/src/wasm/kb-worker/kbdb_worker.js +1066 -0
- package/src/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/src/wasm/kb-worker/kbdb_worker_bg.wasm.d.ts +72 -0
- package/src/wasm/kb-worker/package.json +13 -0
- package/src/wasm/query-parser/kbdb_query_parser.d.ts +195 -0
- package/src/wasm/query-parser/kbdb_query_parser.js +403 -0
- package/src/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
- package/src/wasm/query-parser/kbdb_query_parser_bg.wasm.d.ts +25 -0
- package/src/wasm/query-parser/package.json +13 -0
- package/dist/chunk-QCCN7OZH.mjs.map +0 -7
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const set_return: (a: number, b: number) => void;
|
|
5
|
+
export const qp_cache_get: (a: number, b: number) => number;
|
|
6
|
+
export const qp_cache_insert: (a: number, b: number, c: number, d: number) => number;
|
|
7
|
+
export const qp_compute_field_tf: (a: number, b: number) => number;
|
|
8
|
+
export const qp_compute_tfidf: (a: number, b: number) => number;
|
|
9
|
+
export const qp_extract_keyphrases: (a: number, b: number, c: number) => number;
|
|
10
|
+
export const qp_extract_ngrams: (a: number, b: number) => number;
|
|
11
|
+
export const qp_parse_query: (a: number, b: number) => number;
|
|
12
|
+
export const qp_score_bm25f: (a: number, b: number) => number;
|
|
13
|
+
export const qp_score_bm25f_field: (a: number, b: number) => number;
|
|
14
|
+
export const qp_score_freshness: (a: number, b: number) => number;
|
|
15
|
+
export const qp_score_proximity: (a: number, b: number) => number;
|
|
16
|
+
export const qp_score_zone: (a: number, b: number) => number;
|
|
17
|
+
export const qp_tokenize: (a: number, b: number) => number;
|
|
18
|
+
export const version: (a: number) => void;
|
|
19
|
+
export const qp_cache_clear: () => number;
|
|
20
|
+
export const kbdb_alloc: (a: number) => number;
|
|
21
|
+
export const get_return_len: () => number;
|
|
22
|
+
export const get_return_ptr: () => number;
|
|
23
|
+
export const kbdb_free: (a: number, b: number) => void;
|
|
24
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
25
|
+
export const __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kbdb-query-parser",
|
|
3
|
+
"description": "Query processing and tokenization for kbdb -- compiles to query-parser.wasm",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"files": [
|
|
7
|
+
"kbdb_query_parser_bg.wasm",
|
|
8
|
+
"kbdb_query_parser.js",
|
|
9
|
+
"kbdb_query_parser.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"browser": "kbdb_query_parser.js",
|
|
12
|
+
"types": "kbdb_query_parser.d.ts"
|
|
13
|
+
}
|
package/dist/worker.mjs
CHANGED
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
computeSha256,
|
|
3
3
|
getArgs,
|
|
4
4
|
getIpcPath,
|
|
5
|
+
isRemoteUrl,
|
|
6
|
+
joinPath,
|
|
5
7
|
resolveBaseDir,
|
|
6
8
|
resolveWasmDir
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JG2UCKLI.mjs";
|
|
8
10
|
|
|
9
11
|
// src/worker.ts
|
|
10
12
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -76,7 +78,7 @@ function parseWorkerToml(text, contextPath) {
|
|
|
76
78
|
|
|
77
79
|
// src/shared/worker-daemon/functions/start-daemon.function.ts
|
|
78
80
|
import { writeFileSync as writeFileSync3 } from "node:fs";
|
|
79
|
-
import { join as
|
|
81
|
+
import { join as join4 } from "node:path";
|
|
80
82
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
81
83
|
|
|
82
84
|
// src/shared/worker-daemon/classes/worker-daemon.class.ts
|
|
@@ -88,12 +90,11 @@ import {
|
|
|
88
90
|
unlinkSync as unlinkSync2,
|
|
89
91
|
constants
|
|
90
92
|
} from "node:fs";
|
|
91
|
-
import { join as
|
|
93
|
+
import { join as join3 } from "node:path";
|
|
92
94
|
import { tmpdir } from "node:os";
|
|
93
95
|
|
|
94
96
|
// src/shared/worker-daemon/functions/load-wasm-modules.function.ts
|
|
95
97
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
96
|
-
import { join as join3 } from "node:path";
|
|
97
98
|
|
|
98
99
|
// src/shared/worker-daemon/functions/create-host-imports.function.ts
|
|
99
100
|
import {
|
|
@@ -293,8 +294,8 @@ async function loadWasmModules(config, wasmDir2) {
|
|
|
293
294
|
void 0,
|
|
294
295
|
allocator
|
|
295
296
|
);
|
|
296
|
-
const wkPath =
|
|
297
|
-
const wkBytes =
|
|
297
|
+
const wkPath = joinPath(wasmDir2, "kb-worker", "kbdb_worker_bg.wasm");
|
|
298
|
+
const wkBytes = await readWasmFile(wkPath, "kb-worker");
|
|
298
299
|
let wkModule;
|
|
299
300
|
try {
|
|
300
301
|
wkModule = await WebAssembly.compile(wkBytes);
|
|
@@ -318,8 +319,17 @@ async function loadWasmModules(config, wasmDir2) {
|
|
|
318
319
|
};
|
|
319
320
|
return { memory, kbWorker };
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
+
async function readWasmFile(path, label) {
|
|
322
323
|
try {
|
|
324
|
+
if (isRemoteUrl(path)) {
|
|
325
|
+
const response = await fetch(path);
|
|
326
|
+
if (!response.ok) {
|
|
327
|
+
throw new Error(
|
|
328
|
+
`HTTP ${String(response.status)} ${response.statusText}`
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
return await response.arrayBuffer();
|
|
332
|
+
}
|
|
323
333
|
const buf = readFileSync3(path);
|
|
324
334
|
return buf.buffer.slice(
|
|
325
335
|
buf.byteOffset,
|
|
@@ -924,7 +934,7 @@ var WorkerDaemon = class {
|
|
|
924
934
|
);
|
|
925
935
|
this._wasmModules = wasmModules;
|
|
926
936
|
this.initWorkerContext();
|
|
927
|
-
const pidPath =
|
|
937
|
+
const pidPath = join3(tmpdir(), `kbdb-${this.ctx}.pid`);
|
|
928
938
|
writeFileSync2(pidPath, process.pid.toString());
|
|
929
939
|
const ipcPath = getIpcPath(this.ctx);
|
|
930
940
|
if (existsSync2(ipcPath)) {
|
|
@@ -964,7 +974,7 @@ var WorkerDaemon = class {
|
|
|
964
974
|
this._server = null;
|
|
965
975
|
}
|
|
966
976
|
this._wasmModules = null;
|
|
967
|
-
const pidPath =
|
|
977
|
+
const pidPath = join3(tmpdir(), `kbdb-${this.ctx}.pid`);
|
|
968
978
|
try {
|
|
969
979
|
unlinkSync2(pidPath);
|
|
970
980
|
} catch {
|
|
@@ -974,7 +984,7 @@ var WorkerDaemon = class {
|
|
|
974
984
|
unlinkSync2(ipcPath);
|
|
975
985
|
} catch {
|
|
976
986
|
}
|
|
977
|
-
const crashPath =
|
|
987
|
+
const crashPath = join3(tmpdir(), `kbdb-${this.ctx}.crash`);
|
|
978
988
|
try {
|
|
979
989
|
unlinkSync2(crashPath);
|
|
980
990
|
} catch {
|
|
@@ -1069,7 +1079,7 @@ var WorkerDaemon = class {
|
|
|
1069
1079
|
}
|
|
1070
1080
|
/** Reads catalog.toml and validates the version field. */
|
|
1071
1081
|
checkCatalogVersion() {
|
|
1072
|
-
const catalogPath =
|
|
1082
|
+
const catalogPath = join3(this.targetDir, "catalog.toml");
|
|
1073
1083
|
let text;
|
|
1074
1084
|
try {
|
|
1075
1085
|
text = readFileSync4(catalogPath, "utf-8");
|
|
@@ -1464,7 +1474,7 @@ var WorkerDaemon = class {
|
|
|
1464
1474
|
}
|
|
1465
1475
|
handleCheckVersion(params) {
|
|
1466
1476
|
const targetPath = typeof params.targetPath === "string" ? params.targetPath : this.targetDir;
|
|
1467
|
-
const catalogPath =
|
|
1477
|
+
const catalogPath = join3(targetPath, "catalog.toml");
|
|
1468
1478
|
let text;
|
|
1469
1479
|
try {
|
|
1470
1480
|
text = readFileSync4(catalogPath, "utf-8");
|
|
@@ -1561,7 +1571,7 @@ async function startDaemon(contextPath, wasmDir2) {
|
|
|
1561
1571
|
}
|
|
1562
1572
|
function writeCrashLog(contextId, message) {
|
|
1563
1573
|
try {
|
|
1564
|
-
const crashPath =
|
|
1574
|
+
const crashPath = join4(tmpdir2(), `kbdb-${contextId}.crash`);
|
|
1565
1575
|
const payload = JSON.stringify({
|
|
1566
1576
|
error: message,
|
|
1567
1577
|
timestamp: Date.now()
|