@automerge/sedimentree 0.9.0 → 0.10.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.
Files changed (37) hide show
  1. package/package.json +30 -3
  2. package/dist/cjs/node.cjs +0 -5
  3. package/dist/cjs/slim.cjs +0 -1
  4. package/dist/cjs/wasm-base64.cjs +0 -1
  5. package/dist/cjs/web-bindings.cjs +0 -1788
  6. package/dist/cjs/web.cjs +0 -1741
  7. package/dist/esm/bundler.js +0 -7
  8. package/dist/esm/node.js +0 -7
  9. package/dist/esm/slim.js +0 -2
  10. package/dist/esm/wasm-base64.js +0 -1
  11. package/dist/esm/web.js +0 -5
  12. package/dist/esm/workerd.js +0 -5
  13. package/dist/iife/index.js +0 -1723
  14. package/dist/index.d.ts +0 -522
  15. package/dist/sedimentree.wasm +0 -0
  16. package/dist/wasm_bindgen/bundler/sedimentree_wasm.d.ts +0 -522
  17. package/dist/wasm_bindgen/bundler/sedimentree_wasm.js +0 -9
  18. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.js +0 -1742
  19. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm +0 -0
  20. package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm.d.ts +0 -104
  21. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  22. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  23. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  24. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.cjs +0 -1762
  25. package/dist/wasm_bindgen/nodejs/sedimentree_wasm.d.ts +0 -522
  26. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm +0 -0
  27. package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm.d.ts +0 -104
  28. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  29. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  30. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
  31. package/dist/wasm_bindgen/web/sedimentree_wasm.d.ts +0 -651
  32. package/dist/wasm_bindgen/web/sedimentree_wasm.js +0 -1844
  33. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm +0 -0
  34. package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm.d.ts +0 -104
  35. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline0.js +0 -2
  36. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline1.js +0 -2
  37. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-8e1863d4f7634be2/inline2.js +0 -2
