@grafeo-db/wasm-lite 0.5.35 → 0.5.36
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/grafeo_wasm.d.ts +20 -0
- package/grafeo_wasm_bg.js +73 -0
- package/grafeo_wasm_bg.wasm +0 -0
- package/grafeo_wasm_bg.wasm.d.ts +3 -0
- package/package.json +1 -1
package/grafeo_wasm.d.ts
CHANGED
|
@@ -30,10 +30,26 @@ export class Database {
|
|
|
30
30
|
* Returns `JsError` if compaction fails (e.g., the database is already in compact mode).
|
|
31
31
|
*/
|
|
32
32
|
compact(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a named graph projection. Returns `true` if created, `false`
|
|
35
|
+
* if a projection with that name already exists.
|
|
36
|
+
*
|
|
37
|
+
* A projection is a read-only, filtered view of the default graph.
|
|
38
|
+
* Only nodes with matching labels and edges with matching types are visible.
|
|
39
|
+
*
|
|
40
|
+
* # Errors
|
|
41
|
+
*
|
|
42
|
+
* This method does not currently return errors.
|
|
43
|
+
*/
|
|
44
|
+
createProjection(name: string, node_labels?: string[] | null, edge_types?: string[] | null): boolean;
|
|
33
45
|
/**
|
|
34
46
|
* Returns the current schema name, or `undefined` if no schema is set.
|
|
35
47
|
*/
|
|
36
48
|
currentSchema(): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Drops a named graph projection. Returns `true` if it existed.
|
|
51
|
+
*/
|
|
52
|
+
dropProjection(name: string): boolean;
|
|
37
53
|
/**
|
|
38
54
|
* Returns the number of edges in the database.
|
|
39
55
|
*/
|
|
@@ -243,6 +259,10 @@ export class Database {
|
|
|
243
259
|
* Returns `JsError` if the info data cannot be serialised to a JS value.
|
|
244
260
|
*/
|
|
245
261
|
info(): any;
|
|
262
|
+
/**
|
|
263
|
+
* Returns the names of all graph projections.
|
|
264
|
+
*/
|
|
265
|
+
listProjections(): string[];
|
|
246
266
|
/**
|
|
247
267
|
* Returns a hierarchical memory usage breakdown.
|
|
248
268
|
*
|
package/grafeo_wasm_bg.js
CHANGED
|
@@ -56,6 +56,31 @@ export class Database {
|
|
|
56
56
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a named graph projection. Returns `true` if created, `false`
|
|
61
|
+
* if a projection with that name already exists.
|
|
62
|
+
*
|
|
63
|
+
* A projection is a read-only, filtered view of the default graph.
|
|
64
|
+
* Only nodes with matching labels and edges with matching types are visible.
|
|
65
|
+
*
|
|
66
|
+
* # Errors
|
|
67
|
+
*
|
|
68
|
+
* This method does not currently return errors.
|
|
69
|
+
* @param {string} name
|
|
70
|
+
* @param {string[] | null} [node_labels]
|
|
71
|
+
* @param {string[] | null} [edge_types]
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
createProjection(name, node_labels, edge_types) {
|
|
75
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
76
|
+
const len0 = WASM_VECTOR_LEN;
|
|
77
|
+
var ptr1 = isLikeNone(node_labels) ? 0 : passArrayJsValueToWasm0(node_labels, wasm.__wbindgen_export);
|
|
78
|
+
var len1 = WASM_VECTOR_LEN;
|
|
79
|
+
var ptr2 = isLikeNone(edge_types) ? 0 : passArrayJsValueToWasm0(edge_types, wasm.__wbindgen_export);
|
|
80
|
+
var len2 = WASM_VECTOR_LEN;
|
|
81
|
+
const ret = wasm.database_createProjection(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
82
|
+
return ret !== 0;
|
|
83
|
+
}
|
|
59
84
|
/**
|
|
60
85
|
* Returns the current schema name, or `undefined` if no schema is set.
|
|
61
86
|
* @returns {string | undefined}
|
|
@@ -76,6 +101,17 @@ export class Database {
|
|
|
76
101
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
77
102
|
}
|
|
78
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Drops a named graph projection. Returns `true` if it existed.
|
|
106
|
+
* @param {string} name
|
|
107
|
+
* @returns {boolean}
|
|
108
|
+
*/
|
|
109
|
+
dropProjection(name) {
|
|
110
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
112
|
+
const ret = wasm.database_dropProjection(this.__wbg_ptr, ptr0, len0);
|
|
113
|
+
return ret !== 0;
|
|
114
|
+
}
|
|
79
115
|
/**
|
|
80
116
|
* Returns the number of edges in the database.
|
|
81
117
|
* @returns {number}
|
|
@@ -492,6 +528,23 @@ export class Database {
|
|
|
492
528
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
493
529
|
}
|
|
494
530
|
}
|
|
531
|
+
/**
|
|
532
|
+
* Returns the names of all graph projections.
|
|
533
|
+
* @returns {string[]}
|
|
534
|
+
*/
|
|
535
|
+
listProjections() {
|
|
536
|
+
try {
|
|
537
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
538
|
+
wasm.database_listProjections(retptr, this.__wbg_ptr);
|
|
539
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
540
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
541
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
542
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
543
|
+
return v1;
|
|
544
|
+
} finally {
|
|
545
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
495
548
|
/**
|
|
496
549
|
* Returns a hierarchical memory usage breakdown.
|
|
497
550
|
*
|
|
@@ -1007,6 +1060,16 @@ function getArrayF32FromWasm0(ptr, len) {
|
|
|
1007
1060
|
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1008
1061
|
}
|
|
1009
1062
|
|
|
1063
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1064
|
+
ptr = ptr >>> 0;
|
|
1065
|
+
const mem = getDataViewMemory0();
|
|
1066
|
+
const result = [];
|
|
1067
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1068
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
1069
|
+
}
|
|
1070
|
+
return result;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1010
1073
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1011
1074
|
ptr = ptr >>> 0;
|
|
1012
1075
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -1067,6 +1130,16 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
1067
1130
|
return ptr;
|
|
1068
1131
|
}
|
|
1069
1132
|
|
|
1133
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
1134
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
1135
|
+
const mem = getDataViewMemory0();
|
|
1136
|
+
for (let i = 0; i < array.length; i++) {
|
|
1137
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
1138
|
+
}
|
|
1139
|
+
WASM_VECTOR_LEN = array.length;
|
|
1140
|
+
return ptr;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1070
1143
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
1071
1144
|
if (realloc === undefined) {
|
|
1072
1145
|
const buf = cachedTextEncoder.encode(arg);
|
package/grafeo_wasm_bg.wasm
CHANGED
|
Binary file
|
package/grafeo_wasm_bg.wasm.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_database_free: (a: number, b: number) => void;
|
|
5
5
|
export const database_clearPlanCache: (a: number) => void;
|
|
6
6
|
export const database_compact: (a: number, b: number) => void;
|
|
7
|
+
export const database_createProjection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
7
8
|
export const database_currentSchema: (a: number, b: number) => void;
|
|
9
|
+
export const database_dropProjection: (a: number, b: number, c: number) => number;
|
|
8
10
|
export const database_edgeCount: (a: number) => number;
|
|
9
11
|
export const database_execute: (a: number, b: number, c: number, d: number) => void;
|
|
10
12
|
export const database_executeRaw: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -17,6 +19,7 @@ export const database_importLpg: (a: number, b: number, c: number) => void;
|
|
|
17
19
|
export const database_importRows: (a: number, b: number, c: number, d: number) => void;
|
|
18
20
|
export const database_importSnapshot: (a: number, b: number, c: number) => void;
|
|
19
21
|
export const database_info: (a: number, b: number) => void;
|
|
22
|
+
export const database_listProjections: (a: number, b: number) => void;
|
|
20
23
|
export const database_memoryUsage: (a: number, b: number) => void;
|
|
21
24
|
export const database_new: (a: number) => void;
|
|
22
25
|
export const database_nodeCount: (a: number) => number;
|