@grafeo-db/grafeo-wasm 0.5.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 +83 -0
- package/grafeo_wasm.d.ts +94 -0
- package/grafeo_wasm.js +9 -0
- package/grafeo_wasm_bg.js +443 -0
- package/grafeo_wasm_bg.wasm +0 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @grafeo-db/wasm
|
|
2
|
+
|
|
3
|
+
Low-level WebAssembly binary for [Grafeo](https://github.com/GrafeoDB/grafeo), a high-performance graph database.
|
|
4
|
+
|
|
5
|
+
## Which Package Do You Need?
|
|
6
|
+
|
|
7
|
+
| Package | Use Case |
|
|
8
|
+
|---------|----------|
|
|
9
|
+
| [`@grafeo-db/web`](https://www.npmjs.com/package/@grafeo-db/web) | Browser apps with IndexedDB, Web Workers, React/Vue/Svelte (recommended) |
|
|
10
|
+
| [`@grafeo-db/wasm`](https://www.npmjs.com/package/@grafeo-db/wasm) | Raw WASM binary for custom loaders or non-standard runtimes |
|
|
11
|
+
| [`@grafeo-db/js`](https://www.npmjs.com/package/@grafeo-db/js) | Node.js native bindings (faster than WASM for server-side) |
|
|
12
|
+
|
|
13
|
+
**Most users should use `@grafeo-db/web`** - it wraps this package and adds browser-specific features.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @grafeo-db/wasm
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import init, { GrafeoCore } from '@grafeo-db/wasm';
|
|
25
|
+
|
|
26
|
+
// Initialize the WASM module
|
|
27
|
+
await init();
|
|
28
|
+
|
|
29
|
+
// Low-level API
|
|
30
|
+
const core = new GrafeoCore();
|
|
31
|
+
const result = core.execute(`MATCH (n:Person) RETURN n.name`);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Progress
|
|
35
|
+
|
|
36
|
+
- [ ] Core WASM bindings via wasm-bindgen
|
|
37
|
+
- [ ] In-memory database support
|
|
38
|
+
- [ ] All query languages (GQL, Cypher, SPARQL, GraphQL, Gremlin)
|
|
39
|
+
- [ ] TypeScript type definitions
|
|
40
|
+
- [ ] Size optimization (target: <1MB gzipped)
|
|
41
|
+
|
|
42
|
+
## Package Contents
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
@grafeo-db/wasm/
|
|
46
|
+
├── grafeo_wasm_bg.wasm # WebAssembly binary
|
|
47
|
+
├── grafeo_wasm.js # JavaScript loader
|
|
48
|
+
├── grafeo_wasm.d.ts # TypeScript definitions
|
|
49
|
+
└── package.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Target Bundle Size
|
|
53
|
+
|
|
54
|
+
| Build | Size (gzip) |
|
|
55
|
+
|-------|-------------|
|
|
56
|
+
| Full (all languages) | ~600 KB |
|
|
57
|
+
| Minimal (GQL only) | ~300 KB |
|
|
58
|
+
|
|
59
|
+
## Runtime Support
|
|
60
|
+
|
|
61
|
+
| Runtime | Status |
|
|
62
|
+
|---------|--------|
|
|
63
|
+
| Browser (Chrome, Firefox, Safari, Edge) | Planned |
|
|
64
|
+
| Deno | Planned |
|
|
65
|
+
| Cloudflare Workers | Planned |
|
|
66
|
+
| Node.js | Use `@grafeo-db/js` instead |
|
|
67
|
+
|
|
68
|
+
## Current Alternatives
|
|
69
|
+
|
|
70
|
+
While WASM bindings are in development, you can use:
|
|
71
|
+
|
|
72
|
+
- **Python**: [`grafeo`](https://pypi.org/project/grafeo/) - fully functional
|
|
73
|
+
- **Rust**: [`grafeo`](https://crates.io/crates/grafeo) - fully functional
|
|
74
|
+
|
|
75
|
+
## Links
|
|
76
|
+
|
|
77
|
+
- [Documentation](https://grafeo.dev)
|
|
78
|
+
- [GitHub](https://github.com/GrafeoDB/grafeo)
|
|
79
|
+
- [Roadmap](https://github.com/GrafeoDB/grafeo/blob/main/docs/roadmap.md)
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
Apache-2.0
|
package/grafeo_wasm.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A Grafeo graph database instance running in WebAssembly.
|
|
6
|
+
*
|
|
7
|
+
* All data is held in memory within the WASM heap. For persistence,
|
|
8
|
+
* use `exportSnapshot()` / `importSnapshot()` with IndexedDB or
|
|
9
|
+
* the higher-level `@grafeo-db/web` package.
|
|
10
|
+
*/
|
|
11
|
+
export class Database {
|
|
12
|
+
free(): void;
|
|
13
|
+
[Symbol.dispose](): void;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the number of edges in the database.
|
|
16
|
+
*/
|
|
17
|
+
edgeCount(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Executes a GQL query and returns results as an array of objects.
|
|
20
|
+
*
|
|
21
|
+
* Each row becomes a JavaScript object with column names as keys.
|
|
22
|
+
*
|
|
23
|
+
* ```js
|
|
24
|
+
* const results = db.execute("MATCH (p:Person) RETURN p.name, p.age");
|
|
25
|
+
* // [{name: "Alice", age: 30}, {name: "Bob", age: 25}]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
execute(query: string): any;
|
|
29
|
+
/**
|
|
30
|
+
* Executes a GQL query and returns raw columns, rows, and metadata.
|
|
31
|
+
*
|
|
32
|
+
* Returns `{ columns: string[], rows: any[][], executionTimeMs?: number }`.
|
|
33
|
+
*/
|
|
34
|
+
executeRaw(query: string): any;
|
|
35
|
+
/**
|
|
36
|
+
* Executes a query using a specific query language.
|
|
37
|
+
*
|
|
38
|
+
* Supported languages: `"gql"`, `"cypher"`, `"sparql"`, `"gremlin"`, `"graphql"`.
|
|
39
|
+
* Languages require their corresponding feature flag to be enabled.
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* const results = db.executeWithLanguage(
|
|
43
|
+
* "MATCH (p:Person) RETURN p.name",
|
|
44
|
+
* "cypher"
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
executeWithLanguage(query: string, language: string): any;
|
|
49
|
+
/**
|
|
50
|
+
* Exports the database to a binary snapshot.
|
|
51
|
+
*
|
|
52
|
+
* Returns a `Uint8Array` that can be stored in IndexedDB, localStorage,
|
|
53
|
+
* or sent over the network. Restore with `Database.importSnapshot()`.
|
|
54
|
+
*
|
|
55
|
+
* ```js
|
|
56
|
+
* const bytes = db.exportSnapshot();
|
|
57
|
+
* // Store in IndexedDB, download as file, etc.
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
exportSnapshot(): Uint8Array;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a database from a binary snapshot.
|
|
63
|
+
*
|
|
64
|
+
* The `data` must have been produced by `exportSnapshot()`.
|
|
65
|
+
*
|
|
66
|
+
* ```js
|
|
67
|
+
* const db = Database.importSnapshot(bytes);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
static importSnapshot(data: Uint8Array): Database;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new in-memory database.
|
|
73
|
+
*/
|
|
74
|
+
constructor();
|
|
75
|
+
/**
|
|
76
|
+
* Returns the number of nodes in the database.
|
|
77
|
+
*/
|
|
78
|
+
nodeCount(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Returns schema information about the database.
|
|
81
|
+
*
|
|
82
|
+
* Returns an object describing labels, edge types, and property keys.
|
|
83
|
+
*
|
|
84
|
+
* ```js
|
|
85
|
+
* const schema = db.schema();
|
|
86
|
+
* // { lpg: { labels: [...], edgeTypes: [...], propertyKeys: [...] } }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
schema(): any;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the Grafeo version.
|
|
92
|
+
*/
|
|
93
|
+
static version(): string;
|
|
94
|
+
}
|
package/grafeo_wasm.js
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Grafeo graph database instance running in WebAssembly.
|
|
3
|
+
*
|
|
4
|
+
* All data is held in memory within the WASM heap. For persistence,
|
|
5
|
+
* use `exportSnapshot()` / `importSnapshot()` with IndexedDB or
|
|
6
|
+
* the higher-level `@grafeo-db/web` package.
|
|
7
|
+
*/
|
|
8
|
+
export class Database {
|
|
9
|
+
static __wrap(ptr) {
|
|
10
|
+
ptr = ptr >>> 0;
|
|
11
|
+
const obj = Object.create(Database.prototype);
|
|
12
|
+
obj.__wbg_ptr = ptr;
|
|
13
|
+
DatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
__destroy_into_raw() {
|
|
17
|
+
const ptr = this.__wbg_ptr;
|
|
18
|
+
this.__wbg_ptr = 0;
|
|
19
|
+
DatabaseFinalization.unregister(this);
|
|
20
|
+
return ptr;
|
|
21
|
+
}
|
|
22
|
+
free() {
|
|
23
|
+
const ptr = this.__destroy_into_raw();
|
|
24
|
+
wasm.__wbg_database_free(ptr, 0);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the number of edges in the database.
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
edgeCount() {
|
|
31
|
+
const ret = wasm.database_edgeCount(this.__wbg_ptr);
|
|
32
|
+
return ret >>> 0;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Executes a GQL query and returns results as an array of objects.
|
|
36
|
+
*
|
|
37
|
+
* Each row becomes a JavaScript object with column names as keys.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* const results = db.execute("MATCH (p:Person) RETURN p.name, p.age");
|
|
41
|
+
* // [{name: "Alice", age: 30}, {name: "Bob", age: 25}]
|
|
42
|
+
* ```
|
|
43
|
+
* @param {string} query
|
|
44
|
+
* @returns {any}
|
|
45
|
+
*/
|
|
46
|
+
execute(query) {
|
|
47
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
48
|
+
const len0 = WASM_VECTOR_LEN;
|
|
49
|
+
const ret = wasm.database_execute(this.__wbg_ptr, ptr0, len0);
|
|
50
|
+
if (ret[2]) {
|
|
51
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
52
|
+
}
|
|
53
|
+
return takeFromExternrefTable0(ret[0]);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Executes a GQL query and returns raw columns, rows, and metadata.
|
|
57
|
+
*
|
|
58
|
+
* Returns `{ columns: string[], rows: any[][], executionTimeMs?: number }`.
|
|
59
|
+
* @param {string} query
|
|
60
|
+
* @returns {any}
|
|
61
|
+
*/
|
|
62
|
+
executeRaw(query) {
|
|
63
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
64
|
+
const len0 = WASM_VECTOR_LEN;
|
|
65
|
+
const ret = wasm.database_executeRaw(this.__wbg_ptr, ptr0, len0);
|
|
66
|
+
if (ret[2]) {
|
|
67
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
68
|
+
}
|
|
69
|
+
return takeFromExternrefTable0(ret[0]);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Executes a query using a specific query language.
|
|
73
|
+
*
|
|
74
|
+
* Supported languages: `"gql"`, `"cypher"`, `"sparql"`, `"gremlin"`, `"graphql"`.
|
|
75
|
+
* Languages require their corresponding feature flag to be enabled.
|
|
76
|
+
*
|
|
77
|
+
* ```js
|
|
78
|
+
* const results = db.executeWithLanguage(
|
|
79
|
+
* "MATCH (p:Person) RETURN p.name",
|
|
80
|
+
* "cypher"
|
|
81
|
+
* );
|
|
82
|
+
* ```
|
|
83
|
+
* @param {string} query
|
|
84
|
+
* @param {string} language
|
|
85
|
+
* @returns {any}
|
|
86
|
+
*/
|
|
87
|
+
executeWithLanguage(query, language) {
|
|
88
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
89
|
+
const len0 = WASM_VECTOR_LEN;
|
|
90
|
+
const ptr1 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
91
|
+
const len1 = WASM_VECTOR_LEN;
|
|
92
|
+
const ret = wasm.database_executeWithLanguage(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
93
|
+
if (ret[2]) {
|
|
94
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
95
|
+
}
|
|
96
|
+
return takeFromExternrefTable0(ret[0]);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Exports the database to a binary snapshot.
|
|
100
|
+
*
|
|
101
|
+
* Returns a `Uint8Array` that can be stored in IndexedDB, localStorage,
|
|
102
|
+
* or sent over the network. Restore with `Database.importSnapshot()`.
|
|
103
|
+
*
|
|
104
|
+
* ```js
|
|
105
|
+
* const bytes = db.exportSnapshot();
|
|
106
|
+
* // Store in IndexedDB, download as file, etc.
|
|
107
|
+
* ```
|
|
108
|
+
* @returns {Uint8Array}
|
|
109
|
+
*/
|
|
110
|
+
exportSnapshot() {
|
|
111
|
+
const ret = wasm.database_exportSnapshot(this.__wbg_ptr);
|
|
112
|
+
if (ret[3]) {
|
|
113
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
114
|
+
}
|
|
115
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
116
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
117
|
+
return v1;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates a database from a binary snapshot.
|
|
121
|
+
*
|
|
122
|
+
* The `data` must have been produced by `exportSnapshot()`.
|
|
123
|
+
*
|
|
124
|
+
* ```js
|
|
125
|
+
* const db = Database.importSnapshot(bytes);
|
|
126
|
+
* ```
|
|
127
|
+
* @param {Uint8Array} data
|
|
128
|
+
* @returns {Database}
|
|
129
|
+
*/
|
|
130
|
+
static importSnapshot(data) {
|
|
131
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
132
|
+
const len0 = WASM_VECTOR_LEN;
|
|
133
|
+
const ret = wasm.database_importSnapshot(ptr0, len0);
|
|
134
|
+
if (ret[2]) {
|
|
135
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
136
|
+
}
|
|
137
|
+
return Database.__wrap(ret[0]);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Creates a new in-memory database.
|
|
141
|
+
*/
|
|
142
|
+
constructor() {
|
|
143
|
+
const ret = wasm.database_new();
|
|
144
|
+
if (ret[2]) {
|
|
145
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
146
|
+
}
|
|
147
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
148
|
+
DatabaseFinalization.register(this, this.__wbg_ptr, this);
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns the number of nodes in the database.
|
|
153
|
+
* @returns {number}
|
|
154
|
+
*/
|
|
155
|
+
nodeCount() {
|
|
156
|
+
const ret = wasm.database_nodeCount(this.__wbg_ptr);
|
|
157
|
+
return ret >>> 0;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns schema information about the database.
|
|
161
|
+
*
|
|
162
|
+
* Returns an object describing labels, edge types, and property keys.
|
|
163
|
+
*
|
|
164
|
+
* ```js
|
|
165
|
+
* const schema = db.schema();
|
|
166
|
+
* // { lpg: { labels: [...], edgeTypes: [...], propertyKeys: [...] } }
|
|
167
|
+
* ```
|
|
168
|
+
* @returns {any}
|
|
169
|
+
*/
|
|
170
|
+
schema() {
|
|
171
|
+
const ret = wasm.database_schema(this.__wbg_ptr);
|
|
172
|
+
if (ret[2]) {
|
|
173
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
174
|
+
}
|
|
175
|
+
return takeFromExternrefTable0(ret[0]);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns the Grafeo version.
|
|
179
|
+
* @returns {string}
|
|
180
|
+
*/
|
|
181
|
+
static version() {
|
|
182
|
+
let deferred1_0;
|
|
183
|
+
let deferred1_1;
|
|
184
|
+
try {
|
|
185
|
+
const ret = wasm.database_version();
|
|
186
|
+
deferred1_0 = ret[0];
|
|
187
|
+
deferred1_1 = ret[1];
|
|
188
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
189
|
+
} finally {
|
|
190
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (Symbol.dispose) Database.prototype[Symbol.dispose] = Database.prototype.free;
|
|
195
|
+
export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
|
|
196
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
197
|
+
return ret;
|
|
198
|
+
}
|
|
199
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
200
|
+
const ret = String(arg1);
|
|
201
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
202
|
+
const len1 = WASM_VECTOR_LEN;
|
|
203
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
204
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
205
|
+
}
|
|
206
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
207
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
208
|
+
}
|
|
209
|
+
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
210
|
+
let deferred0_0;
|
|
211
|
+
let deferred0_1;
|
|
212
|
+
try {
|
|
213
|
+
deferred0_0 = arg0;
|
|
214
|
+
deferred0_1 = arg1;
|
|
215
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
216
|
+
} finally {
|
|
217
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function __wbg_getRandomValues_1c61fac11405ffdc() { return handleError(function (arg0, arg1) {
|
|
221
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
222
|
+
}, arguments); }
|
|
223
|
+
export function __wbg_length_32ed9a279acd054c(arg0) {
|
|
224
|
+
const ret = arg0.length;
|
|
225
|
+
return ret;
|
|
226
|
+
}
|
|
227
|
+
export function __wbg_length_9a7876c9728a0979(arg0) {
|
|
228
|
+
const ret = arg0.length;
|
|
229
|
+
return ret;
|
|
230
|
+
}
|
|
231
|
+
export function __wbg_new_361308b2356cecd0() {
|
|
232
|
+
const ret = new Object();
|
|
233
|
+
return ret;
|
|
234
|
+
}
|
|
235
|
+
export function __wbg_new_3eb36ae241fe6f44() {
|
|
236
|
+
const ret = new Array();
|
|
237
|
+
return ret;
|
|
238
|
+
}
|
|
239
|
+
export function __wbg_new_8a6f238a6ece86ea() {
|
|
240
|
+
const ret = new Error();
|
|
241
|
+
return ret;
|
|
242
|
+
}
|
|
243
|
+
export function __wbg_new_with_length_1763c527b2923202(arg0) {
|
|
244
|
+
const ret = new Array(arg0 >>> 0);
|
|
245
|
+
return ret;
|
|
246
|
+
}
|
|
247
|
+
export function __wbg_new_with_length_63f2683cc2521026(arg0) {
|
|
248
|
+
const ret = new Float32Array(arg0 >>> 0);
|
|
249
|
+
return ret;
|
|
250
|
+
}
|
|
251
|
+
export function __wbg_new_with_length_a2c39cbe88fd8ff1(arg0) {
|
|
252
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
253
|
+
return ret;
|
|
254
|
+
}
|
|
255
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
256
|
+
arg0[arg1] = arg2;
|
|
257
|
+
}
|
|
258
|
+
export function __wbg_set_6cb8631f80447a67() { return handleError(function (arg0, arg1, arg2) {
|
|
259
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
260
|
+
return ret;
|
|
261
|
+
}, arguments); }
|
|
262
|
+
export function __wbg_set_cc56eefd2dd91957(arg0, arg1, arg2) {
|
|
263
|
+
arg0.set(getArrayU8FromWasm0(arg1, arg2));
|
|
264
|
+
}
|
|
265
|
+
export function __wbg_set_f43e577aea94465b(arg0, arg1, arg2) {
|
|
266
|
+
arg0[arg1 >>> 0] = arg2;
|
|
267
|
+
}
|
|
268
|
+
export function __wbg_set_f8edeec46569cc70(arg0, arg1, arg2) {
|
|
269
|
+
arg0.set(getArrayF32FromWasm0(arg1, arg2));
|
|
270
|
+
}
|
|
271
|
+
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
272
|
+
const ret = arg1.stack;
|
|
273
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
274
|
+
const len1 = WASM_VECTOR_LEN;
|
|
275
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
276
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
277
|
+
}
|
|
278
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
279
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
280
|
+
const ret = arg0;
|
|
281
|
+
return ret;
|
|
282
|
+
}
|
|
283
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
284
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
285
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
286
|
+
return ret;
|
|
287
|
+
}
|
|
288
|
+
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
289
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
290
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
291
|
+
return ret;
|
|
292
|
+
}
|
|
293
|
+
export function __wbindgen_init_externref_table() {
|
|
294
|
+
const table = wasm.__wbindgen_externrefs;
|
|
295
|
+
const offset = table.grow(4);
|
|
296
|
+
table.set(0, undefined);
|
|
297
|
+
table.set(offset + 0, undefined);
|
|
298
|
+
table.set(offset + 1, null);
|
|
299
|
+
table.set(offset + 2, true);
|
|
300
|
+
table.set(offset + 3, false);
|
|
301
|
+
}
|
|
302
|
+
const DatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
303
|
+
? { register: () => {}, unregister: () => {} }
|
|
304
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_database_free(ptr >>> 0, 1));
|
|
305
|
+
|
|
306
|
+
function addToExternrefTable0(obj) {
|
|
307
|
+
const idx = wasm.__externref_table_alloc();
|
|
308
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
309
|
+
return idx;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
313
|
+
ptr = ptr >>> 0;
|
|
314
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
318
|
+
ptr = ptr >>> 0;
|
|
319
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
let cachedDataViewMemory0 = null;
|
|
323
|
+
function getDataViewMemory0() {
|
|
324
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
325
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
326
|
+
}
|
|
327
|
+
return cachedDataViewMemory0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
331
|
+
function getFloat32ArrayMemory0() {
|
|
332
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
333
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
334
|
+
}
|
|
335
|
+
return cachedFloat32ArrayMemory0;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function getStringFromWasm0(ptr, len) {
|
|
339
|
+
ptr = ptr >>> 0;
|
|
340
|
+
return decodeText(ptr, len);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
let cachedUint8ArrayMemory0 = null;
|
|
344
|
+
function getUint8ArrayMemory0() {
|
|
345
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
346
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
347
|
+
}
|
|
348
|
+
return cachedUint8ArrayMemory0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function handleError(f, args) {
|
|
352
|
+
try {
|
|
353
|
+
return f.apply(this, args);
|
|
354
|
+
} catch (e) {
|
|
355
|
+
const idx = addToExternrefTable0(e);
|
|
356
|
+
wasm.__wbindgen_exn_store(idx);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
361
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
362
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
363
|
+
WASM_VECTOR_LEN = arg.length;
|
|
364
|
+
return ptr;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
368
|
+
if (realloc === undefined) {
|
|
369
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
370
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
371
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
372
|
+
WASM_VECTOR_LEN = buf.length;
|
|
373
|
+
return ptr;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let len = arg.length;
|
|
377
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
378
|
+
|
|
379
|
+
const mem = getUint8ArrayMemory0();
|
|
380
|
+
|
|
381
|
+
let offset = 0;
|
|
382
|
+
|
|
383
|
+
for (; offset < len; offset++) {
|
|
384
|
+
const code = arg.charCodeAt(offset);
|
|
385
|
+
if (code > 0x7F) break;
|
|
386
|
+
mem[ptr + offset] = code;
|
|
387
|
+
}
|
|
388
|
+
if (offset !== len) {
|
|
389
|
+
if (offset !== 0) {
|
|
390
|
+
arg = arg.slice(offset);
|
|
391
|
+
}
|
|
392
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
393
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
394
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
395
|
+
|
|
396
|
+
offset += ret.written;
|
|
397
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
WASM_VECTOR_LEN = offset;
|
|
401
|
+
return ptr;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function takeFromExternrefTable0(idx) {
|
|
405
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
406
|
+
wasm.__externref_table_dealloc(idx);
|
|
407
|
+
return value;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
411
|
+
cachedTextDecoder.decode();
|
|
412
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
413
|
+
let numBytesDecoded = 0;
|
|
414
|
+
function decodeText(ptr, len) {
|
|
415
|
+
numBytesDecoded += len;
|
|
416
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
417
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
418
|
+
cachedTextDecoder.decode();
|
|
419
|
+
numBytesDecoded = len;
|
|
420
|
+
}
|
|
421
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const cachedTextEncoder = new TextEncoder();
|
|
425
|
+
|
|
426
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
427
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
428
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
429
|
+
view.set(buf);
|
|
430
|
+
return {
|
|
431
|
+
read: arg.length,
|
|
432
|
+
written: buf.length
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
let WASM_VECTOR_LEN = 0;
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
let wasm;
|
|
441
|
+
export function __wbg_set_wasm(val) {
|
|
442
|
+
wasm = val;
|
|
443
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grafeo-db/grafeo-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"S.T. Grond"
|
|
6
|
+
],
|
|
7
|
+
"description": "WebAssembly bindings for Grafeo graph database",
|
|
8
|
+
"version": "0.5.0",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/GrafeoDB/grafeo"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"grafeo_wasm_bg.wasm",
|
|
16
|
+
"grafeo_wasm.js",
|
|
17
|
+
"grafeo_wasm_bg.js",
|
|
18
|
+
"grafeo_wasm.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "grafeo_wasm.js",
|
|
21
|
+
"types": "grafeo_wasm.d.ts",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./grafeo_wasm.js",
|
|
24
|
+
"./snippets/*"
|
|
25
|
+
]
|
|
26
|
+
}
|