@dreamlake/dreamdb 0.3.0 → 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/browser/dreamdb.d.ts +326 -0
- package/browser/dreamdb.js +9 -0
- package/{dreamdb_bg.js → browser/dreamdb_bg.js} +612 -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.d.ts +0 -150
- package/dreamdb.js +0 -9
- package/dreamdb_bg.wasm +0 -0
- package/index.js +0 -6
|
@@ -163,6 +163,35 @@ export class Space {
|
|
|
163
163
|
const ret = wasm.space_queryHybrid(this.__wbg_ptr, ptr0, len0, opts);
|
|
164
164
|
return ret;
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Scalar-index lookup: every anchor whose `field` satisfies `op value`
|
|
168
|
+
* (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
|
|
169
|
+
* tombstone-suppressed, sorted ascending and deduped.
|
|
170
|
+
*
|
|
171
|
+
* This is the expansion half of a compact lexical index. A BM25 index
|
|
172
|
+
* built over a scalar field's DISTINCT values returns one representative
|
|
173
|
+
* anchor per matched value; resolving that value back to *every* record
|
|
174
|
+
* carrying it is a scalar-index lookup, not a text-index concern. Keeping
|
|
175
|
+
* the split this way is what lets the text index stay small enough to
|
|
176
|
+
* load in a browser — indexing one document per record instead produced a
|
|
177
|
+
* 406 MB object for ~1,700 distinct strings.
|
|
178
|
+
*
|
|
179
|
+
* `op` is one of `==`, `!=`, `<`, `<=`, `>`, `>=`. `value` may be a
|
|
180
|
+
* string, number, or boolean; strings match both `String` and
|
|
181
|
+
* `Categorical` scalar fields.
|
|
182
|
+
* @param {string} field
|
|
183
|
+
* @param {string} op
|
|
184
|
+
* @param {any} value
|
|
185
|
+
* @returns {Promise<Array<any>>}
|
|
186
|
+
*/
|
|
187
|
+
queryScalar(field, op, value) {
|
|
188
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
189
|
+
const len0 = WASM_VECTOR_LEN;
|
|
190
|
+
const ptr1 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
191
|
+
const len1 = WASM_VECTOR_LEN;
|
|
192
|
+
const ret = wasm.space_queryScalar(this.__wbg_ptr, ptr0, len0, ptr1, len1, value);
|
|
193
|
+
return ret;
|
|
194
|
+
}
|
|
166
195
|
/**
|
|
167
196
|
* Lexical BM25 text search over a text `field` (spec/0015 §3.6).
|
|
168
197
|
*
|
|
@@ -274,6 +303,221 @@ export class Space {
|
|
|
274
303
|
}
|
|
275
304
|
if (Symbol.dispose) Space.prototype[Symbol.dispose] = Space.prototype.free;
|
|
276
305
|
|
|
306
|
+
/**
|
|
307
|
+
* A write handle onto a ref.
|
|
308
|
+
*/
|
|
309
|
+
export class Writer {
|
|
310
|
+
static __wrap(ptr) {
|
|
311
|
+
const obj = Object.create(Writer.prototype);
|
|
312
|
+
obj.__wbg_ptr = ptr;
|
|
313
|
+
WriterFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
314
|
+
return obj;
|
|
315
|
+
}
|
|
316
|
+
__destroy_into_raw() {
|
|
317
|
+
const ptr = this.__wbg_ptr;
|
|
318
|
+
this.__wbg_ptr = 0;
|
|
319
|
+
WriterFinalization.unregister(this);
|
|
320
|
+
return ptr;
|
|
321
|
+
}
|
|
322
|
+
free() {
|
|
323
|
+
const ptr = this.__destroy_into_raw();
|
|
324
|
+
wasm.__wbg_writer_free(ptr, 0);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Append records and commit in one call.
|
|
328
|
+
*
|
|
329
|
+
* `samples` is an array of `{ anchor?: bigint|number, <field>: value }`.
|
|
330
|
+
* See `marshal::samples_from_js` for the accepted field shapes.
|
|
331
|
+
*
|
|
332
|
+
* Committing here rather than exposing a separate staged mode is
|
|
333
|
+
* deliberate for the browser surface: a staged write that is never
|
|
334
|
+
* committed leaves uploaded objects unreferenced, and a tab can close at
|
|
335
|
+
* any moment. `appendStaged` exists on the Node surface where the process
|
|
336
|
+
* lifetime is under the caller's control.
|
|
337
|
+
* @param {Array<any>} samples
|
|
338
|
+
* @returns {Promise<number>}
|
|
339
|
+
*/
|
|
340
|
+
appendMany(samples) {
|
|
341
|
+
const ret = wasm.writer_appendMany(this.__wbg_ptr, samples);
|
|
342
|
+
return ret;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Flush staged entries and publish a new manifest.
|
|
346
|
+
*
|
|
347
|
+
* Fails with a CAS conflict if the ref moved underneath this writer. That
|
|
348
|
+
* is not retried automatically: an automatic retry would hide a logical
|
|
349
|
+
* conflict, and the caller is the only one who knows whether re-applying
|
|
350
|
+
* its records on top of the new head is correct.
|
|
351
|
+
* @returns {Promise<string>}
|
|
352
|
+
*/
|
|
353
|
+
commit() {
|
|
354
|
+
const ret = wasm.writer_commit(this.__wbg_ptr);
|
|
355
|
+
return ret;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Tombstone records by anchor. Returns the new manifest hash.
|
|
359
|
+
* @param {BigUint64Array} anchors
|
|
360
|
+
* @param {string | null} [reason]
|
|
361
|
+
* @returns {Promise<string>}
|
|
362
|
+
*/
|
|
363
|
+
deleteRecords(anchors, reason) {
|
|
364
|
+
const ptr0 = passArray64ToWasm0(anchors, wasm.__wbindgen_malloc);
|
|
365
|
+
const len0 = WASM_VECTOR_LEN;
|
|
366
|
+
var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
367
|
+
var len1 = WASM_VECTOR_LEN;
|
|
368
|
+
const ret = wasm.writer_deleteRecords(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
369
|
+
return ret;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Current manifest hash, base32.
|
|
373
|
+
* @returns {string}
|
|
374
|
+
*/
|
|
375
|
+
get manifestHash() {
|
|
376
|
+
let deferred2_0;
|
|
377
|
+
let deferred2_1;
|
|
378
|
+
try {
|
|
379
|
+
const ret = wasm.writer_manifestHash(this.__wbg_ptr);
|
|
380
|
+
var ptr1 = ret[0];
|
|
381
|
+
var len1 = ret[1];
|
|
382
|
+
if (ret[3]) {
|
|
383
|
+
ptr1 = 0; len1 = 0;
|
|
384
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
385
|
+
}
|
|
386
|
+
deferred2_0 = ptr1;
|
|
387
|
+
deferred2_1 = len1;
|
|
388
|
+
return getStringFromWasm0(ptr1, len1);
|
|
389
|
+
} finally {
|
|
390
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Open a ref for writing.
|
|
395
|
+
*
|
|
396
|
+
* `uri` is the same `.../refs/<name>` form `Space.fromUri` takes; a
|
|
397
|
+
* `.../manifests/<hash>` URI is rejected rather than silently opening
|
|
398
|
+
* something unwritable, because a manifest hash names an immutable
|
|
399
|
+
* snapshot — there is nothing for a commit to advance.
|
|
400
|
+
*
|
|
401
|
+
* `backend` must implement `put` (Backend contract v2). Passing a
|
|
402
|
+
* read-only backend fails at the first write with a clear message rather
|
|
403
|
+
* than here, since the connector cannot know what the JS object omits
|
|
404
|
+
* until it calls it.
|
|
405
|
+
* @param {string} uri
|
|
406
|
+
* @param {any} backend
|
|
407
|
+
* @returns {Promise<Writer>}
|
|
408
|
+
*/
|
|
409
|
+
static open(uri, backend) {
|
|
410
|
+
const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
411
|
+
const len0 = WASM_VECTOR_LEN;
|
|
412
|
+
const ret = wasm.writer_open(ptr0, len0, backend);
|
|
413
|
+
return ret;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* The ref this writer advances.
|
|
417
|
+
* @returns {string}
|
|
418
|
+
*/
|
|
419
|
+
get refName() {
|
|
420
|
+
let deferred1_0;
|
|
421
|
+
let deferred1_1;
|
|
422
|
+
try {
|
|
423
|
+
const ret = wasm.writer_refName(this.__wbg_ptr);
|
|
424
|
+
deferred1_0 = ret[0];
|
|
425
|
+
deferred1_1 = ret[1];
|
|
426
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
427
|
+
} finally {
|
|
428
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
|
|
433
|
+
* @param {string} label
|
|
434
|
+
* @returns {Promise<string>}
|
|
435
|
+
*/
|
|
436
|
+
snapshot(label) {
|
|
437
|
+
const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
438
|
+
const len0 = WASM_VECTOR_LEN;
|
|
439
|
+
const ret = wasm.writer_snapshot(this.__wbg_ptr, ptr0, len0);
|
|
440
|
+
return ret;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (Symbol.dispose) Writer.prototype[Symbol.dispose] = Writer.prototype.free;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Install a panic hook that logs the panic message AND its `file:line:col`
|
|
447
|
+
* to the console before the wasm trap surfaces to JS.
|
|
448
|
+
*
|
|
449
|
+
* Without this, every Rust panic reaches JavaScript as a bare
|
|
450
|
+
* `RuntimeError: unreachable` with nothing but wasm frame offsets — and it is
|
|
451
|
+
* indistinguishable from an allocation failure, since Rust's alloc-error
|
|
452
|
+
* handler also aborts. That ambiguity cost real debugging time: a browser
|
|
453
|
+
* `unreachable` from exhausting wasm32's 32-bit address space on an oversized
|
|
454
|
+
* index was initially read as an integer-overflow panic.
|
|
455
|
+
*
|
|
456
|
+
* Zero new deps — uses the already-enabled `web-sys` `console` feature.
|
|
457
|
+
* Runs once at module init.
|
|
458
|
+
*/
|
|
459
|
+
export function __wasm_init() {
|
|
460
|
+
wasm.__wasm_init();
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Parse an object path and re-format it. Byte-identity of the result is the
|
|
465
|
+
* actual assertion: a parser that silently drops a component still "parses".
|
|
466
|
+
* @param {string} path
|
|
467
|
+
* @returns {string}
|
|
468
|
+
*/
|
|
469
|
+
export function addressRoundTrip(path) {
|
|
470
|
+
let deferred3_0;
|
|
471
|
+
let deferred3_1;
|
|
472
|
+
try {
|
|
473
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
474
|
+
const len0 = WASM_VECTOR_LEN;
|
|
475
|
+
const ret = wasm.addressRoundTrip(ptr0, len0);
|
|
476
|
+
var ptr2 = ret[0];
|
|
477
|
+
var len2 = ret[1];
|
|
478
|
+
if (ret[3]) {
|
|
479
|
+
ptr2 = 0; len2 = 0;
|
|
480
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
481
|
+
}
|
|
482
|
+
deferred3_0 = ptr2;
|
|
483
|
+
deferred3_1 = len2;
|
|
484
|
+
return getStringFromWasm0(ptr2, len2);
|
|
485
|
+
} finally {
|
|
486
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* The address variant name (`Genesis`, `Manifest`, `Ref`, …) for a path.
|
|
492
|
+
*
|
|
493
|
+
* Derived from the Debug representation rather than a hand-written match.
|
|
494
|
+
* `DreamDbAddress` has seventeen variants and gains one whenever the protocol
|
|
495
|
+
* does; a match arm per variant would be a second list to keep in sync, and
|
|
496
|
+
* the vectors only ever assert the name.
|
|
497
|
+
* @param {string} path
|
|
498
|
+
* @returns {string}
|
|
499
|
+
*/
|
|
500
|
+
export function addressVariant(path) {
|
|
501
|
+
let deferred3_0;
|
|
502
|
+
let deferred3_1;
|
|
503
|
+
try {
|
|
504
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
505
|
+
const len0 = WASM_VECTOR_LEN;
|
|
506
|
+
const ret = wasm.addressVariant(ptr0, len0);
|
|
507
|
+
var ptr2 = ret[0];
|
|
508
|
+
var len2 = ret[1];
|
|
509
|
+
if (ret[3]) {
|
|
510
|
+
ptr2 = 0; len2 = 0;
|
|
511
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
512
|
+
}
|
|
513
|
+
deferred3_0 = ptr2;
|
|
514
|
+
deferred3_1 = len2;
|
|
515
|
+
return getStringFromWasm0(ptr2, len2);
|
|
516
|
+
} finally {
|
|
517
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
277
521
|
/**
|
|
278
522
|
* Encode arbitrary bytes as lowercase RFC-4648 base32 (no padding).
|
|
279
523
|
*
|
|
@@ -313,6 +557,196 @@ export function decodeCbor(bytes) {
|
|
|
313
557
|
return takeFromExternrefTable0(ret[0]);
|
|
314
558
|
}
|
|
315
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Canonically encode a JS value as CBOR, returning the bytes.
|
|
562
|
+
*
|
|
563
|
+
* Canonical here means what spec/0002 §3.1 means: map keys sorted by their
|
|
564
|
+
* encoded bytes, shortest-form integers, no indefinite lengths. Two writers
|
|
565
|
+
* that disagree on this produce different content hashes for the same logical
|
|
566
|
+
* object, and every address derived from them diverges.
|
|
567
|
+
* @param {any} value
|
|
568
|
+
* @returns {Uint8Array}
|
|
569
|
+
*/
|
|
570
|
+
export function encodeCbor(value) {
|
|
571
|
+
const ret = wasm.encodeCbor(value);
|
|
572
|
+
if (ret[3]) {
|
|
573
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
574
|
+
}
|
|
575
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
576
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
577
|
+
return v1;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Parse a modality tag into `{class, encoding, trackKind, objectKind, params,
|
|
582
|
+
* flags}`, or throw if it is invalid.
|
|
583
|
+
*
|
|
584
|
+
* `params` is a plain object of the `key=value` segments and `flags` an array
|
|
585
|
+
* of the bare ones (`bucketed`, `graph`). They are separate because the
|
|
586
|
+
* grammar treats them differently and merging them would make a flag
|
|
587
|
+
* indistinguishable from a parameter whose value happened to be empty.
|
|
588
|
+
* @param {string} tag
|
|
589
|
+
* @returns {any}
|
|
590
|
+
*/
|
|
591
|
+
export function modalityParse(tag) {
|
|
592
|
+
const ptr0 = passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
593
|
+
const len0 = WASM_VECTOR_LEN;
|
|
594
|
+
const ret = wasm.modalityParse(ptr0, len0);
|
|
595
|
+
if (ret[2]) {
|
|
596
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
597
|
+
}
|
|
598
|
+
return takeFromExternrefTable0(ret[0]);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* BLAKE3-256 multihash of `bytes`, base32 (the form used in object paths).
|
|
603
|
+
* @param {Uint8Array} bytes
|
|
604
|
+
* @returns {string}
|
|
605
|
+
*/
|
|
606
|
+
export function multihashBase32(bytes) {
|
|
607
|
+
let deferred2_0;
|
|
608
|
+
let deferred2_1;
|
|
609
|
+
try {
|
|
610
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
611
|
+
const len0 = WASM_VECTOR_LEN;
|
|
612
|
+
const ret = wasm.multihashBase32(ptr0, len0);
|
|
613
|
+
deferred2_0 = ret[0];
|
|
614
|
+
deferred2_1 = ret[1];
|
|
615
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
616
|
+
} finally {
|
|
617
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* BLAKE3-256 multihash of `bytes` as lowercase hex (33 bytes: tag + digest).
|
|
623
|
+
* @param {Uint8Array} bytes
|
|
624
|
+
* @returns {string}
|
|
625
|
+
*/
|
|
626
|
+
export function multihashHex(bytes) {
|
|
627
|
+
let deferred2_0;
|
|
628
|
+
let deferred2_1;
|
|
629
|
+
try {
|
|
630
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
632
|
+
const ret = wasm.multihashHex(ptr0, len0);
|
|
633
|
+
deferred2_0 = ret[0];
|
|
634
|
+
deferred2_1 = ret[1];
|
|
635
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
636
|
+
} finally {
|
|
637
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* DreamDB's half-open `[start, end)` → an HTTP `Range` header value.
|
|
643
|
+
*
|
|
644
|
+
* The off-by-one here is worth a vector of its own: HTTP ranges are
|
|
645
|
+
* *inclusive* of the end byte. Getting it wrong reads one byte too few from
|
|
646
|
+
* every object, which corrupts decode in ways that look like anything but an
|
|
647
|
+
* off-by-one.
|
|
648
|
+
* @param {bigint} start
|
|
649
|
+
* @param {bigint} end
|
|
650
|
+
* @returns {string}
|
|
651
|
+
*/
|
|
652
|
+
export function rangeHeader(start, end) {
|
|
653
|
+
let deferred2_0;
|
|
654
|
+
let deferred2_1;
|
|
655
|
+
try {
|
|
656
|
+
const ret = wasm.rangeHeader(start, end);
|
|
657
|
+
var ptr1 = ret[0];
|
|
658
|
+
var len1 = ret[1];
|
|
659
|
+
if (ret[3]) {
|
|
660
|
+
ptr1 = 0; len1 = 0;
|
|
661
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
662
|
+
}
|
|
663
|
+
deferred2_0 = ptr1;
|
|
664
|
+
deferred2_1 = len1;
|
|
665
|
+
return getStringFromWasm0(ptr1, len1);
|
|
666
|
+
} finally {
|
|
667
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Round-trip a spatial key through its base-2 form, per spec/0002 §6.
|
|
673
|
+
*
|
|
674
|
+
* Returns the re-encoded string, so a caller can assert byte-identity rather
|
|
675
|
+
* than merely "it parsed".
|
|
676
|
+
* @param {string} bits
|
|
677
|
+
* @returns {string}
|
|
678
|
+
*/
|
|
679
|
+
export function spatialKeyRoundTrip(bits) {
|
|
680
|
+
let deferred3_0;
|
|
681
|
+
let deferred3_1;
|
|
682
|
+
try {
|
|
683
|
+
const ptr0 = passStringToWasm0(bits, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
684
|
+
const len0 = WASM_VECTOR_LEN;
|
|
685
|
+
const ret = wasm.spatialKeyRoundTrip(ptr0, len0);
|
|
686
|
+
var ptr2 = ret[0];
|
|
687
|
+
var len2 = ret[1];
|
|
688
|
+
if (ret[3]) {
|
|
689
|
+
ptr2 = 0; len2 = 0;
|
|
690
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
691
|
+
}
|
|
692
|
+
deferred3_0 = ptr2;
|
|
693
|
+
deferred3_1 = len2;
|
|
694
|
+
return getStringFromWasm0(ptr2, len2);
|
|
695
|
+
} finally {
|
|
696
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* The 16-char hex address form → TimeAnchor. Throws on a malformed input
|
|
702
|
+
* (wrong length, uppercase) rather than coercing it.
|
|
703
|
+
* @param {string} s
|
|
704
|
+
* @returns {bigint}
|
|
705
|
+
*/
|
|
706
|
+
export function timeAnchorFromHex(s) {
|
|
707
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
708
|
+
const len0 = WASM_VECTOR_LEN;
|
|
709
|
+
const ret = wasm.timeAnchorFromHex(ptr0, len0);
|
|
710
|
+
if (ret[2]) {
|
|
711
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
712
|
+
}
|
|
713
|
+
return BigInt.asUintN(64, ret[0]);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* TimeAnchor → the 16-char hex used in addresses.
|
|
718
|
+
* @param {bigint} value
|
|
719
|
+
* @returns {string}
|
|
720
|
+
*/
|
|
721
|
+
export function timeAnchorHex(value) {
|
|
722
|
+
let deferred1_0;
|
|
723
|
+
let deferred1_1;
|
|
724
|
+
try {
|
|
725
|
+
const ret = wasm.timeAnchorHex(value);
|
|
726
|
+
deferred1_0 = ret[0];
|
|
727
|
+
deferred1_1 = ret[1];
|
|
728
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
729
|
+
} finally {
|
|
730
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Which time bucket an anchor falls in, given a duration like `"1s"`/`"60s"`.
|
|
736
|
+
* @param {bigint} t_start
|
|
737
|
+
* @param {string} duration
|
|
738
|
+
* @returns {bigint}
|
|
739
|
+
*/
|
|
740
|
+
export function timeBucket(t_start, duration) {
|
|
741
|
+
const ptr0 = passStringToWasm0(duration, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
742
|
+
const len0 = WASM_VECTOR_LEN;
|
|
743
|
+
const ret = wasm.timeBucket(t_start, ptr0, len0);
|
|
744
|
+
if (ret[2]) {
|
|
745
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
746
|
+
}
|
|
747
|
+
return BigInt.asUintN(64, ret[0]);
|
|
748
|
+
}
|
|
749
|
+
|
|
316
750
|
/**
|
|
317
751
|
* Package version — useful for consumers to confirm which build is loaded.
|
|
318
752
|
* @returns {string}
|
|
@@ -351,6 +785,19 @@ export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
|
|
|
351
785
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
352
786
|
return ret;
|
|
353
787
|
}
|
|
788
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
789
|
+
const ret = String(arg1);
|
|
790
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
791
|
+
const len1 = WASM_VECTOR_LEN;
|
|
792
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
793
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
794
|
+
}
|
|
795
|
+
export function __wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83(arg0, arg1) {
|
|
796
|
+
const v = arg1;
|
|
797
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
798
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
799
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
800
|
+
}
|
|
354
801
|
export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
|
|
355
802
|
const v = arg0;
|
|
356
803
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
@@ -363,6 +810,14 @@ export function __wbg___wbindgen_debug_string_edece8177ad01481(arg0, arg1) {
|
|
|
363
810
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
364
811
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
365
812
|
}
|
|
813
|
+
export function __wbg___wbindgen_in_07056af4f902c445(arg0, arg1) {
|
|
814
|
+
const ret = arg0 in arg1;
|
|
815
|
+
return ret;
|
|
816
|
+
}
|
|
817
|
+
export function __wbg___wbindgen_is_bigint_aeae3893f30ed54e(arg0) {
|
|
818
|
+
const ret = typeof(arg0) === 'bigint';
|
|
819
|
+
return ret;
|
|
820
|
+
}
|
|
366
821
|
export function __wbg___wbindgen_is_function_5cd60d5cf78b4eef(arg0) {
|
|
367
822
|
const ret = typeof(arg0) === 'function';
|
|
368
823
|
return ret;
|
|
@@ -371,10 +826,23 @@ export function __wbg___wbindgen_is_null_2042690d351e14f0(arg0) {
|
|
|
371
826
|
const ret = arg0 === null;
|
|
372
827
|
return ret;
|
|
373
828
|
}
|
|
829
|
+
export function __wbg___wbindgen_is_object_b4593df85baada48(arg0) {
|
|
830
|
+
const val = arg0;
|
|
831
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
832
|
+
return ret;
|
|
833
|
+
}
|
|
374
834
|
export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
|
|
375
835
|
const ret = arg0 === undefined;
|
|
376
836
|
return ret;
|
|
377
837
|
}
|
|
838
|
+
export function __wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9(arg0, arg1) {
|
|
839
|
+
const ret = arg0 === arg1;
|
|
840
|
+
return ret;
|
|
841
|
+
}
|
|
842
|
+
export function __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c(arg0, arg1) {
|
|
843
|
+
const ret = arg0 == arg1;
|
|
844
|
+
return ret;
|
|
845
|
+
}
|
|
378
846
|
export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
|
|
379
847
|
const obj = arg1;
|
|
380
848
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -399,10 +867,37 @@ export function __wbg_arrayBuffer_cb5d4748b5f3cad5() { return handleError(functi
|
|
|
399
867
|
const ret = arg0.arrayBuffer();
|
|
400
868
|
return ret;
|
|
401
869
|
}, arguments); }
|
|
870
|
+
export function __wbg_call_084ee3e860ee9f92() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
871
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
872
|
+
return ret;
|
|
873
|
+
}, arguments); }
|
|
874
|
+
export function __wbg_call_13665d9f14390edc() { return handleError(function (arg0, arg1) {
|
|
875
|
+
const ret = arg0.call(arg1);
|
|
876
|
+
return ret;
|
|
877
|
+
}, arguments); }
|
|
402
878
|
export function __wbg_call_dfde26266607c996() { return handleError(function (arg0, arg1, arg2) {
|
|
403
879
|
const ret = arg0.call(arg1, arg2);
|
|
404
880
|
return ret;
|
|
405
881
|
}, arguments); }
|
|
882
|
+
export function __wbg_done_54b8da57023b7ed2(arg0) {
|
|
883
|
+
const ret = arg0.done;
|
|
884
|
+
return ret;
|
|
885
|
+
}
|
|
886
|
+
export function __wbg_entries_564a7e8b1e54ede5(arg0) {
|
|
887
|
+
const ret = Object.entries(arg0);
|
|
888
|
+
return ret;
|
|
889
|
+
}
|
|
890
|
+
export function __wbg_error_f085d7e62279b703(arg0) {
|
|
891
|
+
console.error(arg0);
|
|
892
|
+
}
|
|
893
|
+
export function __wbg_get_3e9a707ab7d352eb() { return handleError(function (arg0, arg1) {
|
|
894
|
+
const ret = Reflect.get(arg0, arg1);
|
|
895
|
+
return ret;
|
|
896
|
+
}, arguments); }
|
|
897
|
+
export function __wbg_get_98fdf51d029a75eb(arg0, arg1) {
|
|
898
|
+
const ret = arg0[arg1 >>> 0];
|
|
899
|
+
return ret;
|
|
900
|
+
}
|
|
406
901
|
export function __wbg_get_dcf82ab8aad1a593() { return handleError(function (arg0, arg1) {
|
|
407
902
|
const ret = Reflect.get(arg0, arg1);
|
|
408
903
|
return ret;
|
|
@@ -411,6 +906,50 @@ export function __wbg_get_unchecked_1dfe6d05ad91d9b7(arg0, arg1) {
|
|
|
411
906
|
const ret = arg0[arg1 >>> 0];
|
|
412
907
|
return ret;
|
|
413
908
|
}
|
|
909
|
+
export function __wbg_headers_4cfb0c75793d7a8d(arg0) {
|
|
910
|
+
const ret = arg0.headers;
|
|
911
|
+
return ret;
|
|
912
|
+
}
|
|
913
|
+
export function __wbg_instanceof_ArrayBuffer_53db37b06f6b9afe(arg0) {
|
|
914
|
+
let result;
|
|
915
|
+
try {
|
|
916
|
+
result = arg0 instanceof ArrayBuffer;
|
|
917
|
+
} catch (_) {
|
|
918
|
+
result = false;
|
|
919
|
+
}
|
|
920
|
+
const ret = result;
|
|
921
|
+
return ret;
|
|
922
|
+
}
|
|
923
|
+
export function __wbg_instanceof_Float32Array_3cc6d04a6a12262f(arg0) {
|
|
924
|
+
let result;
|
|
925
|
+
try {
|
|
926
|
+
result = arg0 instanceof Float32Array;
|
|
927
|
+
} catch (_) {
|
|
928
|
+
result = false;
|
|
929
|
+
}
|
|
930
|
+
const ret = result;
|
|
931
|
+
return ret;
|
|
932
|
+
}
|
|
933
|
+
export function __wbg_instanceof_Map_16f217b9a2a08d8c(arg0) {
|
|
934
|
+
let result;
|
|
935
|
+
try {
|
|
936
|
+
result = arg0 instanceof Map;
|
|
937
|
+
} catch (_) {
|
|
938
|
+
result = false;
|
|
939
|
+
}
|
|
940
|
+
const ret = result;
|
|
941
|
+
return ret;
|
|
942
|
+
}
|
|
943
|
+
export function __wbg_instanceof_Object_03924e0dbda74bd8(arg0) {
|
|
944
|
+
let result;
|
|
945
|
+
try {
|
|
946
|
+
result = arg0 instanceof Object;
|
|
947
|
+
} catch (_) {
|
|
948
|
+
result = false;
|
|
949
|
+
}
|
|
950
|
+
const ret = result;
|
|
951
|
+
return ret;
|
|
952
|
+
}
|
|
414
953
|
export function __wbg_instanceof_Promise_09012cfa9708520a(arg0) {
|
|
415
954
|
let result;
|
|
416
955
|
try {
|
|
@@ -445,6 +984,18 @@ export function __wbg_isArray_94898ed3aad6947b(arg0) {
|
|
|
445
984
|
const ret = Array.isArray(arg0);
|
|
446
985
|
return ret;
|
|
447
986
|
}
|
|
987
|
+
export function __wbg_isSafeInteger_01e964d144ad3a55(arg0) {
|
|
988
|
+
const ret = Number.isSafeInteger(arg0);
|
|
989
|
+
return ret;
|
|
990
|
+
}
|
|
991
|
+
export function __wbg_iterator_1441b47f341dc34f() {
|
|
992
|
+
const ret = Symbol.iterator;
|
|
993
|
+
return ret;
|
|
994
|
+
}
|
|
995
|
+
export function __wbg_length_13e61aa81636ec86(arg0) {
|
|
996
|
+
const ret = arg0.length;
|
|
997
|
+
return ret;
|
|
998
|
+
}
|
|
448
999
|
export function __wbg_length_2591a0f4f659a55c(arg0) {
|
|
449
1000
|
const ret = arg0.length;
|
|
450
1001
|
return ret;
|
|
@@ -495,6 +1046,18 @@ export function __wbg_new_with_str_and_init_ffe9977c986ea039() { return handleEr
|
|
|
495
1046
|
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
496
1047
|
return ret;
|
|
497
1048
|
}, arguments); }
|
|
1049
|
+
export function __wbg_next_2a4e19f4f5083b0f(arg0) {
|
|
1050
|
+
const ret = arg0.next;
|
|
1051
|
+
return ret;
|
|
1052
|
+
}
|
|
1053
|
+
export function __wbg_next_6429a146bf756f93() { return handleError(function (arg0) {
|
|
1054
|
+
const ret = arg0.next();
|
|
1055
|
+
return ret;
|
|
1056
|
+
}, arguments); }
|
|
1057
|
+
export function __wbg_now_81363d44c96dd239() {
|
|
1058
|
+
const ret = Date.now();
|
|
1059
|
+
return ret;
|
|
1060
|
+
}
|
|
498
1061
|
export function __wbg_ok_556a55299dd238ba(arg0) {
|
|
499
1062
|
const ret = arg0.ok;
|
|
500
1063
|
return ret;
|
|
@@ -502,6 +1065,9 @@ export function __wbg_ok_556a55299dd238ba(arg0) {
|
|
|
502
1065
|
export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
|
|
503
1066
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
504
1067
|
}
|
|
1068
|
+
export function __wbg_prototypesetcall_fe9d129a614489fa(arg0, arg1, arg2) {
|
|
1069
|
+
Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
|
|
1070
|
+
}
|
|
505
1071
|
export function __wbg_push_b77c476b01548d0a(arg0, arg1) {
|
|
506
1072
|
const ret = arg0.push(arg1);
|
|
507
1073
|
return ret;
|
|
@@ -521,6 +1087,9 @@ export function __wbg_set_a0e911be3da02782() { return handleError(function (arg0
|
|
|
521
1087
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
522
1088
|
return ret;
|
|
523
1089
|
}, arguments); }
|
|
1090
|
+
export function __wbg_set_d57e5106f0271787() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1091
|
+
arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1092
|
+
}, arguments); }
|
|
524
1093
|
export function __wbg_set_facb7a5914e0fa39(arg0, arg1, arg2) {
|
|
525
1094
|
const ret = arg0.set(arg1, arg2);
|
|
526
1095
|
return ret;
|
|
@@ -557,8 +1126,16 @@ export function __wbg_then_bd927500e8905df2(arg0, arg1, arg2) {
|
|
|
557
1126
|
const ret = arg0.then(arg1, arg2);
|
|
558
1127
|
return ret;
|
|
559
1128
|
}
|
|
1129
|
+
export function __wbg_value_9cc0518af87a489c(arg0) {
|
|
1130
|
+
const ret = arg0.value;
|
|
1131
|
+
return ret;
|
|
1132
|
+
}
|
|
1133
|
+
export function __wbg_writer_new(arg0) {
|
|
1134
|
+
const ret = Writer.__wrap(arg0);
|
|
1135
|
+
return ret;
|
|
1136
|
+
}
|
|
560
1137
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
561
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1138
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 488, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
562
1139
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___wasm_bindgen_f7c54996eb9137d9___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_f7c54996eb9137d9___JsError___true_);
|
|
563
1140
|
return ret;
|
|
564
1141
|
}
|
|
@@ -572,11 +1149,21 @@ export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
|
572
1149
|
const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
|
|
573
1150
|
return ret;
|
|
574
1151
|
}
|
|
575
|
-
export function __wbindgen_cast_0000000000000004(arg0
|
|
1152
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
1153
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1154
|
+
const ret = arg0;
|
|
1155
|
+
return ret;
|
|
1156
|
+
}
|
|
1157
|
+
export function __wbindgen_cast_0000000000000005(arg0, arg1) {
|
|
576
1158
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
577
1159
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
578
1160
|
return ret;
|
|
579
1161
|
}
|
|
1162
|
+
export function __wbindgen_cast_0000000000000006(arg0) {
|
|
1163
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1164
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1165
|
+
return ret;
|
|
1166
|
+
}
|
|
580
1167
|
export function __wbindgen_init_externref_table() {
|
|
581
1168
|
const table = wasm.__wbindgen_externrefs;
|
|
582
1169
|
const offset = table.grow(4);
|
|
@@ -603,6 +1190,9 @@ const S3BackendFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
603
1190
|
const SpaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
604
1191
|
? { register: () => {}, unregister: () => {} }
|
|
605
1192
|
: new FinalizationRegistry(ptr => wasm.__wbg_space_free(ptr, 1));
|
|
1193
|
+
const WriterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1194
|
+
? { register: () => {}, unregister: () => {} }
|
|
1195
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_writer_free(ptr, 1));
|
|
606
1196
|
|
|
607
1197
|
function addToExternrefTable0(obj) {
|
|
608
1198
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -679,11 +1269,24 @@ function debugString(val) {
|
|
|
679
1269
|
return className;
|
|
680
1270
|
}
|
|
681
1271
|
|
|
1272
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
1273
|
+
ptr = ptr >>> 0;
|
|
1274
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
682
1277
|
function getArrayU8FromWasm0(ptr, len) {
|
|
683
1278
|
ptr = ptr >>> 0;
|
|
684
1279
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
685
1280
|
}
|
|
686
1281
|
|
|
1282
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
1283
|
+
function getBigUint64ArrayMemory0() {
|
|
1284
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
1285
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
1286
|
+
}
|
|
1287
|
+
return cachedBigUint64ArrayMemory0;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
687
1290
|
let cachedDataViewMemory0 = null;
|
|
688
1291
|
function getDataViewMemory0() {
|
|
689
1292
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -753,6 +1356,13 @@ function makeMutClosure(arg0, arg1, f) {
|
|
|
753
1356
|
return real;
|
|
754
1357
|
}
|
|
755
1358
|
|
|
1359
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
1360
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
1361
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
1362
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1363
|
+
return ptr;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
756
1366
|
function passArray8ToWasm0(arg, malloc) {
|
|
757
1367
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
758
1368
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|