@hajewski/latticedb 0.1.0 → 0.3.0
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 +244 -46
- package/dist/embedding.d.ts +48 -0
- package/dist/embedding.d.ts.map +1 -0
- package/dist/embedding.js +74 -0
- package/dist/embedding.js.map +1 -0
- package/dist/ffi/bindings.d.ts +7 -0
- package/dist/ffi/bindings.d.ts.map +1 -1
- package/dist/ffi/bindings.js +59 -24
- package/dist/ffi/bindings.js.map +1 -1
- package/dist/ffi/index.d.ts +24 -2
- package/dist/ffi/index.d.ts.map +1 -1
- package/dist/ffi/index.js +56 -2
- package/dist/ffi/index.js.map +1 -1
- package/dist/ffi/types.d.ts +10 -0
- package/dist/ffi/types.d.ts.map +1 -1
- package/dist/ffi/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/include/lattice.h +586 -0
- package/lib/darwin-arm64/liblattice.dylib +0 -0
- package/lib/darwin-x64/liblattice.dylib +0 -0
- package/lib/linux-arm64/liblattice.so +0 -0
- package/lib/linux-x64/liblattice.so +0 -0
- package/package.json +4 -3
- package/dist/native.d.ts +0 -98
- package/dist/native.d.ts.map +0 -1
- package/dist/native.js +0 -52
- package/dist/native.js.map +0 -1
package/dist/native.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native module loader and type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This module loads the native N-API addon and provides TypeScript types
|
|
5
|
-
* for the raw native interface.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Native edge object returned from edge traversal.
|
|
9
|
-
*/
|
|
10
|
-
export interface NativeEdge {
|
|
11
|
-
sourceId: bigint;
|
|
12
|
-
targetId: bigint;
|
|
13
|
-
type: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Native query result.
|
|
17
|
-
*/
|
|
18
|
-
export interface NativeQueryResult {
|
|
19
|
-
columns: string[];
|
|
20
|
-
rows: Array<Record<string, unknown>>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Native vector search result.
|
|
24
|
-
*/
|
|
25
|
-
export interface NativeVectorResult {
|
|
26
|
-
nodeId: bigint;
|
|
27
|
-
distance: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Native FTS search result.
|
|
31
|
-
*/
|
|
32
|
-
export interface NativeFtsResult {
|
|
33
|
-
nodeId: bigint;
|
|
34
|
-
score: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Native Transaction class interface.
|
|
38
|
-
*/
|
|
39
|
-
export interface NativeTransaction {
|
|
40
|
-
commit(): void;
|
|
41
|
-
rollback(): void;
|
|
42
|
-
createNode(label?: string): bigint;
|
|
43
|
-
deleteNode(nodeId: bigint): void;
|
|
44
|
-
nodeExists(nodeId: bigint): boolean;
|
|
45
|
-
getLabels(nodeId: bigint): string[] | null;
|
|
46
|
-
setProperty(nodeId: bigint, key: string, value: unknown): void;
|
|
47
|
-
getProperty(nodeId: bigint, key: string): unknown;
|
|
48
|
-
setVector(nodeId: bigint, key: string, vector: Float32Array): void;
|
|
49
|
-
ftsIndex(nodeId: bigint, text: string): void;
|
|
50
|
-
createEdge(sourceId: bigint, targetId: bigint, edgeType: string): bigint;
|
|
51
|
-
deleteEdge(sourceId: bigint, targetId: bigint, edgeType: string): void;
|
|
52
|
-
getOutgoingEdges(nodeId: bigint): NativeEdge[];
|
|
53
|
-
getIncomingEdges(nodeId: bigint): NativeEdge[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Native Database class interface.
|
|
57
|
-
*/
|
|
58
|
-
export interface NativeDatabase {
|
|
59
|
-
open(path: string, options?: {
|
|
60
|
-
create?: boolean;
|
|
61
|
-
readOnly?: boolean;
|
|
62
|
-
cacheSizeMb?: number;
|
|
63
|
-
enableVector?: boolean;
|
|
64
|
-
vectorDimensions?: number;
|
|
65
|
-
}): void;
|
|
66
|
-
close(): void;
|
|
67
|
-
begin(readOnly?: boolean): NativeTransaction;
|
|
68
|
-
isOpen(): boolean;
|
|
69
|
-
query(cypher: string, parameters?: Record<string, unknown>): NativeQueryResult;
|
|
70
|
-
vectorSearch(vector: Float32Array, options?: {
|
|
71
|
-
k?: number;
|
|
72
|
-
efSearch?: number;
|
|
73
|
-
}): NativeVectorResult[];
|
|
74
|
-
ftsSearch(query: string, options?: {
|
|
75
|
-
limit?: number;
|
|
76
|
-
}): NativeFtsResult[];
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Native module interface.
|
|
80
|
-
*/
|
|
81
|
-
export interface NativeModule {
|
|
82
|
-
Database: new () => NativeDatabase;
|
|
83
|
-
Transaction: new () => NativeTransaction;
|
|
84
|
-
version(): string;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* The loaded native module, or null if not available.
|
|
88
|
-
*/
|
|
89
|
-
export declare const native: NativeModule | null;
|
|
90
|
-
/**
|
|
91
|
-
* Check if the native module is available.
|
|
92
|
-
*/
|
|
93
|
-
export declare function isNativeAvailable(): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Get the native module, throwing if not available.
|
|
96
|
-
*/
|
|
97
|
-
export declare function getNative(): NativeModule;
|
|
98
|
-
//# sourceMappingURL=native.d.ts.map
|
package/dist/native.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE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AS,IAAI,YAAY,CAQxC"}
|
package/dist/native.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Native module loader and type definitions.
|
|
4
|
-
*
|
|
5
|
-
* This module loads the native N-API addon and provides TypeScript types
|
|
6
|
-
* for the raw native interface.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.native = void 0;
|
|
10
|
-
exports.isNativeAvailable = isNativeAvailable;
|
|
11
|
-
exports.getNative = getNative;
|
|
12
|
-
/**
|
|
13
|
-
* Try to load the native module.
|
|
14
|
-
*/
|
|
15
|
-
function loadNative() {
|
|
16
|
-
try {
|
|
17
|
-
// Try to load from the build directory
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
19
|
-
return require('../build/Release/lattice_native.node');
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
try {
|
|
23
|
-
// Try debug build
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
25
|
-
return require('../build/Debug/lattice_native.node');
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The loaded native module, or null if not available.
|
|
34
|
-
*/
|
|
35
|
-
exports.native = loadNative();
|
|
36
|
-
/**
|
|
37
|
-
* Check if the native module is available.
|
|
38
|
-
*/
|
|
39
|
-
function isNativeAvailable() {
|
|
40
|
-
return exports.native !== null;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get the native module, throwing if not available.
|
|
44
|
-
*/
|
|
45
|
-
function getNative() {
|
|
46
|
-
if (exports.native === null) {
|
|
47
|
-
throw new Error('Native module not available. ' +
|
|
48
|
-
'Make sure the native addon is built with "npm run build:native".');
|
|
49
|
-
}
|
|
50
|
-
return exports.native;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=native.js.map
|
package/dist/native.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAgHH,8CAEC;AAKD,8BAQC;AA1CD;;GAEG;AACH,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,uCAAuC;QACvC,iEAAiE;QACjE,OAAO,OAAO,CAAC,sCAAsC,CAAiB,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,kBAAkB;YAClB,iEAAiE;YACjE,OAAO,OAAO,CAAC,oCAAoC,CAAiB,CAAC;QACvE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACU,QAAA,MAAM,GAAwB,UAAU,EAAE,CAAC;AAExD;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,cAAM,KAAK,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS;IACvB,IAAI,cAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,+BAA+B;YAC/B,kEAAkE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,cAAM,CAAC;AAChB,CAAC"}
|