@kodelyth/memory-lancedb 2026.5.39 → 2026.5.42
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/api.ts +2 -0
- package/cli-metadata.ts +18 -0
- package/config.test.ts +178 -0
- package/config.ts +283 -0
- package/dist/api.js +3 -0
- package/dist/cli-metadata.js +16 -0
- package/dist/config.js +202 -0
- package/dist/index.js +730 -0
- package/dist/lancedb-runtime.js +46 -0
- package/dist/test-helpers.js +3205 -0
- package/index.test.ts +2370 -0
- package/index.ts +1158 -0
- package/klaw.plugin.json +4 -13
- package/lancedb-runtime.ts +77 -0
- package/memory-lancedb.live.test.ts +121 -0
- package/package.json +2 -2
- package/test-helpers.ts +25 -0
- package/tsconfig.json +16 -0
- package/api.js +0 -7
- package/cli-metadata.js +0 -7
- package/config.js +0 -7
- package/index.js +0 -7
- package/lancedb-runtime.js +0 -7
- package/test-helpers.js +0 -7
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region extensions/memory-lancedb/lancedb-runtime.ts
|
|
2
|
+
function buildLoadFailureMessage(error) {
|
|
3
|
+
return [
|
|
4
|
+
"memory-lancedb: bundled @lancedb/lancedb dependency is unavailable.",
|
|
5
|
+
"Install or repair the memory-lancedb plugin package dependencies, then restart Klaw.",
|
|
6
|
+
String(error)
|
|
7
|
+
].join(" ");
|
|
8
|
+
}
|
|
9
|
+
function isUnsupportedNativePlatform(params) {
|
|
10
|
+
return params.platform === "darwin" && params.arch === "x64";
|
|
11
|
+
}
|
|
12
|
+
function buildUnsupportedNativePlatformMessage(params) {
|
|
13
|
+
return [
|
|
14
|
+
`memory-lancedb: LanceDB runtime is unavailable on ${params.platform}-${params.arch}.`,
|
|
15
|
+
"The bundled @lancedb/lancedb dependency does not publish a native package for this platform.",
|
|
16
|
+
"Disable memory-lancedb or switch to a supported memory backend/platform."
|
|
17
|
+
].join(" ");
|
|
18
|
+
}
|
|
19
|
+
function createLanceDbRuntimeLoader(overrides = {}) {
|
|
20
|
+
const deps = {
|
|
21
|
+
platform: overrides.platform ?? process.platform,
|
|
22
|
+
arch: overrides.arch ?? process.arch,
|
|
23
|
+
importBundled: overrides.importBundled ?? (() => import("@lancedb/lancedb"))
|
|
24
|
+
};
|
|
25
|
+
let loadPromise = null;
|
|
26
|
+
return { async load(_logger) {
|
|
27
|
+
if (!loadPromise) loadPromise = deps.importBundled().catch((error) => {
|
|
28
|
+
loadPromise = null;
|
|
29
|
+
if (isUnsupportedNativePlatform({
|
|
30
|
+
platform: deps.platform,
|
|
31
|
+
arch: deps.arch
|
|
32
|
+
})) throw new Error(buildUnsupportedNativePlatformMessage({
|
|
33
|
+
platform: deps.platform,
|
|
34
|
+
arch: deps.arch
|
|
35
|
+
}), { cause: error });
|
|
36
|
+
throw new Error(buildLoadFailureMessage(error), { cause: error });
|
|
37
|
+
});
|
|
38
|
+
return await loadPromise;
|
|
39
|
+
} };
|
|
40
|
+
}
|
|
41
|
+
const defaultLoader = createLanceDbRuntimeLoader();
|
|
42
|
+
async function loadLanceDbModule(logger) {
|
|
43
|
+
return await defaultLoader.load(logger);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { createLanceDbRuntimeLoader, loadLanceDbModule };
|