logosdb 0.7.7 → 0.7.10
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 +20 -8
- package/binding.gyp +9 -9
- package/deps/core/include/logosdb/logosdb.h +530 -0
- package/deps/core/src/hnsw_index.cpp +345 -0
- package/deps/core/src/hnsw_index.h +77 -0
- package/deps/core/src/logosdb.cpp +781 -0
- package/deps/core/src/metadata.cpp +266 -0
- package/deps/core/src/metadata.h +69 -0
- package/deps/core/src/platform.cpp +342 -0
- package/deps/core/src/platform.h +94 -0
- package/deps/core/src/storage.cpp +764 -0
- package/deps/core/src/storage.h +131 -0
- package/deps/core/src/wal.cpp +570 -0
- package/deps/core/src/wal.h +99 -0
- package/deps/core/third_party/hnswlib/hnswlib/bruteforce.h +163 -0
- package/deps/core/third_party/hnswlib/hnswlib/hnswalg.h +1411 -0
- package/deps/core/third_party/hnswlib/hnswlib/hnswlib.h +228 -0
- package/deps/core/third_party/hnswlib/hnswlib/space_ip.h +400 -0
- package/deps/core/third_party/hnswlib/hnswlib/space_l2.h +324 -0
- package/deps/core/third_party/hnswlib/hnswlib/stop_condition.h +276 -0
- package/deps/core/third_party/hnswlib/hnswlib/visited_list_pool.h +78 -0
- package/deps/core/third_party/nlohmann/json.hpp +24765 -0
- package/package.json +21 -5
- package/scripts/vendor-core.mjs +66 -0
package/package.json
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logosdb",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "Fast semantic vector database (HNSW + mmap) - Node.js bindings",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
|
+
"config": {
|
|
8
|
+
"runtime": "napi",
|
|
9
|
+
"target": "8"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
|
-
"
|
|
12
|
+
"vendor-core": "node ./scripts/vendor-core.mjs",
|
|
13
|
+
"prepublishOnly": "node ./scripts/vendor-core.mjs",
|
|
14
|
+
"install": "prebuild-install --runtime napi --target 8 || node-gyp rebuild",
|
|
9
15
|
"build": "node-gyp rebuild",
|
|
10
16
|
"test": "mocha test/test.js",
|
|
11
|
-
"prebuild": "prebuild --runtime napi --all --strip",
|
|
12
|
-
"prebuild-upload": "prebuild --runtime napi --all --strip --upload-all"
|
|
17
|
+
"native:prebuild": "prebuild --runtime napi --all --strip",
|
|
18
|
+
"native:prebuild-upload": "prebuild --runtime napi --all --strip --upload-all"
|
|
13
19
|
},
|
|
14
20
|
"repository": {
|
|
15
21
|
"type": "git",
|
|
@@ -32,10 +38,11 @@
|
|
|
32
38
|
"dependencies": {
|
|
33
39
|
"bindings": "^1.5.0",
|
|
34
40
|
"node-addon-api": "^7.0.0",
|
|
35
|
-
"prebuild-install": "
|
|
41
|
+
"prebuild-install": "npm:@mmomtchev/prebuild-install@^1.0.2"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
44
|
"mocha": "^10.2.0",
|
|
45
|
+
"node-gyp": "^11.2.0",
|
|
39
46
|
"prebuild": "^12.1.0"
|
|
40
47
|
},
|
|
41
48
|
"binary": {
|
|
@@ -44,6 +51,15 @@
|
|
|
44
51
|
]
|
|
45
52
|
},
|
|
46
53
|
"gypfile": true,
|
|
54
|
+
"files": [
|
|
55
|
+
"binding.gyp",
|
|
56
|
+
"lib",
|
|
57
|
+
"src",
|
|
58
|
+
"types",
|
|
59
|
+
"test",
|
|
60
|
+
"deps",
|
|
61
|
+
"scripts"
|
|
62
|
+
],
|
|
47
63
|
"engines": {
|
|
48
64
|
"node": ">=16.0.0"
|
|
49
65
|
},
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy C++ core + headers into nodejs/deps/core so the npm tarball is self-contained
|
|
4
|
+
* (binding.gyp must not reference parent ../ paths outside the published package).
|
|
5
|
+
*
|
|
6
|
+
* Run from repo root: node nodejs/scripts/vendor-core.mjs
|
|
7
|
+
* Or from nodejs/: npm run vendor-core
|
|
8
|
+
*/
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const NODEJS_ROOT = path.join(__dirname, '..');
|
|
15
|
+
const REPO_ROOT = path.join(NODEJS_ROOT, '..');
|
|
16
|
+
const DEST = path.join(NODEJS_ROOT, 'deps', 'core');
|
|
17
|
+
|
|
18
|
+
function rmrf(p) {
|
|
19
|
+
fs.rmSync(p, { recursive: true, force: true });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function cp(src, dst) {
|
|
23
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
24
|
+
fs.copyFileSync(src, dst);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function cpDir(srcDir, dstDir, filter) {
|
|
28
|
+
fs.mkdirSync(dstDir, { recursive: true });
|
|
29
|
+
for (const ent of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
30
|
+
const s = path.join(srcDir, ent.name);
|
|
31
|
+
const d = path.join(dstDir, ent.name);
|
|
32
|
+
if (filter && !filter(s, ent)) continue;
|
|
33
|
+
if (ent.isDirectory()) cpDir(s, d, filter);
|
|
34
|
+
else if (ent.isFile()) cp(s, d);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function main() {
|
|
39
|
+
const includeSrc = path.join(REPO_ROOT, 'include');
|
|
40
|
+
const srcDir = path.join(REPO_ROOT, 'src');
|
|
41
|
+
const nlohmann = path.join(REPO_ROOT, 'third_party', 'nlohmann', 'json.hpp');
|
|
42
|
+
const hnswDir = path.join(REPO_ROOT, 'third_party', 'hnswlib', 'hnswlib');
|
|
43
|
+
|
|
44
|
+
if (!fs.existsSync(includeSrc) || !fs.existsSync(srcDir)) {
|
|
45
|
+
console.error(
|
|
46
|
+
'[vendor-core] Expected monorepo layout (include/, src/) next to nodejs/. Skip if publishing from incomplete tree.',
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
rmrf(DEST);
|
|
52
|
+
cpDir(includeSrc, path.join(DEST, 'include'));
|
|
53
|
+
fs.mkdirSync(path.join(DEST, 'src'), { recursive: true });
|
|
54
|
+
for (const f of fs.readdirSync(srcDir)) {
|
|
55
|
+
if (f.endsWith('.cpp') || f.endsWith('.h')) {
|
|
56
|
+
cp(path.join(srcDir, f), path.join(DEST, 'src', f));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const nlohmannDst = path.join(DEST, 'third_party', 'nlohmann', 'json.hpp');
|
|
60
|
+
fs.mkdirSync(path.dirname(nlohmannDst), { recursive: true });
|
|
61
|
+
fs.copyFileSync(nlohmann, nlohmannDst);
|
|
62
|
+
cpDir(hnswDir, path.join(DEST, 'third_party', 'hnswlib', 'hnswlib'));
|
|
63
|
+
console.log('[vendor-core] Wrote', DEST);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
main();
|