@@ -1,1762 +0,0 @@
1
- /* @ts-self-types="./sedimentree_wasm.d.ts" */
2
-
3
- /**
4
- * A Wasm wrapper around the [`BlobMeta`] type.
5
- */
6
- class BlobMeta {
7
- static __wrap(ptr) {
8
- ptr = ptr >>> 0;
9
- const obj = Object.create(BlobMeta.prototype);
10
- obj.__wbg_ptr = ptr;
11
- BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
12
- return obj;
13
- }
14
- __destroy_into_raw() {
15
- const ptr = this.__wbg_ptr;
16
- this.__wbg_ptr = 0;
17
- BlobMetaFinalization.unregister(this);
18
- return ptr;
19
- }
20
- free() {
21
- const ptr = this.__destroy_into_raw();
22
- wasm.__wbg_blobmeta_free(ptr, 0);
23
- }
24
- /**
25
- * Get the digest of the blob.
26
- * @returns {Digest}
27
- */
28
- digest() {
29
- const ret = wasm.blobmeta_digest(this.__wbg_ptr);
30
- return Digest.__wrap(ret);
31
- }
32
- /**
33
- * Create a `BlobMeta` from a digest and size.
34
- *
35
- * This is useful for deserialization when the original blob is not available.
36
- * Since this is manual, the caller must ensure the digest and size are correct.
37
- * @param {Digest} digest
38
- * @param {bigint} size_bytes
39
- * @returns {BlobMeta}
40
- */
41
- static fromDigestSize(digest, size_bytes) {
42
- _assertClass(digest, Digest);
43
- const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
44
- return BlobMeta.__wrap(ret);
45
- }
46
- /**
47
- * Create a new `BlobMeta` from the given blob contents.
48
- * @param {Uint8Array} blob
49
- */
50
- constructor(blob) {
51
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
52
- const len0 = WASM_VECTOR_LEN;
53
- const ret = wasm.blobmeta_new(ptr0, len0);
54
- this.__wbg_ptr = ret >>> 0;
55
- BlobMetaFinalization.register(this, this.__wbg_ptr, this);
56
- return this;
57
- }
58
- /**
59
- * Get the size of the blob in bytes.
60
- * @returns {bigint}
61
- */
62
- get sizeBytes() {
63
- const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
64
- return BigInt.asUintN(64, ret);
65
- }
66
- }
67
- if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
68
- exports.BlobMeta = BlobMeta;
69
-
70
- /**
71
- * A user-supplied opaque identifier for a loose commit.
72
- *
73
- * Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
74
- * computed by the system, `CommitId` is provided by the caller at construction
75
- * time. This is the identity used for DAG traversal, fragment boundaries,
76
- * and sync.
77
- */
78
- class CommitId {
79
- static __wrap(ptr) {
80
- ptr = ptr >>> 0;
81
- const obj = Object.create(CommitId.prototype);
82
- obj.__wbg_ptr = ptr;
83
- CommitIdFinalization.register(obj, obj.__wbg_ptr, obj);
84
- return obj;
85
- }
86
- __destroy_into_raw() {
87
- const ptr = this.__wbg_ptr;
88
- this.__wbg_ptr = 0;
89
- CommitIdFinalization.unregister(this);
90
- return ptr;
91
- }
92
- free() {
93
- const ptr = this.__destroy_into_raw();
94
- wasm.__wbg_commitid_free(ptr, 0);
95
- }
96
- /**
97
- * Upcasts; to the JS-import type for [`WasmCommitId`].
98
- * @returns {CommitId}
99
- */
100
- __wasm_refgen_toWasmCommitId() {
101
- const ret = wasm.commitid___wasm_refgen_toWasmCommitId(this.__wbg_ptr);
102
- return CommitId.__wrap(ret);
103
- }
104
- /**
105
- * Creates a new commit identifier from its Base58 string representation.
106
- *
107
- * # Errors
108
- *
109
- * Returns an error if the string cannot be decoded or is not 32 bytes.
110
- * @param {string} s
111
- * @returns {CommitId}
112
- */
113
- static fromBase58(s) {
114
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
115
- const len0 = WASM_VECTOR_LEN;
116
- const ret = wasm.commitid_fromBase58(ptr0, len0);
117
- if (ret[2]) {
118
- throw takeFromExternrefTable0(ret[1]);
119
- }
120
- return CommitId.__wrap(ret[0]);
121
- }
122
- /**
123
- * Creates a new commit identifier from its byte representation.
124
- *
125
- * # Errors
126
- *
127
- * Returns an error if the byte slice is not exactly 32 bytes.
128
- * @param {Uint8Array} bytes
129
- * @returns {CommitId}
130
- */
131
- static fromBytes(bytes) {
132
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
133
- const len0 = WASM_VECTOR_LEN;
134
- const ret = wasm.commitid_fromBytes(ptr0, len0);
135
- if (ret[2]) {
136
- throw takeFromExternrefTable0(ret[1]);
137
- }
138
- return CommitId.__wrap(ret[0]);
139
- }
140
- /**
141
- * Creates a new commit identifier from its hexadecimal string representation.
142
- *
143
- * # Errors
144
- *
145
- * Returns an error if the string is not valid hex or not 32 bytes.
146
- * @param {string} s
147
- * @returns {CommitId}
148
- */
149
- static fromHexString(s) {
150
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
151
- const len0 = WASM_VECTOR_LEN;
152
- const ret = wasm.commitid_fromHexString(ptr0, len0);
153
- if (ret[2]) {
154
- throw takeFromExternrefTable0(ret[1]);
155
- }
156
- return CommitId.__wrap(ret[0]);
157
- }
158
- /**
159
- * Creates a new commit identifier from its byte representation.
160
- *
161
- * # Errors
162
- *
163
- * Returns an error if the byte slice is not exactly 32 bytes.
164
- * @param {Uint8Array} bytes
165
- */
166
- constructor(bytes) {
167
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
168
- const len0 = WASM_VECTOR_LEN;
169
- const ret = wasm.commitid_new(ptr0, len0);
170
- if (ret[2]) {
171
- throw takeFromExternrefTable0(ret[1]);
172
- }
173
- this.__wbg_ptr = ret[0] >>> 0;
174
- CommitIdFinalization.register(this, this.__wbg_ptr, this);
175
- return this;
176
- }
177
- /**
178
- * Returns the byte representation of the commit identifier.
179
- * @returns {Uint8Array}
180
- */
181
- toBytes() {
182
- const ret = wasm.commitid_toBytes(this.__wbg_ptr);
183
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
184
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
185
- return v1;
186
- }
187
- /**
188
- * Returns the hexadecimal string representation.
189
- * @returns {string}
190
- */
191
- toHexString() {
192
- let deferred1_0;
193
- let deferred1_1;
194
- try {
195
- const ret = wasm.commitid_toHexString(this.__wbg_ptr);
196
- deferred1_0 = ret[0];
197
- deferred1_1 = ret[1];
198
- return getStringFromWasm0(ret[0], ret[1]);
199
- } finally {
200
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
201
- }
202
- }
203
- }
204
- if (Symbol.dispose) CommitId.prototype[Symbol.dispose] = CommitId.prototype.free;
205
- exports.CommitId = CommitId;
206
-
207
- /**
208
- * A commit stored with its associated blob.
209
- */
210
- class CommitWithBlob {
211
- static __wrap(ptr) {
212
- ptr = ptr >>> 0;
213
- const obj = Object.create(CommitWithBlob.prototype);
214
- obj.__wbg_ptr = ptr;
215
- CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
216
- return obj;
217
- }
218
- __destroy_into_raw() {
219
- const ptr = this.__wbg_ptr;
220
- this.__wbg_ptr = 0;
221
- CommitWithBlobFinalization.unregister(this);
222
- return ptr;
223
- }
224
- free() {
225
- const ptr = this.__destroy_into_raw();
226
- wasm.__wbg_commitwithblob_free(ptr, 0);
227
- }
228
- /**
229
- * Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
230
- * @returns {CommitWithBlob}
231
- */
232
- __wasm_refgen_toWasmCommitWithBlob() {
233
- const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
234
- return CommitWithBlob.__wrap(ret);
235
- }
236
- /**
237
- * Get the blob.
238
- * @returns {Uint8Array}
239
- */
240
- get blob() {
241
- const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
242
- return ret;
243
- }
244
- /**
245
- * Create a new commit with blob.
246
- * @param {SignedLooseCommit} signed
247
- * @param {Uint8Array} blob
248
- */
249
- constructor(signed, blob) {
250
- _assertClass(signed, SignedLooseCommit);
251
- var ptr0 = signed.__destroy_into_raw();
252
- const ret = wasm.commitwithblob_new(ptr0, blob);
253
- this.__wbg_ptr = ret >>> 0;
254
- CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
255
- return this;
256
- }
257
- /**
258
- * Get the signed commit.
259
- * @returns {SignedLooseCommit}
260
- */
261
- get signed() {
262
- const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
263
- return SignedLooseCommit.__wrap(ret);
264
- }
265
- }
266
- if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
267
- exports.CommitWithBlob = CommitWithBlob;
268
-
269
- /**
270
- * A JavaScript wrapper around `Depth`.
271
- */
272
- class Depth {
273
- static __wrap(ptr) {
274
- ptr = ptr >>> 0;
275
- const obj = Object.create(Depth.prototype);
276
- obj.__wbg_ptr = ptr;
277
- DepthFinalization.register(obj, obj.__wbg_ptr, obj);
278
- return obj;
279
- }
280
- __destroy_into_raw() {
281
- const ptr = this.__wbg_ptr;
282
- this.__wbg_ptr = 0;
283
- DepthFinalization.unregister(this);
284
- return ptr;
285
- }
286
- free() {
287
- const ptr = this.__destroy_into_raw();
288
- wasm.__wbg_depth_free(ptr, 0);
289
- }
290
- /**
291
- * Internal method for a hack crossing the JS boundary.
292
- * @returns {Depth}
293
- */
294
- __subduction_castToDepth() {
295
- const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
296
- return Depth.__wrap(ret);
297
- }
298
- /**
299
- * Upcasts; to the JS-import type for [`WasmDepth`].
300
- * @returns {Depth}
301
- */
302
- __wasm_refgen_toWasmDepth() {
303
- const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
304
- return Depth.__wrap(ret);
305
- }
306
- /**
307
- * Creates a new `WasmDepth` from a JavaScript value.
308
- *
309
- * # Errors
310
- *
311
- * Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
312
- * @param {any} js_value
313
- */
314
- constructor(js_value) {
315
- const ret = wasm.depth_new(js_value);
316
- if (ret[2]) {
317
- throw takeFromExternrefTable0(ret[1]);
318
- }
319
- this.__wbg_ptr = ret[0] >>> 0;
320
- DepthFinalization.register(this, this.__wbg_ptr, this);
321
- return this;
322
- }
323
- /**
324
- * The depth value as an integer.
325
- * @returns {number}
326
- */
327
- get value() {
328
- const ret = wasm.depth_value(this.__wbg_ptr);
329
- return ret >>> 0;
330
- }
331
- }
332
- if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
333
- exports.Depth = Depth;
334
-
335
- /**
336
- * A wrapper around digest bytes for use in JavaScript via wasm-bindgen.
337
- *
338
- * Since JavaScript doesn't have Rust's type system, this stores raw bytes
339
- * and converts to/from typed `Digest<T>` at the Rust boundary.
340
- */
341
- class Digest {
342
- static __wrap(ptr) {
343
- ptr = ptr >>> 0;
344
- const obj = Object.create(Digest.prototype);
345
- obj.__wbg_ptr = ptr;
346
- DigestFinalization.register(obj, obj.__wbg_ptr, obj);
347
- return obj;
348
- }
349
- __destroy_into_raw() {
350
- const ptr = this.__wbg_ptr;
351
- this.__wbg_ptr = 0;
352
- DigestFinalization.unregister(this);
353
- return ptr;
354
- }
355
- free() {
356
- const ptr = this.__destroy_into_raw();
357
- wasm.__wbg_digest_free(ptr, 0);
358
- }
359
- /**
360
- * Upcasts; to the JS-import type for [`WasmDigest`].
361
- * @returns {Digest}
362
- */
363
- __wasm_refgen_toWasmDigest() {
364
- const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
365
- return Digest.__wrap(ret);
366
- }
367
- /**
368
- * Creates a new digest from its Base58 string representation.
369
- *
370
- * # Errors
371
- *
372
- * Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
373
- * @param {string} s
374
- * @returns {Digest}
375
- */
376
- static fromBase58(s) {
377
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
378
- const len0 = WASM_VECTOR_LEN;
379
- const ret = wasm.digest_fromBase58(ptr0, len0);
380
- if (ret[2]) {
381
- throw takeFromExternrefTable0(ret[1]);
382
- }
383
- return Digest.__wrap(ret[0]);
384
- }
385
- /**
386
- * Creates a new digest from its byte representation.
387
- *
388
- * # Errors
389
- *
390
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
391
- * @param {Uint8Array} bytes
392
- * @returns {Digest}
393
- */
394
- static fromBytes(bytes) {
395
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
396
- const len0 = WASM_VECTOR_LEN;
397
- const ret = wasm.digest_fromBytes(ptr0, len0);
398
- if (ret[2]) {
399
- throw takeFromExternrefTable0(ret[1]);
400
- }
401
- return Digest.__wrap(ret[0]);
402
- }
403
- /**
404
- * Creates a new digest from its hexadecimal string representation.
405
- *
406
- * # Errors
407
- *
408
- * Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
409
- * @param {string} s
410
- * @returns {Digest}
411
- */
412
- static fromHexString(s) {
413
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
414
- const len0 = WASM_VECTOR_LEN;
415
- const ret = wasm.digest_fromHexString(ptr0, len0);
416
- if (ret[2]) {
417
- throw takeFromExternrefTable0(ret[1]);
418
- }
419
- return Digest.__wrap(ret[0]);
420
- }
421
- /**
422
- * Creates a new digest from its byte representation.
423
- *
424
- * # Errors
425
- *
426
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
427
- * @param {Uint8Array} bytes
428
- */
429
- constructor(bytes) {
430
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
431
- const len0 = WASM_VECTOR_LEN;
432
- const ret = wasm.digest_new(ptr0, len0);
433
- if (ret[2]) {
434
- throw takeFromExternrefTable0(ret[1]);
435
- }
436
- this.__wbg_ptr = ret[0] >>> 0;
437
- DigestFinalization.register(this, this.__wbg_ptr, this);
438
- return this;
439
- }
440
- /**
441
- * Returns the byte representation of the digest.
442
- * @returns {Uint8Array}
443
- */
444
- toBytes() {
445
- const ret = wasm.digest_toBytes(this.__wbg_ptr);
446
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
447
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
448
- return v1;
449
- }
450
- /**
451
- * Returns the hexadecimal string representation of the digest.
452
- * @returns {string}
453
- */
454
- toHexString() {
455
- let deferred1_0;
456
- let deferred1_1;
457
- try {
458
- const ret = wasm.digest_toHexString(this.__wbg_ptr);
459
- deferred1_0 = ret[0];
460
- deferred1_1 = ret[1];
461
- return getStringFromWasm0(ret[0], ret[1]);
462
- } finally {
463
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
464
- }
465
- }
466
- }
467
- if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
468
- exports.Digest = Digest;
469
-
470
- /**
471
- * A data fragment used in the Sedimentree system.
472
- */
473
- class Fragment {
474
- static __wrap(ptr) {
475
- ptr = ptr >>> 0;
476
- const obj = Object.create(Fragment.prototype);
477
- obj.__wbg_ptr = ptr;
478
- FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
479
- return obj;
480
- }
481
- __destroy_into_raw() {
482
- const ptr = this.__wbg_ptr;
483
- this.__wbg_ptr = 0;
484
- FragmentFinalization.unregister(this);
485
- return ptr;
486
- }
487
- free() {
488
- const ptr = this.__destroy_into_raw();
489
- wasm.__wbg_fragment_free(ptr, 0);
490
- }
491
- /**
492
- * Upcasts; to the JS-import type for [`WasmFragment`].
493
- * @returns {Fragment}
494
- */
495
- __wasm_refgen_toWasmFragment() {
496
- const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
497
- return Fragment.__wrap(ret);
498
- }
499
- /**
500
- * Get the blob metadata of the fragment.
501
- * @returns {BlobMeta}
502
- */
503
- get blobMeta() {
504
- const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
505
- return BlobMeta.__wrap(ret);
506
- }
507
- /**
508
- * Get the boundary commit identifiers of the fragment.
509
- * @returns {CommitId[]}
510
- */
511
- get boundary() {
512
- const ret = wasm.fragment_boundary(this.__wbg_ptr);
513
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
514
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
515
- return v1;
516
- }
517
- /**
518
- * Get the head commit identifier of the fragment.
519
- * @returns {CommitId}
520
- */
521
- get head() {
522
- const ret = wasm.fragment_head(this.__wbg_ptr);
523
- return CommitId.__wrap(ret);
524
- }
525
- /**
526
- * Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
527
- * @param {SedimentreeId} sedimentree_id
528
- * @param {CommitId} head
529
- * @param {CommitId[]} boundary
530
- * @param {CommitId[]} checkpoints
531
- * @param {BlobMeta} blob_meta
532
- */
533
- constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
534
- _assertClass(sedimentree_id, SedimentreeId);
535
- var ptr0 = sedimentree_id.__destroy_into_raw();
536
- _assertClass(head, CommitId);
537
- var ptr1 = head.__destroy_into_raw();
538
- const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
539
- const len2 = WASM_VECTOR_LEN;
540
- const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
541
- const len3 = WASM_VECTOR_LEN;
542
- _assertClass(blob_meta, BlobMeta);
543
- var ptr4 = blob_meta.__destroy_into_raw();
544
- const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
545
- this.__wbg_ptr = ret >>> 0;
546
- FragmentFinalization.register(this, this.__wbg_ptr, this);
547
- return this;
548
- }
549
- }
550
- if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
551
- exports.Fragment = Fragment;
552
-
553
- /**
554
- * A fragment stored with its associated blob.
555
- */
556
- class FragmentWithBlob {
557
- static __wrap(ptr) {
558
- ptr = ptr >>> 0;
559
- const obj = Object.create(FragmentWithBlob.prototype);
560
- obj.__wbg_ptr = ptr;
561
- FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
562
- return obj;
563
- }
564
- __destroy_into_raw() {
565
- const ptr = this.__wbg_ptr;
566
- this.__wbg_ptr = 0;
567
- FragmentWithBlobFinalization.unregister(this);
568
- return ptr;
569
- }
570
- free() {
571
- const ptr = this.__destroy_into_raw();
572
- wasm.__wbg_fragmentwithblob_free(ptr, 0);
573
- }
574
- /**
575
- * Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
576
- * @returns {FragmentWithBlob}
577
- */
578
- __wasm_refgen_toWasmFragmentWithBlob() {
579
- const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
580
- return FragmentWithBlob.__wrap(ret);
581
- }
582
- /**
583
- * Get the blob.
584
- * @returns {Uint8Array}
585
- */
586
- get blob() {
587
- const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
588
- return ret;
589
- }
590
- /**
591
- * Create a new fragment with blob.
592
- * @param {SignedFragment} signed
593
- * @param {Uint8Array} blob
594
- */
595
- constructor(signed, blob) {
596
- _assertClass(signed, SignedFragment);
597
- var ptr0 = signed.__destroy_into_raw();
598
- const ret = wasm.fragmentwithblob_new(ptr0, blob);
599
- this.__wbg_ptr = ret >>> 0;
600
- FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
601
- return this;
602
- }
603
- /**
604
- * Get the signed fragment.
605
- * @returns {SignedFragment}
606
- */
607
- get signed() {
608
- const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
609
- return SignedFragment.__wrap(ret);
610
- }
611
- }
612
- if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
613
- exports.FragmentWithBlob = FragmentWithBlob;
614
-
615
- class FragmentsArray {
616
- static __wrap(ptr) {
617
- ptr = ptr >>> 0;
618
- const obj = Object.create(FragmentsArray.prototype);
619
- obj.__wbg_ptr = ptr;
620
- FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
621
- return obj;
622
- }
623
- __destroy_into_raw() {
624
- const ptr = this.__wbg_ptr;
625
- this.__wbg_ptr = 0;
626
- FragmentsArrayFinalization.unregister(this);
627
- return ptr;
628
- }
629
- free() {
630
- const ptr = this.__destroy_into_raw();
631
- wasm.__wbg_fragmentsarray_free(ptr, 0);
632
- }
633
- /**
634
- * Upcasts; to the JS-import type for [`WasmFragmentsArray`].
635
- * @returns {FragmentsArray}
636
- */
637
- __wasm_refgen_toWasmFragmentsArray() {
638
- const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
639
- return FragmentsArray.__wrap(ret);
640
- }
641
- }
642
- if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
643
- exports.FragmentsArray = FragmentsArray;
644
-
645
- /**
646
- * A Wasm wrapper around the [`LooseCommit`] type.
647
- */
648
- class LooseCommit {
649
- static __wrap(ptr) {
650
- ptr = ptr >>> 0;
651
- const obj = Object.create(LooseCommit.prototype);
652
- obj.__wbg_ptr = ptr;
653
- LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
654
- return obj;
655
- }
656
- __destroy_into_raw() {
657
- const ptr = this.__wbg_ptr;
658
- this.__wbg_ptr = 0;
659
- LooseCommitFinalization.unregister(this);
660
- return ptr;
661
- }
662
- free() {
663
- const ptr = this.__destroy_into_raw();
664
- wasm.__wbg_loosecommit_free(ptr, 0);
665
- }
666
- /**
667
- * Upcasts; to the JS-import type for [`WasmLooseCommit`].
668
- * @returns {LooseCommit}
669
- */
670
- __wasm_refgen_toWasmLooseCommit() {
671
- const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
672
- return LooseCommit.__wrap(ret);
673
- }
674
- /**
675
- * Get the blob metadata of the commit.
676
- * @returns {BlobMeta}
677
- */
678
- get blobMeta() {
679
- const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
680
- return BlobMeta.__wrap(ret);
681
- }
682
- /**
683
- * Get the commit's head identifier.
684
- * @returns {CommitId}
685
- */
686
- get commitId() {
687
- const ret = wasm.loosecommit_commitId(this.__wbg_ptr);
688
- return CommitId.__wrap(ret);
689
- }
690
- /**
691
- * Get the digest of the commit (content hash).
692
- * @returns {Digest}
693
- */
694
- get digest() {
695
- const ret = wasm.loosecommit_digest(this.__wbg_ptr);
696
- return Digest.__wrap(ret);
697
- }
698
- /**
699
- * Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
700
- * @param {SedimentreeId} sedimentree_id
701
- * @param {CommitId} head
702
- * @param {CommitId[]} parents
703
- * @param {BlobMeta} blob_meta
704
- */
705
- constructor(sedimentree_id, head, parents, blob_meta) {
706
- _assertClass(sedimentree_id, SedimentreeId);
707
- var ptr0 = sedimentree_id.__destroy_into_raw();
708
- _assertClass(head, CommitId);
709
- var ptr1 = head.__destroy_into_raw();
710
- const ptr2 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
711
- const len2 = WASM_VECTOR_LEN;
712
- _assertClass(blob_meta, BlobMeta);
713
- const ret = wasm.loosecommit_new(ptr0, ptr1, ptr2, len2, blob_meta.__wbg_ptr);
714
- this.__wbg_ptr = ret >>> 0;
715
- LooseCommitFinalization.register(this, this.__wbg_ptr, this);
716
- return this;
717
- }
718
- /**
719
- * Get the parent commit identifiers.
720
- * @returns {CommitId[]}
721
- */
722
- get parents() {
723
- const ret = wasm.loosecommit_parents(this.__wbg_ptr);
724
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
725
- wasm.__wbindgen_export6(ret[0], ret[1] * 4, 4);
726
- return v1;
727
- }
728
- }
729
- if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
730
- exports.LooseCommit = LooseCommit;
731
-
732
- /**
733
- * An in-memory storage implementation for use in tests and development.
734
- *
735
- * This wraps the core `MemoryStorage` and exposes it via the `SedimentreeStorage` interface.
736
- */
737
- class MemoryStorage {
738
- __destroy_into_raw() {
739
- const ptr = this.__wbg_ptr;
740
- this.__wbg_ptr = 0;
741
- MemoryStorageFinalization.unregister(this);
742
- return ptr;
743
- }
744
- free() {
745
- const ptr = this.__destroy_into_raw();
746
- wasm.__wbg_memorystorage_free(ptr, 0);
747
- }
748
- /**
749
- * Delete all commits for a sedimentree.
750
- * @param {SedimentreeId} sedimentree_id
751
- * @returns {Promise<any>}
752
- */
753
- deleteAllCommits(sedimentree_id) {
754
- _assertClass(sedimentree_id, SedimentreeId);
755
- const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
756
- return ret;
757
- }
758
- /**
759
- * Delete all fragments for a sedimentree.
760
- * @param {SedimentreeId} sedimentree_id
761
- * @returns {Promise<any>}
762
- */
763
- deleteAllFragments(sedimentree_id) {
764
- _assertClass(sedimentree_id, SedimentreeId);
765
- const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
766
- return ret;
767
- }
768
- /**
769
- * Delete a single commit by its ID.
770
- * @param {SedimentreeId} sedimentree_id
771
- * @param {CommitId} commit_id
772
- * @returns {Promise<any>}
773
- */
774
- deleteCommit(sedimentree_id, commit_id) {
775
- _assertClass(sedimentree_id, SedimentreeId);
776
- _assertClass(commit_id, CommitId);
777
- const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
778
- return ret;
779
- }
780
- /**
781
- * Delete a fragment by its identifier.
782
- * @param {SedimentreeId} sedimentree_id
783
- * @param {CommitId} fragment_head
784
- * @returns {Promise<any>}
785
- */
786
- deleteFragment(sedimentree_id, fragment_head) {
787
- _assertClass(sedimentree_id, SedimentreeId);
788
- _assertClass(fragment_head, CommitId);
789
- const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
790
- return ret;
791
- }
792
- /**
793
- * Delete a sedimentree ID.
794
- * @param {SedimentreeId} sedimentree_id
795
- * @returns {Promise<any>}
796
- */
797
- deleteSedimentreeId(sedimentree_id) {
798
- _assertClass(sedimentree_id, SedimentreeId);
799
- const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
800
- return ret;
801
- }
802
- /**
803
- * List all commit IDs for a sedimentree.
804
- * @param {SedimentreeId} sedimentree_id
805
- * @returns {Promise<any>}
806
- */
807
- listCommitIds(sedimentree_id) {
808
- _assertClass(sedimentree_id, SedimentreeId);
809
- const ret = wasm.memorystorage_listCommitIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
810
- return ret;
811
- }
812
- /**
813
- * List all fragment IDs for a sedimentree.
814
- * @param {SedimentreeId} sedimentree_id
815
- * @returns {Promise<any>}
816
- */
817
- listFragmentIds(sedimentree_id) {
818
- _assertClass(sedimentree_id, SedimentreeId);
819
- const ret = wasm.memorystorage_listFragmentIds(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
820
- return ret;
821
- }
822
- /**
823
- * Load all commits for a sedimentree, returning `CommitWithBlob[]`.
824
- * @param {SedimentreeId} sedimentree_id
825
- * @returns {Promise<any>}
826
- */
827
- loadAllCommits(sedimentree_id) {
828
- _assertClass(sedimentree_id, SedimentreeId);
829
- const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
830
- return ret;
831
- }
832
- /**
833
- * Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
834
- * @param {SedimentreeId} sedimentree_id
835
- * @returns {Promise<any>}
836
- */
837
- loadAllFragments(sedimentree_id) {
838
- _assertClass(sedimentree_id, SedimentreeId);
839
- const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
840
- return ret;
841
- }
842
- /**
843
- * Load all sedimentree IDs.
844
- * @returns {Promise<any>}
845
- */
846
- loadAllSedimentreeIds() {
847
- const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
848
- return ret;
849
- }
850
- /**
851
- * Load a single commit by its ID, returning `CommitWithBlob` or null.
852
- * @param {SedimentreeId} sedimentree_id
853
- * @param {CommitId} commit_id
854
- * @returns {Promise<any>}
855
- */
856
- loadCommit(sedimentree_id, commit_id) {
857
- _assertClass(sedimentree_id, SedimentreeId);
858
- _assertClass(commit_id, CommitId);
859
- const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr);
860
- return ret;
861
- }
862
- /**
863
- * Load a fragment by its identifier, returning `FragmentWithBlob` or null.
864
- * @param {SedimentreeId} sedimentree_id
865
- * @param {CommitId} fragment_head
866
- * @returns {Promise<any>}
867
- */
868
- loadFragment(sedimentree_id, fragment_head) {
869
- _assertClass(sedimentree_id, SedimentreeId);
870
- _assertClass(fragment_head, CommitId);
871
- const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, fragment_head.__wbg_ptr);
872
- return ret;
873
- }
874
- /**
875
- * Create a new in-memory storage instance.
876
- */
877
- constructor() {
878
- const ret = wasm.memorystorage_new();
879
- this.__wbg_ptr = ret >>> 0;
880
- MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
881
- return this;
882
- }
883
- /**
884
- * Save commits and fragments in a single batch.
885
- * @param {SedimentreeId} sedimentree_id
886
- * @param {Array<any>} commits
887
- * @param {Array<any>} fragments
888
- * @returns {Promise<any>}
889
- */
890
- saveBatchAll(sedimentree_id, commits, fragments) {
891
- _assertClass(sedimentree_id, SedimentreeId);
892
- const ret = wasm.memorystorage_saveBatchAll(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commits, fragments);
893
- return ret;
894
- }
895
- /**
896
- * Save a commit with its blob.
897
- *
898
- * The `commit_id` parameter must match the `head()` embedded in
899
- * the signed commit payload. Returns an error if they differ.
900
- *
901
- * # Errors
902
- *
903
- * Returns a JS error if:
904
- * - The signed payload cannot be decoded
905
- * - The `commit_id` does not match the embedded `head()`
906
- * @param {SedimentreeId} sedimentree_id
907
- * @param {CommitId} commit_id
908
- * @param {SignedLooseCommit} signed_commit
909
- * @param {Uint8Array} blob
910
- * @returns {Promise<any>}
911
- */
912
- saveCommit(sedimentree_id, commit_id, signed_commit, blob) {
913
- _assertClass(sedimentree_id, SedimentreeId);
914
- _assertClass(commit_id, CommitId);
915
- _assertClass(signed_commit, SignedLooseCommit);
916
- const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, commit_id.__wbg_ptr, signed_commit.__wbg_ptr, blob);
917
- return ret;
918
- }
919
- /**
920
- * Save a fragment with its blob.
921
- * @param {SedimentreeId} sedimentree_id
922
- * @param {CommitId} _fragment_head
923
- * @param {SignedFragment} signed_fragment
924
- * @param {Uint8Array} blob
925
- * @returns {Promise<any>}
926
- */
927
- saveFragment(sedimentree_id, _fragment_head, signed_fragment, blob) {
928
- _assertClass(sedimentree_id, SedimentreeId);
929
- _assertClass(_fragment_head, CommitId);
930
- _assertClass(signed_fragment, SignedFragment);
931
- const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _fragment_head.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
932
- return ret;
933
- }
934
- /**
935
- * Save a sedimentree ID.
936
- * @param {SedimentreeId} sedimentree_id
937
- * @returns {Promise<any>}
938
- */
939
- saveSedimentreeId(sedimentree_id) {
940
- _assertClass(sedimentree_id, SedimentreeId);
941
- const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
942
- return ret;
943
- }
944
- }
945
- if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
946
- exports.MemoryStorage = MemoryStorage;
947
-
948
- /**
949
- * The main Sedimentree data structure.
950
- */
951
- class Sedimentree {
952
- static __wrap(ptr) {
953
- ptr = ptr >>> 0;
954
- const obj = Object.create(Sedimentree.prototype);
955
- obj.__wbg_ptr = ptr;
956
- SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
957
- return obj;
958
- }
959
- __destroy_into_raw() {
960
- const ptr = this.__wbg_ptr;
961
- this.__wbg_ptr = 0;
962
- SedimentreeFinalization.unregister(this);
963
- return ptr;
964
- }
965
- free() {
966
- const ptr = this.__destroy_into_raw();
967
- wasm.__wbg_sedimentree_free(ptr, 0);
968
- }
969
- /**
970
- * Create an empty Sedimentree.
971
- * @returns {Sedimentree}
972
- */
973
- static empty() {
974
- const ret = wasm.sedimentree_empty();
975
- return Sedimentree.__wrap(ret);
976
- }
977
- /**
978
- * Create a new Sedimentree from fragments and loose commits.
979
- * @param {Fragment[]} fragments
980
- * @param {LooseCommit[]} commits
981
- */
982
- constructor(fragments, commits) {
983
- const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
984
- const len0 = WASM_VECTOR_LEN;
985
- const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
986
- const len1 = WASM_VECTOR_LEN;
987
- const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
988
- this.__wbg_ptr = ret >>> 0;
989
- SedimentreeFinalization.register(this, this.__wbg_ptr, this);
990
- return this;
991
- }
992
- }
993
- if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
994
- exports.Sedimentree = Sedimentree;
995
-
996
- /**
997
- * A Wasm wrapper around the [`SedimentreeId`] type.
998
- */
999
- class SedimentreeId {
1000
- static __wrap(ptr) {
1001
- ptr = ptr >>> 0;
1002
- const obj = Object.create(SedimentreeId.prototype);
1003
- obj.__wbg_ptr = ptr;
1004
- SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
1005
- return obj;
1006
- }
1007
- __destroy_into_raw() {
1008
- const ptr = this.__wbg_ptr;
1009
- this.__wbg_ptr = 0;
1010
- SedimentreeIdFinalization.unregister(this);
1011
- return ptr;
1012
- }
1013
- free() {
1014
- const ptr = this.__destroy_into_raw();
1015
- wasm.__wbg_sedimentreeid_free(ptr, 0);
1016
- }
1017
- /**
1018
- * Upcasts; to the JS-import type for [`WasmSedimentreeId`].
1019
- * @returns {SedimentreeId}
1020
- */
1021
- __wasm_refgen_toWasmSedimentreeId() {
1022
- const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
1023
- return SedimentreeId.__wrap(ret);
1024
- }
1025
- /**
1026
- * Create an ID from a byte array.
1027
- *
1028
- * # Errors
1029
- *
1030
- * Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
1031
- * @param {Uint8Array} bytes
1032
- * @returns {SedimentreeId}
1033
- */
1034
- static fromBytes(bytes) {
1035
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1036
- const len0 = WASM_VECTOR_LEN;
1037
- const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
1038
- if (ret[2]) {
1039
- throw takeFromExternrefTable0(ret[1]);
1040
- }
1041
- return SedimentreeId.__wrap(ret[0]);
1042
- }
1043
- /**
1044
- * Returns the raw bytes of this ID.
1045
- * @returns {Uint8Array}
1046
- */
1047
- toBytes() {
1048
- const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
1049
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1050
- wasm.__wbindgen_export6(ret[0], ret[1] * 1, 1);
1051
- return v1;
1052
- }
1053
- /**
1054
- * Returns the string representation of the ID.
1055
- * @returns {string}
1056
- */
1057
- toString() {
1058
- let deferred1_0;
1059
- let deferred1_1;
1060
- try {
1061
- const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
1062
- deferred1_0 = ret[0];
1063
- deferred1_1 = ret[1];
1064
- return getStringFromWasm0(ret[0], ret[1]);
1065
- } finally {
1066
- wasm.__wbindgen_export6(deferred1_0, deferred1_1, 1);
1067
- }
1068
- }
1069
- }
1070
- if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
1071
- exports.SedimentreeId = SedimentreeId;
1072
-
1073
- class SedimentreeIdsArray {
1074
- static __wrap(ptr) {
1075
- ptr = ptr >>> 0;
1076
- const obj = Object.create(SedimentreeIdsArray.prototype);
1077
- obj.__wbg_ptr = ptr;
1078
- SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
1079
- return obj;
1080
- }
1081
- __destroy_into_raw() {
1082
- const ptr = this.__wbg_ptr;
1083
- this.__wbg_ptr = 0;
1084
- SedimentreeIdsArrayFinalization.unregister(this);
1085
- return ptr;
1086
- }
1087
- free() {
1088
- const ptr = this.__destroy_into_raw();
1089
- wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
1090
- }
1091
- /**
1092
- * Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
1093
- * @returns {SedimentreeIdsArray}
1094
- */
1095
- __wasm_refgen_toWasmSedimentreeIdsArray() {
1096
- const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
1097
- return SedimentreeIdsArray.__wrap(ret);
1098
- }
1099
- }
1100
- if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
1101
- exports.SedimentreeIdsArray = SedimentreeIdsArray;
1102
-
1103
- /**
1104
- * A Wasm wrapper around `Signed<Fragment>`.
1105
- */
1106
- class SignedFragment {
1107
- static __wrap(ptr) {
1108
- ptr = ptr >>> 0;
1109
- const obj = Object.create(SignedFragment.prototype);
1110
- obj.__wbg_ptr = ptr;
1111
- SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
1112
- return obj;
1113
- }
1114
- static __unwrap(jsValue) {
1115
- if (!(jsValue instanceof SignedFragment)) {
1116
- return 0;
1117
- }
1118
- return jsValue.__destroy_into_raw();
1119
- }
1120
- __destroy_into_raw() {
1121
- const ptr = this.__wbg_ptr;
1122
- this.__wbg_ptr = 0;
1123
- SignedFragmentFinalization.unregister(this);
1124
- return ptr;
1125
- }
1126
- free() {
1127
- const ptr = this.__destroy_into_raw();
1128
- wasm.__wbg_signedfragment_free(ptr, 0);
1129
- }
1130
- /**
1131
- * Upcasts; to the JS-import type for [`WasmSignedFragment`].
1132
- * @returns {SignedFragment}
1133
- */
1134
- __wasm_refgen_toWasmSignedFragment() {
1135
- const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
1136
- return SignedFragment.__wrap(ret);
1137
- }
1138
- /**
1139
- * Encode this signed fragment to raw bytes.
1140
- * @returns {Uint8Array}
1141
- */
1142
- encode() {
1143
- const ret = wasm.signedfragment_encode(this.__wbg_ptr);
1144
- return ret;
1145
- }
1146
- /**
1147
- * Get the unsigned payload without re-verifying the signature.
1148
- *
1149
- * # Errors
1150
- *
1151
- * Returns an error if the payload cannot be decoded.
1152
- * @returns {Fragment}
1153
- */
1154
- get payload() {
1155
- const ret = wasm.signedfragment_payload(this.__wbg_ptr);
1156
- if (ret[2]) {
1157
- throw takeFromExternrefTable0(ret[1]);
1158
- }
1159
- return Fragment.__wrap(ret[0]);
1160
- }
1161
- /**
1162
- * Decode a `SignedFragment` from raw bytes.
1163
- *
1164
- * # Errors
1165
- *
1166
- * Returns an error if the bytes are not a valid signed fragment.
1167
- * @param {Uint8Array} bytes
1168
- * @returns {SignedFragment}
1169
- */
1170
- static tryDecode(bytes) {
1171
- const ret = wasm.signedfragment_tryDecode(bytes);
1172
- if (ret[2]) {
1173
- throw takeFromExternrefTable0(ret[1]);
1174
- }
1175
- return SignedFragment.__wrap(ret[0]);
1176
- }
1177
- }
1178
- if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
1179
- exports.SignedFragment = SignedFragment;
1180
-
1181
- /**
1182
- * A Wasm wrapper around `Signed<LooseCommit>`.
1183
- */
1184
- class SignedLooseCommit {
1185
- static __wrap(ptr) {
1186
- ptr = ptr >>> 0;
1187
- const obj = Object.create(SignedLooseCommit.prototype);
1188
- obj.__wbg_ptr = ptr;
1189
- SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
1190
- return obj;
1191
- }
1192
- static __unwrap(jsValue) {
1193
- if (!(jsValue instanceof SignedLooseCommit)) {
1194
- return 0;
1195
- }
1196
- return jsValue.__destroy_into_raw();
1197
- }
1198
- __destroy_into_raw() {
1199
- const ptr = this.__wbg_ptr;
1200
- this.__wbg_ptr = 0;
1201
- SignedLooseCommitFinalization.unregister(this);
1202
- return ptr;
1203
- }
1204
- free() {
1205
- const ptr = this.__destroy_into_raw();
1206
- wasm.__wbg_signedloosecommit_free(ptr, 0);
1207
- }
1208
- /**
1209
- * Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
1210
- * @returns {SignedLooseCommit}
1211
- */
1212
- __wasm_refgen_toWasmSignedLooseCommit() {
1213
- const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
1214
- return SignedLooseCommit.__wrap(ret);
1215
- }
1216
- /**
1217
- * Encode this signed loose commit to raw bytes.
1218
- * @returns {Uint8Array}
1219
- */
1220
- encode() {
1221
- const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
1222
- return ret;
1223
- }
1224
- /**
1225
- * Get the unsigned payload without re-verifying the signature.
1226
- *
1227
- * # Errors
1228
- *
1229
- * Returns an error if the payload cannot be decoded.
1230
- * @returns {LooseCommit}
1231
- */
1232
- get payload() {
1233
- const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
1234
- if (ret[2]) {
1235
- throw takeFromExternrefTable0(ret[1]);
1236
- }
1237
- return LooseCommit.__wrap(ret[0]);
1238
- }
1239
- /**
1240
- * Decode a `SignedLooseCommit` from raw bytes.
1241
- *
1242
- * # Errors
1243
- *
1244
- * Returns an error if the bytes are not a valid signed loose commit.
1245
- * @param {Uint8Array} bytes
1246
- * @returns {SignedLooseCommit}
1247
- */
1248
- static tryDecode(bytes) {
1249
- const ret = wasm.signedloosecommit_tryDecode(bytes);
1250
- if (ret[2]) {
1251
- throw takeFromExternrefTable0(ret[1]);
1252
- }
1253
- return SignedLooseCommit.__wrap(ret[0]);
1254
- }
1255
- }
1256
- if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
1257
- exports.SignedLooseCommit = SignedLooseCommit;
1258
-
1259
- function __wbg_get_imports() {
1260
- const import0 = {
1261
- __proto__: null,
1262
- __wbg___wasm_refgen_toWasmCommitId_65b818e358f27de6: function(arg0) {
1263
- const ret = arg0.__wasm_refgen_toWasmCommitId();
1264
- _assertClass(ret, CommitId);
1265
- var ptr1 = ret.__destroy_into_raw();
1266
- return ptr1;
1267
- },
1268
- __wbg___wasm_refgen_toWasmFragment_38ddb9958dbdc455: function(arg0) {
1269
- const ret = arg0.__wasm_refgen_toWasmFragment();
1270
- _assertClass(ret, Fragment);
1271
- var ptr1 = ret.__destroy_into_raw();
1272
- return ptr1;
1273
- },
1274
- __wbg___wasm_refgen_toWasmLooseCommit_876edb05490f6350: function(arg0) {
1275
- const ret = arg0.__wasm_refgen_toWasmLooseCommit();
1276
- _assertClass(ret, LooseCommit);
1277
- var ptr1 = ret.__destroy_into_raw();
1278
- return ptr1;
1279
- },
1280
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
1281
- const ret = debugString(arg1);
1282
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1283
- const len1 = WASM_VECTOR_LEN;
1284
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1285
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1286
- },
1287
- __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
1288
- const ret = typeof(arg0) === 'function';
1289
- return ret;
1290
- },
1291
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
1292
- const ret = arg0 === undefined;
1293
- return ret;
1294
- },
1295
- __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
1296
- const obj = arg1;
1297
- const ret = typeof(obj) === 'number' ? obj : undefined;
1298
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1299
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1300
- },
1301
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
1302
- throw new Error(getStringFromWasm0(arg0, arg1));
1303
- },
1304
- __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
1305
- arg0._wbg_cb_unref();
1306
- },
1307
- __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
1308
- const ret = arg0.call(arg1, arg2);
1309
- return ret;
1310
- }, arguments); },
1311
- __wbg_commitid_new: function(arg0) {
1312
- const ret = CommitId.__wrap(arg0);
1313
- return ret;
1314
- },
1315
- __wbg_commitwithblob_new: function(arg0) {
1316
- const ret = CommitWithBlob.__wrap(arg0);
1317
- return ret;
1318
- },
1319
- __wbg_fragmentwithblob_new: function(arg0) {
1320
- const ret = FragmentWithBlob.__wrap(arg0);
1321
- return ret;
1322
- },
1323
- __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
1324
- const ret = Reflect.get(arg0, arg1);
1325
- return ret;
1326
- }, arguments); },
1327
- __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
1328
- const ret = arg0[arg1 >>> 0];
1329
- return ret;
1330
- },
1331
- __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
1332
- const ret = Number.isSafeInteger(arg0);
1333
- return ret;
1334
- },
1335
- __wbg_length_b3416cf66a5452c8: function(arg0) {
1336
- const ret = arg0.length;
1337
- return ret;
1338
- },
1339
- __wbg_length_ea16607d7b61445b: function(arg0) {
1340
- const ret = arg0.length;
1341
- return ret;
1342
- },
1343
- __wbg_new_5f486cdf45a04d78: function(arg0) {
1344
- const ret = new Uint8Array(arg0);
1345
- return ret;
1346
- },
1347
- __wbg_new_a70fbab9066b301f: function() {
1348
- const ret = new Array();
1349
- return ret;
1350
- },
1351
- __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
1352
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1353
- return ret;
1354
- },
1355
- __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
1356
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1357
- return ret;
1358
- },
1359
- __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
1360
- try {
1361
- var state0 = {a: arg0, b: arg1};
1362
- var cb0 = (arg0, arg1) => {
1363
- const a = state0.a;
1364
- state0.a = 0;
1365
- try {
1366
- return __wasm_bindgen_func_elem_563_75(a, state0.b, arg0, arg1);
1367
- } finally {
1368
- state0.a = a;
1369
- }
1370
- };
1371
- const ret = new Promise(cb0);
1372
- return ret;
1373
- } finally {
1374
- state0.a = state0.b = 0;
1375
- }
1376
- },
1377
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
1378
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1379
- },
1380
- __wbg_push_e87b0e732085a946: function(arg0, arg1) {
1381
- const ret = arg0.push(arg1);
1382
- return ret;
1383
- },
1384
- __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
1385
- const ret = arg0.queueMicrotask;
1386
- return ret;
1387
- },
1388
- __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
1389
- queueMicrotask(arg0);
1390
- },
1391
- __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
1392
- const ret = Promise.resolve(arg0);
1393
- return ret;
1394
- },
1395
- __wbg_sedimentreeid_new: function(arg0) {
1396
- const ret = SedimentreeId.__wrap(arg0);
1397
- return ret;
1398
- },
1399
- __wbg_set_name_7ef37fe858379aaf: function(arg0, arg1, arg2) {
1400
- arg0.name = getStringFromWasm0(arg1, arg2);
1401
- },
1402
- __wbg_signedfragment_unwrap: function(arg0) {
1403
- const ret = SignedFragment.__unwrap(arg0);
1404
- return ret;
1405
- },
1406
- __wbg_signedloosecommit_unwrap: function(arg0) {
1407
- const ret = SignedLooseCommit.__unwrap(arg0);
1408
- return ret;
1409
- },
1410
- __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
1411
- const ret = typeof global === 'undefined' ? null : global;
1412
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1413
- },
1414
- __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
1415
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1416
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1417
- },
1418
- __wbg_static_accessor_SELF_f207c857566db248: function() {
1419
- const ret = typeof self === 'undefined' ? null : self;
1420
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1421
- },
1422
- __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
1423
- const ret = typeof window === 'undefined' ? null : window;
1424
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1425
- },
1426
- __wbg_then_098abe61755d12f6: function(arg0, arg1) {
1427
- const ret = arg0.then(arg1);
1428
- return ret;
1429
- },
1430
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1431
- // Cast intrinsic for `Closure(Closure { dtor_idx: 73, function: Function { arguments: [Externref], shim_idx: 136, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1432
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_400, __wasm_bindgen_func_elem_563);
1433
- return ret;
1434
- },
1435
- __wbindgen_cast_0000000000000002: function(arg0) {
1436
- // Cast intrinsic for `F64 -> Externref`.
1437
- const ret = arg0;
1438
- return ret;
1439
- },
1440
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1441
- // Cast intrinsic for `Ref(String) -> Externref`.
1442
- const ret = getStringFromWasm0(arg0, arg1);
1443
- return ret;
1444
- },
1445
- __wbindgen_init_externref_table: function() {
1446
- const table = wasm.__wbindgen_externrefs;
1447
- const offset = table.grow(4);
1448
- table.set(0, undefined);
1449
- table.set(offset + 0, undefined);
1450
- table.set(offset + 1, null);
1451
- table.set(offset + 2, true);
1452
- table.set(offset + 3, false);
1453
- },
1454
- };
1455
- return {
1456
- __proto__: null,
1457
- "./sedimentree_wasm_bg.js": import0,
1458
- };
1459
- }
1460
-
1461
- function __wasm_bindgen_func_elem_563(arg0, arg1, arg2) {
1462
- const ret = wasm.__wasm_bindgen_func_elem_563(arg0, arg1, arg2);
1463
- if (ret[1]) {
1464
- throw takeFromExternrefTable0(ret[0]);
1465
- }
1466
- }
1467
-
1468
- function __wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3) {
1469
- wasm.__wasm_bindgen_func_elem_563_75(arg0, arg1, arg2, arg3);
1470
- }
1471
-
1472
- const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
1473
- ? { register: () => {}, unregister: () => {} }
1474
- : new FinalizationRegistry(ptr => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
1475
- const BlobMetaFinalization = (typeof FinalizationRegistry === 'undefined')
1476
- ? { register: () => {}, unregister: () => {} }
1477
- : new FinalizationRegistry(ptr => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
1478
- const CommitIdFinalization = (typeof FinalizationRegistry === 'undefined')
1479
- ? { register: () => {}, unregister: () => {} }
1480
- : new FinalizationRegistry(ptr => wasm.__wbg_commitid_free(ptr >>> 0, 1));
1481
- const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1482
- ? { register: () => {}, unregister: () => {} }
1483
- : new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
1484
- const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
1485
- ? { register: () => {}, unregister: () => {} }
1486
- : new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
1487
- const DigestFinalization = (typeof FinalizationRegistry === 'undefined')
1488
- ? { register: () => {}, unregister: () => {} }
1489
- : new FinalizationRegistry(ptr => wasm.__wbg_digest_free(ptr >>> 0, 1));
1490
- const FragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1491
- ? { register: () => {}, unregister: () => {} }
1492
- : new FinalizationRegistry(ptr => wasm.__wbg_fragment_free(ptr >>> 0, 1));
1493
- const FragmentWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
1494
- ? { register: () => {}, unregister: () => {} }
1495
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
1496
- const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1497
- ? { register: () => {}, unregister: () => {} }
1498
- : new FinalizationRegistry(ptr => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
1499
- const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1500
- ? { register: () => {}, unregister: () => {} }
1501
- : new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
1502
- const SedimentreeFinalization = (typeof FinalizationRegistry === 'undefined')
1503
- ? { register: () => {}, unregister: () => {} }
1504
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
1505
- const SedimentreeIdFinalization = (typeof FinalizationRegistry === 'undefined')
1506
- ? { register: () => {}, unregister: () => {} }
1507
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
1508
- const SedimentreeIdsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
1509
- ? { register: () => {}, unregister: () => {} }
1510
- : new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
1511
- const SignedFragmentFinalization = (typeof FinalizationRegistry === 'undefined')
1512
- ? { register: () => {}, unregister: () => {} }
1513
- : new FinalizationRegistry(ptr => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
1514
- const SignedLooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
1515
- ? { register: () => {}, unregister: () => {} }
1516
- : new FinalizationRegistry(ptr => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
1517
-
1518
- function addToExternrefTable0(obj) {
1519
- const idx = wasm.__wbindgen_export4();
1520
- wasm.__wbindgen_externrefs.set(idx, obj);
1521
- return idx;
1522
- }
1523
-
1524
- function _assertClass(instance, klass) {
1525
- if (!(instance instanceof klass)) {
1526
- throw new Error(`expected instance of ${klass.name}`);
1527
- }
1528
- }
1529
-
1530
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1531
- ? { register: () => {}, unregister: () => {} }
1532
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1533
-
1534
- function debugString(val) {
1535
- // primitive types
1536
- const type = typeof val;
1537
- if (type == 'number' || type == 'boolean' || val == null) {
1538
- return `${val}`;
1539
- }
1540
- if (type == 'string') {
1541
- return `"${val}"`;
1542
- }
1543
- if (type == 'symbol') {
1544
- const description = val.description;
1545
- if (description == null) {
1546
- return 'Symbol';
1547
- } else {
1548
- return `Symbol(${description})`;
1549
- }
1550
- }
1551
- if (type == 'function') {
1552
- const name = val.name;
1553
- if (typeof name == 'string' && name.length > 0) {
1554
- return `Function(${name})`;
1555
- } else {
1556
- return 'Function';
1557
- }
1558
- }
1559
- // objects
1560
- if (Array.isArray(val)) {
1561
- const length = val.length;
1562
- let debug = '[';
1563
- if (length > 0) {
1564
- debug += debugString(val[0]);
1565
- }
1566
- for(let i = 1; i < length; i++) {
1567
- debug += ', ' + debugString(val[i]);
1568
- }
1569
- debug += ']';
1570
- return debug;
1571
- }
1572
- // Test for built-in
1573
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1574
- let className;
1575
- if (builtInMatches && builtInMatches.length > 1) {
1576
- className = builtInMatches[1];
1577
- } else {
1578
- // Failed to match the standard '[object ClassName]'
1579
- return toString.call(val);
1580
- }
1581
- if (className == 'Object') {
1582
- // we're a user defined class or Object
1583
- // JSON.stringify avoids problems with cycles, and is generally much
1584
- // easier than looping through ownProperties of `val`.
1585
- try {
1586
- return 'Object(' + JSON.stringify(val) + ')';
1587
- } catch (_) {
1588
- return 'Object';
1589
- }
1590
- }
1591
- // errors
1592
- if (val instanceof Error) {
1593
- return `${val.name}: ${val.message}\n${val.stack}`;
1594
- }
1595
- // TODO we could test for more things here, like `Set`s and `Map`s.
1596
- return className;
1597
- }
1598
-
1599
- function getArrayJsValueFromWasm0(ptr, len) {
1600
- ptr = ptr >>> 0;
1601
- const mem = getDataViewMemory0();
1602
- const result = [];
1603
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
1604
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1605
- }
1606
- wasm.__wbindgen_export7(ptr, len);
1607
- return result;
1608
- }
1609
-
1610
- function getArrayU8FromWasm0(ptr, len) {
1611
- ptr = ptr >>> 0;
1612
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1613
- }
1614
-
1615
- let cachedDataViewMemory0 = null;
1616
- function getDataViewMemory0() {
1617
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1618
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1619
- }
1620
- return cachedDataViewMemory0;
1621
- }
1622
-
1623
- function getStringFromWasm0(ptr, len) {
1624
- ptr = ptr >>> 0;
1625
- return decodeText(ptr, len);
1626
- }
1627
-
1628
- let cachedUint8ArrayMemory0 = null;
1629
- function getUint8ArrayMemory0() {
1630
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1631
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1632
- }
1633
- return cachedUint8ArrayMemory0;
1634
- }
1635
-
1636
- function handleError(f, args) {
1637
- try {
1638
- return f.apply(this, args);
1639
- } catch (e) {
1640
- const idx = addToExternrefTable0(e);
1641
- wasm.__wbindgen_export3(idx);
1642
- }
1643
- }
1644
-
1645
- function isLikeNone(x) {
1646
- return x === undefined || x === null;
1647
- }
1648
-
1649
- function makeMutClosure(arg0, arg1, dtor, f) {
1650
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
1651
- const real = (...args) => {
1652
-
1653
- // First up with a closure we increment the internal reference
1654
- // count. This ensures that the Rust closure environment won't
1655
- // be deallocated while we're invoking it.
1656
- state.cnt++;
1657
- const a = state.a;
1658
- state.a = 0;
1659
- try {
1660
- return f(a, state.b, ...args);
1661
- } finally {
1662
- state.a = a;
1663
- real._wbg_cb_unref();
1664
- }
1665
- };
1666
- real._wbg_cb_unref = () => {
1667
- if (--state.cnt === 0) {
1668
- state.dtor(state.a, state.b);
1669
- state.a = 0;
1670
- CLOSURE_DTORS.unregister(state);
1671
- }
1672
- };
1673
- CLOSURE_DTORS.register(real, state, state);
1674
- return real;
1675
- }
1676
-
1677
- function passArray8ToWasm0(arg, malloc) {
1678
- const ptr = malloc(arg.length * 1, 1) >>> 0;
1679
- getUint8ArrayMemory0().set(arg, ptr / 1);
1680
- WASM_VECTOR_LEN = arg.length;
1681
- return ptr;
1682
- }
1683
-
1684
- function passArrayJsValueToWasm0(array, malloc) {
1685
- const ptr = malloc(array.length * 4, 4) >>> 0;
1686
- for (let i = 0; i < array.length; i++) {
1687
- const add = addToExternrefTable0(array[i]);
1688
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1689
- }
1690
- WASM_VECTOR_LEN = array.length;
1691
- return ptr;
1692
- }
1693
-
1694
- function passStringToWasm0(arg, malloc, realloc) {
1695
- if (realloc === undefined) {
1696
- const buf = cachedTextEncoder.encode(arg);
1697
- const ptr = malloc(buf.length, 1) >>> 0;
1698
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1699
- WASM_VECTOR_LEN = buf.length;
1700
- return ptr;
1701
- }
1702
-
1703
- let len = arg.length;
1704
- let ptr = malloc(len, 1) >>> 0;
1705
-
1706
- const mem = getUint8ArrayMemory0();
1707
-
1708
- let offset = 0;
1709
-
1710
- for (; offset < len; offset++) {
1711
- const code = arg.charCodeAt(offset);
1712
- if (code > 0x7F) break;
1713
- mem[ptr + offset] = code;
1714
- }
1715
- if (offset !== len) {
1716
- if (offset !== 0) {
1717
- arg = arg.slice(offset);
1718
- }
1719
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1720
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1721
- const ret = cachedTextEncoder.encodeInto(arg, view);
1722
-
1723
- offset += ret.written;
1724
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1725
- }
1726
-
1727
- WASM_VECTOR_LEN = offset;
1728
- return ptr;
1729
- }
1730
-
1731
- function takeFromExternrefTable0(idx) {
1732
- const value = wasm.__wbindgen_externrefs.get(idx);
1733
- wasm.__wbindgen_export5(idx);
1734
- return value;
1735
- }
1736
-
1737
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1738
- cachedTextDecoder.decode();
1739
- function decodeText(ptr, len) {
1740
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1741
- }
1742
-
1743
- const cachedTextEncoder = new TextEncoder();
1744
-
1745
- if (!('encodeInto' in cachedTextEncoder)) {
1746
- cachedTextEncoder.encodeInto = function (arg, view) {
1747
- const buf = cachedTextEncoder.encode(arg);
1748
- view.set(buf);
1749
- return {
1750
- read: arg.length,
1751
- written: buf.length
1752
- };
1753
- };
1754
- }
1755
-
1756
- let WASM_VECTOR_LEN = 0;
1757
-
1758
- const wasmPath = `${__dirname}/sedimentree_wasm_bg.wasm`;
1759
- const wasmBytes = require('fs').readFileSync(wasmPath);
1760
- const wasmModule = new WebAssembly.Module(wasmBytes);
1761
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1762
- wasm.__wbindgen_start();