@dreamlake/dreamdb 0.3.1 → 0.4.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 +178 -0
- package/{dreamdb.d.ts → browser/dreamdb.d.ts} +142 -0
- package/browser/dreamdb.js +9 -0
- package/{dreamdb_bg.js → browser/dreamdb_bg.js} +555 -2
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +56 -0
- package/browser-extras.mjs +193 -0
- package/browser.mjs +4 -0
- package/index.d.ts +541 -1
- package/node/dreamdb.cjs +1762 -0
- package/node/dreamdb.d.cts +425 -0
- package/node/dreamdb_bg.wasm +0 -0
- package/node/dreamdb_bg.wasm.d.ts +72 -0
- package/node.cjs +10 -0
- package/node.mjs +19 -0
- package/package.json +40 -16
- package/web/dreamdb.d.ts +407 -0
- package/web/dreamdb.js +1558 -0
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +56 -0
- package/web.mjs +17 -0
- package/dreamdb.js +0 -9
- package/dreamdb_bg.wasm +0 -0
- package/index.js +0 -6
package/node/dreamdb.cjs
ADDED
|
@@ -0,0 +1,1762 @@
|
|
|
1
|
+
/* @ts-self-types="./dreamdb.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dataset creation, layers, merge, compaction and history.
|
|
5
|
+
*/
|
|
6
|
+
class Authoring {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(Authoring.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
AuthoringFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
AuthoringFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_authoring_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Add an embedding column whose index artifacts already exist.
|
|
25
|
+
*
|
|
26
|
+
* `spatialIndex` and `compressor` are base32 multihashes of objects the
|
|
27
|
+
* caller has already trained and uploaded (the CLI's `rebuild_exact` /
|
|
28
|
+
* index builders produce them). They are required rather than optional
|
|
29
|
+
* because training an IVF index inside a wasm module means holding the
|
|
30
|
+
* full training set in a 32-bit address space — the failure mode is an
|
|
31
|
+
* allocation abort that reaches JS as a bare `unreachable`.
|
|
32
|
+
*
|
|
33
|
+
* `rerank` stores exact f32 vectors alongside the compressed ones. Leave
|
|
34
|
+
* it on unless you have measured that you can live without it: with it
|
|
35
|
+
* off, reads decode 1-bit reconstructions and relevance degrades in a way
|
|
36
|
+
* no API-level check can see.
|
|
37
|
+
* @param {string} name
|
|
38
|
+
* @param {string} parent_field
|
|
39
|
+
* @param {number} dim
|
|
40
|
+
* @param {string} algorithm
|
|
41
|
+
* @param {string} spatial_index
|
|
42
|
+
* @param {string} compressor
|
|
43
|
+
* @param {boolean} rerank
|
|
44
|
+
* @param {number | null | undefined} version
|
|
45
|
+
* @param {Array<any>} samples
|
|
46
|
+
* @returns {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
addEmbeddingLayer(name, parent_field, dim, algorithm, spatial_index, compressor, rerank, version, samples) {
|
|
49
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
50
|
+
const len0 = WASM_VECTOR_LEN;
|
|
51
|
+
const ptr1 = passStringToWasm0(parent_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
52
|
+
const len1 = WASM_VECTOR_LEN;
|
|
53
|
+
const ptr2 = passStringToWasm0(algorithm, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
54
|
+
const len2 = WASM_VECTOR_LEN;
|
|
55
|
+
const ptr3 = passStringToWasm0(spatial_index, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
56
|
+
const len3 = WASM_VECTOR_LEN;
|
|
57
|
+
const ptr4 = passStringToWasm0(compressor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
58
|
+
const len4 = WASM_VECTOR_LEN;
|
|
59
|
+
const ret = wasm.authoring_addEmbeddingLayer(this.__wbg_ptr, ptr0, len0, ptr1, len1, dim, ptr2, len2, ptr3, len3, ptr4, len4, rerank, isLikeNone(version) ? Number.MAX_SAFE_INTEGER : (version) >>> 0, samples);
|
|
60
|
+
return ret;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Add a field to the schema of an existing dataset.
|
|
64
|
+
* @param {any} field
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
*/
|
|
67
|
+
addField(field) {
|
|
68
|
+
const ret = wasm.authoring_addField(this.__wbg_ptr, field);
|
|
69
|
+
return ret;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Add an image column over an existing field's anchors.
|
|
73
|
+
* `samples` is `[[anchor, Uint8Array], …]`.
|
|
74
|
+
* @param {string} name
|
|
75
|
+
* @param {string} parent_field
|
|
76
|
+
* @param {Array<any>} samples
|
|
77
|
+
* @param {string} mime
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
addImageLayer(name, parent_field, samples, mime) {
|
|
81
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
|
+
const len0 = WASM_VECTOR_LEN;
|
|
83
|
+
const ptr1 = passStringToWasm0(parent_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
|
+
const len1 = WASM_VECTOR_LEN;
|
|
85
|
+
const ptr2 = passStringToWasm0(mime, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
86
|
+
const len2 = WASM_VECTOR_LEN;
|
|
87
|
+
const ret = wasm.authoring_addImageLayer(this.__wbg_ptr, ptr0, len0, ptr1, len1, samples, ptr2, len2);
|
|
88
|
+
return ret;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Add a scalar column over an existing field's anchors.
|
|
92
|
+
*
|
|
93
|
+
* `samples` is `[[anchor, value], …]`; anchors must already exist in the
|
|
94
|
+
* parent field. `valueType` is one of
|
|
95
|
+
* `int|float|bool|string|categorical|timestamp`.
|
|
96
|
+
* @param {string} name
|
|
97
|
+
* @param {string} parent_field
|
|
98
|
+
* @param {string} value_type
|
|
99
|
+
* @param {Array<any>} samples
|
|
100
|
+
* @returns {Promise<void>}
|
|
101
|
+
*/
|
|
102
|
+
addScalarLayer(name, parent_field, value_type, samples) {
|
|
103
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
+
const len0 = WASM_VECTOR_LEN;
|
|
105
|
+
const ptr1 = passStringToWasm0(parent_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
|
+
const len1 = WASM_VECTOR_LEN;
|
|
107
|
+
const ptr2 = passStringToWasm0(value_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
108
|
+
const len2 = WASM_VECTOR_LEN;
|
|
109
|
+
const ret = wasm.authoring_addScalarLayer(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, samples);
|
|
110
|
+
return ret;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Fork the current manifest to a new ref name.
|
|
114
|
+
* @param {string} new_name
|
|
115
|
+
* @returns {Promise<Authoring>}
|
|
116
|
+
*/
|
|
117
|
+
branch(new_name) {
|
|
118
|
+
const ptr0 = passStringToWasm0(new_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
119
|
+
const len0 = WASM_VECTOR_LEN;
|
|
120
|
+
const ret = wasm.authoring_branch(this.__wbg_ptr, ptr0, len0);
|
|
121
|
+
return ret;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Collapse per-cell fragments. Returns
|
|
125
|
+
* `{cellsExamined, cellsCompacted, fragmentsCollapsed, manifest?}`.
|
|
126
|
+
*
|
|
127
|
+
* This is the cheapest latency lever there is on a sharded ingest: on the
|
|
128
|
+
* `vision-mixed` corpus it took 32,782 buckets to 3,122 in 1m48s, for no
|
|
129
|
+
* change in results and no extra hardware. `manifest` is absent when
|
|
130
|
+
* nothing needed compacting — a no-op, not a failure.
|
|
131
|
+
* @param {string | null | undefined} modality
|
|
132
|
+
* @param {number} threshold
|
|
133
|
+
* @param {number} max_cells
|
|
134
|
+
* @returns {Promise<any>}
|
|
135
|
+
*/
|
|
136
|
+
compact(modality, threshold, max_cells) {
|
|
137
|
+
var ptr0 = isLikeNone(modality) ? 0 : passStringToWasm0(modality, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
138
|
+
var len0 = WASM_VECTOR_LEN;
|
|
139
|
+
const ret = wasm.authoring_compact(this.__wbg_ptr, ptr0, len0, threshold, max_cells);
|
|
140
|
+
return ret;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create a new dataset and publish `refs/<name>`.
|
|
144
|
+
*
|
|
145
|
+
* `schema` is an array of field descriptors — see `marshal::schema_from_js`
|
|
146
|
+
* for the accepted shapes.
|
|
147
|
+
*
|
|
148
|
+
* Note the core's own constraint, surfaced rather than papered over:
|
|
149
|
+
* embedding fields declaring `dreamdb.ivf-cosine` / `dreamdb.imi-cosine`
|
|
150
|
+
* cannot be created here, because those index families need training data
|
|
151
|
+
* that does not exist yet at create time. Create with the default
|
|
152
|
+
* `dreamdb.lsh-cosine` and add a trained index as a layer once you have
|
|
153
|
+
* vectors, or build the index with the CLI.
|
|
154
|
+
* @param {string} name
|
|
155
|
+
* @param {Array<any>} schema
|
|
156
|
+
* @param {string} base
|
|
157
|
+
* @param {any} backend
|
|
158
|
+
* @returns {Promise<Authoring>}
|
|
159
|
+
*/
|
|
160
|
+
static create(name, schema, base, backend) {
|
|
161
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
162
|
+
const len0 = WASM_VECTOR_LEN;
|
|
163
|
+
const ptr1 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
164
|
+
const len1 = WASM_VECTOR_LEN;
|
|
165
|
+
const ret = wasm.authoring_create(ptr0, len0, schema, ptr1, len1, backend);
|
|
166
|
+
return ret;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Delete a ref. Does not delete the objects it pointed at — they stay
|
|
170
|
+
* reachable by manifest hash, which is what makes this recoverable.
|
|
171
|
+
* @param {string} name
|
|
172
|
+
* @returns {Promise<void>}
|
|
173
|
+
*/
|
|
174
|
+
deleteRef(name) {
|
|
175
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
176
|
+
const len0 = WASM_VECTOR_LEN;
|
|
177
|
+
const ret = wasm.authoring_deleteRef(this.__wbg_ptr, ptr0, len0);
|
|
178
|
+
return ret;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Ref names under `refs/`. Requires a backend implementing `list`.
|
|
182
|
+
* @returns {Promise<string[]>}
|
|
183
|
+
*/
|
|
184
|
+
listRefs() {
|
|
185
|
+
const ret = wasm.authoring_listRefs(this.__wbg_ptr);
|
|
186
|
+
return ret;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Merge one or more branches into this ref. Returns the new manifest hash.
|
|
190
|
+
* @param {string[]} branches
|
|
191
|
+
* @returns {Promise<string>}
|
|
192
|
+
*/
|
|
193
|
+
mergeMany(branches) {
|
|
194
|
+
const ptr0 = passArrayJsValueToWasm0(branches, wasm.__wbindgen_malloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ret = wasm.authoring_mergeMany(this.__wbg_ptr, ptr0, len0);
|
|
197
|
+
return ret;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Open an existing ref for authoring.
|
|
201
|
+
* @param {string} uri
|
|
202
|
+
* @param {any} backend
|
|
203
|
+
* @returns {Promise<Authoring>}
|
|
204
|
+
*/
|
|
205
|
+
static open(uri, backend) {
|
|
206
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
208
|
+
const ret = wasm.authoring_open(ptr0, len0, backend);
|
|
209
|
+
return ret;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The ref this handle writes to.
|
|
213
|
+
* @returns {string}
|
|
214
|
+
*/
|
|
215
|
+
get refName() {
|
|
216
|
+
let deferred1_0;
|
|
217
|
+
let deferred1_1;
|
|
218
|
+
try {
|
|
219
|
+
const ret = wasm.authoring_refName(this.__wbg_ptr);
|
|
220
|
+
deferred1_0 = ret[0];
|
|
221
|
+
deferred1_1 = ret[1];
|
|
222
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
223
|
+
} finally {
|
|
224
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Set a human-readable description on the dataset.
|
|
229
|
+
* @param {string} text
|
|
230
|
+
* @returns {Promise<void>}
|
|
231
|
+
*/
|
|
232
|
+
setDescription(text) {
|
|
233
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ret = wasm.authoring_setDescription(this.__wbg_ptr, ptr0, len0);
|
|
236
|
+
return ret;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* A `Writer` sharing this handle — for append/commit/snapshot.
|
|
240
|
+
* @returns {Writer}
|
|
241
|
+
*/
|
|
242
|
+
writer() {
|
|
243
|
+
const ret = wasm.authoring_writer(this.__wbg_ptr);
|
|
244
|
+
return Writer.__wrap(ret);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (Symbol.dispose) Authoring.prototype[Symbol.dispose] = Authoring.prototype.free;
|
|
248
|
+
exports.Authoring = Authoring;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* A `fetch`-backed backend rooted at a base URL.
|
|
252
|
+
*/
|
|
253
|
+
class S3Backend {
|
|
254
|
+
__destroy_into_raw() {
|
|
255
|
+
const ptr = this.__wbg_ptr;
|
|
256
|
+
this.__wbg_ptr = 0;
|
|
257
|
+
S3BackendFinalization.unregister(this);
|
|
258
|
+
return ptr;
|
|
259
|
+
}
|
|
260
|
+
free() {
|
|
261
|
+
const ptr = this.__destroy_into_raw();
|
|
262
|
+
wasm.__wbg_s3backend_free(ptr, 0);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Fetch `path` (relative to the base URL) and resolve to its bytes.
|
|
266
|
+
* `opts.noCache` is accepted for API compatibility (currently a no-op:
|
|
267
|
+
* content is hash-addressed; refs are read fresh each page load anyway).
|
|
268
|
+
* @param {string} path
|
|
269
|
+
* @param {any} _opts
|
|
270
|
+
* @returns {Promise<Uint8Array>}
|
|
271
|
+
*/
|
|
272
|
+
get(path, _opts) {
|
|
273
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
274
|
+
const len0 = WASM_VECTOR_LEN;
|
|
275
|
+
const ret = wasm.s3backend_get(this.__wbg_ptr, ptr0, len0, _opts);
|
|
276
|
+
return ret;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* List object paths under `prefix`. Stub (returns empty); the current
|
|
280
|
+
* consumer read paths don't require listing.
|
|
281
|
+
* @param {string} _prefix
|
|
282
|
+
* @returns {Promise<Array<any>>}
|
|
283
|
+
*/
|
|
284
|
+
list(_prefix) {
|
|
285
|
+
const ptr0 = passStringToWasm0(_prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
287
|
+
const ret = wasm.s3backend_list(this.__wbg_ptr, ptr0, len0);
|
|
288
|
+
return ret;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Construct rooted at `base_url` (trailing slash trimmed).
|
|
292
|
+
* @param {string} base_url
|
|
293
|
+
*/
|
|
294
|
+
constructor(base_url) {
|
|
295
|
+
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
296
|
+
const len0 = WASM_VECTOR_LEN;
|
|
297
|
+
const ret = wasm.s3backend_new(ptr0, len0);
|
|
298
|
+
this.__wbg_ptr = ret;
|
|
299
|
+
S3BackendFinalization.register(this, this.__wbg_ptr, this);
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (Symbol.dispose) S3Backend.prototype[Symbol.dispose] = S3Backend.prototype.free;
|
|
304
|
+
exports.S3Backend = S3Backend;
|
|
305
|
+
|
|
306
|
+
class Space {
|
|
307
|
+
static __wrap(ptr) {
|
|
308
|
+
const obj = Object.create(Space.prototype);
|
|
309
|
+
obj.__wbg_ptr = ptr;
|
|
310
|
+
SpaceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
311
|
+
return obj;
|
|
312
|
+
}
|
|
313
|
+
__destroy_into_raw() {
|
|
314
|
+
const ptr = this.__wbg_ptr;
|
|
315
|
+
this.__wbg_ptr = 0;
|
|
316
|
+
SpaceFinalization.unregister(this);
|
|
317
|
+
return ptr;
|
|
318
|
+
}
|
|
319
|
+
free() {
|
|
320
|
+
const ptr = this.__destroy_into_raw();
|
|
321
|
+
wasm.__wbg_space_free(ptr, 0);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The base URL objects are fetched relative to (consumers build their own
|
|
325
|
+
* object URLs from this — e.g. `dreamdb-demo`'s track readers).
|
|
326
|
+
* @returns {string}
|
|
327
|
+
*/
|
|
328
|
+
get connectorBase() {
|
|
329
|
+
let deferred1_0;
|
|
330
|
+
let deferred1_1;
|
|
331
|
+
try {
|
|
332
|
+
const ret = wasm.space_connectorBase(this.__wbg_ptr);
|
|
333
|
+
deferred1_0 = ret[0];
|
|
334
|
+
deferred1_1 = ret[1];
|
|
335
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
336
|
+
} finally {
|
|
337
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
|
|
342
|
+
* resolving the ref (if any) and loading the manifest. If `backend` is
|
|
343
|
+
* provided it handles IO (relative paths); otherwise a direct-fetch
|
|
344
|
+
* connector rooted at the parsed base URL is used (the `dreamdb-demo`
|
|
345
|
+
* no-backend path).
|
|
346
|
+
* @param {string} uri
|
|
347
|
+
* @param {any} backend
|
|
348
|
+
* @returns {Promise<Space>}
|
|
349
|
+
*/
|
|
350
|
+
static fromUri(uri, backend) {
|
|
351
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
352
|
+
const len0 = WASM_VECTOR_LEN;
|
|
353
|
+
const ret = wasm.space_fromUri(ptr0, len0, backend);
|
|
354
|
+
return ret;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
|
|
358
|
+
* `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
|
|
359
|
+
* @param {number | null} [max_depth]
|
|
360
|
+
* @returns {Promise<Array<any>>}
|
|
361
|
+
*/
|
|
362
|
+
history(max_depth) {
|
|
363
|
+
const ret = wasm.space_history(this.__wbg_ptr, isLikeNone(max_depth) ? Number.MAX_SAFE_INTEGER : (max_depth) >>> 0);
|
|
364
|
+
return ret;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The manifest's base32 multihash.
|
|
368
|
+
* @returns {string}
|
|
369
|
+
*/
|
|
370
|
+
get manifestHash() {
|
|
371
|
+
let deferred1_0;
|
|
372
|
+
let deferred1_1;
|
|
373
|
+
try {
|
|
374
|
+
const ret = wasm.space_manifestHash(this.__wbg_ptr);
|
|
375
|
+
deferred1_0 = ret[0];
|
|
376
|
+
deferred1_1 = ret[1];
|
|
377
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
378
|
+
} finally {
|
|
379
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
|
|
384
|
+
* sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
|
|
385
|
+
* list sorted by fused score descending — the same scored shape as
|
|
386
|
+
* `queryVector`.
|
|
387
|
+
*
|
|
388
|
+
* `vector` is the dense sub-query embedding (a `Float32Array`). `opts` is a
|
|
389
|
+
* plain JS object:
|
|
390
|
+
* ```js
|
|
391
|
+
* {
|
|
392
|
+
* textField, textQuery, // BM25 sub-query (required)
|
|
393
|
+
* vectorField, // dense field the `vector` targets (required)
|
|
394
|
+
* topK = 10, // fused results to return
|
|
395
|
+
* fusion = 'rrf', // 'rrf' | 'linear' | 'max' | 'pareto'
|
|
396
|
+
* rrfK = 60, // RRF rank constant (fusion='rrf')
|
|
397
|
+
* textWeight = 1, vectorWeight = 1, // Linear weights (fusion='linear')
|
|
398
|
+
* textK = topK, vectorK = topK, // per-sub-query candidate depths
|
|
399
|
+
* textRequired = false, vectorRequired = false, // §5.3 boolean-AND gates
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
|
|
404
|
+
* (v0 does not expose the optional scalar pre/post-filter; it runs with no
|
|
405
|
+
* scalar gate.)
|
|
406
|
+
* @param {Float32Array} vector
|
|
407
|
+
* @param {any} opts
|
|
408
|
+
* @returns {Promise<Array<any>>}
|
|
409
|
+
*/
|
|
410
|
+
queryHybrid(vector, opts) {
|
|
411
|
+
const ptr0 = passArrayF32ToWasm0(vector, wasm.__wbindgen_malloc);
|
|
412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
413
|
+
const ret = wasm.space_queryHybrid(this.__wbg_ptr, ptr0, len0, opts);
|
|
414
|
+
return ret;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Scalar-index lookup: every anchor whose `field` satisfies `op value`
|
|
418
|
+
* (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
|
|
419
|
+
* tombstone-suppressed, sorted ascending and deduped.
|
|
420
|
+
*
|
|
421
|
+
* This is the expansion half of a compact lexical index. A BM25 index
|
|
422
|
+
* built over a scalar field's DISTINCT values returns one representative
|
|
423
|
+
* anchor per matched value; resolving that value back to *every* record
|
|
424
|
+
* carrying it is a scalar-index lookup, not a text-index concern. Keeping
|
|
425
|
+
* the split this way is what lets the text index stay small enough to
|
|
426
|
+
* load in a browser — indexing one document per record instead produced a
|
|
427
|
+
* 406 MB object for ~1,700 distinct strings.
|
|
428
|
+
*
|
|
429
|
+
* `op` is one of `==`, `!=`, `<`, `<=`, `>`, `>=`. `value` may be a
|
|
430
|
+
* string, number, or boolean; strings match both `String` and
|
|
431
|
+
* `Categorical` scalar fields.
|
|
432
|
+
* @param {string} field
|
|
433
|
+
* @param {string} op
|
|
434
|
+
* @param {any} value
|
|
435
|
+
* @returns {Promise<Array<any>>}
|
|
436
|
+
*/
|
|
437
|
+
queryScalar(field, op, value) {
|
|
438
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
439
|
+
const len0 = WASM_VECTOR_LEN;
|
|
440
|
+
const ptr1 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
441
|
+
const len1 = WASM_VECTOR_LEN;
|
|
442
|
+
const ret = wasm.space_queryScalar(this.__wbg_ptr, ptr0, len0, ptr1, len1, value);
|
|
443
|
+
return ret;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Lexical BM25 text search over a text `field` (spec/0015 §3.6).
|
|
447
|
+
*
|
|
448
|
+
* Tokenizes `query` with the built-in `dreamdb.utf8-words` tokenizer
|
|
449
|
+
* (lowercase + split on non-alphanumeric — pure Rust, compiled into the
|
|
450
|
+
* wasm; no external model needed even though the field's embeddings were
|
|
451
|
+
* produced elsewhere), scores docs with BM25, and suppresses tombstoned
|
|
452
|
+
* anchors. Returns `[{ anchor, score }]` sorted by score descending — the
|
|
453
|
+
* same scored shape as `queryVector`.
|
|
454
|
+
*
|
|
455
|
+
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_text`.
|
|
456
|
+
* @param {string} field
|
|
457
|
+
* @param {string} query
|
|
458
|
+
* @param {number} top_k
|
|
459
|
+
* @returns {Promise<Array<any>>}
|
|
460
|
+
*/
|
|
461
|
+
queryText(field, query, top_k) {
|
|
462
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
463
|
+
const len0 = WASM_VECTOR_LEN;
|
|
464
|
+
const ptr1 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
465
|
+
const len1 = WASM_VECTOR_LEN;
|
|
466
|
+
const ret = wasm.space_queryText(this.__wbg_ptr, ptr0, len0, ptr1, len1, top_k);
|
|
467
|
+
return ret;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Top-K cosine vector search over an embedding `field`. `opts` may be a
|
|
471
|
+
* number (topK) or `{ topK?, probeCount? }`. Returns `[{ anchor, score }]`
|
|
472
|
+
* sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
|
|
473
|
+
*
|
|
474
|
+
* Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
|
|
475
|
+
* two-pass rerank + HotShard merge + tombstone suppression.
|
|
476
|
+
* @param {string} field
|
|
477
|
+
* @param {Float32Array} query
|
|
478
|
+
* @param {any} opts
|
|
479
|
+
* @returns {Promise<Array<any>>}
|
|
480
|
+
*/
|
|
481
|
+
queryVector(field, query, opts) {
|
|
482
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
483
|
+
const len0 = WASM_VECTOR_LEN;
|
|
484
|
+
const ptr1 = passArrayF32ToWasm0(query, wasm.__wbindgen_malloc);
|
|
485
|
+
const len1 = WASM_VECTOR_LEN;
|
|
486
|
+
const ret = wasm.space_queryVector(this.__wbg_ptr, ptr0, len0, ptr1, len1, opts);
|
|
487
|
+
return ret;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
491
|
+
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
492
|
+
* de-dupe) their bucket and roaring-decode the anchor set.
|
|
493
|
+
* @param {any} track
|
|
494
|
+
* @param {any} _opts
|
|
495
|
+
* @returns {Promise<Map<any, any>>}
|
|
496
|
+
*/
|
|
497
|
+
readScalarColumn(track, _opts) {
|
|
498
|
+
const ret = wasm.space_readScalarColumn(this.__wbg_ptr, track, _opts);
|
|
499
|
+
return ret;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Fetch a track object and return its `object_index` (array of CBOR
|
|
503
|
+
* entries). Inline indexes only — paged indexes are not resolved (matching
|
|
504
|
+
* dreamdb-ts, which also doesn't support them on this path).
|
|
505
|
+
* @param {any} track
|
|
506
|
+
* @returns {Promise<Array<any>>}
|
|
507
|
+
*/
|
|
508
|
+
resolveObjectIndex(track) {
|
|
509
|
+
const ret = wasm.space_resolveObjectIndex(this.__wbg_ptr, track);
|
|
510
|
+
return ret;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Base32 hash of the manifest's first timeline.
|
|
514
|
+
* @returns {string}
|
|
515
|
+
*/
|
|
516
|
+
timelineId() {
|
|
517
|
+
let deferred2_0;
|
|
518
|
+
let deferred2_1;
|
|
519
|
+
try {
|
|
520
|
+
const ret = wasm.space_timelineId(this.__wbg_ptr);
|
|
521
|
+
var ptr1 = ret[0];
|
|
522
|
+
var len1 = ret[1];
|
|
523
|
+
if (ret[3]) {
|
|
524
|
+
ptr1 = 0; len1 = 0;
|
|
525
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
526
|
+
}
|
|
527
|
+
deferred2_0 = ptr1;
|
|
528
|
+
deferred2_1 = len1;
|
|
529
|
+
return getStringFromWasm0(ptr1, len1);
|
|
530
|
+
} finally {
|
|
531
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Find a track by its resolved `key` or by `modality`.
|
|
536
|
+
* @param {string} key_or_modality
|
|
537
|
+
* @returns {any}
|
|
538
|
+
*/
|
|
539
|
+
trackFor(key_or_modality) {
|
|
540
|
+
const ptr0 = passStringToWasm0(key_or_modality, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
541
|
+
const len0 = WASM_VECTOR_LEN;
|
|
542
|
+
const ret = wasm.space_trackFor(this.__wbg_ptr, ptr0, len0);
|
|
543
|
+
return ret;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* List resolved tracks from this manifest.
|
|
547
|
+
* @returns {Array<any>}
|
|
548
|
+
*/
|
|
549
|
+
tracks() {
|
|
550
|
+
const ret = wasm.space_tracks(this.__wbg_ptr);
|
|
551
|
+
return ret;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (Symbol.dispose) Space.prototype[Symbol.dispose] = Space.prototype.free;
|
|
555
|
+
exports.Space = Space;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* A write handle onto a ref.
|
|
559
|
+
*/
|
|
560
|
+
class Writer {
|
|
561
|
+
static __wrap(ptr) {
|
|
562
|
+
const obj = Object.create(Writer.prototype);
|
|
563
|
+
obj.__wbg_ptr = ptr;
|
|
564
|
+
WriterFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
565
|
+
return obj;
|
|
566
|
+
}
|
|
567
|
+
__destroy_into_raw() {
|
|
568
|
+
const ptr = this.__wbg_ptr;
|
|
569
|
+
this.__wbg_ptr = 0;
|
|
570
|
+
WriterFinalization.unregister(this);
|
|
571
|
+
return ptr;
|
|
572
|
+
}
|
|
573
|
+
free() {
|
|
574
|
+
const ptr = this.__destroy_into_raw();
|
|
575
|
+
wasm.__wbg_writer_free(ptr, 0);
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Append records and commit in one call.
|
|
579
|
+
*
|
|
580
|
+
* `samples` is an array of `{ anchor?: bigint|number, <field>: value }`.
|
|
581
|
+
* See `marshal::samples_from_js` for the accepted field shapes.
|
|
582
|
+
*
|
|
583
|
+
* Committing here rather than exposing a separate staged mode is
|
|
584
|
+
* deliberate for the browser surface: a staged write that is never
|
|
585
|
+
* committed leaves uploaded objects unreferenced, and a tab can close at
|
|
586
|
+
* any moment. `appendStaged` exists on the Node surface where the process
|
|
587
|
+
* lifetime is under the caller's control.
|
|
588
|
+
* @param {Array<any>} samples
|
|
589
|
+
* @returns {Promise<number>}
|
|
590
|
+
*/
|
|
591
|
+
appendMany(samples) {
|
|
592
|
+
const ret = wasm.writer_appendMany(this.__wbg_ptr, samples);
|
|
593
|
+
return ret;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Flush staged entries and publish a new manifest.
|
|
597
|
+
*
|
|
598
|
+
* Fails with a CAS conflict if the ref moved underneath this writer. That
|
|
599
|
+
* is not retried automatically: an automatic retry would hide a logical
|
|
600
|
+
* conflict, and the caller is the only one who knows whether re-applying
|
|
601
|
+
* its records on top of the new head is correct.
|
|
602
|
+
* @returns {Promise<string>}
|
|
603
|
+
*/
|
|
604
|
+
commit() {
|
|
605
|
+
const ret = wasm.writer_commit(this.__wbg_ptr);
|
|
606
|
+
return ret;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Tombstone records by anchor. Returns the new manifest hash.
|
|
610
|
+
* @param {BigUint64Array} anchors
|
|
611
|
+
* @param {string | null} [reason]
|
|
612
|
+
* @returns {Promise<string>}
|
|
613
|
+
*/
|
|
614
|
+
deleteRecords(anchors, reason) {
|
|
615
|
+
const ptr0 = passArray64ToWasm0(anchors, wasm.__wbindgen_malloc);
|
|
616
|
+
const len0 = WASM_VECTOR_LEN;
|
|
617
|
+
var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
618
|
+
var len1 = WASM_VECTOR_LEN;
|
|
619
|
+
const ret = wasm.writer_deleteRecords(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
620
|
+
return ret;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Current manifest hash, base32.
|
|
624
|
+
* @returns {string}
|
|
625
|
+
*/
|
|
626
|
+
get manifestHash() {
|
|
627
|
+
let deferred2_0;
|
|
628
|
+
let deferred2_1;
|
|
629
|
+
try {
|
|
630
|
+
const ret = wasm.writer_manifestHash(this.__wbg_ptr);
|
|
631
|
+
var ptr1 = ret[0];
|
|
632
|
+
var len1 = ret[1];
|
|
633
|
+
if (ret[3]) {
|
|
634
|
+
ptr1 = 0; len1 = 0;
|
|
635
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
636
|
+
}
|
|
637
|
+
deferred2_0 = ptr1;
|
|
638
|
+
deferred2_1 = len1;
|
|
639
|
+
return getStringFromWasm0(ptr1, len1);
|
|
640
|
+
} finally {
|
|
641
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Open a ref for writing.
|
|
646
|
+
*
|
|
647
|
+
* `uri` is the same `.../refs/<name>` form `Space.fromUri` takes; a
|
|
648
|
+
* `.../manifests/<hash>` URI is rejected rather than silently opening
|
|
649
|
+
* something unwritable, because a manifest hash names an immutable
|
|
650
|
+
* snapshot — there is nothing for a commit to advance.
|
|
651
|
+
*
|
|
652
|
+
* `backend` must implement `put` (Backend contract v2). Passing a
|
|
653
|
+
* read-only backend fails at the first write with a clear message rather
|
|
654
|
+
* than here, since the connector cannot know what the JS object omits
|
|
655
|
+
* until it calls it.
|
|
656
|
+
* @param {string} uri
|
|
657
|
+
* @param {any} backend
|
|
658
|
+
* @returns {Promise<Writer>}
|
|
659
|
+
*/
|
|
660
|
+
static open(uri, backend) {
|
|
661
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
662
|
+
const len0 = WASM_VECTOR_LEN;
|
|
663
|
+
const ret = wasm.writer_open(ptr0, len0, backend);
|
|
664
|
+
return ret;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* The ref this writer advances.
|
|
668
|
+
* @returns {string}
|
|
669
|
+
*/
|
|
670
|
+
get refName() {
|
|
671
|
+
let deferred1_0;
|
|
672
|
+
let deferred1_1;
|
|
673
|
+
try {
|
|
674
|
+
const ret = wasm.writer_refName(this.__wbg_ptr);
|
|
675
|
+
deferred1_0 = ret[0];
|
|
676
|
+
deferred1_1 = ret[1];
|
|
677
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
678
|
+
} finally {
|
|
679
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
|
|
684
|
+
* @param {string} label
|
|
685
|
+
* @returns {Promise<string>}
|
|
686
|
+
*/
|
|
687
|
+
snapshot(label) {
|
|
688
|
+
const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
689
|
+
const len0 = WASM_VECTOR_LEN;
|
|
690
|
+
const ret = wasm.writer_snapshot(this.__wbg_ptr, ptr0, len0);
|
|
691
|
+
return ret;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (Symbol.dispose) Writer.prototype[Symbol.dispose] = Writer.prototype.free;
|
|
695
|
+
exports.Writer = Writer;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Install a panic hook that logs the panic message AND its `file:line:col`
|
|
699
|
+
* to the console before the wasm trap surfaces to JS.
|
|
700
|
+
*
|
|
701
|
+
* Without this, every Rust panic reaches JavaScript as a bare
|
|
702
|
+
* `RuntimeError: unreachable` with nothing but wasm frame offsets — and it is
|
|
703
|
+
* indistinguishable from an allocation failure, since Rust's alloc-error
|
|
704
|
+
* handler also aborts. That ambiguity cost real debugging time: a browser
|
|
705
|
+
* `unreachable` from exhausting wasm32's 32-bit address space on an oversized
|
|
706
|
+
* index was initially read as an integer-overflow panic.
|
|
707
|
+
*
|
|
708
|
+
* Zero new deps — uses the already-enabled `web-sys` `console` feature.
|
|
709
|
+
* Runs once at module init.
|
|
710
|
+
*/
|
|
711
|
+
function __wasm_init() {
|
|
712
|
+
wasm.__wasm_init();
|
|
713
|
+
}
|
|
714
|
+
exports.__wasm_init = __wasm_init;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Parse an object path and re-format it. Byte-identity of the result is the
|
|
718
|
+
* actual assertion: a parser that silently drops a component still "parses".
|
|
719
|
+
* @param {string} path
|
|
720
|
+
* @returns {string}
|
|
721
|
+
*/
|
|
722
|
+
function addressRoundTrip(path) {
|
|
723
|
+
let deferred3_0;
|
|
724
|
+
let deferred3_1;
|
|
725
|
+
try {
|
|
726
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
727
|
+
const len0 = WASM_VECTOR_LEN;
|
|
728
|
+
const ret = wasm.addressRoundTrip(ptr0, len0);
|
|
729
|
+
var ptr2 = ret[0];
|
|
730
|
+
var len2 = ret[1];
|
|
731
|
+
if (ret[3]) {
|
|
732
|
+
ptr2 = 0; len2 = 0;
|
|
733
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
734
|
+
}
|
|
735
|
+
deferred3_0 = ptr2;
|
|
736
|
+
deferred3_1 = len2;
|
|
737
|
+
return getStringFromWasm0(ptr2, len2);
|
|
738
|
+
} finally {
|
|
739
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
exports.addressRoundTrip = addressRoundTrip;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* The address variant name (`Genesis`, `Manifest`, `Ref`, …) for a path.
|
|
746
|
+
*
|
|
747
|
+
* Derived from the Debug representation rather than a hand-written match.
|
|
748
|
+
* `DreamDbAddress` has seventeen variants and gains one whenever the protocol
|
|
749
|
+
* does; a match arm per variant would be a second list to keep in sync, and
|
|
750
|
+
* the vectors only ever assert the name.
|
|
751
|
+
* @param {string} path
|
|
752
|
+
* @returns {string}
|
|
753
|
+
*/
|
|
754
|
+
function addressVariant(path) {
|
|
755
|
+
let deferred3_0;
|
|
756
|
+
let deferred3_1;
|
|
757
|
+
try {
|
|
758
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
759
|
+
const len0 = WASM_VECTOR_LEN;
|
|
760
|
+
const ret = wasm.addressVariant(ptr0, len0);
|
|
761
|
+
var ptr2 = ret[0];
|
|
762
|
+
var len2 = ret[1];
|
|
763
|
+
if (ret[3]) {
|
|
764
|
+
ptr2 = 0; len2 = 0;
|
|
765
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
766
|
+
}
|
|
767
|
+
deferred3_0 = ptr2;
|
|
768
|
+
deferred3_1 = len2;
|
|
769
|
+
return getStringFromWasm0(ptr2, len2);
|
|
770
|
+
} finally {
|
|
771
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
exports.addressVariant = addressVariant;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Encode arbitrary bytes as lowercase RFC-4648 base32 (no padding).
|
|
778
|
+
*
|
|
779
|
+
* Byte-identical to `dreamdb-ts`'s `bytesToBase32` (alphabet
|
|
780
|
+
* `abcdefghijklmnopqrstuvwxyz234567`) and to `dreamdb_core`'s multihash
|
|
781
|
+
* `to_base32`, which is how object addresses are spelled on disk.
|
|
782
|
+
* @param {Uint8Array} bytes
|
|
783
|
+
* @returns {string}
|
|
784
|
+
*/
|
|
785
|
+
function bytesToBase32(bytes) {
|
|
786
|
+
let deferred2_0;
|
|
787
|
+
let deferred2_1;
|
|
788
|
+
try {
|
|
789
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
790
|
+
const len0 = WASM_VECTOR_LEN;
|
|
791
|
+
const ret = wasm.bytesToBase32(ptr0, len0);
|
|
792
|
+
deferred2_0 = ret[0];
|
|
793
|
+
deferred2_1 = ret[1];
|
|
794
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
795
|
+
} finally {
|
|
796
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
exports.bytesToBase32 = bytesToBase32;
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Decode a single CBOR value from `bytes` into its JS representation.
|
|
803
|
+
* @param {Uint8Array} bytes
|
|
804
|
+
* @returns {any}
|
|
805
|
+
*/
|
|
806
|
+
function decodeCbor(bytes) {
|
|
807
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
808
|
+
const len0 = WASM_VECTOR_LEN;
|
|
809
|
+
const ret = wasm.decodeCbor(ptr0, len0);
|
|
810
|
+
if (ret[2]) {
|
|
811
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
812
|
+
}
|
|
813
|
+
return takeFromExternrefTable0(ret[0]);
|
|
814
|
+
}
|
|
815
|
+
exports.decodeCbor = decodeCbor;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Canonically encode a JS value as CBOR, returning the bytes.
|
|
819
|
+
*
|
|
820
|
+
* Canonical here means what spec/0002 §3.1 means: map keys sorted by their
|
|
821
|
+
* encoded bytes, shortest-form integers, no indefinite lengths. Two writers
|
|
822
|
+
* that disagree on this produce different content hashes for the same logical
|
|
823
|
+
* object, and every address derived from them diverges.
|
|
824
|
+
* @param {any} value
|
|
825
|
+
* @returns {Uint8Array}
|
|
826
|
+
*/
|
|
827
|
+
function encodeCbor(value) {
|
|
828
|
+
const ret = wasm.encodeCbor(value);
|
|
829
|
+
if (ret[3]) {
|
|
830
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
831
|
+
}
|
|
832
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
833
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
834
|
+
return v1;
|
|
835
|
+
}
|
|
836
|
+
exports.encodeCbor = encodeCbor;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Parse a modality tag into `{class, encoding, trackKind, objectKind, params,
|
|
840
|
+
* flags}`, or throw if it is invalid.
|
|
841
|
+
*
|
|
842
|
+
* `params` is a plain object of the `key=value` segments and `flags` an array
|
|
843
|
+
* of the bare ones (`bucketed`, `graph`). They are separate because the
|
|
844
|
+
* grammar treats them differently and merging them would make a flag
|
|
845
|
+
* indistinguishable from a parameter whose value happened to be empty.
|
|
846
|
+
* @param {string} tag
|
|
847
|
+
* @returns {any}
|
|
848
|
+
*/
|
|
849
|
+
function modalityParse(tag) {
|
|
850
|
+
const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
851
|
+
const len0 = WASM_VECTOR_LEN;
|
|
852
|
+
const ret = wasm.modalityParse(ptr0, len0);
|
|
853
|
+
if (ret[2]) {
|
|
854
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
855
|
+
}
|
|
856
|
+
return takeFromExternrefTable0(ret[0]);
|
|
857
|
+
}
|
|
858
|
+
exports.modalityParse = modalityParse;
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* BLAKE3-256 multihash of `bytes`, base32 (the form used in object paths).
|
|
862
|
+
* @param {Uint8Array} bytes
|
|
863
|
+
* @returns {string}
|
|
864
|
+
*/
|
|
865
|
+
function multihashBase32(bytes) {
|
|
866
|
+
let deferred2_0;
|
|
867
|
+
let deferred2_1;
|
|
868
|
+
try {
|
|
869
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
870
|
+
const len0 = WASM_VECTOR_LEN;
|
|
871
|
+
const ret = wasm.multihashBase32(ptr0, len0);
|
|
872
|
+
deferred2_0 = ret[0];
|
|
873
|
+
deferred2_1 = ret[1];
|
|
874
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
875
|
+
} finally {
|
|
876
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
exports.multihashBase32 = multihashBase32;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* BLAKE3-256 multihash of `bytes` as lowercase hex (33 bytes: tag + digest).
|
|
883
|
+
* @param {Uint8Array} bytes
|
|
884
|
+
* @returns {string}
|
|
885
|
+
*/
|
|
886
|
+
function multihashHex(bytes) {
|
|
887
|
+
let deferred2_0;
|
|
888
|
+
let deferred2_1;
|
|
889
|
+
try {
|
|
890
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
891
|
+
const len0 = WASM_VECTOR_LEN;
|
|
892
|
+
const ret = wasm.multihashHex(ptr0, len0);
|
|
893
|
+
deferred2_0 = ret[0];
|
|
894
|
+
deferred2_1 = ret[1];
|
|
895
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
896
|
+
} finally {
|
|
897
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
exports.multihashHex = multihashHex;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* DreamDB's half-open `[start, end)` → an HTTP `Range` header value.
|
|
904
|
+
*
|
|
905
|
+
* The off-by-one here is worth a vector of its own: HTTP ranges are
|
|
906
|
+
* *inclusive* of the end byte. Getting it wrong reads one byte too few from
|
|
907
|
+
* every object, which corrupts decode in ways that look like anything but an
|
|
908
|
+
* off-by-one.
|
|
909
|
+
* @param {bigint} start
|
|
910
|
+
* @param {bigint} end
|
|
911
|
+
* @returns {string}
|
|
912
|
+
*/
|
|
913
|
+
function rangeHeader(start, end) {
|
|
914
|
+
let deferred2_0;
|
|
915
|
+
let deferred2_1;
|
|
916
|
+
try {
|
|
917
|
+
const ret = wasm.rangeHeader(start, end);
|
|
918
|
+
var ptr1 = ret[0];
|
|
919
|
+
var len1 = ret[1];
|
|
920
|
+
if (ret[3]) {
|
|
921
|
+
ptr1 = 0; len1 = 0;
|
|
922
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
923
|
+
}
|
|
924
|
+
deferred2_0 = ptr1;
|
|
925
|
+
deferred2_1 = len1;
|
|
926
|
+
return getStringFromWasm0(ptr1, len1);
|
|
927
|
+
} finally {
|
|
928
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
exports.rangeHeader = rangeHeader;
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Round-trip a spatial key through its base-2 form, per spec/0002 §6.
|
|
935
|
+
*
|
|
936
|
+
* Returns the re-encoded string, so a caller can assert byte-identity rather
|
|
937
|
+
* than merely "it parsed".
|
|
938
|
+
* @param {string} bits
|
|
939
|
+
* @returns {string}
|
|
940
|
+
*/
|
|
941
|
+
function spatialKeyRoundTrip(bits) {
|
|
942
|
+
let deferred3_0;
|
|
943
|
+
let deferred3_1;
|
|
944
|
+
try {
|
|
945
|
+
const ptr0 = passStringToWasm0(bits, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
946
|
+
const len0 = WASM_VECTOR_LEN;
|
|
947
|
+
const ret = wasm.spatialKeyRoundTrip(ptr0, len0);
|
|
948
|
+
var ptr2 = ret[0];
|
|
949
|
+
var len2 = ret[1];
|
|
950
|
+
if (ret[3]) {
|
|
951
|
+
ptr2 = 0; len2 = 0;
|
|
952
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
953
|
+
}
|
|
954
|
+
deferred3_0 = ptr2;
|
|
955
|
+
deferred3_1 = len2;
|
|
956
|
+
return getStringFromWasm0(ptr2, len2);
|
|
957
|
+
} finally {
|
|
958
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
exports.spatialKeyRoundTrip = spatialKeyRoundTrip;
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* The 16-char hex address form → TimeAnchor. Throws on a malformed input
|
|
965
|
+
* (wrong length, uppercase) rather than coercing it.
|
|
966
|
+
* @param {string} s
|
|
967
|
+
* @returns {bigint}
|
|
968
|
+
*/
|
|
969
|
+
function timeAnchorFromHex(s) {
|
|
970
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
971
|
+
const len0 = WASM_VECTOR_LEN;
|
|
972
|
+
const ret = wasm.timeAnchorFromHex(ptr0, len0);
|
|
973
|
+
if (ret[2]) {
|
|
974
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
975
|
+
}
|
|
976
|
+
return BigInt.asUintN(64, ret[0]);
|
|
977
|
+
}
|
|
978
|
+
exports.timeAnchorFromHex = timeAnchorFromHex;
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* TimeAnchor → the 16-char hex used in addresses.
|
|
982
|
+
* @param {bigint} value
|
|
983
|
+
* @returns {string}
|
|
984
|
+
*/
|
|
985
|
+
function timeAnchorHex(value) {
|
|
986
|
+
let deferred1_0;
|
|
987
|
+
let deferred1_1;
|
|
988
|
+
try {
|
|
989
|
+
const ret = wasm.timeAnchorHex(value);
|
|
990
|
+
deferred1_0 = ret[0];
|
|
991
|
+
deferred1_1 = ret[1];
|
|
992
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
993
|
+
} finally {
|
|
994
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
exports.timeAnchorHex = timeAnchorHex;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Which time bucket an anchor falls in, given a duration like `"1s"`/`"60s"`.
|
|
1001
|
+
* @param {bigint} t_start
|
|
1002
|
+
* @param {string} duration
|
|
1003
|
+
* @returns {bigint}
|
|
1004
|
+
*/
|
|
1005
|
+
function timeBucket(t_start, duration) {
|
|
1006
|
+
const ptr0 = passStringToWasm0(duration, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1007
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1008
|
+
const ret = wasm.timeBucket(t_start, ptr0, len0);
|
|
1009
|
+
if (ret[2]) {
|
|
1010
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1011
|
+
}
|
|
1012
|
+
return BigInt.asUintN(64, ret[0]);
|
|
1013
|
+
}
|
|
1014
|
+
exports.timeBucket = timeBucket;
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Package version — useful for consumers to confirm which build is loaded.
|
|
1018
|
+
* @returns {string}
|
|
1019
|
+
*/
|
|
1020
|
+
function version() {
|
|
1021
|
+
let deferred1_0;
|
|
1022
|
+
let deferred1_1;
|
|
1023
|
+
try {
|
|
1024
|
+
const ret = wasm.version();
|
|
1025
|
+
deferred1_0 = ret[0];
|
|
1026
|
+
deferred1_1 = ret[1];
|
|
1027
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1028
|
+
} finally {
|
|
1029
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
exports.version = version;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* The all-zero spatial-key path segment used for non-spatial (fragment) object
|
|
1036
|
+
* addresses. Matches `dreamdb-ts`'s `ZERO_SPATIAL_KEY` constant exactly.
|
|
1037
|
+
* @returns {string}
|
|
1038
|
+
*/
|
|
1039
|
+
function zeroSpatialKey() {
|
|
1040
|
+
let deferred1_0;
|
|
1041
|
+
let deferred1_1;
|
|
1042
|
+
try {
|
|
1043
|
+
const ret = wasm.zeroSpatialKey();
|
|
1044
|
+
deferred1_0 = ret[0];
|
|
1045
|
+
deferred1_1 = ret[1];
|
|
1046
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1047
|
+
} finally {
|
|
1048
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
exports.zeroSpatialKey = zeroSpatialKey;
|
|
1052
|
+
function __wbg_get_imports() {
|
|
1053
|
+
const import0 = {
|
|
1054
|
+
__proto__: null,
|
|
1055
|
+
__wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
|
|
1056
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1057
|
+
return ret;
|
|
1058
|
+
},
|
|
1059
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
1060
|
+
const ret = String(arg1);
|
|
1061
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1062
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1063
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1064
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1065
|
+
},
|
|
1066
|
+
__wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83: function(arg0, arg1) {
|
|
1067
|
+
const v = arg1;
|
|
1068
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1069
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1070
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1071
|
+
},
|
|
1072
|
+
__wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
|
|
1073
|
+
const v = arg0;
|
|
1074
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1075
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1076
|
+
},
|
|
1077
|
+
__wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
|
|
1078
|
+
const ret = debugString(arg1);
|
|
1079
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1080
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1081
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1082
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1083
|
+
},
|
|
1084
|
+
__wbg___wbindgen_in_07056af4f902c445: function(arg0, arg1) {
|
|
1085
|
+
const ret = arg0 in arg1;
|
|
1086
|
+
return ret;
|
|
1087
|
+
},
|
|
1088
|
+
__wbg___wbindgen_is_bigint_aeae3893f30ed54e: function(arg0) {
|
|
1089
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1090
|
+
return ret;
|
|
1091
|
+
},
|
|
1092
|
+
__wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
|
|
1093
|
+
const ret = typeof(arg0) === 'function';
|
|
1094
|
+
return ret;
|
|
1095
|
+
},
|
|
1096
|
+
__wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
|
|
1097
|
+
const ret = arg0 === null;
|
|
1098
|
+
return ret;
|
|
1099
|
+
},
|
|
1100
|
+
__wbg___wbindgen_is_object_b4593df85baada48: function(arg0) {
|
|
1101
|
+
const val = arg0;
|
|
1102
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1103
|
+
return ret;
|
|
1104
|
+
},
|
|
1105
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
1106
|
+
const ret = arg0 === undefined;
|
|
1107
|
+
return ret;
|
|
1108
|
+
},
|
|
1109
|
+
__wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9: function(arg0, arg1) {
|
|
1110
|
+
const ret = arg0 === arg1;
|
|
1111
|
+
return ret;
|
|
1112
|
+
},
|
|
1113
|
+
__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c: function(arg0, arg1) {
|
|
1114
|
+
const ret = arg0 == arg1;
|
|
1115
|
+
return ret;
|
|
1116
|
+
},
|
|
1117
|
+
__wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
|
|
1118
|
+
const obj = arg1;
|
|
1119
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1120
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1121
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1122
|
+
},
|
|
1123
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
1124
|
+
const obj = arg1;
|
|
1125
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1126
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1127
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1128
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1129
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1130
|
+
},
|
|
1131
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
1132
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1133
|
+
},
|
|
1134
|
+
__wbg__wbg_cb_unref_3fa391f3fcdb55f8: function(arg0) {
|
|
1135
|
+
arg0._wbg_cb_unref();
|
|
1136
|
+
},
|
|
1137
|
+
__wbg_arrayBuffer_cb5d4748b5f3cad5: function() { return handleError(function (arg0) {
|
|
1138
|
+
const ret = arg0.arrayBuffer();
|
|
1139
|
+
return ret;
|
|
1140
|
+
}, arguments); },
|
|
1141
|
+
__wbg_authoring_new: function(arg0) {
|
|
1142
|
+
const ret = Authoring.__wrap(arg0);
|
|
1143
|
+
return ret;
|
|
1144
|
+
},
|
|
1145
|
+
__wbg_call_084ee3e860ee9f92: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1146
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
1147
|
+
return ret;
|
|
1148
|
+
}, arguments); },
|
|
1149
|
+
__wbg_call_13665d9f14390edc: function() { return handleError(function (arg0, arg1) {
|
|
1150
|
+
const ret = arg0.call(arg1);
|
|
1151
|
+
return ret;
|
|
1152
|
+
}, arguments); },
|
|
1153
|
+
__wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1154
|
+
const ret = arg0.call(arg1, arg2);
|
|
1155
|
+
return ret;
|
|
1156
|
+
}, arguments); },
|
|
1157
|
+
__wbg_done_54b8da57023b7ed2: function(arg0) {
|
|
1158
|
+
const ret = arg0.done;
|
|
1159
|
+
return ret;
|
|
1160
|
+
},
|
|
1161
|
+
__wbg_entries_564a7e8b1e54ede5: function(arg0) {
|
|
1162
|
+
const ret = Object.entries(arg0);
|
|
1163
|
+
return ret;
|
|
1164
|
+
},
|
|
1165
|
+
__wbg_error_f085d7e62279b703: function(arg0) {
|
|
1166
|
+
console.error(arg0);
|
|
1167
|
+
},
|
|
1168
|
+
__wbg_get_3e9a707ab7d352eb: function() { return handleError(function (arg0, arg1) {
|
|
1169
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1170
|
+
return ret;
|
|
1171
|
+
}, arguments); },
|
|
1172
|
+
__wbg_get_98fdf51d029a75eb: function(arg0, arg1) {
|
|
1173
|
+
const ret = arg0[arg1 >>> 0];
|
|
1174
|
+
return ret;
|
|
1175
|
+
},
|
|
1176
|
+
__wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
|
|
1177
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1178
|
+
return ret;
|
|
1179
|
+
}, arguments); },
|
|
1180
|
+
__wbg_get_unchecked_1dfe6d05ad91d9b7: function(arg0, arg1) {
|
|
1181
|
+
const ret = arg0[arg1 >>> 0];
|
|
1182
|
+
return ret;
|
|
1183
|
+
},
|
|
1184
|
+
__wbg_headers_4cfb0c75793d7a8d: function(arg0) {
|
|
1185
|
+
const ret = arg0.headers;
|
|
1186
|
+
return ret;
|
|
1187
|
+
},
|
|
1188
|
+
__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe: function(arg0) {
|
|
1189
|
+
let result;
|
|
1190
|
+
try {
|
|
1191
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1192
|
+
} catch (_) {
|
|
1193
|
+
result = false;
|
|
1194
|
+
}
|
|
1195
|
+
const ret = result;
|
|
1196
|
+
return ret;
|
|
1197
|
+
},
|
|
1198
|
+
__wbg_instanceof_Float32Array_3cc6d04a6a12262f: function(arg0) {
|
|
1199
|
+
let result;
|
|
1200
|
+
try {
|
|
1201
|
+
result = arg0 instanceof Float32Array;
|
|
1202
|
+
} catch (_) {
|
|
1203
|
+
result = false;
|
|
1204
|
+
}
|
|
1205
|
+
const ret = result;
|
|
1206
|
+
return ret;
|
|
1207
|
+
},
|
|
1208
|
+
__wbg_instanceof_Map_16f217b9a2a08d8c: function(arg0) {
|
|
1209
|
+
let result;
|
|
1210
|
+
try {
|
|
1211
|
+
result = arg0 instanceof Map;
|
|
1212
|
+
} catch (_) {
|
|
1213
|
+
result = false;
|
|
1214
|
+
}
|
|
1215
|
+
const ret = result;
|
|
1216
|
+
return ret;
|
|
1217
|
+
},
|
|
1218
|
+
__wbg_instanceof_Object_03924e0dbda74bd8: function(arg0) {
|
|
1219
|
+
let result;
|
|
1220
|
+
try {
|
|
1221
|
+
result = arg0 instanceof Object;
|
|
1222
|
+
} catch (_) {
|
|
1223
|
+
result = false;
|
|
1224
|
+
}
|
|
1225
|
+
const ret = result;
|
|
1226
|
+
return ret;
|
|
1227
|
+
},
|
|
1228
|
+
__wbg_instanceof_Promise_09012cfa9708520a: function(arg0) {
|
|
1229
|
+
let result;
|
|
1230
|
+
try {
|
|
1231
|
+
result = arg0 instanceof Promise;
|
|
1232
|
+
} catch (_) {
|
|
1233
|
+
result = false;
|
|
1234
|
+
}
|
|
1235
|
+
const ret = result;
|
|
1236
|
+
return ret;
|
|
1237
|
+
},
|
|
1238
|
+
__wbg_instanceof_Response_ecfc823e8fb354e2: function(arg0) {
|
|
1239
|
+
let result;
|
|
1240
|
+
try {
|
|
1241
|
+
result = arg0 instanceof Response;
|
|
1242
|
+
} catch (_) {
|
|
1243
|
+
result = false;
|
|
1244
|
+
}
|
|
1245
|
+
const ret = result;
|
|
1246
|
+
return ret;
|
|
1247
|
+
},
|
|
1248
|
+
__wbg_instanceof_Uint8Array_abd07d4bd221d50b: function(arg0) {
|
|
1249
|
+
let result;
|
|
1250
|
+
try {
|
|
1251
|
+
result = arg0 instanceof Uint8Array;
|
|
1252
|
+
} catch (_) {
|
|
1253
|
+
result = false;
|
|
1254
|
+
}
|
|
1255
|
+
const ret = result;
|
|
1256
|
+
return ret;
|
|
1257
|
+
},
|
|
1258
|
+
__wbg_isArray_94898ed3aad6947b: function(arg0) {
|
|
1259
|
+
const ret = Array.isArray(arg0);
|
|
1260
|
+
return ret;
|
|
1261
|
+
},
|
|
1262
|
+
__wbg_isSafeInteger_01e964d144ad3a55: function(arg0) {
|
|
1263
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1264
|
+
return ret;
|
|
1265
|
+
},
|
|
1266
|
+
__wbg_iterator_1441b47f341dc34f: function() {
|
|
1267
|
+
const ret = Symbol.iterator;
|
|
1268
|
+
return ret;
|
|
1269
|
+
},
|
|
1270
|
+
__wbg_length_13e61aa81636ec86: function(arg0) {
|
|
1271
|
+
const ret = arg0.length;
|
|
1272
|
+
return ret;
|
|
1273
|
+
},
|
|
1274
|
+
__wbg_length_2591a0f4f659a55c: function(arg0) {
|
|
1275
|
+
const ret = arg0.length;
|
|
1276
|
+
return ret;
|
|
1277
|
+
},
|
|
1278
|
+
__wbg_length_56fcd3e2b7e0299d: function(arg0) {
|
|
1279
|
+
const ret = arg0.length;
|
|
1280
|
+
return ret;
|
|
1281
|
+
},
|
|
1282
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
1283
|
+
const ret = new Object();
|
|
1284
|
+
return ret;
|
|
1285
|
+
},
|
|
1286
|
+
__wbg_new_070df68d66325372: function() {
|
|
1287
|
+
const ret = new Map();
|
|
1288
|
+
return ret;
|
|
1289
|
+
},
|
|
1290
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
1291
|
+
const ret = new Array();
|
|
1292
|
+
return ret;
|
|
1293
|
+
},
|
|
1294
|
+
__wbg_new_7ddec6de44ff8f5d: function(arg0) {
|
|
1295
|
+
const ret = new Uint8Array(arg0);
|
|
1296
|
+
return ret;
|
|
1297
|
+
},
|
|
1298
|
+
__wbg_new_from_slice_269e35316ed2d061: function(arg0, arg1) {
|
|
1299
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1300
|
+
return ret;
|
|
1301
|
+
},
|
|
1302
|
+
__wbg_new_typed_c072c4ce9a2a0cdf: function(arg0, arg1) {
|
|
1303
|
+
try {
|
|
1304
|
+
var state0 = {a: arg0, b: arg1};
|
|
1305
|
+
var cb0 = (arg0, arg1) => {
|
|
1306
|
+
const a = state0.a;
|
|
1307
|
+
state0.a = 0;
|
|
1308
|
+
try {
|
|
1309
|
+
return wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1310
|
+
} finally {
|
|
1311
|
+
state0.a = a;
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
const ret = new Promise(cb0);
|
|
1315
|
+
return ret;
|
|
1316
|
+
} finally {
|
|
1317
|
+
state0.a = 0;
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
__wbg_new_with_str_and_init_ffe9977c986ea039: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1321
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
1322
|
+
return ret;
|
|
1323
|
+
}, arguments); },
|
|
1324
|
+
__wbg_next_2a4e19f4f5083b0f: function(arg0) {
|
|
1325
|
+
const ret = arg0.next;
|
|
1326
|
+
return ret;
|
|
1327
|
+
},
|
|
1328
|
+
__wbg_next_6429a146bf756f93: function() { return handleError(function (arg0) {
|
|
1329
|
+
const ret = arg0.next();
|
|
1330
|
+
return ret;
|
|
1331
|
+
}, arguments); },
|
|
1332
|
+
__wbg_now_81363d44c96dd239: function() {
|
|
1333
|
+
const ret = Date.now();
|
|
1334
|
+
return ret;
|
|
1335
|
+
},
|
|
1336
|
+
__wbg_ok_556a55299dd238ba: function(arg0) {
|
|
1337
|
+
const ret = arg0.ok;
|
|
1338
|
+
return ret;
|
|
1339
|
+
},
|
|
1340
|
+
__wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
|
|
1341
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1342
|
+
},
|
|
1343
|
+
__wbg_prototypesetcall_fe9d129a614489fa: function(arg0, arg1, arg2) {
|
|
1344
|
+
Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
|
|
1345
|
+
},
|
|
1346
|
+
__wbg_push_b77c476b01548d0a: function(arg0, arg1) {
|
|
1347
|
+
const ret = arg0.push(arg1);
|
|
1348
|
+
return ret;
|
|
1349
|
+
},
|
|
1350
|
+
__wbg_queueMicrotask_78d584b53af520f5: function(arg0) {
|
|
1351
|
+
const ret = arg0.queueMicrotask;
|
|
1352
|
+
return ret;
|
|
1353
|
+
},
|
|
1354
|
+
__wbg_queueMicrotask_b39ea83c7f01971a: function(arg0) {
|
|
1355
|
+
queueMicrotask(arg0);
|
|
1356
|
+
},
|
|
1357
|
+
__wbg_resolve_d17db9352f5a220e: function(arg0) {
|
|
1358
|
+
const ret = Promise.resolve(arg0);
|
|
1359
|
+
return ret;
|
|
1360
|
+
},
|
|
1361
|
+
__wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1362
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1363
|
+
return ret;
|
|
1364
|
+
}, arguments); },
|
|
1365
|
+
__wbg_set_d57e5106f0271787: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1366
|
+
arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1367
|
+
}, arguments); },
|
|
1368
|
+
__wbg_set_facb7a5914e0fa39: function(arg0, arg1, arg2) {
|
|
1369
|
+
const ret = arg0.set(arg1, arg2);
|
|
1370
|
+
return ret;
|
|
1371
|
+
},
|
|
1372
|
+
__wbg_space_new: function(arg0) {
|
|
1373
|
+
const ret = Space.__wrap(arg0);
|
|
1374
|
+
return ret;
|
|
1375
|
+
},
|
|
1376
|
+
__wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
|
|
1377
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1378
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1379
|
+
},
|
|
1380
|
+
__wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
|
|
1381
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1382
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1383
|
+
},
|
|
1384
|
+
__wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
|
|
1385
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1386
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1387
|
+
},
|
|
1388
|
+
__wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
|
|
1389
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1390
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1391
|
+
},
|
|
1392
|
+
__wbg_status_0853c9f5752c7ee2: function(arg0) {
|
|
1393
|
+
const ret = arg0.status;
|
|
1394
|
+
return ret;
|
|
1395
|
+
},
|
|
1396
|
+
__wbg_then_837494e384b37459: function(arg0, arg1) {
|
|
1397
|
+
const ret = arg0.then(arg1);
|
|
1398
|
+
return ret;
|
|
1399
|
+
},
|
|
1400
|
+
__wbg_then_bd927500e8905df2: function(arg0, arg1, arg2) {
|
|
1401
|
+
const ret = arg0.then(arg1, arg2);
|
|
1402
|
+
return ret;
|
|
1403
|
+
},
|
|
1404
|
+
__wbg_value_9cc0518af87a489c: function(arg0) {
|
|
1405
|
+
const ret = arg0.value;
|
|
1406
|
+
return ret;
|
|
1407
|
+
},
|
|
1408
|
+
__wbg_writer_new: function(arg0) {
|
|
1409
|
+
const ret = Writer.__wrap(arg0);
|
|
1410
|
+
return ret;
|
|
1411
|
+
},
|
|
1412
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1413
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 579, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1414
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___wasm_bindgen_f7c54996eb9137d9___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_f7c54996eb9137d9___JsError___true_);
|
|
1415
|
+
return ret;
|
|
1416
|
+
},
|
|
1417
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
1418
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1419
|
+
const ret = arg0;
|
|
1420
|
+
return ret;
|
|
1421
|
+
},
|
|
1422
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1423
|
+
// Cast intrinsic for `I128 -> Externref`.
|
|
1424
|
+
const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
|
|
1425
|
+
return ret;
|
|
1426
|
+
},
|
|
1427
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
1428
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1429
|
+
const ret = arg0;
|
|
1430
|
+
return ret;
|
|
1431
|
+
},
|
|
1432
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1433
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1434
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1435
|
+
return ret;
|
|
1436
|
+
},
|
|
1437
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
1438
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1439
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1440
|
+
return ret;
|
|
1441
|
+
},
|
|
1442
|
+
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
1443
|
+
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
1444
|
+
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
1445
|
+
// Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
|
|
1446
|
+
const ret = v0;
|
|
1447
|
+
return ret;
|
|
1448
|
+
},
|
|
1449
|
+
__wbindgen_init_externref_table: function() {
|
|
1450
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1451
|
+
const offset = table.grow(4);
|
|
1452
|
+
table.set(0, undefined);
|
|
1453
|
+
table.set(offset + 0, undefined);
|
|
1454
|
+
table.set(offset + 1, null);
|
|
1455
|
+
table.set(offset + 2, true);
|
|
1456
|
+
table.set(offset + 3, false);
|
|
1457
|
+
},
|
|
1458
|
+
};
|
|
1459
|
+
return {
|
|
1460
|
+
__proto__: null,
|
|
1461
|
+
"./dreamdb_bg.js": import0,
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
function wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___wasm_bindgen_f7c54996eb9137d9___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_f7c54996eb9137d9___JsError___true_(arg0, arg1, arg2) {
|
|
1466
|
+
const ret = wasm.wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___wasm_bindgen_f7c54996eb9137d9___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_f7c54996eb9137d9___JsError___true_(arg0, arg1, arg2);
|
|
1467
|
+
if (ret[1]) {
|
|
1468
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
function wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
1473
|
+
wasm.wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
const AuthoringFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1477
|
+
? { register: () => {}, unregister: () => {} }
|
|
1478
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_authoring_free(ptr, 1));
|
|
1479
|
+
const S3BackendFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1480
|
+
? { register: () => {}, unregister: () => {} }
|
|
1481
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_s3backend_free(ptr, 1));
|
|
1482
|
+
const SpaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1483
|
+
? { register: () => {}, unregister: () => {} }
|
|
1484
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_space_free(ptr, 1));
|
|
1485
|
+
const WriterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1486
|
+
? { register: () => {}, unregister: () => {} }
|
|
1487
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_writer_free(ptr, 1));
|
|
1488
|
+
|
|
1489
|
+
function addToExternrefTable0(obj) {
|
|
1490
|
+
const idx = wasm.__externref_table_alloc();
|
|
1491
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1492
|
+
return idx;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1496
|
+
? { register: () => {}, unregister: () => {} }
|
|
1497
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
1498
|
+
|
|
1499
|
+
function debugString(val) {
|
|
1500
|
+
// primitive types
|
|
1501
|
+
const type = typeof val;
|
|
1502
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1503
|
+
return `${val}`;
|
|
1504
|
+
}
|
|
1505
|
+
if (type == 'string') {
|
|
1506
|
+
return `"${val}"`;
|
|
1507
|
+
}
|
|
1508
|
+
if (type == 'symbol') {
|
|
1509
|
+
const description = val.description;
|
|
1510
|
+
if (description == null) {
|
|
1511
|
+
return 'Symbol';
|
|
1512
|
+
} else {
|
|
1513
|
+
return `Symbol(${description})`;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
if (type == 'function') {
|
|
1517
|
+
const name = val.name;
|
|
1518
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1519
|
+
return `Function(${name})`;
|
|
1520
|
+
} else {
|
|
1521
|
+
return 'Function';
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
// objects
|
|
1525
|
+
if (Array.isArray(val)) {
|
|
1526
|
+
const length = val.length;
|
|
1527
|
+
let debug = '[';
|
|
1528
|
+
if (length > 0) {
|
|
1529
|
+
debug += debugString(val[0]);
|
|
1530
|
+
}
|
|
1531
|
+
for(let i = 1; i < length; i++) {
|
|
1532
|
+
debug += ', ' + debugString(val[i]);
|
|
1533
|
+
}
|
|
1534
|
+
debug += ']';
|
|
1535
|
+
return debug;
|
|
1536
|
+
}
|
|
1537
|
+
// Test for built-in
|
|
1538
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1539
|
+
let className;
|
|
1540
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1541
|
+
className = builtInMatches[1];
|
|
1542
|
+
} else {
|
|
1543
|
+
// Failed to match the standard '[object ClassName]'
|
|
1544
|
+
return toString.call(val);
|
|
1545
|
+
}
|
|
1546
|
+
if (className == 'Object') {
|
|
1547
|
+
// we're a user defined class or Object
|
|
1548
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1549
|
+
// easier than looping through ownProperties of `val`.
|
|
1550
|
+
try {
|
|
1551
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1552
|
+
} catch (_) {
|
|
1553
|
+
return 'Object';
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
// errors
|
|
1557
|
+
if (val instanceof Error) {
|
|
1558
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1559
|
+
}
|
|
1560
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1561
|
+
return className;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
1565
|
+
ptr = ptr >>> 0;
|
|
1566
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1570
|
+
ptr = ptr >>> 0;
|
|
1571
|
+
const mem = getDataViewMemory0();
|
|
1572
|
+
const result = [];
|
|
1573
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1574
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1575
|
+
}
|
|
1576
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
1577
|
+
return result;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1581
|
+
ptr = ptr >>> 0;
|
|
1582
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
1586
|
+
function getBigUint64ArrayMemory0() {
|
|
1587
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
1588
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
1589
|
+
}
|
|
1590
|
+
return cachedBigUint64ArrayMemory0;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
let cachedDataViewMemory0 = null;
|
|
1594
|
+
function getDataViewMemory0() {
|
|
1595
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1596
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1597
|
+
}
|
|
1598
|
+
return cachedDataViewMemory0;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
1602
|
+
function getFloat32ArrayMemory0() {
|
|
1603
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
1604
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
1605
|
+
}
|
|
1606
|
+
return cachedFloat32ArrayMemory0;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
function getStringFromWasm0(ptr, len) {
|
|
1610
|
+
return decodeText(ptr >>> 0, len);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1614
|
+
function getUint8ArrayMemory0() {
|
|
1615
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1616
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1617
|
+
}
|
|
1618
|
+
return cachedUint8ArrayMemory0;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
function handleError(f, args) {
|
|
1622
|
+
try {
|
|
1623
|
+
return f.apply(this, args);
|
|
1624
|
+
} catch (e) {
|
|
1625
|
+
const idx = addToExternrefTable0(e);
|
|
1626
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
function isLikeNone(x) {
|
|
1631
|
+
return x === undefined || x === null;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1635
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1636
|
+
const real = (...args) => {
|
|
1637
|
+
|
|
1638
|
+
// First up with a closure we increment the internal reference
|
|
1639
|
+
// count. This ensures that the Rust closure environment won't
|
|
1640
|
+
// be deallocated while we're invoking it.
|
|
1641
|
+
state.cnt++;
|
|
1642
|
+
const a = state.a;
|
|
1643
|
+
state.a = 0;
|
|
1644
|
+
try {
|
|
1645
|
+
return f(a, state.b, ...args);
|
|
1646
|
+
} finally {
|
|
1647
|
+
state.a = a;
|
|
1648
|
+
real._wbg_cb_unref();
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
real._wbg_cb_unref = () => {
|
|
1652
|
+
if (--state.cnt === 0) {
|
|
1653
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
1654
|
+
state.a = 0;
|
|
1655
|
+
CLOSURE_DTORS.unregister(state);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1659
|
+
return real;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
1663
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
1664
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
1665
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1666
|
+
return ptr;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1670
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1671
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1672
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1673
|
+
return ptr;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
function passArrayF32ToWasm0(arg, malloc) {
|
|
1677
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
1678
|
+
getFloat32ArrayMemory0().set(arg, ptr / 4);
|
|
1679
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1680
|
+
return ptr;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
1684
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
1685
|
+
for (let i = 0; i < array.length; i++) {
|
|
1686
|
+
const add = addToExternrefTable0(array[i]);
|
|
1687
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
1688
|
+
}
|
|
1689
|
+
WASM_VECTOR_LEN = array.length;
|
|
1690
|
+
return ptr;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1694
|
+
if (realloc === undefined) {
|
|
1695
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1696
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1697
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1698
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1699
|
+
return ptr;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
let len = arg.length;
|
|
1703
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1704
|
+
|
|
1705
|
+
const mem = getUint8ArrayMemory0();
|
|
1706
|
+
|
|
1707
|
+
let offset = 0;
|
|
1708
|
+
|
|
1709
|
+
for (; offset < len; offset++) {
|
|
1710
|
+
const code = arg.charCodeAt(offset);
|
|
1711
|
+
if (code > 0x7F) break;
|
|
1712
|
+
mem[ptr + offset] = code;
|
|
1713
|
+
}
|
|
1714
|
+
if (offset !== len) {
|
|
1715
|
+
if (offset !== 0) {
|
|
1716
|
+
arg = arg.slice(offset);
|
|
1717
|
+
}
|
|
1718
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1719
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1720
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1721
|
+
|
|
1722
|
+
offset += ret.written;
|
|
1723
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
WASM_VECTOR_LEN = offset;
|
|
1727
|
+
return ptr;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
function takeFromExternrefTable0(idx) {
|
|
1731
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1732
|
+
wasm.__externref_table_dealloc(idx);
|
|
1733
|
+
return value;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1737
|
+
cachedTextDecoder.decode();
|
|
1738
|
+
function decodeText(ptr, len) {
|
|
1739
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1743
|
+
|
|
1744
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1745
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1746
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1747
|
+
view.set(buf);
|
|
1748
|
+
return {
|
|
1749
|
+
read: arg.length,
|
|
1750
|
+
written: buf.length
|
|
1751
|
+
};
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
let WASM_VECTOR_LEN = 0;
|
|
1756
|
+
|
|
1757
|
+
const wasmPath = `${__dirname}/dreamdb_bg.wasm`;
|
|
1758
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1759
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1760
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
1761
|
+
let wasm = wasmInstance.exports;
|
|
1762
|
+
wasm.__wbindgen_start();
|