@automerge/subduction 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 (40) hide show
  1. package/package.json +3 -2
  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 -4621
  6. package/dist/cjs/web.cjs +0 -4572
  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 -4531
  14. package/dist/index.d.ts +0 -1634
  15. package/dist/subduction.wasm +0 -0
  16. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
  17. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
  18. package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
  19. package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
  20. package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +0 -1634
  21. package/dist/wasm_bindgen/bundler/subduction_wasm.js +0 -9
  22. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +0 -4645
  23. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
  24. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +0 -242
  25. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
  26. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
  27. package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
  28. package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
  29. package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +0 -4689
  30. package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +0 -1634
  31. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
  32. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +0 -242
  33. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
  34. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
  35. package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
  36. package/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
  37. package/dist/wasm_bindgen/web/subduction_wasm.d.ts +0 -1901
  38. package/dist/wasm_bindgen/web/subduction_wasm.js +0 -4748
  39. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
  40. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +0 -242
@@ -1,4621 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // subduction_wasm/dist/wasm_bindgen/web/subduction_wasm.js
20
- var subduction_wasm_exports = {};
21
- __export(subduction_wasm_exports, {
22
- AuthenticatedLongPoll: () => AuthenticatedLongPoll,
23
- AuthenticatedTransport: () => AuthenticatedTransport,
24
- AuthenticatedWebSocket: () => AuthenticatedWebSocket,
25
- BatchSyncRequest: () => BatchSyncRequest,
26
- BatchSyncResponse: () => BatchSyncResponse,
27
- BlobMeta: () => BlobMeta,
28
- CallError: () => CallError,
29
- CommitWithBlob: () => CommitWithBlob,
30
- Depth: () => Depth,
31
- Digest: () => Digest,
32
- Fragment: () => Fragment,
33
- FragmentRequested: () => FragmentRequested,
34
- FragmentWithBlob: () => FragmentWithBlob,
35
- FragmentsArray: () => FragmentsArray,
36
- HashMetric: () => HashMetric,
37
- LooseCommit: () => LooseCommit,
38
- MemorySigner: () => MemorySigner,
39
- MemoryStorage: () => MemoryStorage,
40
- MessagePortTransport: () => MessagePortTransport,
41
- Nonce: () => Nonce,
42
- PeerBatchSyncResult: () => PeerBatchSyncResult,
43
- PeerId: () => PeerId,
44
- PeerResultMap: () => PeerResultMap,
45
- RequestId: () => RequestId,
46
- Sedimentree: () => Sedimentree,
47
- SedimentreeId: () => SedimentreeId,
48
- SedimentreeIdsArray: () => SedimentreeIdsArray,
49
- SignedFragment: () => SignedFragment,
50
- SignedLooseCommit: () => SignedLooseCommit,
51
- Subduction: () => Subduction,
52
- SubductionHttpLongPoll: () => SubductionHttpLongPoll,
53
- SubductionLongPoll: () => SubductionLongPoll,
54
- SubductionWebSocket: () => SubductionWebSocket,
55
- SyncMessage: () => SyncMessage,
56
- SyncStats: () => SyncStats,
57
- WebCryptoSigner: () => WebCryptoSigner,
58
- __wbg_set_wasm: () => __wbg_set_wasm,
59
- default: () => __wbg_init,
60
- initSync: () => initSync,
61
- makeMessagePortTransport: () => makeMessagePortTransport,
62
- start: () => start
63
- });
64
- module.exports = __toCommonJS(subduction_wasm_exports);
65
-
66
- // subduction_wasm/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js
67
- function tryIntoJsSedimentreeIdsArray(xs) {
68
- return xs;
69
- }
70
-
71
- // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js
72
- var inline0_exports = {};
73
- __export(inline0_exports, {
74
- makeOpenPolicy: () => makeOpenPolicy
75
- });
76
- function makeOpenPolicy() {
77
- return {
78
- authorizeConnect() {
79
- return Promise.resolve();
80
- },
81
- authorizeFetch() {
82
- return Promise.resolve();
83
- },
84
- authorizePut() {
85
- return Promise.resolve();
86
- },
87
- filterAuthorizedFetch(_peer, ids) {
88
- return Promise.resolve(ids);
89
- }
90
- };
91
- }
92
-
93
- // subduction_wasm/dist/wasm_bindgen/web/subduction_wasm.js
94
- var import_meta = {};
95
- var AuthenticatedLongPoll = class _AuthenticatedLongPoll {
96
- static __wrap(ptr) {
97
- ptr = ptr >>> 0;
98
- const obj = Object.create(_AuthenticatedLongPoll.prototype);
99
- obj.__wbg_ptr = ptr;
100
- AuthenticatedLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
101
- return obj;
102
- }
103
- __destroy_into_raw() {
104
- const ptr = this.__wbg_ptr;
105
- this.__wbg_ptr = 0;
106
- AuthenticatedLongPollFinalization.unregister(this);
107
- return ptr;
108
- }
109
- free() {
110
- const ptr = this.__destroy_into_raw();
111
- wasm.__wbg_authenticatedlongpoll_free(ptr, 0);
112
- }
113
- /**
114
- * The verified peer identity.
115
- * @returns {PeerId}
116
- */
117
- get peerId() {
118
- const ret = wasm.authenticatedlongpoll_peerId(this.__wbg_ptr);
119
- return PeerId.__wrap(ret);
120
- }
121
- /**
122
- * The session ID assigned by the server.
123
- * @returns {string}
124
- */
125
- get sessionId() {
126
- let deferred1_0;
127
- let deferred1_1;
128
- try {
129
- const ret = wasm.authenticatedlongpoll_sessionId(this.__wbg_ptr);
130
- deferred1_0 = ret[0];
131
- deferred1_1 = ret[1];
132
- return getStringFromWasm0(ret[0], ret[1]);
133
- } finally {
134
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
135
- }
136
- }
137
- /**
138
- * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
139
- * @returns {AuthenticatedTransport}
140
- */
141
- toTransport() {
142
- const ptr = this.__destroy_into_raw();
143
- const ret = wasm.authenticatedlongpoll_toTransport(ptr);
144
- return AuthenticatedTransport.__wrap(ret);
145
- }
146
- };
147
- if (Symbol.dispose) AuthenticatedLongPoll.prototype[Symbol.dispose] = AuthenticatedLongPoll.prototype.free;
148
- var AuthenticatedTransport = class _AuthenticatedTransport {
149
- static __wrap(ptr) {
150
- ptr = ptr >>> 0;
151
- const obj = Object.create(_AuthenticatedTransport.prototype);
152
- obj.__wbg_ptr = ptr;
153
- AuthenticatedTransportFinalization.register(obj, obj.__wbg_ptr, obj);
154
- return obj;
155
- }
156
- __destroy_into_raw() {
157
- const ptr = this.__wbg_ptr;
158
- this.__wbg_ptr = 0;
159
- AuthenticatedTransportFinalization.unregister(this);
160
- return ptr;
161
- }
162
- free() {
163
- const ptr = this.__destroy_into_raw();
164
- wasm.__wbg_authenticatedtransport_free(ptr, 0);
165
- }
166
- /**
167
- * Accept an incoming handshake over a custom transport (responder side).
168
- *
169
- * This is the counterpart to [`setup`](Self::setup). The initiator calls
170
- * `setup`, and the responder calls `accept` over the same underlying channel.
171
- *
172
- * # Arguments
173
- *
174
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
175
- * * `signer` - The responder's signer for authentication
176
- * * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
177
- *
178
- * # Errors
179
- *
180
- * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
181
- * @param {Transport} transport
182
- * @param {any} signer
183
- * @param {number | null} [max_drift_seconds]
184
- * @param {Function | null} [on_disconnect]
185
- * @returns {Promise<AuthenticatedTransport>}
186
- */
187
- static accept(transport, signer, max_drift_seconds, on_disconnect) {
188
- const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 4294967297 : max_drift_seconds >>> 0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
189
- return ret;
190
- }
191
- /**
192
- * The verified peer identity.
193
- * @returns {PeerId}
194
- */
195
- get peerId() {
196
- const ret = wasm.authenticatedtransport_peerId(this.__wbg_ptr);
197
- return PeerId.__wrap(ret);
198
- }
199
- /**
200
- * Run the Subduction handshake over a custom transport, producing an
201
- * authenticated transport.
202
- *
203
- * The `transport` object must implement the `Transport` interface
204
- * (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`).
205
- * The same object is used for both the handshake phase and post-handshake
206
- * communication.
207
- *
208
- * # Arguments
209
- *
210
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
211
- * * `signer` - The client's signer for authentication
212
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
213
- *
214
- * # Errors
215
- *
216
- * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
217
- * @param {Transport} transport
218
- * @param {any} signer
219
- * @param {PeerId} expected_peer_id
220
- * @param {Function | null} [on_disconnect]
221
- * @returns {Promise<AuthenticatedTransport>}
222
- */
223
- static setup(transport, signer, expected_peer_id, on_disconnect) {
224
- _assertClass(expected_peer_id, PeerId);
225
- const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
226
- return ret;
227
- }
228
- /**
229
- * Run the Subduction handshake over a custom transport using discovery
230
- * mode, producing an authenticated transport.
231
- *
232
- * Unlike [`setup`](Self::setup) which requires a known peer ID,
233
- * this method discovers the peer's identity during the handshake
234
- * using a shared service name.
235
- *
236
- * # Arguments
237
- *
238
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
239
- * * `signer` - The client's signer for authentication
240
- * * `service_name` - Shared service name for discovery.
241
- * Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
242
- *
243
- * # Errors
244
- *
245
- * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
246
- * @param {Transport} transport
247
- * @param {any} signer
248
- * @param {string | null} [service_name]
249
- * @param {Function | null} [on_disconnect]
250
- * @returns {Promise<AuthenticatedTransport>}
251
- */
252
- static setupDiscover(transport, signer, service_name, on_disconnect) {
253
- var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
254
- var len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
256
- return ret;
257
- }
258
- };
259
- if (Symbol.dispose) AuthenticatedTransport.prototype[Symbol.dispose] = AuthenticatedTransport.prototype.free;
260
- var AuthenticatedWebSocket = class _AuthenticatedWebSocket {
261
- static __wrap(ptr) {
262
- ptr = ptr >>> 0;
263
- const obj = Object.create(_AuthenticatedWebSocket.prototype);
264
- obj.__wbg_ptr = ptr;
265
- AuthenticatedWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
266
- return obj;
267
- }
268
- __destroy_into_raw() {
269
- const ptr = this.__wbg_ptr;
270
- this.__wbg_ptr = 0;
271
- AuthenticatedWebSocketFinalization.unregister(this);
272
- return ptr;
273
- }
274
- free() {
275
- const ptr = this.__destroy_into_raw();
276
- wasm.__wbg_authenticatedwebsocket_free(ptr, 0);
277
- }
278
- /**
279
- * The verified peer identity.
280
- * @returns {PeerId}
281
- */
282
- get peerId() {
283
- const ret = wasm.authenticatedwebsocket_peerId(this.__wbg_ptr);
284
- return PeerId.__wrap(ret);
285
- }
286
- /**
287
- * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
288
- * @returns {AuthenticatedTransport}
289
- */
290
- toTransport() {
291
- const ptr = this.__destroy_into_raw();
292
- const ret = wasm.authenticatedwebsocket_toTransport(ptr);
293
- return AuthenticatedTransport.__wrap(ret);
294
- }
295
- };
296
- if (Symbol.dispose) AuthenticatedWebSocket.prototype[Symbol.dispose] = AuthenticatedWebSocket.prototype.free;
297
- var BatchSyncRequest = class _BatchSyncRequest {
298
- static __wrap(ptr) {
299
- ptr = ptr >>> 0;
300
- const obj = Object.create(_BatchSyncRequest.prototype);
301
- obj.__wbg_ptr = ptr;
302
- BatchSyncRequestFinalization.register(obj, obj.__wbg_ptr, obj);
303
- return obj;
304
- }
305
- __destroy_into_raw() {
306
- const ptr = this.__wbg_ptr;
307
- this.__wbg_ptr = 0;
308
- BatchSyncRequestFinalization.unregister(this);
309
- return ptr;
310
- }
311
- free() {
312
- const ptr = this.__destroy_into_raw();
313
- wasm.__wbg_batchsyncrequest_free(ptr, 0);
314
- }
315
- /**
316
- * The sedimentree ID this request corresponds to.
317
- * @returns {SedimentreeId}
318
- */
319
- id() {
320
- const ret = wasm.batchsyncrequest_id(this.__wbg_ptr);
321
- return SedimentreeId.__wrap(ret);
322
- }
323
- /**
324
- * The request ID for this request.
325
- * @returns {RequestId}
326
- */
327
- request_id() {
328
- const ret = wasm.batchsyncrequest_request_id(this.__wbg_ptr);
329
- return RequestId.__wrap(ret);
330
- }
331
- /**
332
- * Whether this request subscribes to future updates.
333
- * @returns {boolean}
334
- */
335
- subscribe() {
336
- const ret = wasm.batchsyncrequest_subscribe(this.__wbg_ptr);
337
- return ret !== 0;
338
- }
339
- };
340
- if (Symbol.dispose) BatchSyncRequest.prototype[Symbol.dispose] = BatchSyncRequest.prototype.free;
341
- var BatchSyncResponse = class _BatchSyncResponse {
342
- static __wrap(ptr) {
343
- ptr = ptr >>> 0;
344
- const obj = Object.create(_BatchSyncResponse.prototype);
345
- obj.__wbg_ptr = ptr;
346
- BatchSyncResponseFinalization.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
- BatchSyncResponseFinalization.unregister(this);
353
- return ptr;
354
- }
355
- free() {
356
- const ptr = this.__destroy_into_raw();
357
- wasm.__wbg_batchsyncresponse_free(ptr, 0);
358
- }
359
- /**
360
- * Upcasts; to the JS-import type for [`WasmBatchSyncResponse`].
361
- * @returns {BatchSyncResponse}
362
- */
363
- __wasm_refgen_toWasmBatchSyncResponse() {
364
- const ret = wasm.batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse(this.__wbg_ptr);
365
- return _BatchSyncResponse.__wrap(ret);
366
- }
367
- /**
368
- * The sedimentree ID this response corresponds to.
369
- * @returns {SedimentreeId}
370
- */
371
- id() {
372
- const ret = wasm.batchsyncresponse_id(this.__wbg_ptr);
373
- return SedimentreeId.__wrap(ret);
374
- }
375
- /**
376
- * The request ID this response corresponds to.
377
- * @returns {RequestId}
378
- */
379
- request_id() {
380
- const ret = wasm.batchsyncresponse_request_id(this.__wbg_ptr);
381
- return RequestId.__wrap(ret);
382
- }
383
- };
384
- if (Symbol.dispose) BatchSyncResponse.prototype[Symbol.dispose] = BatchSyncResponse.prototype.free;
385
- var BlobMeta = class _BlobMeta {
386
- static __wrap(ptr) {
387
- ptr = ptr >>> 0;
388
- const obj = Object.create(_BlobMeta.prototype);
389
- obj.__wbg_ptr = ptr;
390
- BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
391
- return obj;
392
- }
393
- __destroy_into_raw() {
394
- const ptr = this.__wbg_ptr;
395
- this.__wbg_ptr = 0;
396
- BlobMetaFinalization.unregister(this);
397
- return ptr;
398
- }
399
- free() {
400
- const ptr = this.__destroy_into_raw();
401
- wasm.__wbg_blobmeta_free(ptr, 0);
402
- }
403
- /**
404
- * Get the digest of the blob.
405
- * @returns {Digest}
406
- */
407
- digest() {
408
- const ret = wasm.blobmeta_digest(this.__wbg_ptr);
409
- return Digest.__wrap(ret);
410
- }
411
- /**
412
- * Create a `BlobMeta` from a digest and size.
413
- *
414
- * This is useful for deserialization when the original blob is not available.
415
- * Since this is manual, the caller must ensure the digest and size are correct.
416
- * @param {Digest} digest
417
- * @param {bigint} size_bytes
418
- * @returns {BlobMeta}
419
- */
420
- static fromDigestSize(digest, size_bytes) {
421
- _assertClass(digest, Digest);
422
- const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
423
- return _BlobMeta.__wrap(ret);
424
- }
425
- /**
426
- * Create a new `BlobMeta` from the given blob contents.
427
- * @param {Uint8Array} blob
428
- */
429
- constructor(blob) {
430
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
431
- const len0 = WASM_VECTOR_LEN;
432
- const ret = wasm.blobmeta_new(ptr0, len0);
433
- this.__wbg_ptr = ret >>> 0;
434
- BlobMetaFinalization.register(this, this.__wbg_ptr, this);
435
- return this;
436
- }
437
- /**
438
- * Get the size of the blob in bytes.
439
- * @returns {bigint}
440
- */
441
- get sizeBytes() {
442
- const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
443
- return BigInt.asUintN(64, ret);
444
- }
445
- };
446
- if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
447
- var CallError = class {
448
- __destroy_into_raw() {
449
- const ptr = this.__wbg_ptr;
450
- this.__wbg_ptr = 0;
451
- CallErrorFinalization.unregister(this);
452
- return ptr;
453
- }
454
- free() {
455
- const ptr = this.__destroy_into_raw();
456
- wasm.__wbg_callerror_free(ptr, 0);
457
- }
458
- };
459
- if (Symbol.dispose) CallError.prototype[Symbol.dispose] = CallError.prototype.free;
460
- var CommitWithBlob = class _CommitWithBlob {
461
- static __wrap(ptr) {
462
- ptr = ptr >>> 0;
463
- const obj = Object.create(_CommitWithBlob.prototype);
464
- obj.__wbg_ptr = ptr;
465
- CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
466
- return obj;
467
- }
468
- __destroy_into_raw() {
469
- const ptr = this.__wbg_ptr;
470
- this.__wbg_ptr = 0;
471
- CommitWithBlobFinalization.unregister(this);
472
- return ptr;
473
- }
474
- free() {
475
- const ptr = this.__destroy_into_raw();
476
- wasm.__wbg_commitwithblob_free(ptr, 0);
477
- }
478
- /**
479
- * Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
480
- * @returns {CommitWithBlob}
481
- */
482
- __wasm_refgen_toWasmCommitWithBlob() {
483
- const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
484
- return _CommitWithBlob.__wrap(ret);
485
- }
486
- /**
487
- * Get the blob.
488
- * @returns {Uint8Array}
489
- */
490
- get blob() {
491
- const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
492
- return ret;
493
- }
494
- /**
495
- * Create a new commit with blob.
496
- * @param {SignedLooseCommit} signed
497
- * @param {Uint8Array} blob
498
- */
499
- constructor(signed, blob) {
500
- _assertClass(signed, SignedLooseCommit);
501
- var ptr0 = signed.__destroy_into_raw();
502
- const ret = wasm.commitwithblob_new(ptr0, blob);
503
- this.__wbg_ptr = ret >>> 0;
504
- CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
505
- return this;
506
- }
507
- /**
508
- * Get the signed commit.
509
- * @returns {SignedLooseCommit}
510
- */
511
- get signed() {
512
- const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
513
- return SignedLooseCommit.__wrap(ret);
514
- }
515
- };
516
- if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
517
- var Depth = class _Depth {
518
- static __wrap(ptr) {
519
- ptr = ptr >>> 0;
520
- const obj = Object.create(_Depth.prototype);
521
- obj.__wbg_ptr = ptr;
522
- DepthFinalization.register(obj, obj.__wbg_ptr, obj);
523
- return obj;
524
- }
525
- __destroy_into_raw() {
526
- const ptr = this.__wbg_ptr;
527
- this.__wbg_ptr = 0;
528
- DepthFinalization.unregister(this);
529
- return ptr;
530
- }
531
- free() {
532
- const ptr = this.__destroy_into_raw();
533
- wasm.__wbg_depth_free(ptr, 0);
534
- }
535
- /**
536
- * Internal method for a hack crossing the JS boundary.
537
- * @returns {Depth}
538
- */
539
- __subduction_castToDepth() {
540
- const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
541
- return _Depth.__wrap(ret);
542
- }
543
- /**
544
- * Upcasts; to the JS-import type for [`WasmDepth`].
545
- * @returns {Depth}
546
- */
547
- __wasm_refgen_toWasmDepth() {
548
- const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
549
- return _Depth.__wrap(ret);
550
- }
551
- /**
552
- * Creates a new `WasmDepth` from a JavaScript value.
553
- *
554
- * # Errors
555
- *
556
- * Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
557
- * @param {any} js_value
558
- */
559
- constructor(js_value) {
560
- const ret = wasm.depth_new(js_value);
561
- if (ret[2]) {
562
- throw takeFromExternrefTable0(ret[1]);
563
- }
564
- this.__wbg_ptr = ret[0] >>> 0;
565
- DepthFinalization.register(this, this.__wbg_ptr, this);
566
- return this;
567
- }
568
- /**
569
- * The depth value as an integer.
570
- * @returns {number}
571
- */
572
- get value() {
573
- const ret = wasm.depth_value(this.__wbg_ptr);
574
- return ret >>> 0;
575
- }
576
- };
577
- if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
578
- var Digest = class _Digest {
579
- static __wrap(ptr) {
580
- ptr = ptr >>> 0;
581
- const obj = Object.create(_Digest.prototype);
582
- obj.__wbg_ptr = ptr;
583
- DigestFinalization.register(obj, obj.__wbg_ptr, obj);
584
- return obj;
585
- }
586
- static __unwrap(jsValue) {
587
- if (!(jsValue instanceof _Digest)) {
588
- return 0;
589
- }
590
- return jsValue.__destroy_into_raw();
591
- }
592
- __destroy_into_raw() {
593
- const ptr = this.__wbg_ptr;
594
- this.__wbg_ptr = 0;
595
- DigestFinalization.unregister(this);
596
- return ptr;
597
- }
598
- free() {
599
- const ptr = this.__destroy_into_raw();
600
- wasm.__wbg_digest_free(ptr, 0);
601
- }
602
- /**
603
- * Upcasts; to the JS-import type for [`WasmDigest`].
604
- * @returns {Digest}
605
- */
606
- __wasm_refgen_toWasmDigest() {
607
- const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
608
- return _Digest.__wrap(ret);
609
- }
610
- /**
611
- * Creates a new digest from its Base58 string representation.
612
- *
613
- * # Errors
614
- *
615
- * Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
616
- * @param {string} s
617
- * @returns {Digest}
618
- */
619
- static fromBase58(s) {
620
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
621
- const len0 = WASM_VECTOR_LEN;
622
- const ret = wasm.digest_fromBase58(ptr0, len0);
623
- if (ret[2]) {
624
- throw takeFromExternrefTable0(ret[1]);
625
- }
626
- return _Digest.__wrap(ret[0]);
627
- }
628
- /**
629
- * Creates a new digest from its byte representation.
630
- *
631
- * # Errors
632
- *
633
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
634
- * @param {Uint8Array} bytes
635
- * @returns {Digest}
636
- */
637
- static fromBytes(bytes) {
638
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
639
- const len0 = WASM_VECTOR_LEN;
640
- const ret = wasm.digest_fromBytes(ptr0, len0);
641
- if (ret[2]) {
642
- throw takeFromExternrefTable0(ret[1]);
643
- }
644
- return _Digest.__wrap(ret[0]);
645
- }
646
- /**
647
- * Creates a new digest from its hexadecimal string representation.
648
- *
649
- * # Errors
650
- *
651
- * Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
652
- * @param {string} s
653
- * @returns {Digest}
654
- */
655
- static fromHexString(s) {
656
- const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
657
- const len0 = WASM_VECTOR_LEN;
658
- const ret = wasm.digest_fromHexString(ptr0, len0);
659
- if (ret[2]) {
660
- throw takeFromExternrefTable0(ret[1]);
661
- }
662
- return _Digest.__wrap(ret[0]);
663
- }
664
- /**
665
- * Creates a new digest from its byte representation.
666
- *
667
- * # Errors
668
- *
669
- * Returns a `WasmValue` error if the byte slice is not a valid digest.
670
- * @param {Uint8Array} bytes
671
- */
672
- constructor(bytes) {
673
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
674
- const len0 = WASM_VECTOR_LEN;
675
- const ret = wasm.digest_new(ptr0, len0);
676
- if (ret[2]) {
677
- throw takeFromExternrefTable0(ret[1]);
678
- }
679
- this.__wbg_ptr = ret[0] >>> 0;
680
- DigestFinalization.register(this, this.__wbg_ptr, this);
681
- return this;
682
- }
683
- /**
684
- * Returns the byte representation of the digest.
685
- * @returns {Uint8Array}
686
- */
687
- toBytes() {
688
- const ret = wasm.digest_toBytes(this.__wbg_ptr);
689
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
690
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
691
- return v1;
692
- }
693
- /**
694
- * Returns the hexadecimal string representation of the digest.
695
- * @returns {string}
696
- */
697
- toHexString() {
698
- let deferred1_0;
699
- let deferred1_1;
700
- try {
701
- const ret = wasm.digest_toHexString(this.__wbg_ptr);
702
- deferred1_0 = ret[0];
703
- deferred1_1 = ret[1];
704
- return getStringFromWasm0(ret[0], ret[1]);
705
- } finally {
706
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
707
- }
708
- }
709
- };
710
- if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
711
- var Fragment = class _Fragment {
712
- static __wrap(ptr) {
713
- ptr = ptr >>> 0;
714
- const obj = Object.create(_Fragment.prototype);
715
- obj.__wbg_ptr = ptr;
716
- FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
717
- return obj;
718
- }
719
- __destroy_into_raw() {
720
- const ptr = this.__wbg_ptr;
721
- this.__wbg_ptr = 0;
722
- FragmentFinalization.unregister(this);
723
- return ptr;
724
- }
725
- free() {
726
- const ptr = this.__destroy_into_raw();
727
- wasm.__wbg_fragment_free(ptr, 0);
728
- }
729
- /**
730
- * Upcasts; to the JS-import type for [`WasmFragment`].
731
- * @returns {Fragment}
732
- */
733
- __wasm_refgen_toWasmFragment() {
734
- const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
735
- return _Fragment.__wrap(ret);
736
- }
737
- /**
738
- * Get the blob metadata of the fragment.
739
- * @returns {BlobMeta}
740
- */
741
- get blobMeta() {
742
- const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
743
- return BlobMeta.__wrap(ret);
744
- }
745
- /**
746
- * Get the boundary digests of the fragment.
747
- * @returns {Digest[]}
748
- */
749
- get boundary() {
750
- const ret = wasm.fragment_boundary(this.__wbg_ptr);
751
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
752
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
753
- return v1;
754
- }
755
- /**
756
- * Get the head digest of the fragment.
757
- * @returns {Digest}
758
- */
759
- get head() {
760
- const ret = wasm.fragment_head(this.__wbg_ptr);
761
- return Digest.__wrap(ret);
762
- }
763
- /**
764
- * Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
765
- * @param {SedimentreeId} sedimentree_id
766
- * @param {Digest} head
767
- * @param {Digest[]} boundary
768
- * @param {Digest[]} checkpoints
769
- * @param {BlobMeta} blob_meta
770
- */
771
- constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
772
- _assertClass(sedimentree_id, SedimentreeId);
773
- var ptr0 = sedimentree_id.__destroy_into_raw();
774
- _assertClass(head, Digest);
775
- var ptr1 = head.__destroy_into_raw();
776
- const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
777
- const len2 = WASM_VECTOR_LEN;
778
- const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
779
- const len3 = WASM_VECTOR_LEN;
780
- _assertClass(blob_meta, BlobMeta);
781
- var ptr4 = blob_meta.__destroy_into_raw();
782
- const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
783
- this.__wbg_ptr = ret >>> 0;
784
- FragmentFinalization.register(this, this.__wbg_ptr, this);
785
- return this;
786
- }
787
- };
788
- if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
789
- var FragmentRequested = class _FragmentRequested {
790
- static __wrap(ptr) {
791
- ptr = ptr >>> 0;
792
- const obj = Object.create(_FragmentRequested.prototype);
793
- obj.__wbg_ptr = ptr;
794
- FragmentRequestedFinalization.register(obj, obj.__wbg_ptr, obj);
795
- return obj;
796
- }
797
- __destroy_into_raw() {
798
- const ptr = this.__wbg_ptr;
799
- this.__wbg_ptr = 0;
800
- FragmentRequestedFinalization.unregister(this);
801
- return ptr;
802
- }
803
- free() {
804
- const ptr = this.__destroy_into_raw();
805
- wasm.__wbg_fragmentrequested_free(ptr, 0);
806
- }
807
- /**
808
- * Get the depth of the requested fragment.
809
- * @returns {Depth}
810
- */
811
- get depth() {
812
- const ret = wasm.fragmentrequested_depth(this.__wbg_ptr);
813
- return Depth.__wrap(ret);
814
- }
815
- /**
816
- * Get the digest of the requested fragment.
817
- * @returns {Digest}
818
- */
819
- get head() {
820
- const ret = wasm.fragmentrequested_head(this.__wbg_ptr);
821
- return Digest.__wrap(ret);
822
- }
823
- /**
824
- * Create a new fragment request from the given digest.
825
- * @param {Digest} digest
826
- * @param {Depth} depth
827
- */
828
- constructor(digest, depth) {
829
- _assertClass(digest, Digest);
830
- _assertClass(depth, Depth);
831
- const ret = wasm.fragmentrequested_new(digest.__wbg_ptr, depth.__wbg_ptr);
832
- this.__wbg_ptr = ret >>> 0;
833
- FragmentRequestedFinalization.register(this, this.__wbg_ptr, this);
834
- return this;
835
- }
836
- };
837
- if (Symbol.dispose) FragmentRequested.prototype[Symbol.dispose] = FragmentRequested.prototype.free;
838
- var FragmentWithBlob = class _FragmentWithBlob {
839
- static __wrap(ptr) {
840
- ptr = ptr >>> 0;
841
- const obj = Object.create(_FragmentWithBlob.prototype);
842
- obj.__wbg_ptr = ptr;
843
- FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
844
- return obj;
845
- }
846
- __destroy_into_raw() {
847
- const ptr = this.__wbg_ptr;
848
- this.__wbg_ptr = 0;
849
- FragmentWithBlobFinalization.unregister(this);
850
- return ptr;
851
- }
852
- free() {
853
- const ptr = this.__destroy_into_raw();
854
- wasm.__wbg_fragmentwithblob_free(ptr, 0);
855
- }
856
- /**
857
- * Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
858
- * @returns {FragmentWithBlob}
859
- */
860
- __wasm_refgen_toWasmFragmentWithBlob() {
861
- const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
862
- return _FragmentWithBlob.__wrap(ret);
863
- }
864
- /**
865
- * Get the blob.
866
- * @returns {Uint8Array}
867
- */
868
- get blob() {
869
- const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
870
- return ret;
871
- }
872
- /**
873
- * Create a new fragment with blob.
874
- * @param {SignedFragment} signed
875
- * @param {Uint8Array} blob
876
- */
877
- constructor(signed, blob) {
878
- _assertClass(signed, SignedFragment);
879
- var ptr0 = signed.__destroy_into_raw();
880
- const ret = wasm.fragmentwithblob_new(ptr0, blob);
881
- this.__wbg_ptr = ret >>> 0;
882
- FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
883
- return this;
884
- }
885
- /**
886
- * Get the signed fragment.
887
- * @returns {SignedFragment}
888
- */
889
- get signed() {
890
- const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
891
- return SignedFragment.__wrap(ret);
892
- }
893
- };
894
- if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
895
- var FragmentsArray = class _FragmentsArray {
896
- static __wrap(ptr) {
897
- ptr = ptr >>> 0;
898
- const obj = Object.create(_FragmentsArray.prototype);
899
- obj.__wbg_ptr = ptr;
900
- FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
901
- return obj;
902
- }
903
- __destroy_into_raw() {
904
- const ptr = this.__wbg_ptr;
905
- this.__wbg_ptr = 0;
906
- FragmentsArrayFinalization.unregister(this);
907
- return ptr;
908
- }
909
- free() {
910
- const ptr = this.__destroy_into_raw();
911
- wasm.__wbg_fragmentsarray_free(ptr, 0);
912
- }
913
- /**
914
- * Upcasts; to the JS-import type for [`WasmFragmentsArray`].
915
- * @returns {FragmentsArray}
916
- */
917
- __wasm_refgen_toWasmFragmentsArray() {
918
- const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
919
- return _FragmentsArray.__wrap(ret);
920
- }
921
- };
922
- if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
923
- var HashMetric = class {
924
- __destroy_into_raw() {
925
- const ptr = this.__wbg_ptr;
926
- this.__wbg_ptr = 0;
927
- HashMetricFinalization.unregister(this);
928
- return ptr;
929
- }
930
- free() {
931
- const ptr = this.__destroy_into_raw();
932
- wasm.__wbg_hashmetric_free(ptr, 0);
933
- }
934
- /**
935
- * Create a new `WasmHashMetric` with an optional JavaScript function.
936
- *
937
- * Defaults to counting leading zero bytes if no function is provided.
938
- * @param {Function | null} [func]
939
- */
940
- constructor(func) {
941
- const ret = wasm.hashmetric_new(isLikeNone(func) ? 0 : addToExternrefTable0(func));
942
- this.__wbg_ptr = ret >>> 0;
943
- HashMetricFinalization.register(this, this.__wbg_ptr, this);
944
- return this;
945
- }
946
- };
947
- if (Symbol.dispose) HashMetric.prototype[Symbol.dispose] = HashMetric.prototype.free;
948
- var LooseCommit = class _LooseCommit {
949
- static __wrap(ptr) {
950
- ptr = ptr >>> 0;
951
- const obj = Object.create(_LooseCommit.prototype);
952
- obj.__wbg_ptr = ptr;
953
- LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
954
- return obj;
955
- }
956
- __destroy_into_raw() {
957
- const ptr = this.__wbg_ptr;
958
- this.__wbg_ptr = 0;
959
- LooseCommitFinalization.unregister(this);
960
- return ptr;
961
- }
962
- free() {
963
- const ptr = this.__destroy_into_raw();
964
- wasm.__wbg_loosecommit_free(ptr, 0);
965
- }
966
- /**
967
- * Upcasts; to the JS-import type for [`WasmLooseCommit`].
968
- * @returns {LooseCommit}
969
- */
970
- __wasm_refgen_toWasmLooseCommit() {
971
- const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
972
- return _LooseCommit.__wrap(ret);
973
- }
974
- /**
975
- * Get the blob metadata of the commit.
976
- * @returns {BlobMeta}
977
- */
978
- get blobMeta() {
979
- const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
980
- return BlobMeta.__wrap(ret);
981
- }
982
- /**
983
- * Get the digest of the commit.
984
- * @returns {Digest}
985
- */
986
- get digest() {
987
- const ret = wasm.loosecommit_digest(this.__wbg_ptr);
988
- return Digest.__wrap(ret);
989
- }
990
- /**
991
- * Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
992
- * @param {SedimentreeId} sedimentree_id
993
- * @param {Digest[]} parents
994
- * @param {BlobMeta} blob_meta
995
- */
996
- constructor(sedimentree_id, parents, blob_meta) {
997
- _assertClass(sedimentree_id, SedimentreeId);
998
- var ptr0 = sedimentree_id.__destroy_into_raw();
999
- const ptr1 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
1000
- const len1 = WASM_VECTOR_LEN;
1001
- _assertClass(blob_meta, BlobMeta);
1002
- const ret = wasm.loosecommit_new(ptr0, ptr1, len1, blob_meta.__wbg_ptr);
1003
- this.__wbg_ptr = ret >>> 0;
1004
- LooseCommitFinalization.register(this, this.__wbg_ptr, this);
1005
- return this;
1006
- }
1007
- /**
1008
- * Get the parent digests of the commit.
1009
- * @returns {Digest[]}
1010
- */
1011
- get parents() {
1012
- const ret = wasm.loosecommit_parents(this.__wbg_ptr);
1013
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1014
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1015
- return v1;
1016
- }
1017
- };
1018
- if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
1019
- var MemorySigner = class _MemorySigner {
1020
- static __wrap(ptr) {
1021
- ptr = ptr >>> 0;
1022
- const obj = Object.create(_MemorySigner.prototype);
1023
- obj.__wbg_ptr = ptr;
1024
- MemorySignerFinalization.register(obj, obj.__wbg_ptr, obj);
1025
- return obj;
1026
- }
1027
- __destroy_into_raw() {
1028
- const ptr = this.__wbg_ptr;
1029
- this.__wbg_ptr = 0;
1030
- MemorySignerFinalization.unregister(this);
1031
- return ptr;
1032
- }
1033
- free() {
1034
- const ptr = this.__destroy_into_raw();
1035
- wasm.__wbg_memorysigner_free(ptr, 0);
1036
- }
1037
- /**
1038
- * Create a signer from raw 32-byte Ed25519 secret key bytes.
1039
- *
1040
- * # Errors
1041
- *
1042
- * Returns an error if `bytes` is not exactly 32 bytes.
1043
- * @param {Uint8Array} bytes
1044
- * @returns {MemorySigner}
1045
- */
1046
- static fromBytes(bytes) {
1047
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1048
- const len0 = WASM_VECTOR_LEN;
1049
- const ret = wasm.memorysigner_fromBytes(ptr0, len0);
1050
- if (ret[2]) {
1051
- throw takeFromExternrefTable0(ret[1]);
1052
- }
1053
- return _MemorySigner.__wrap(ret[0]);
1054
- }
1055
- /**
1056
- * Create a new signer with a randomly generated Ed25519 key.
1057
- *
1058
- * # Panics
1059
- *
1060
- * Panics if the system random number generator fails.
1061
- * @returns {MemorySigner}
1062
- */
1063
- static generate() {
1064
- const ret = wasm.memorysigner_generate();
1065
- return _MemorySigner.__wrap(ret);
1066
- }
1067
- /**
1068
- * Create a new signer with a randomly generated Ed25519 key.
1069
- *
1070
- * This is the JS constructor (`new MemorySigner()`), equivalent to
1071
- * [`generate`](Self::generate).
1072
- *
1073
- * # Panics
1074
- *
1075
- * Panics if the system random number generator fails.
1076
- */
1077
- constructor() {
1078
- const ret = wasm.memorysigner_new();
1079
- this.__wbg_ptr = ret >>> 0;
1080
- MemorySignerFinalization.register(this, this.__wbg_ptr, this);
1081
- return this;
1082
- }
1083
- /**
1084
- * Get the peer ID derived from this signer's verifying key.
1085
- * @returns {PeerId}
1086
- */
1087
- peerId() {
1088
- const ret = wasm.memorysigner_peerId(this.__wbg_ptr);
1089
- return PeerId.__wrap(ret);
1090
- }
1091
- /**
1092
- * Sign a message and return the 64-byte Ed25519 signature as a `Uint8Array`.
1093
- *
1094
- * This fulfils the `Signer.sign(message)` interface contract.
1095
- * Returns a `Promise<Uint8Array>` for consistency with the async signer interface.
1096
- * @param {Uint8Array} message
1097
- * @returns {Promise<Uint8Array>}
1098
- */
1099
- sign(message) {
1100
- const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
1101
- const len0 = WASM_VECTOR_LEN;
1102
- const ret = wasm.memorysigner_sign(this.__wbg_ptr, ptr0, len0);
1103
- return ret;
1104
- }
1105
- /**
1106
- * Get the 32-byte Ed25519 verifying (public) key as a `Uint8Array`.
1107
- *
1108
- * This fulfils the `Signer.verifyingKey()` interface contract.
1109
- * @returns {Uint8Array}
1110
- */
1111
- verifyingKey() {
1112
- const ret = wasm.memorysigner_verifyingKey(this.__wbg_ptr);
1113
- return ret;
1114
- }
1115
- };
1116
- if (Symbol.dispose) MemorySigner.prototype[Symbol.dispose] = MemorySigner.prototype.free;
1117
- var MemoryStorage = class {
1118
- __destroy_into_raw() {
1119
- const ptr = this.__wbg_ptr;
1120
- this.__wbg_ptr = 0;
1121
- MemoryStorageFinalization.unregister(this);
1122
- return ptr;
1123
- }
1124
- free() {
1125
- const ptr = this.__destroy_into_raw();
1126
- wasm.__wbg_memorystorage_free(ptr, 0);
1127
- }
1128
- /**
1129
- * Delete all commits for a sedimentree.
1130
- * @param {SedimentreeId} sedimentree_id
1131
- * @returns {Promise<any>}
1132
- */
1133
- deleteAllCommits(sedimentree_id) {
1134
- _assertClass(sedimentree_id, SedimentreeId);
1135
- const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1136
- return ret;
1137
- }
1138
- /**
1139
- * Delete all fragments for a sedimentree.
1140
- * @param {SedimentreeId} sedimentree_id
1141
- * @returns {Promise<any>}
1142
- */
1143
- deleteAllFragments(sedimentree_id) {
1144
- _assertClass(sedimentree_id, SedimentreeId);
1145
- const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1146
- return ret;
1147
- }
1148
- /**
1149
- * Delete a commit by digest.
1150
- * @param {SedimentreeId} sedimentree_id
1151
- * @param {Digest} digest
1152
- * @returns {Promise<any>}
1153
- */
1154
- deleteCommit(sedimentree_id, digest) {
1155
- _assertClass(sedimentree_id, SedimentreeId);
1156
- _assertClass(digest, Digest);
1157
- const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1158
- return ret;
1159
- }
1160
- /**
1161
- * Delete a fragment by digest.
1162
- * @param {SedimentreeId} sedimentree_id
1163
- * @param {Digest} digest
1164
- * @returns {Promise<any>}
1165
- */
1166
- deleteFragment(sedimentree_id, digest) {
1167
- _assertClass(sedimentree_id, SedimentreeId);
1168
- _assertClass(digest, Digest);
1169
- const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1170
- return ret;
1171
- }
1172
- /**
1173
- * Delete a sedimentree ID.
1174
- * @param {SedimentreeId} sedimentree_id
1175
- * @returns {Promise<any>}
1176
- */
1177
- deleteSedimentreeId(sedimentree_id) {
1178
- _assertClass(sedimentree_id, SedimentreeId);
1179
- const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1180
- return ret;
1181
- }
1182
- /**
1183
- * List all commit digests for a sedimentree.
1184
- * @param {SedimentreeId} sedimentree_id
1185
- * @returns {Promise<any>}
1186
- */
1187
- listCommitDigests(sedimentree_id) {
1188
- _assertClass(sedimentree_id, SedimentreeId);
1189
- const ret = wasm.memorystorage_listCommitDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1190
- return ret;
1191
- }
1192
- /**
1193
- * List all fragment digests for a sedimentree.
1194
- * @param {SedimentreeId} sedimentree_id
1195
- * @returns {Promise<any>}
1196
- */
1197
- listFragmentDigests(sedimentree_id) {
1198
- _assertClass(sedimentree_id, SedimentreeId);
1199
- const ret = wasm.memorystorage_listFragmentDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1200
- return ret;
1201
- }
1202
- /**
1203
- * Load all commits for a sedimentree, returning `CommitWithBlob[]`.
1204
- * @param {SedimentreeId} sedimentree_id
1205
- * @returns {Promise<any>}
1206
- */
1207
- loadAllCommits(sedimentree_id) {
1208
- _assertClass(sedimentree_id, SedimentreeId);
1209
- const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1210
- return ret;
1211
- }
1212
- /**
1213
- * Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
1214
- * @param {SedimentreeId} sedimentree_id
1215
- * @returns {Promise<any>}
1216
- */
1217
- loadAllFragments(sedimentree_id) {
1218
- _assertClass(sedimentree_id, SedimentreeId);
1219
- const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1220
- return ret;
1221
- }
1222
- /**
1223
- * Load all sedimentree IDs.
1224
- * @returns {Promise<any>}
1225
- */
1226
- loadAllSedimentreeIds() {
1227
- const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
1228
- return ret;
1229
- }
1230
- /**
1231
- * Load a commit by digest, returning `CommitWithBlob` or null.
1232
- * @param {SedimentreeId} sedimentree_id
1233
- * @param {Digest} digest
1234
- * @returns {Promise<any>}
1235
- */
1236
- loadCommit(sedimentree_id, digest) {
1237
- _assertClass(sedimentree_id, SedimentreeId);
1238
- _assertClass(digest, Digest);
1239
- const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1240
- return ret;
1241
- }
1242
- /**
1243
- * Load a fragment by digest, returning `FragmentWithBlob` or null.
1244
- * @param {SedimentreeId} sedimentree_id
1245
- * @param {Digest} digest
1246
- * @returns {Promise<any>}
1247
- */
1248
- loadFragment(sedimentree_id, digest) {
1249
- _assertClass(sedimentree_id, SedimentreeId);
1250
- _assertClass(digest, Digest);
1251
- const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
1252
- return ret;
1253
- }
1254
- /**
1255
- * Create a new in-memory storage instance.
1256
- */
1257
- constructor() {
1258
- const ret = wasm.memorystorage_new();
1259
- this.__wbg_ptr = ret >>> 0;
1260
- MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
1261
- return this;
1262
- }
1263
- /**
1264
- * Save a commit with its blob.
1265
- * @param {SedimentreeId} sedimentree_id
1266
- * @param {Digest} _digest
1267
- * @param {SignedLooseCommit} signed_commit
1268
- * @param {Uint8Array} blob
1269
- * @returns {Promise<any>}
1270
- */
1271
- saveCommit(sedimentree_id, _digest, signed_commit, blob) {
1272
- _assertClass(sedimentree_id, SedimentreeId);
1273
- _assertClass(_digest, Digest);
1274
- _assertClass(signed_commit, SignedLooseCommit);
1275
- const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_commit.__wbg_ptr, blob);
1276
- return ret;
1277
- }
1278
- /**
1279
- * Save a fragment with its blob.
1280
- * @param {SedimentreeId} sedimentree_id
1281
- * @param {Digest} _digest
1282
- * @param {SignedFragment} signed_fragment
1283
- * @param {Uint8Array} blob
1284
- * @returns {Promise<any>}
1285
- */
1286
- saveFragment(sedimentree_id, _digest, signed_fragment, blob) {
1287
- _assertClass(sedimentree_id, SedimentreeId);
1288
- _assertClass(_digest, Digest);
1289
- _assertClass(signed_fragment, SignedFragment);
1290
- const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
1291
- return ret;
1292
- }
1293
- /**
1294
- * Save a sedimentree ID.
1295
- * @param {SedimentreeId} sedimentree_id
1296
- * @returns {Promise<any>}
1297
- */
1298
- saveSedimentreeId(sedimentree_id) {
1299
- _assertClass(sedimentree_id, SedimentreeId);
1300
- const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
1301
- return ret;
1302
- }
1303
- };
1304
- if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
1305
- var MessagePortTransport = class _MessagePortTransport {
1306
- static __wrap(ptr) {
1307
- ptr = ptr >>> 0;
1308
- const obj = Object.create(_MessagePortTransport.prototype);
1309
- obj.__wbg_ptr = ptr;
1310
- MessagePortTransportFinalization.register(obj, obj.__wbg_ptr, obj);
1311
- return obj;
1312
- }
1313
- __destroy_into_raw() {
1314
- const ptr = this.__wbg_ptr;
1315
- this.__wbg_ptr = 0;
1316
- MessagePortTransportFinalization.unregister(this);
1317
- return ptr;
1318
- }
1319
- free() {
1320
- const ptr = this.__destroy_into_raw();
1321
- wasm.__wbg_messageporttransport_free(ptr, 0);
1322
- }
1323
- /**
1324
- * Disconnect (close the port) and fire the `onDisconnect` callback if registered.
1325
- * @returns {Promise<any>}
1326
- */
1327
- disconnect() {
1328
- const ret = wasm.messageporttransport_disconnect(this.__wbg_ptr);
1329
- return ret;
1330
- }
1331
- /**
1332
- * Create a new connection wrapping the given `MessagePort`.
1333
- * @param {any} port
1334
- */
1335
- constructor(port) {
1336
- const ret = wasm.messageporttransport_new(port);
1337
- this.__wbg_ptr = ret >>> 0;
1338
- MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
1339
- return this;
1340
- }
1341
- /**
1342
- * Register a callback to be invoked when the transport disconnects.
1343
- *
1344
- * Part of the [`Transport`](super::JsTransport) interface contract.
1345
- * Typically called by internal wiring rather than directly by user code.
1346
- * @param {Function} callback
1347
- */
1348
- onDisconnect(callback) {
1349
- wasm.messageporttransport_onDisconnect(this.__wbg_ptr, callback);
1350
- }
1351
- /**
1352
- * Receive raw bytes (for the handshake phase).
1353
- * @returns {Promise<any>}
1354
- */
1355
- recvBytes() {
1356
- const ret = wasm.messageporttransport_recvBytes(this.__wbg_ptr);
1357
- return ret;
1358
- }
1359
- /**
1360
- * Send raw bytes (for the handshake phase).
1361
- * @param {Uint8Array} bytes
1362
- * @returns {Promise<any>}
1363
- */
1364
- sendBytes(bytes) {
1365
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1366
- const len0 = WASM_VECTOR_LEN;
1367
- const ret = wasm.messageporttransport_sendBytes(this.__wbg_ptr, ptr0, len0);
1368
- return ret;
1369
- }
1370
- };
1371
- if (Symbol.dispose) MessagePortTransport.prototype[Symbol.dispose] = MessagePortTransport.prototype.free;
1372
- var Nonce = class _Nonce {
1373
- static __wrap(ptr) {
1374
- ptr = ptr >>> 0;
1375
- const obj = Object.create(_Nonce.prototype);
1376
- obj.__wbg_ptr = ptr;
1377
- NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1378
- return obj;
1379
- }
1380
- __destroy_into_raw() {
1381
- const ptr = this.__wbg_ptr;
1382
- this.__wbg_ptr = 0;
1383
- NonceFinalization.unregister(this);
1384
- return ptr;
1385
- }
1386
- free() {
1387
- const ptr = this.__destroy_into_raw();
1388
- wasm.__wbg_nonce_free(ptr, 0);
1389
- }
1390
- /**
1391
- * Get the nonce as big-endian bytes.
1392
- * @returns {Uint8Array}
1393
- */
1394
- get bytes() {
1395
- const ret = wasm.nonce_bytes(this.__wbg_ptr);
1396
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1397
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1398
- return v1;
1399
- }
1400
- /**
1401
- * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1402
- *
1403
- * # Errors
1404
- *
1405
- * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1406
- * @param {Uint8Array} bytes
1407
- */
1408
- constructor(bytes) {
1409
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1410
- const len0 = WASM_VECTOR_LEN;
1411
- const ret = wasm.nonce_new(ptr0, len0);
1412
- if (ret[2]) {
1413
- throw takeFromExternrefTable0(ret[1]);
1414
- }
1415
- this.__wbg_ptr = ret[0] >>> 0;
1416
- NonceFinalization.register(this, this.__wbg_ptr, this);
1417
- return this;
1418
- }
1419
- /**
1420
- * Generate a random nonce.
1421
- *
1422
- * # Panics
1423
- *
1424
- * Panics if the system random number generator fails.
1425
- * @returns {Nonce}
1426
- */
1427
- static random() {
1428
- const ret = wasm.nonce_random();
1429
- return _Nonce.__wrap(ret);
1430
- }
1431
- };
1432
- if (Symbol.dispose) Nonce.prototype[Symbol.dispose] = Nonce.prototype.free;
1433
- var PeerBatchSyncResult = class _PeerBatchSyncResult {
1434
- static __wrap(ptr) {
1435
- ptr = ptr >>> 0;
1436
- const obj = Object.create(_PeerBatchSyncResult.prototype);
1437
- obj.__wbg_ptr = ptr;
1438
- PeerBatchSyncResultFinalization.register(obj, obj.__wbg_ptr, obj);
1439
- return obj;
1440
- }
1441
- __destroy_into_raw() {
1442
- const ptr = this.__wbg_ptr;
1443
- this.__wbg_ptr = 0;
1444
- PeerBatchSyncResultFinalization.unregister(this);
1445
- return ptr;
1446
- }
1447
- free() {
1448
- const ptr = this.__destroy_into_raw();
1449
- wasm.__wbg_peerbatchsyncresult_free(ptr, 0);
1450
- }
1451
- /**
1452
- * Statistics about the sync operation.
1453
- * @returns {SyncStats}
1454
- */
1455
- get stats() {
1456
- const ret = wasm.peerbatchsyncresult_stats(this.__wbg_ptr);
1457
- return SyncStats.__wrap(ret);
1458
- }
1459
- /**
1460
- * Whether the batch sync was successful with at least one connection.
1461
- * @returns {boolean}
1462
- */
1463
- get success() {
1464
- const ret = wasm.peerbatchsyncresult_success(this.__wbg_ptr);
1465
- return ret !== 0;
1466
- }
1467
- /**
1468
- * Errors that occurred during the batch sync.
1469
- * @returns {Error[]}
1470
- */
1471
- get transportErrors() {
1472
- const ret = wasm.peerbatchsyncresult_transportErrors(this.__wbg_ptr);
1473
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1474
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1475
- return v1;
1476
- }
1477
- };
1478
- if (Symbol.dispose) PeerBatchSyncResult.prototype[Symbol.dispose] = PeerBatchSyncResult.prototype.free;
1479
- var PeerId = class _PeerId {
1480
- static __wrap(ptr) {
1481
- ptr = ptr >>> 0;
1482
- const obj = Object.create(_PeerId.prototype);
1483
- obj.__wbg_ptr = ptr;
1484
- PeerIdFinalization.register(obj, obj.__wbg_ptr, obj);
1485
- return obj;
1486
- }
1487
- __destroy_into_raw() {
1488
- const ptr = this.__wbg_ptr;
1489
- this.__wbg_ptr = 0;
1490
- PeerIdFinalization.unregister(this);
1491
- return ptr;
1492
- }
1493
- free() {
1494
- const ptr = this.__destroy_into_raw();
1495
- wasm.__wbg_peerid_free(ptr, 0);
1496
- }
1497
- /**
1498
- * Creates a new `WasmPeerId` from a `PeerId`.
1499
- *
1500
- * # Errors
1501
- *
1502
- * Returns a `WasmInvalidPeerId` if the provided byte slice is not exactly 32 bytes long.
1503
- * @param {Uint8Array} bytes
1504
- */
1505
- constructor(bytes) {
1506
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1507
- const len0 = WASM_VECTOR_LEN;
1508
- const ret = wasm.peerid_new(ptr0, len0);
1509
- if (ret[2]) {
1510
- throw takeFromExternrefTable0(ret[1]);
1511
- }
1512
- this.__wbg_ptr = ret[0] >>> 0;
1513
- PeerIdFinalization.register(this, this.__wbg_ptr, this);
1514
- return this;
1515
- }
1516
- /**
1517
- * Returns the byte representation of the `PeerId`.
1518
- * @returns {Uint8Array}
1519
- */
1520
- toBytes() {
1521
- const ret = wasm.peerid_toBytes(this.__wbg_ptr);
1522
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1523
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1524
- return v1;
1525
- }
1526
- /**
1527
- * Returns the string representation of the `PeerId`.
1528
- * @returns {string}
1529
- */
1530
- toString() {
1531
- let deferred1_0;
1532
- let deferred1_1;
1533
- try {
1534
- const ret = wasm.peerid_toString(this.__wbg_ptr);
1535
- deferred1_0 = ret[0];
1536
- deferred1_1 = ret[1];
1537
- return getStringFromWasm0(ret[0], ret[1]);
1538
- } finally {
1539
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1540
- }
1541
- }
1542
- };
1543
- if (Symbol.dispose) PeerId.prototype[Symbol.dispose] = PeerId.prototype.free;
1544
- var PeerResultMap = class _PeerResultMap {
1545
- static __wrap(ptr) {
1546
- ptr = ptr >>> 0;
1547
- const obj = Object.create(_PeerResultMap.prototype);
1548
- obj.__wbg_ptr = ptr;
1549
- PeerResultMapFinalization.register(obj, obj.__wbg_ptr, obj);
1550
- return obj;
1551
- }
1552
- __destroy_into_raw() {
1553
- const ptr = this.__wbg_ptr;
1554
- this.__wbg_ptr = 0;
1555
- PeerResultMapFinalization.unregister(this);
1556
- return ptr;
1557
- }
1558
- free() {
1559
- const ptr = this.__destroy_into_raw();
1560
- wasm.__wbg_peerresultmap_free(ptr, 0);
1561
- }
1562
- /**
1563
- * Get all entries in the peer result map.
1564
- * @returns {PeerBatchSyncResult[]}
1565
- */
1566
- entries() {
1567
- const ret = wasm.peerresultmap_entries(this.__wbg_ptr);
1568
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1569
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1570
- return v1;
1571
- }
1572
- /**
1573
- * Get the result for a specific peer ID.
1574
- * @param {PeerId} peer_id
1575
- * @returns {PeerBatchSyncResult | undefined}
1576
- */
1577
- getResult(peer_id) {
1578
- _assertClass(peer_id, PeerId);
1579
- const ret = wasm.peerresultmap_getResult(this.__wbg_ptr, peer_id.__wbg_ptr);
1580
- return ret === 0 ? void 0 : PeerBatchSyncResult.__wrap(ret);
1581
- }
1582
- };
1583
- if (Symbol.dispose) PeerResultMap.prototype[Symbol.dispose] = PeerResultMap.prototype.free;
1584
- var RequestId = class _RequestId {
1585
- static __wrap(ptr) {
1586
- ptr = ptr >>> 0;
1587
- const obj = Object.create(_RequestId.prototype);
1588
- obj.__wbg_ptr = ptr;
1589
- RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
1590
- return obj;
1591
- }
1592
- __destroy_into_raw() {
1593
- const ptr = this.__wbg_ptr;
1594
- this.__wbg_ptr = 0;
1595
- RequestIdFinalization.unregister(this);
1596
- return ptr;
1597
- }
1598
- free() {
1599
- const ptr = this.__destroy_into_raw();
1600
- wasm.__wbg_requestid_free(ptr, 0);
1601
- }
1602
- /**
1603
- * Upcasts; to the JS-import type for [`WasmRequestId`].
1604
- * @returns {RequestId}
1605
- */
1606
- __wasm_refgen_toWasmRequestId() {
1607
- const ret = wasm.requestid___wasm_refgen_toWasmRequestId(this.__wbg_ptr);
1608
- return _RequestId.__wrap(ret);
1609
- }
1610
- /**
1611
- * Create a new [`RequestId`] from a requestor peer ID and nonce.
1612
- * @param {PeerId} requestor
1613
- * @param {Nonce} nonce
1614
- */
1615
- constructor(requestor, nonce) {
1616
- _assertClass(requestor, PeerId);
1617
- _assertClass(nonce, Nonce);
1618
- const ret = wasm.requestid_new(requestor.__wbg_ptr, nonce.__wbg_ptr);
1619
- this.__wbg_ptr = ret >>> 0;
1620
- RequestIdFinalization.register(this, this.__wbg_ptr, this);
1621
- return this;
1622
- }
1623
- /**
1624
- * The request nonce.
1625
- * @returns {Nonce}
1626
- */
1627
- get nonce() {
1628
- const ret = wasm.requestid_nonce(this.__wbg_ptr);
1629
- return Nonce.__wrap(ret);
1630
- }
1631
- /**
1632
- * The peer ID of the requestor.
1633
- * @returns {PeerId}
1634
- */
1635
- get requestor() {
1636
- const ret = wasm.requestid_requestor(this.__wbg_ptr);
1637
- return PeerId.__wrap(ret);
1638
- }
1639
- };
1640
- if (Symbol.dispose) RequestId.prototype[Symbol.dispose] = RequestId.prototype.free;
1641
- var Sedimentree = class _Sedimentree {
1642
- static __wrap(ptr) {
1643
- ptr = ptr >>> 0;
1644
- const obj = Object.create(_Sedimentree.prototype);
1645
- obj.__wbg_ptr = ptr;
1646
- SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
1647
- return obj;
1648
- }
1649
- __destroy_into_raw() {
1650
- const ptr = this.__wbg_ptr;
1651
- this.__wbg_ptr = 0;
1652
- SedimentreeFinalization.unregister(this);
1653
- return ptr;
1654
- }
1655
- free() {
1656
- const ptr = this.__destroy_into_raw();
1657
- wasm.__wbg_sedimentree_free(ptr, 0);
1658
- }
1659
- /**
1660
- * Create an empty Sedimentree.
1661
- * @returns {Sedimentree}
1662
- */
1663
- static empty() {
1664
- const ret = wasm.sedimentree_empty();
1665
- return _Sedimentree.__wrap(ret);
1666
- }
1667
- /**
1668
- * Create a new Sedimentree from fragments and loose commits.
1669
- * @param {Fragment[]} fragments
1670
- * @param {LooseCommit[]} commits
1671
- */
1672
- constructor(fragments, commits) {
1673
- const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
1674
- const len0 = WASM_VECTOR_LEN;
1675
- const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
1676
- const len1 = WASM_VECTOR_LEN;
1677
- const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
1678
- this.__wbg_ptr = ret >>> 0;
1679
- SedimentreeFinalization.register(this, this.__wbg_ptr, this);
1680
- return this;
1681
- }
1682
- };
1683
- if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
1684
- var SedimentreeId = class _SedimentreeId {
1685
- static __wrap(ptr) {
1686
- ptr = ptr >>> 0;
1687
- const obj = Object.create(_SedimentreeId.prototype);
1688
- obj.__wbg_ptr = ptr;
1689
- SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
1690
- return obj;
1691
- }
1692
- static __unwrap(jsValue) {
1693
- if (!(jsValue instanceof _SedimentreeId)) {
1694
- return 0;
1695
- }
1696
- return jsValue.__destroy_into_raw();
1697
- }
1698
- __destroy_into_raw() {
1699
- const ptr = this.__wbg_ptr;
1700
- this.__wbg_ptr = 0;
1701
- SedimentreeIdFinalization.unregister(this);
1702
- return ptr;
1703
- }
1704
- free() {
1705
- const ptr = this.__destroy_into_raw();
1706
- wasm.__wbg_sedimentreeid_free(ptr, 0);
1707
- }
1708
- /**
1709
- * Upcasts; to the JS-import type for [`WasmSedimentreeId`].
1710
- * @returns {SedimentreeId}
1711
- */
1712
- __wasm_refgen_toWasmSedimentreeId() {
1713
- const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
1714
- return _SedimentreeId.__wrap(ret);
1715
- }
1716
- /**
1717
- * Create an ID from a byte array.
1718
- *
1719
- * # Errors
1720
- *
1721
- * Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
1722
- * @param {Uint8Array} bytes
1723
- * @returns {SedimentreeId}
1724
- */
1725
- static fromBytes(bytes) {
1726
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1727
- const len0 = WASM_VECTOR_LEN;
1728
- const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
1729
- if (ret[2]) {
1730
- throw takeFromExternrefTable0(ret[1]);
1731
- }
1732
- return _SedimentreeId.__wrap(ret[0]);
1733
- }
1734
- /**
1735
- * Returns the raw bytes of this ID.
1736
- * @returns {Uint8Array}
1737
- */
1738
- toBytes() {
1739
- const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
1740
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1741
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1742
- return v1;
1743
- }
1744
- /**
1745
- * Returns the string representation of the ID.
1746
- * @returns {string}
1747
- */
1748
- toString() {
1749
- let deferred1_0;
1750
- let deferred1_1;
1751
- try {
1752
- const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
1753
- deferred1_0 = ret[0];
1754
- deferred1_1 = ret[1];
1755
- return getStringFromWasm0(ret[0], ret[1]);
1756
- } finally {
1757
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1758
- }
1759
- }
1760
- };
1761
- if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
1762
- var SedimentreeIdsArray = class _SedimentreeIdsArray {
1763
- static __wrap(ptr) {
1764
- ptr = ptr >>> 0;
1765
- const obj = Object.create(_SedimentreeIdsArray.prototype);
1766
- obj.__wbg_ptr = ptr;
1767
- SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
1768
- return obj;
1769
- }
1770
- __destroy_into_raw() {
1771
- const ptr = this.__wbg_ptr;
1772
- this.__wbg_ptr = 0;
1773
- SedimentreeIdsArrayFinalization.unregister(this);
1774
- return ptr;
1775
- }
1776
- free() {
1777
- const ptr = this.__destroy_into_raw();
1778
- wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
1779
- }
1780
- /**
1781
- * Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
1782
- * @returns {SedimentreeIdsArray}
1783
- */
1784
- __wasm_refgen_toWasmSedimentreeIdsArray() {
1785
- const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
1786
- return _SedimentreeIdsArray.__wrap(ret);
1787
- }
1788
- };
1789
- if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
1790
- var SignedFragment = class _SignedFragment {
1791
- static __wrap(ptr) {
1792
- ptr = ptr >>> 0;
1793
- const obj = Object.create(_SignedFragment.prototype);
1794
- obj.__wbg_ptr = ptr;
1795
- SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
1796
- return obj;
1797
- }
1798
- __destroy_into_raw() {
1799
- const ptr = this.__wbg_ptr;
1800
- this.__wbg_ptr = 0;
1801
- SignedFragmentFinalization.unregister(this);
1802
- return ptr;
1803
- }
1804
- free() {
1805
- const ptr = this.__destroy_into_raw();
1806
- wasm.__wbg_signedfragment_free(ptr, 0);
1807
- }
1808
- /**
1809
- * Upcasts; to the JS-import type for [`WasmSignedFragment`].
1810
- * @returns {SignedFragment}
1811
- */
1812
- __wasm_refgen_toWasmSignedFragment() {
1813
- const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
1814
- return _SignedFragment.__wrap(ret);
1815
- }
1816
- /**
1817
- * Encode this signed fragment to raw bytes.
1818
- * @returns {Uint8Array}
1819
- */
1820
- encode() {
1821
- const ret = wasm.signedfragment_encode(this.__wbg_ptr);
1822
- return ret;
1823
- }
1824
- /**
1825
- * Get the unsigned payload without re-verifying the signature.
1826
- *
1827
- * # Errors
1828
- *
1829
- * Returns an error if the payload cannot be decoded.
1830
- * @returns {Fragment}
1831
- */
1832
- get payload() {
1833
- const ret = wasm.signedfragment_payload(this.__wbg_ptr);
1834
- if (ret[2]) {
1835
- throw takeFromExternrefTable0(ret[1]);
1836
- }
1837
- return Fragment.__wrap(ret[0]);
1838
- }
1839
- /**
1840
- * Decode a `SignedFragment` from raw bytes.
1841
- *
1842
- * # Errors
1843
- *
1844
- * Returns an error if the bytes are not a valid signed fragment.
1845
- * @param {Uint8Array} bytes
1846
- * @returns {SignedFragment}
1847
- */
1848
- static tryDecode(bytes) {
1849
- const ret = wasm.signedfragment_tryDecode(bytes);
1850
- if (ret[2]) {
1851
- throw takeFromExternrefTable0(ret[1]);
1852
- }
1853
- return _SignedFragment.__wrap(ret[0]);
1854
- }
1855
- };
1856
- if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
1857
- var SignedLooseCommit = class _SignedLooseCommit {
1858
- static __wrap(ptr) {
1859
- ptr = ptr >>> 0;
1860
- const obj = Object.create(_SignedLooseCommit.prototype);
1861
- obj.__wbg_ptr = ptr;
1862
- SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
1863
- return obj;
1864
- }
1865
- __destroy_into_raw() {
1866
- const ptr = this.__wbg_ptr;
1867
- this.__wbg_ptr = 0;
1868
- SignedLooseCommitFinalization.unregister(this);
1869
- return ptr;
1870
- }
1871
- free() {
1872
- const ptr = this.__destroy_into_raw();
1873
- wasm.__wbg_signedloosecommit_free(ptr, 0);
1874
- }
1875
- /**
1876
- * Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
1877
- * @returns {SignedLooseCommit}
1878
- */
1879
- __wasm_refgen_toWasmSignedLooseCommit() {
1880
- const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
1881
- return _SignedLooseCommit.__wrap(ret);
1882
- }
1883
- /**
1884
- * Encode this signed loose commit to raw bytes.
1885
- * @returns {Uint8Array}
1886
- */
1887
- encode() {
1888
- const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
1889
- return ret;
1890
- }
1891
- /**
1892
- * Get the unsigned payload without re-verifying the signature.
1893
- *
1894
- * # Errors
1895
- *
1896
- * Returns an error if the payload cannot be decoded.
1897
- * @returns {LooseCommit}
1898
- */
1899
- get payload() {
1900
- const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
1901
- if (ret[2]) {
1902
- throw takeFromExternrefTable0(ret[1]);
1903
- }
1904
- return LooseCommit.__wrap(ret[0]);
1905
- }
1906
- /**
1907
- * Decode a `SignedLooseCommit` from raw bytes.
1908
- *
1909
- * # Errors
1910
- *
1911
- * Returns an error if the bytes are not a valid signed loose commit.
1912
- * @param {Uint8Array} bytes
1913
- * @returns {SignedLooseCommit}
1914
- */
1915
- static tryDecode(bytes) {
1916
- const ret = wasm.signedloosecommit_tryDecode(bytes);
1917
- if (ret[2]) {
1918
- throw takeFromExternrefTable0(ret[1]);
1919
- }
1920
- return _SignedLooseCommit.__wrap(ret[0]);
1921
- }
1922
- };
1923
- if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
1924
- var Subduction = class _Subduction {
1925
- static __wrap(ptr) {
1926
- ptr = ptr >>> 0;
1927
- const obj = Object.create(_Subduction.prototype);
1928
- obj.__wbg_ptr = ptr;
1929
- SubductionFinalization.register(obj, obj.__wbg_ptr, obj);
1930
- return obj;
1931
- }
1932
- __destroy_into_raw() {
1933
- const ptr = this.__wbg_ptr;
1934
- this.__wbg_ptr = 0;
1935
- SubductionFinalization.unregister(this);
1936
- return ptr;
1937
- }
1938
- free() {
1939
- const ptr = this.__destroy_into_raw();
1940
- wasm.__wbg_subduction_free(ptr, 0);
1941
- }
1942
- /**
1943
- * Accept a connection from a peer over any [`Transport`](JsTransport).
1944
- *
1945
- * Performs the responder side of the handshake, then adds the authenticated
1946
- * connection. This is the counterpart to [`connectTransport`](Self::connect_transport).
1947
- *
1948
- * # Arguments
1949
- *
1950
- * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
1951
- * * `service_name` - Shared service name for discovery
1952
- *
1953
- * # Errors
1954
- *
1955
- * Returns an error if the handshake or connection fails.
1956
- * @param {Transport} transport
1957
- * @param {string} service_name
1958
- * @returns {Promise<PeerId>}
1959
- */
1960
- acceptTransport(transport, service_name) {
1961
- const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1962
- const len0 = WASM_VECTOR_LEN;
1963
- const ret = wasm.subduction_acceptTransport(this.__wbg_ptr, transport, ptr0, len0);
1964
- return ret;
1965
- }
1966
- /**
1967
- * Add a commit with its associated blob to the storage.
1968
- *
1969
- * The commit metadata (including `BlobMeta`) is computed internally from
1970
- * the provided blob, ensuring consistency by construction.
1971
- *
1972
- * # Errors
1973
- *
1974
- * Returns a [`WasmWriteError`] if storage, networking, or policy fail.
1975
- * @param {SedimentreeId} id
1976
- * @param {Digest[]} parents
1977
- * @param {Uint8Array} blob
1978
- * @returns {Promise<FragmentRequested | undefined>}
1979
- */
1980
- addCommit(id, parents, blob) {
1981
- _assertClass(id, SedimentreeId);
1982
- const ptr0 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
1983
- const len0 = WASM_VECTOR_LEN;
1984
- const ret = wasm.subduction_addCommit(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0, blob);
1985
- return ret;
1986
- }
1987
- /**
1988
- * Onboard an authenticated transport: add it and sync all sedimentrees.
1989
- *
1990
- * Accepts an [`AuthenticatedTransport`](WasmAuthenticatedTransport),
1991
- * obtained via [`AuthenticatedTransport.setup`](WasmAuthenticatedTransport::setup),
1992
- * [`AuthenticatedWebSocket.toTransport`], or [`AuthenticatedLongPoll.toTransport`].
1993
- *
1994
- * Returns `true` if this is a new peer, `false` if already connected.
1995
- *
1996
- * Add an authenticated transport to tracking.
1997
- *
1998
- * This does not perform any synchronization. To sync after adding,
1999
- * call [`fullSyncWithPeer`](Self::full_sync_with_peer).
2000
- *
2001
- * Returns `true` if this is a new peer, `false` if already connected.
2002
- *
2003
- * # Errors
2004
- *
2005
- * Returns an error if the connection is rejected by the policy.
2006
- * @param {AuthenticatedTransport} transport
2007
- * @returns {Promise<boolean>}
2008
- */
2009
- addConnection(transport) {
2010
- _assertClass(transport, AuthenticatedTransport);
2011
- const ret = wasm.subduction_addConnection(this.__wbg_ptr, transport.__wbg_ptr);
2012
- return ret;
2013
- }
2014
- /**
2015
- * Add a fragment with its associated blob to the storage.
2016
- *
2017
- * The fragment metadata (including `BlobMeta`) is computed internally from
2018
- * the provided blob, ensuring consistency by construction.
2019
- *
2020
- * # Errors
2021
- *
2022
- * Returns a [`WasmWriteError`] if storage, networking, or policy fail.
2023
- * @param {SedimentreeId} id
2024
- * @param {Digest} head
2025
- * @param {Digest[]} boundary
2026
- * @param {Digest[]} checkpoints
2027
- * @param {Uint8Array} blob
2028
- * @returns {Promise<void>}
2029
- */
2030
- addFragment(id, head, boundary, checkpoints, blob) {
2031
- _assertClass(id, SedimentreeId);
2032
- _assertClass(head, Digest);
2033
- const ptr0 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
2034
- const len0 = WASM_VECTOR_LEN;
2035
- const ptr1 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
2036
- const len1 = WASM_VECTOR_LEN;
2037
- const ret = wasm.subduction_addFragment(this.__wbg_ptr, id.__wbg_ptr, head.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
2038
- return ret;
2039
- }
2040
- /**
2041
- * Add a Sedimentree.
2042
- *
2043
- * # Errors
2044
- *
2045
- * Returns [`WasmWriteError`] if there is a problem with storage, networking, or policy.
2046
- * @param {SedimentreeId} id
2047
- * @param {Sedimentree} sedimentree
2048
- * @param {Uint8Array[]} blobs
2049
- * @returns {Promise<void>}
2050
- */
2051
- addSedimentree(id, sedimentree, blobs) {
2052
- _assertClass(id, SedimentreeId);
2053
- _assertClass(sedimentree, Sedimentree);
2054
- const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2055
- const len0 = WASM_VECTOR_LEN;
2056
- const ret = wasm.subduction_addSedimentree(this.__wbg_ptr, id.__wbg_ptr, sedimentree.__wbg_ptr, ptr0, len0);
2057
- return ret;
2058
- }
2059
- /**
2060
- * Connect to a peer via WebSocket and add the connection.
2061
- *
2062
- * This performs the cryptographic handshake, verifies the server's identity,
2063
- * and adds the authenticated connection for syncing.
2064
- *
2065
- * Returns the verified peer ID on success.
2066
- *
2067
- * # Arguments
2068
- *
2069
- * * `address` - The WebSocket URL to connect to
2070
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2071
- *
2072
- * # Errors
2073
- *
2074
- * Returns an error if connection, handshake, or adding the connection fails.
2075
- * @param {URL} address
2076
- * @param {PeerId} expected_peer_id
2077
- * @returns {Promise<PeerId>}
2078
- */
2079
- connect(address, expected_peer_id) {
2080
- _assertClass(expected_peer_id, PeerId);
2081
- const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr);
2082
- return ret;
2083
- }
2084
- /**
2085
- * Connect to a peer via WebSocket using discovery mode and add the connection.
2086
- *
2087
- * Returns the discovered and verified peer ID on success.
2088
- *
2089
- * # Arguments
2090
- *
2091
- * * `address` - The WebSocket URL to connect to
2092
- * * `timeout_milliseconds` - Request timeout in milliseconds (defaults to 30000)
2093
- * * `service_name` - The service name for discovery (defaults to URL host)
2094
- *
2095
- * # Errors
2096
- *
2097
- * Returns an error if connection, handshake, or adding the connection fails.
2098
- * @param {URL} address
2099
- * @param {string | null} [service_name]
2100
- * @returns {Promise<PeerId>}
2101
- */
2102
- connectDiscover(address, service_name) {
2103
- var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2104
- var len0 = WASM_VECTOR_LEN;
2105
- const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, ptr0, len0);
2106
- return ret;
2107
- }
2108
- /**
2109
- * Connect to a peer via HTTP long-poll using discovery mode.
2110
- *
2111
- * Returns the discovered and verified peer ID on success.
2112
- *
2113
- * # Arguments
2114
- *
2115
- * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2116
- * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2117
- * * `service_name` - The service name for discovery (defaults to `base_url`)
2118
- *
2119
- * # Errors
2120
- *
2121
- * Returns an error if connection, handshake, or adding the connection fails.
2122
- * @param {string} base_url
2123
- * @param {string | null} [service_name]
2124
- * @returns {Promise<PeerId>}
2125
- */
2126
- connectDiscoverLongPoll(base_url, service_name) {
2127
- const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2128
- const len0 = WASM_VECTOR_LEN;
2129
- var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2130
- var len1 = WASM_VECTOR_LEN;
2131
- const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2132
- return ret;
2133
- }
2134
- /**
2135
- * Connect to a peer via HTTP long-poll and add the connection.
2136
- *
2137
- * Returns the verified peer ID on success.
2138
- *
2139
- * # Arguments
2140
- *
2141
- * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2142
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2143
- * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2144
- *
2145
- * # Errors
2146
- *
2147
- * Returns an error if connection, handshake, or adding the connection fails.
2148
- * @param {string} base_url
2149
- * @param {PeerId} expected_peer_id
2150
- * @returns {Promise<PeerId>}
2151
- */
2152
- connectLongPoll(base_url, expected_peer_id) {
2153
- const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2154
- const len0 = WASM_VECTOR_LEN;
2155
- _assertClass(expected_peer_id, PeerId);
2156
- const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr);
2157
- return ret;
2158
- }
2159
- /**
2160
- * Connect to a peer over any [`Transport`](JsTransport) using discovery mode.
2161
- *
2162
- * Performs a discovery handshake, then adds the authenticated connection.
2163
- * The peer's identity is discovered during the handshake.
2164
- *
2165
- * # Arguments
2166
- *
2167
- * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2168
- * * `service_name` - Shared service name for discovery
2169
- *
2170
- * # Errors
2171
- *
2172
- * Returns an error if the handshake or connection fails.
2173
- * @param {Transport} transport
2174
- * @param {string} service_name
2175
- * @returns {Promise<PeerId>}
2176
- */
2177
- connectTransport(transport, service_name) {
2178
- const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2179
- const len0 = WASM_VECTOR_LEN;
2180
- const ret = wasm.subduction_connectTransport(this.__wbg_ptr, transport, ptr0, len0);
2181
- return ret;
2182
- }
2183
- /**
2184
- * Disconnect from all peers.
2185
- *
2186
- * # Errors
2187
- *
2188
- * Returns a [`WasmDisconnectionError`] if disconnection was not graceful.
2189
- * @returns {Promise<void>}
2190
- */
2191
- disconnectAll() {
2192
- const ret = wasm.subduction_disconnectAll(this.__wbg_ptr);
2193
- return ret;
2194
- }
2195
- /**
2196
- * Disconnect from a peer by its ID.
2197
- *
2198
- * # Errors
2199
- *
2200
- * Returns a `WasmDisconnectionError` if disconnection fails.
2201
- * @param {PeerId} peer_id
2202
- * @returns {Promise<boolean>}
2203
- */
2204
- disconnectFromPeer(peer_id) {
2205
- _assertClass(peer_id, PeerId);
2206
- const ret = wasm.subduction_disconnectFromPeer(this.__wbg_ptr, peer_id.__wbg_ptr);
2207
- return ret;
2208
- }
2209
- /**
2210
- * Fetch blobs by their digests, with an optional timeout in milliseconds.
2211
- *
2212
- * # Errors
2213
- *
2214
- * Returns a [`WasmIoError`] if storage or networking fail.
2215
- * @param {SedimentreeId} id
2216
- * @param {bigint | null} [timeout_milliseconds]
2217
- * @returns {Promise<Uint8Array[] | undefined>}
2218
- */
2219
- fetchBlobs(id, timeout_milliseconds) {
2220
- _assertClass(id, SedimentreeId);
2221
- const ret = wasm.subduction_fetchBlobs(this.__wbg_ptr, id.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2222
- return ret;
2223
- }
2224
- /**
2225
- * Sync all known Sedimentree IDs with all connected peers.
2226
- * @param {bigint | null} [timeout_milliseconds]
2227
- * @returns {Promise<PeerBatchSyncResult>}
2228
- */
2229
- fullSyncWithAllPeers(timeout_milliseconds) {
2230
- const ret = wasm.subduction_fullSyncWithAllPeers(this.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2231
- return ret;
2232
- }
2233
- /**
2234
- * Sync all known Sedimentree IDs with a single peer.
2235
- *
2236
- * # Arguments
2237
- *
2238
- * * `peer_id` - The peer to sync with
2239
- * * `subscribe` - Whether to subscribe to future updates (default: `true`)
2240
- * * `timeout_milliseconds` - Per-call timeout in milliseconds
2241
- * @param {PeerId} peer_id
2242
- * @param {boolean | null} [subscribe]
2243
- * @param {bigint | null} [timeout_milliseconds]
2244
- * @returns {Promise<PeerBatchSyncResult>}
2245
- */
2246
- fullSyncWithPeer(peer_id, subscribe, timeout_milliseconds) {
2247
- _assertClass(peer_id, PeerId);
2248
- const ret = wasm.subduction_fullSyncWithPeer(this.__wbg_ptr, peer_id.__wbg_ptr, isLikeNone(subscribe) ? 16777215 : subscribe ? 1 : 0, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2249
- return ret;
2250
- }
2251
- /**
2252
- * Get a local blob by its digest.
2253
- *
2254
- * # Errors
2255
- *
2256
- * Returns a [`JsStorageError`] if JS storage fails.
2257
- * @param {SedimentreeId} id
2258
- * @param {Digest} digest
2259
- * @returns {Promise<Uint8Array | undefined>}
2260
- */
2261
- getBlob(id, digest) {
2262
- _assertClass(id, SedimentreeId);
2263
- _assertClass(digest, Digest);
2264
- const ret = wasm.subduction_getBlob(this.__wbg_ptr, id.__wbg_ptr, digest.__wbg_ptr);
2265
- return ret;
2266
- }
2267
- /**
2268
- * Get all local blobs for a given Sedimentree ID.
2269
- *
2270
- * # Errors
2271
- *
2272
- * Returns a [`JsStorageError`] if JS storage fails.
2273
- * @param {SedimentreeId} id
2274
- * @returns {Promise<Uint8Array[]>}
2275
- */
2276
- getBlobs(id) {
2277
- _assertClass(id, SedimentreeId);
2278
- const ret = wasm.subduction_getBlobs(this.__wbg_ptr, id.__wbg_ptr);
2279
- return ret;
2280
- }
2281
- /**
2282
- * Get all commits for a given Sedimentree ID
2283
- * @param {SedimentreeId} id
2284
- * @returns {Promise<LooseCommit[] | undefined>}
2285
- */
2286
- getCommits(id) {
2287
- _assertClass(id, SedimentreeId);
2288
- const ret = wasm.subduction_getCommits(this.__wbg_ptr, id.__wbg_ptr);
2289
- return ret;
2290
- }
2291
- /**
2292
- * Get the peer IDs of all connected peers.
2293
- * @returns {Promise<PeerId[]>}
2294
- */
2295
- getConnectedPeerIds() {
2296
- const ret = wasm.subduction_getConnectedPeerIds(this.__wbg_ptr);
2297
- return ret;
2298
- }
2299
- /**
2300
- * Get all fragments for a given Sedimentree ID
2301
- * @param {SedimentreeId} id
2302
- * @returns {Promise<Fragment[] | undefined>}
2303
- */
2304
- getFragments(id) {
2305
- _assertClass(id, SedimentreeId);
2306
- const ret = wasm.subduction_getFragments(this.__wbg_ptr, id.__wbg_ptr);
2307
- return ret;
2308
- }
2309
- /**
2310
- * Hydrate a [`Subduction`] instance from external storage.
2311
- *
2312
- * Loads all sedimentree data from storage and reconstructs the in-memory
2313
- * state before initializing the sync engine.
2314
- *
2315
- * # Arguments
2316
- *
2317
- * * `signer` - The cryptographic signer for this node's identity
2318
- * * `storage` - Storage backend for persisting data
2319
- * * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
2320
- * When set, clients can connect without knowing the server's peer ID.
2321
- * * `hash_metric_override` - Optional custom depth metric function
2322
- * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2323
- *
2324
- * # Panics
2325
- *
2326
- * Panics if `hash_metric_override` is `Some` but the underlying JS value
2327
- * cannot be cast to a `Function`.
2328
- *
2329
- * # Errors
2330
- *
2331
- * Returns [`WasmHydrationError`] if hydration fails.
2332
- * @param {any} signer
2333
- * @param {SedimentreeStorage} storage
2334
- * @param {string | null} [service_name]
2335
- * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2336
- * @param {number | null} [max_pending_blob_requests]
2337
- * @param {any | null} [policy]
2338
- * @param {Function | null} [on_remote_heads]
2339
- * @param {Function | null} [on_ephemeral]
2340
- * @returns {Promise<Subduction>}
2341
- */
2342
- static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
2343
- var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2344
- var len0 = WASM_VECTOR_LEN;
2345
- const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2346
- return ret;
2347
- }
2348
- /**
2349
- * Link two local [`Subduction`](WasmSubduction) instances over a
2350
- * [`MessageChannel`](web_sys::MessageChannel).
2351
- *
2352
- * Creates a `MessageChannel`, performs a discovery handshake between
2353
- * the two instances, and adds the connections to both. This is the
2354
- * simplest way to sync two local instances.
2355
- *
2356
- * # Errors
2357
- *
2358
- * Returns an error if the handshake or connection fails.
2359
- * @param {Subduction} a
2360
- * @param {Subduction} b
2361
- * @returns {Promise<void>}
2362
- */
2363
- static link(a, b) {
2364
- _assertClass(a, _Subduction);
2365
- _assertClass(b, _Subduction);
2366
- const ret = wasm.subduction_link(a.__wbg_ptr, b.__wbg_ptr);
2367
- return ret;
2368
- }
2369
- /**
2370
- * Create a new [`Subduction`] instance.
2371
- *
2372
- * # Arguments
2373
- *
2374
- * * `signer` - The cryptographic signer for this node's identity
2375
- * * `storage` - Storage backend for persisting data
2376
- * * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
2377
- * When set, clients can connect without knowing the server's peer ID.
2378
- * * `hash_metric_override` - Optional custom depth metric function
2379
- * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2380
- * * `policy` - Optional JS object implementing authorization.
2381
- * Must have `authorizeConnect(...)`, `authorizeFetch(...)`, `authorizePut(...)`,
2382
- * `filterAuthorizedFetch(...)`. Defaults to allow-all.
2383
- *
2384
- * # Panics
2385
- *
2386
- * Panics if `hash_metric_override` is `Some` but the underlying JS value
2387
- * cannot be cast to a `Function`.
2388
- * @param {any} signer
2389
- * @param {SedimentreeStorage} storage
2390
- * @param {string | null} [service_name]
2391
- * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2392
- * @param {number | null} [max_pending_blob_requests]
2393
- * @param {any | null} [policy]
2394
- * @param {Function | null} [on_remote_heads]
2395
- * @param {Function | null} [on_ephemeral]
2396
- */
2397
- constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
2398
- var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2399
- var len0 = WASM_VECTOR_LEN;
2400
- const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2401
- this.__wbg_ptr = ret >>> 0;
2402
- SubductionFinalization.register(this, this.__wbg_ptr, this);
2403
- return this;
2404
- }
2405
- /**
2406
- * Publish an ephemeral message to all subscribers of a sedimentree.
2407
- *
2408
- * The payload is opaque bytes — encoding is the caller's responsibility.
2409
- * Messages are fire-and-forget; delivery is best-effort.
2410
- * @param {SedimentreeId} id
2411
- * @param {Uint8Array} payload
2412
- * @returns {Promise<void>}
2413
- */
2414
- publishEphemeral(id, payload) {
2415
- _assertClass(id, SedimentreeId);
2416
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
2417
- const len0 = WASM_VECTOR_LEN;
2418
- const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
2419
- return ret;
2420
- }
2421
- /**
2422
- * Remove a Sedimentree and all associated data.
2423
- *
2424
- * # Errors
2425
- *
2426
- * Returns a [`WasmIoError`] if storage or networking fail.
2427
- * @param {SedimentreeId} id
2428
- * @returns {Promise<void>}
2429
- */
2430
- removeSedimentree(id) {
2431
- _assertClass(id, SedimentreeId);
2432
- const ret = wasm.subduction_removeSedimentree(this.__wbg_ptr, id.__wbg_ptr);
2433
- return ret;
2434
- }
2435
- /**
2436
- * Request blobs by their digests from connected peers for a specific sedimentree.
2437
- * @param {SedimentreeId} id
2438
- * @param {Digest[]} digests
2439
- * @returns {Promise<void>}
2440
- */
2441
- requestBlobs(id, digests) {
2442
- _assertClass(id, SedimentreeId);
2443
- const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2444
- const len0 = WASM_VECTOR_LEN;
2445
- const ret = wasm.subduction_requestBlobs(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
2446
- return ret;
2447
- }
2448
- /**
2449
- * Get all known Sedimentree IDs
2450
- * @returns {Promise<SedimentreeId[]>}
2451
- */
2452
- sedimentreeIds() {
2453
- const ret = wasm.subduction_sedimentreeIds(this.__wbg_ptr);
2454
- return ret;
2455
- }
2456
- /**
2457
- * Get the backing storage.
2458
- * @returns {any}
2459
- */
2460
- get storage() {
2461
- const ret = wasm.subduction_storage(this.__wbg_ptr);
2462
- return ret;
2463
- }
2464
- /**
2465
- * Subscribe to ephemeral messages for the given sedimentree IDs
2466
- * from all connected peers.
2467
- * @param {SedimentreeId[]} ids
2468
- * @returns {Promise<void>}
2469
- */
2470
- subscribeEphemeral(ids) {
2471
- const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
2472
- const len0 = WASM_VECTOR_LEN;
2473
- const ret = wasm.subduction_subscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2474
- return ret;
2475
- }
2476
- /**
2477
- * Request batch sync for a given Sedimentree ID from all connected peers.
2478
- *
2479
- * # Arguments
2480
- *
2481
- * * `id` - The sedimentree ID to sync
2482
- * * `subscribe` - Whether to subscribe for incremental updates
2483
- * * `timeout_milliseconds` - Optional timeout in milliseconds
2484
- *
2485
- * # Errors
2486
- *
2487
- * Returns a [`WasmIoError`] if storage or networking fail.
2488
- * @param {SedimentreeId} id
2489
- * @param {boolean} subscribe
2490
- * @param {bigint | null} [timeout_milliseconds]
2491
- * @returns {Promise<PeerResultMap>}
2492
- */
2493
- syncWithAllPeers(id, subscribe, timeout_milliseconds) {
2494
- _assertClass(id, SedimentreeId);
2495
- const ret = wasm.subduction_syncWithAllPeers(this.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2496
- return ret;
2497
- }
2498
- /**
2499
- * Request batch sync for a given Sedimentree ID from a specific peer.
2500
- *
2501
- * # Arguments
2502
- *
2503
- * * `to_ask` - The peer ID to sync with
2504
- * * `id` - The sedimentree ID to sync
2505
- * * `subscribe` - Whether to subscribe for incremental updates
2506
- * * `timeout_milliseconds` - Optional timeout in milliseconds
2507
- *
2508
- * # Errors
2509
- *
2510
- * Returns a [`WasmIoError`] if storage or networking fail.
2511
- * @param {PeerId} to_ask
2512
- * @param {SedimentreeId} id
2513
- * @param {boolean} subscribe
2514
- * @param {bigint | null} [timeout_milliseconds]
2515
- * @returns {Promise<PeerBatchSyncResult>}
2516
- */
2517
- syncWithPeer(to_ask, id, subscribe, timeout_milliseconds) {
2518
- _assertClass(to_ask, PeerId);
2519
- _assertClass(id, SedimentreeId);
2520
- const ret = wasm.subduction_syncWithPeer(this.__wbg_ptr, to_ask.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
2521
- return ret;
2522
- }
2523
- /**
2524
- * Unsubscribe from ephemeral messages for the given sedimentree IDs
2525
- * from all connected peers.
2526
- * @param {SedimentreeId[]} ids
2527
- * @returns {Promise<void>}
2528
- */
2529
- unsubscribeEphemeral(ids) {
2530
- const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
2531
- const len0 = WASM_VECTOR_LEN;
2532
- const ret = wasm.subduction_unsubscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2533
- return ret;
2534
- }
2535
- };
2536
- if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.free;
2537
- var SubductionHttpLongPoll = class _SubductionHttpLongPoll {
2538
- static __wrap(ptr) {
2539
- ptr = ptr >>> 0;
2540
- const obj = Object.create(_SubductionHttpLongPoll.prototype);
2541
- obj.__wbg_ptr = ptr;
2542
- SubductionHttpLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
2543
- return obj;
2544
- }
2545
- __destroy_into_raw() {
2546
- const ptr = this.__wbg_ptr;
2547
- this.__wbg_ptr = 0;
2548
- SubductionHttpLongPollFinalization.unregister(this);
2549
- return ptr;
2550
- }
2551
- free() {
2552
- const ptr = this.__destroy_into_raw();
2553
- wasm.__wbg_subductionhttplongpoll_free(ptr, 0);
2554
- }
2555
- /**
2556
- * Disconnect from the peer gracefully.
2557
- *
2558
- * Fires the `onDisconnect` callback if one is registered.
2559
- *
2560
- * # Errors
2561
- *
2562
- * Returns an error if the disconnect fails.
2563
- * @returns {Promise<void>}
2564
- */
2565
- disconnect() {
2566
- const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
2567
- return ret;
2568
- }
2569
- /**
2570
- * Register a callback to be invoked when the transport disconnects.
2571
- *
2572
- * Part of the [`Transport`](super::JsTransport) interface contract.
2573
- * Typically called by internal wiring rather than directly by user code.
2574
- * @param {Function} callback
2575
- */
2576
- onDisconnect(callback) {
2577
- wasm.subductionhttplongpoll_onDisconnect(this.__wbg_ptr, callback);
2578
- }
2579
- /**
2580
- * Receive the next message frame as raw bytes.
2581
- *
2582
- * # Errors
2583
- *
2584
- * Returns an error if the inbound channel is closed.
2585
- * @returns {Promise<Uint8Array>}
2586
- */
2587
- recvBytes() {
2588
- const ret = wasm.subductionhttplongpoll_recvBytes(this.__wbg_ptr);
2589
- return ret;
2590
- }
2591
- /**
2592
- * Send raw bytes over the transport.
2593
- *
2594
- * # Errors
2595
- *
2596
- * Returns an error if the outbound channel is closed.
2597
- * @param {Uint8Array} bytes
2598
- * @returns {Promise<void>}
2599
- */
2600
- sendBytes(bytes) {
2601
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2602
- const len0 = WASM_VECTOR_LEN;
2603
- const ret = wasm.subductionhttplongpoll_sendBytes(this.__wbg_ptr, ptr0, len0);
2604
- return ret;
2605
- }
2606
- };
2607
- if (Symbol.dispose) SubductionHttpLongPoll.prototype[Symbol.dispose] = SubductionHttpLongPoll.prototype.free;
2608
- var SubductionLongPoll = class {
2609
- __destroy_into_raw() {
2610
- const ptr = this.__wbg_ptr;
2611
- this.__wbg_ptr = 0;
2612
- SubductionLongPollFinalization.unregister(this);
2613
- return ptr;
2614
- }
2615
- free() {
2616
- const ptr = this.__destroy_into_raw();
2617
- wasm.__wbg_subductionlongpoll_free(ptr, 0);
2618
- }
2619
- /**
2620
- * Connect to a server with a known peer ID.
2621
- *
2622
- * # Arguments
2623
- *
2624
- * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2625
- * * `signer` - The client's signer for authentication
2626
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2627
- * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2628
- *
2629
- * # Errors
2630
- *
2631
- * Returns [`LongPollTransportError`] if connection or handshake fails.
2632
- * @param {string} base_url
2633
- * @param {any} signer
2634
- * @param {PeerId} expected_peer_id
2635
- * @param {Function | null} [on_disconnect]
2636
- * @returns {Promise<AuthenticatedLongPoll>}
2637
- */
2638
- static tryConnect(base_url, signer, expected_peer_id, on_disconnect) {
2639
- const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2640
- const len0 = WASM_VECTOR_LEN;
2641
- _assertClass(expected_peer_id, PeerId);
2642
- const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2643
- return ret;
2644
- }
2645
- /**
2646
- * Connect to a server using discovery mode.
2647
- *
2648
- * # Arguments
2649
- *
2650
- * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2651
- * * `signer` - The client's signer for authentication
2652
- * * `service_name` - The service name for discovery. If omitted, the base URL is used.
2653
- *
2654
- * # Errors
2655
- *
2656
- * Returns [`LongPollTransportError`] if connection or handshake fails.
2657
- * @param {string} base_url
2658
- * @param {any} signer
2659
- * @param {string | null} [service_name]
2660
- * @param {Function | null} [on_disconnect]
2661
- * @returns {Promise<AuthenticatedLongPoll>}
2662
- */
2663
- static tryDiscover(base_url, signer, service_name, on_disconnect) {
2664
- const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2665
- const len0 = WASM_VECTOR_LEN;
2666
- var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2667
- var len1 = WASM_VECTOR_LEN;
2668
- const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2669
- return ret;
2670
- }
2671
- };
2672
- if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2673
- var SubductionWebSocket = class _SubductionWebSocket {
2674
- static __wrap(ptr) {
2675
- ptr = ptr >>> 0;
2676
- const obj = Object.create(_SubductionWebSocket.prototype);
2677
- obj.__wbg_ptr = ptr;
2678
- SubductionWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
2679
- return obj;
2680
- }
2681
- __destroy_into_raw() {
2682
- const ptr = this.__wbg_ptr;
2683
- this.__wbg_ptr = 0;
2684
- SubductionWebSocketFinalization.unregister(this);
2685
- return ptr;
2686
- }
2687
- free() {
2688
- const ptr = this.__destroy_into_raw();
2689
- wasm.__wbg_subductionwebsocket_free(ptr, 0);
2690
- }
2691
- /**
2692
- * Disconnect from the peer gracefully.
2693
- * @returns {Promise<void>}
2694
- */
2695
- disconnect() {
2696
- const ret = wasm.subductionwebsocket_disconnect(this.__wbg_ptr);
2697
- return ret;
2698
- }
2699
- /**
2700
- * Register a callback to be invoked when the WebSocket closes.
2701
- *
2702
- * Part of the [`Transport`](super::JsTransport) interface contract.
2703
- * Typically called by internal wiring (factory methods like `tryConnect`
2704
- * and `tryDiscover`) rather than directly by user code.
2705
- *
2706
- * The callback is fired from the browser WebSocket's `onclose` handler.
2707
- * @param {Function} callback
2708
- */
2709
- onDisconnect(callback) {
2710
- wasm.subductionwebsocket_onDisconnect(this.__wbg_ptr, callback);
2711
- }
2712
- /**
2713
- * Receive the next message frame as raw bytes.
2714
- *
2715
- * # Errors
2716
- *
2717
- * Returns [`ReadFromClosedChannel`] if the channel has been closed.
2718
- * @returns {Promise<Uint8Array>}
2719
- */
2720
- recvBytes() {
2721
- const ret = wasm.subductionwebsocket_recvBytes(this.__wbg_ptr);
2722
- return ret;
2723
- }
2724
- /**
2725
- * Send raw bytes over the WebSocket.
2726
- *
2727
- * # Errors
2728
- *
2729
- * Returns [`WasmSendError`] if the bytes could not be sent.
2730
- * @param {Uint8Array} bytes
2731
- * @returns {Promise<void>}
2732
- */
2733
- sendBytes(bytes) {
2734
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2735
- const len0 = WASM_VECTOR_LEN;
2736
- const ret = wasm.subductionwebsocket_sendBytes(this.__wbg_ptr, ptr0, len0);
2737
- return ret;
2738
- }
2739
- /**
2740
- * Authenticate an existing WebSocket via handshake.
2741
- *
2742
- * This performs the Subduction handshake protocol over the provided WebSocket
2743
- * to establish mutual identity. The WebSocket can be in CONNECTING or OPEN state.
2744
- *
2745
- * # Arguments
2746
- *
2747
- * * `ws` - An existing WebSocket (CONNECTING or OPEN)
2748
- * * `signer` - The client's signer for authentication
2749
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2750
- * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2751
- *
2752
- * # Errors
2753
- *
2754
- * Returns an error if the handshake fails (signature invalid, wrong peer, etc.)
2755
- * @param {WebSocket} ws
2756
- * @param {any} signer
2757
- * @param {PeerId} expected_peer_id
2758
- * @param {Function | null} [on_disconnect]
2759
- * @returns {Promise<AuthenticatedWebSocket>}
2760
- */
2761
- static setup(ws, signer, expected_peer_id, on_disconnect) {
2762
- _assertClass(expected_peer_id, PeerId);
2763
- const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2764
- return ret;
2765
- }
2766
- /**
2767
- * Connect to a WebSocket server with mutual authentication via handshake.
2768
- *
2769
- * # Arguments
2770
- *
2771
- * * `address` - The WebSocket URL to connect to
2772
- * * `signer` - The client's signer for authentication
2773
- * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2774
- * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2775
- *
2776
- * # Errors
2777
- *
2778
- * Returns an error if:
2779
- * - The WebSocket connection could not be established
2780
- * - The handshake fails (signature invalid, wrong server, clock drift, etc.)
2781
- * @param {URL} address
2782
- * @param {any} signer
2783
- * @param {PeerId} expected_peer_id
2784
- * @param {Function | null} [on_disconnect]
2785
- * @returns {Promise<AuthenticatedWebSocket>}
2786
- */
2787
- static tryConnect(address, signer, expected_peer_id, on_disconnect) {
2788
- _assertClass(expected_peer_id, PeerId);
2789
- const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2790
- return ret;
2791
- }
2792
- /**
2793
- * Connect to a WebSocket server using discovery mode.
2794
- *
2795
- * This method performs a cryptographic handshake using a service name
2796
- * instead of a known peer ID. The server's peer ID is discovered during
2797
- * the handshake and returned.
2798
- *
2799
- * # Arguments
2800
- *
2801
- * * `address` - The WebSocket URL to connect to
2802
- * * `signer` - The client's signer for authentication
2803
- * * `service_name` - The service name for discovery (e.g., `localhost:8080`).
2804
- * If omitted, the host is extracted from the URL.
2805
- * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
2806
- *
2807
- * # Errors
2808
- *
2809
- * Returns an error if:
2810
- * - The WebSocket connection could not be established
2811
- * - The handshake fails (signature invalid, clock drift, etc.)
2812
- * @param {URL} address
2813
- * @param {any} signer
2814
- * @param {string | null} [service_name]
2815
- * @param {Function | null} [on_disconnect]
2816
- * @returns {Promise<AuthenticatedWebSocket>}
2817
- */
2818
- static tryDiscover(address, signer, service_name, on_disconnect) {
2819
- var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2820
- var len0 = WASM_VECTOR_LEN;
2821
- const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
2822
- return ret;
2823
- }
2824
- };
2825
- if (Symbol.dispose) SubductionWebSocket.prototype[Symbol.dispose] = SubductionWebSocket.prototype.free;
2826
- var SyncMessage = class _SyncMessage {
2827
- static __wrap(ptr) {
2828
- ptr = ptr >>> 0;
2829
- const obj = Object.create(_SyncMessage.prototype);
2830
- obj.__wbg_ptr = ptr;
2831
- SyncMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2832
- return obj;
2833
- }
2834
- __destroy_into_raw() {
2835
- const ptr = this.__wbg_ptr;
2836
- this.__wbg_ptr = 0;
2837
- SyncMessageFinalization.unregister(this);
2838
- return ptr;
2839
- }
2840
- free() {
2841
- const ptr = this.__destroy_into_raw();
2842
- wasm.__wbg_syncmessage_free(ptr, 0);
2843
- }
2844
- /**
2845
- * Upcasts; to the JS-import type for [`WasmMessage`].
2846
- * @returns {SyncMessage}
2847
- */
2848
- __wasm_refgen_toWasmMessage() {
2849
- const ret = wasm.syncmessage___wasm_refgen_toWasmMessage(this.__wbg_ptr);
2850
- return _SyncMessage.__wrap(ret);
2851
- }
2852
- /**
2853
- * Create a [`SyncMessage::BatchSyncRequest`] message.
2854
- * @param {BatchSyncRequest} request
2855
- * @returns {SyncMessage}
2856
- */
2857
- static batchSyncRequest(request) {
2858
- _assertClass(request, BatchSyncRequest);
2859
- const ret = wasm.syncmessage_batchSyncRequest(request.__wbg_ptr);
2860
- return _SyncMessage.__wrap(ret);
2861
- }
2862
- /**
2863
- * Create a [`SyncMessage::BatchSyncResponse`] message.
2864
- * @param {BatchSyncResponse} response
2865
- * @returns {SyncMessage}
2866
- */
2867
- static batchSyncResponse(response) {
2868
- _assertClass(response, BatchSyncResponse);
2869
- const ret = wasm.syncmessage_batchSyncResponse(response.__wbg_ptr);
2870
- return _SyncMessage.__wrap(ret);
2871
- }
2872
- /**
2873
- * The [`Blob`] for commit or fragment messages, if applicable.
2874
- * @returns {Uint8Array | undefined}
2875
- */
2876
- get blob() {
2877
- const ret = wasm.syncmessage_blob(this.__wbg_ptr);
2878
- return ret;
2879
- }
2880
- /**
2881
- * The [`Blob`]s for a [`SyncMessage::BlobsResponse`], if applicable.
2882
- * @returns {Uint8Array[] | undefined}
2883
- */
2884
- get blobs() {
2885
- const ret = wasm.syncmessage_blobs(this.__wbg_ptr);
2886
- let v1;
2887
- if (ret[0] !== 0) {
2888
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2889
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2890
- }
2891
- return v1;
2892
- }
2893
- /**
2894
- * Create a [`SyncMessage::BlobsRequest`] message.
2895
- * @param {SedimentreeId} id
2896
- * @param {Digest[]} digests
2897
- * @returns {SyncMessage}
2898
- */
2899
- static blobsRequest(id, digests) {
2900
- _assertClass(id, SedimentreeId);
2901
- const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2902
- const len0 = WASM_VECTOR_LEN;
2903
- const ret = wasm.syncmessage_blobsRequest(id.__wbg_ptr, ptr0, len0);
2904
- return _SyncMessage.__wrap(ret);
2905
- }
2906
- /**
2907
- * Create a [`SyncMessage::BlobsResponse`] message.
2908
- * @param {SedimentreeId} id
2909
- * @param {Uint8Array[]} blobs
2910
- * @returns {SyncMessage}
2911
- */
2912
- static blobsResponse(id, blobs) {
2913
- _assertClass(id, SedimentreeId);
2914
- const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2915
- const len0 = WASM_VECTOR_LEN;
2916
- const ret = wasm.syncmessage_blobsResponse(id.__wbg_ptr, ptr0, len0);
2917
- return _SyncMessage.__wrap(ret);
2918
- }
2919
- /**
2920
- * The [`LooseCommit`] for a [`SyncMessage::LooseCommit`], if applicable.
2921
- *
2922
- * Decodes the signed payload to extract the underlying commit.
2923
- * @returns {LooseCommit | undefined}
2924
- */
2925
- get commit() {
2926
- const ret = wasm.syncmessage_commit(this.__wbg_ptr);
2927
- return ret === 0 ? void 0 : LooseCommit.__wrap(ret);
2928
- }
2929
- /**
2930
- * The requested [`Digest`]s for a [`SyncMessage::BlobsRequest`], if applicable.
2931
- * @returns {Digest[] | undefined}
2932
- */
2933
- get digests() {
2934
- const ret = wasm.syncmessage_digests(this.__wbg_ptr);
2935
- let v1;
2936
- if (ret[0] !== 0) {
2937
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2938
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2939
- }
2940
- return v1;
2941
- }
2942
- /**
2943
- * The [`Fragment`] for a [`SyncMessage::Fragment`], if applicable.
2944
- *
2945
- * Decodes the signed payload to extract the underlying fragment.
2946
- * @returns {Fragment | undefined}
2947
- */
2948
- get fragment() {
2949
- const ret = wasm.syncmessage_fragment(this.__wbg_ptr);
2950
- return ret === 0 ? void 0 : Fragment.__wrap(ret);
2951
- }
2952
- /**
2953
- * Deserialize a message from bytes.
2954
- *
2955
- * # Errors
2956
- *
2957
- * Returns a [`JsMessageDeserializationError`] if deserialization fails.
2958
- * @param {Uint8Array} bytes
2959
- * @returns {SyncMessage}
2960
- */
2961
- static fromBytes(bytes) {
2962
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2963
- const len0 = WASM_VECTOR_LEN;
2964
- const ret = wasm.syncmessage_fromBytes(ptr0, len0);
2965
- if (ret[2]) {
2966
- throw takeFromExternrefTable0(ret[1]);
2967
- }
2968
- return _SyncMessage.__wrap(ret[0]);
2969
- }
2970
- /**
2971
- * The [`BatchSyncRequest`] for a [`SyncMessage::BatchSyncRequest`], if applicable.
2972
- * @returns {BatchSyncRequest | undefined}
2973
- */
2974
- get request() {
2975
- const ret = wasm.syncmessage_request(this.__wbg_ptr);
2976
- return ret === 0 ? void 0 : BatchSyncRequest.__wrap(ret);
2977
- }
2978
- /**
2979
- * The [`BatchSyncResponse`] for a [`SyncMessage::BatchSyncResponse`], if applicable.
2980
- * @returns {BatchSyncResponse | undefined}
2981
- */
2982
- get response() {
2983
- const ret = wasm.syncmessage_response(this.__wbg_ptr);
2984
- return ret === 0 ? void 0 : BatchSyncResponse.__wrap(ret);
2985
- }
2986
- /**
2987
- * The [`SedimentreeId`] associated with this message, if any.
2988
- * @returns {SedimentreeId | undefined}
2989
- */
2990
- get sedimentreeId() {
2991
- const ret = wasm.syncmessage_sedimentreeId(this.__wbg_ptr);
2992
- return ret === 0 ? void 0 : SedimentreeId.__wrap(ret);
2993
- }
2994
- /**
2995
- * Serialize the message to bytes.
2996
- * @returns {Uint8Array}
2997
- */
2998
- toBytes() {
2999
- const ret = wasm.syncmessage_toBytes(this.__wbg_ptr);
3000
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3001
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3002
- return v1;
3003
- }
3004
- /**
3005
- * The message variant name.
3006
- * @returns {string}
3007
- */
3008
- get type() {
3009
- let deferred1_0;
3010
- let deferred1_1;
3011
- try {
3012
- const ret = wasm.syncmessage_type(this.__wbg_ptr);
3013
- deferred1_0 = ret[0];
3014
- deferred1_1 = ret[1];
3015
- return getStringFromWasm0(ret[0], ret[1]);
3016
- } finally {
3017
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3018
- }
3019
- }
3020
- };
3021
- if (Symbol.dispose) SyncMessage.prototype[Symbol.dispose] = SyncMessage.prototype.free;
3022
- var SyncStats = class _SyncStats {
3023
- static __wrap(ptr) {
3024
- ptr = ptr >>> 0;
3025
- const obj = Object.create(_SyncStats.prototype);
3026
- obj.__wbg_ptr = ptr;
3027
- SyncStatsFinalization.register(obj, obj.__wbg_ptr, obj);
3028
- return obj;
3029
- }
3030
- __destroy_into_raw() {
3031
- const ptr = this.__wbg_ptr;
3032
- this.__wbg_ptr = 0;
3033
- SyncStatsFinalization.unregister(this);
3034
- return ptr;
3035
- }
3036
- free() {
3037
- const ptr = this.__destroy_into_raw();
3038
- wasm.__wbg_syncstats_free(ptr, 0);
3039
- }
3040
- /**
3041
- * Number of commits received from the peer.
3042
- * @returns {number}
3043
- */
3044
- get commitsReceived() {
3045
- const ret = wasm.syncstats_commitsReceived(this.__wbg_ptr);
3046
- return ret >>> 0;
3047
- }
3048
- /**
3049
- * Number of commits successfully sent to the peer.
3050
- * @returns {number}
3051
- */
3052
- get commitsSent() {
3053
- const ret = wasm.syncstats_commitsSent(this.__wbg_ptr);
3054
- return ret >>> 0;
3055
- }
3056
- /**
3057
- * Number of fragments received from the peer.
3058
- * @returns {number}
3059
- */
3060
- get fragmentsReceived() {
3061
- const ret = wasm.syncstats_fragmentsReceived(this.__wbg_ptr);
3062
- return ret >>> 0;
3063
- }
3064
- /**
3065
- * Number of fragments successfully sent to the peer.
3066
- * @returns {number}
3067
- */
3068
- get fragmentsSent() {
3069
- const ret = wasm.syncstats_fragmentsSent(this.__wbg_ptr);
3070
- return ret >>> 0;
3071
- }
3072
- /**
3073
- * Returns true if no commits or fragments were transferred.
3074
- *
3075
- * Note: `remoteHeads` may still be non-empty (heads metadata is not
3076
- * considered "data" for this check).
3077
- * @returns {boolean}
3078
- */
3079
- get isEmpty() {
3080
- const ret = wasm.syncstats_isEmpty(this.__wbg_ptr);
3081
- return ret !== 0;
3082
- }
3083
- /**
3084
- * The remote peer's heads for this sedimentree.
3085
- * @returns {Digest[]}
3086
- */
3087
- get remoteHeads() {
3088
- const ret = wasm.syncstats_remoteHeads(this.__wbg_ptr);
3089
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
3090
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
3091
- return v1;
3092
- }
3093
- /**
3094
- * Total items received (commits + fragments).
3095
- * @returns {number}
3096
- */
3097
- get totalReceived() {
3098
- const ret = wasm.syncstats_totalReceived(this.__wbg_ptr);
3099
- return ret >>> 0;
3100
- }
3101
- /**
3102
- * Total items sent (commits + fragments).
3103
- * @returns {number}
3104
- */
3105
- get totalSent() {
3106
- const ret = wasm.syncstats_totalSent(this.__wbg_ptr);
3107
- return ret >>> 0;
3108
- }
3109
- };
3110
- if (Symbol.dispose) SyncStats.prototype[Symbol.dispose] = SyncStats.prototype.free;
3111
- var WebCryptoSigner = class _WebCryptoSigner {
3112
- static __wrap(ptr) {
3113
- ptr = ptr >>> 0;
3114
- const obj = Object.create(_WebCryptoSigner.prototype);
3115
- obj.__wbg_ptr = ptr;
3116
- WebCryptoSignerFinalization.register(obj, obj.__wbg_ptr, obj);
3117
- return obj;
3118
- }
3119
- __destroy_into_raw() {
3120
- const ptr = this.__wbg_ptr;
3121
- this.__wbg_ptr = 0;
3122
- WebCryptoSignerFinalization.unregister(this);
3123
- return ptr;
3124
- }
3125
- free() {
3126
- const ptr = this.__destroy_into_raw();
3127
- wasm.__wbg_webcryptosigner_free(ptr, 0);
3128
- }
3129
- /**
3130
- * Get the peer ID derived from this signer's verifying key.
3131
- *
3132
- * # Panics
3133
- *
3134
- * Panics if the stored public key bytes are invalid (should never happen).
3135
- * @returns {PeerId}
3136
- */
3137
- peerId() {
3138
- const ret = wasm.webcryptosigner_peerId(this.__wbg_ptr);
3139
- return PeerId.__wrap(ret);
3140
- }
3141
- /**
3142
- * Set up the signer, loading an existing key from `IndexedDB` or generating a new one.
3143
- *
3144
- * # Errors
3145
- *
3146
- * Returns an error if `WebCrypto` or `IndexedDB` operations fail.
3147
- * @returns {Promise<WebCryptoSigner>}
3148
- */
3149
- static setup() {
3150
- const ret = wasm.webcryptosigner_setup();
3151
- return ret;
3152
- }
3153
- /**
3154
- * Sign a message and return the 64-byte Ed25519 signature.
3155
- *
3156
- * # Errors
3157
- *
3158
- * Returns an error if `WebCrypto` signing fails.
3159
- * @param {Uint8Array} message
3160
- * @returns {Promise<Uint8Array>}
3161
- */
3162
- sign(message) {
3163
- const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
3164
- const len0 = WASM_VECTOR_LEN;
3165
- const ret = wasm.webcryptosigner_sign(this.__wbg_ptr, ptr0, len0);
3166
- return ret;
3167
- }
3168
- /**
3169
- * Get the 32-byte Ed25519 verifying (public) key.
3170
- * @returns {Uint8Array}
3171
- */
3172
- verifyingKey() {
3173
- const ret = wasm.webcryptosigner_verifyingKey(this.__wbg_ptr);
3174
- return ret;
3175
- }
3176
- };
3177
- if (Symbol.dispose) WebCryptoSigner.prototype[Symbol.dispose] = WebCryptoSigner.prototype.free;
3178
- function makeMessagePortTransport(port) {
3179
- const ret = wasm.makeMessagePortTransport(port);
3180
- return MessagePortTransport.__wrap(ret);
3181
- }
3182
- function start() {
3183
- wasm.start();
3184
- }
3185
- function __wbg_get_imports() {
3186
- const import0 = {
3187
- __proto__: null,
3188
- __wbg___wasm_refgen_toWasmCommitWithBlob_4c1dc5cc453af7eb: function(arg0) {
3189
- const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
3190
- _assertClass(ret, CommitWithBlob);
3191
- var ptr1 = ret.__destroy_into_raw();
3192
- return ptr1;
3193
- },
3194
- __wbg___wasm_refgen_toWasmDepth_e11bce6176c8257e: function(arg0) {
3195
- const ret = arg0.__wasm_refgen_toWasmDepth();
3196
- _assertClass(ret, Depth);
3197
- var ptr1 = ret.__destroy_into_raw();
3198
- return ptr1;
3199
- },
3200
- __wbg___wasm_refgen_toWasmDigest_86d449f5dc99fc6a: function(arg0) {
3201
- const ret = arg0.__wasm_refgen_toWasmDigest();
3202
- _assertClass(ret, Digest);
3203
- var ptr1 = ret.__destroy_into_raw();
3204
- return ptr1;
3205
- },
3206
- __wbg___wasm_refgen_toWasmFragmentWithBlob_d7450dc251166eea: function(arg0) {
3207
- const ret = arg0.__wasm_refgen_toWasmFragmentWithBlob();
3208
- _assertClass(ret, FragmentWithBlob);
3209
- var ptr1 = ret.__destroy_into_raw();
3210
- return ptr1;
3211
- },
3212
- __wbg___wasm_refgen_toWasmFragment_03b5e19d20693b4f: function(arg0) {
3213
- const ret = arg0.__wasm_refgen_toWasmFragment();
3214
- _assertClass(ret, Fragment);
3215
- var ptr1 = ret.__destroy_into_raw();
3216
- return ptr1;
3217
- },
3218
- __wbg___wasm_refgen_toWasmLooseCommit_bc6f015053af2dd7: function(arg0) {
3219
- const ret = arg0.__wasm_refgen_toWasmLooseCommit();
3220
- _assertClass(ret, LooseCommit);
3221
- var ptr1 = ret.__destroy_into_raw();
3222
- return ptr1;
3223
- },
3224
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
3225
- const ret = debugString(arg1);
3226
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3227
- const len1 = WASM_VECTOR_LEN;
3228
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3229
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3230
- },
3231
- __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
3232
- const ret = typeof arg0 === "function";
3233
- return ret;
3234
- },
3235
- __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
3236
- const ret = arg0 === null;
3237
- return ret;
3238
- },
3239
- __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
3240
- const val = arg0;
3241
- const ret = typeof val === "object" && val !== null;
3242
- return ret;
3243
- },
3244
- __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
3245
- const ret = typeof arg0 === "string";
3246
- return ret;
3247
- },
3248
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
3249
- const ret = arg0 === void 0;
3250
- return ret;
3251
- },
3252
- __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
3253
- const ret = arg0 === arg1;
3254
- return ret;
3255
- },
3256
- __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
3257
- const obj = arg1;
3258
- const ret = typeof obj === "number" ? obj : void 0;
3259
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
3260
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
3261
- },
3262
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
3263
- const obj = arg1;
3264
- const ret = typeof obj === "string" ? obj : void 0;
3265
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3266
- var len1 = WASM_VECTOR_LEN;
3267
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3268
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3269
- },
3270
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
3271
- throw new Error(getStringFromWasm0(arg0, arg1));
3272
- },
3273
- __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
3274
- arg0._wbg_cb_unref();
3275
- },
3276
- __wbg_arrayBuffer_eb8e9ca620af2a19: function() {
3277
- return handleError(function(arg0) {
3278
- const ret = arg0.arrayBuffer();
3279
- return ret;
3280
- }, arguments);
3281
- },
3282
- __wbg_authenticatedlongpoll_new: function(arg0) {
3283
- const ret = AuthenticatedLongPoll.__wrap(arg0);
3284
- return ret;
3285
- },
3286
- __wbg_authenticatedtransport_new: function(arg0) {
3287
- const ret = AuthenticatedTransport.__wrap(arg0);
3288
- return ret;
3289
- },
3290
- __wbg_authenticatedwebsocket_new: function(arg0) {
3291
- const ret = AuthenticatedWebSocket.__wrap(arg0);
3292
- return ret;
3293
- },
3294
- __wbg_authorizeConnect_0e61e98d289a37c9: function() {
3295
- return handleError(function(arg0, arg1) {
3296
- const ret = arg0.authorizeConnect(arg1);
3297
- return ret;
3298
- }, arguments);
3299
- },
3300
- __wbg_authorizeFetch_88703389e9c295d0: function() {
3301
- return handleError(function(arg0, arg1, arg2) {
3302
- const ret = arg0.authorizeFetch(arg1, arg2);
3303
- return ret;
3304
- }, arguments);
3305
- },
3306
- __wbg_authorizePut_dab9270462803778: function() {
3307
- return handleError(function(arg0, arg1, arg2, arg3) {
3308
- const ret = arg0.authorizePut(arg1, arg2, arg3);
3309
- return ret;
3310
- }, arguments);
3311
- },
3312
- __wbg_buffer_60b8043cd926067d: function(arg0) {
3313
- const ret = arg0.buffer;
3314
- return ret;
3315
- },
3316
- __wbg_call_2d781c1f4d5c0ef8: function() {
3317
- return handleError(function(arg0, arg1, arg2) {
3318
- const ret = arg0.call(arg1, arg2);
3319
- return ret;
3320
- }, arguments);
3321
- },
3322
- __wbg_call_e133b57c9155d22c: function() {
3323
- return handleError(function(arg0, arg1) {
3324
- const ret = arg0.call(arg1);
3325
- return ret;
3326
- }, arguments);
3327
- },
3328
- __wbg_call_f858478a02f9600f: function() {
3329
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
3330
- const ret = arg0.call(arg1, arg2, arg3, arg4);
3331
- return ret;
3332
- }, arguments);
3333
- },
3334
- __wbg_close_574e2788efd7bb53: function(arg0) {
3335
- arg0.close();
3336
- },
3337
- __wbg_close_af26905c832a88cb: function() {
3338
- return handleError(function(arg0) {
3339
- arg0.close();
3340
- }, arguments);
3341
- },
3342
- __wbg_close_cbf870bdad0aad99: function(arg0) {
3343
- arg0.close();
3344
- },
3345
- __wbg_commitwithblob_new: function(arg0) {
3346
- const ret = CommitWithBlob.__wrap(arg0);
3347
- return ret;
3348
- },
3349
- __wbg_contains_ef4bfb7fa5a241b7: function(arg0, arg1, arg2) {
3350
- const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
3351
- return ret;
3352
- },
3353
- __wbg_createObjectStore_92a8aebcc6f9d7e3: function() {
3354
- return handleError(function(arg0, arg1, arg2) {
3355
- const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));
3356
- return ret;
3357
- }, arguments);
3358
- },
3359
- __wbg_crypto_38df2bab126b63dc: function(arg0) {
3360
- const ret = arg0.crypto;
3361
- return ret;
3362
- },
3363
- __wbg_data_a3d9ff9cdd801002: function(arg0) {
3364
- const ret = arg0.data;
3365
- return ret;
3366
- },
3367
- __wbg_deleteAllCommits_b0197e590f7fce60: function(arg0, arg1) {
3368
- const ret = arg0.deleteAllCommits(arg1);
3369
- return ret;
3370
- },
3371
- __wbg_deleteAllFragments_f884845698f5afb7: function(arg0, arg1) {
3372
- const ret = arg0.deleteAllFragments(arg1);
3373
- return ret;
3374
- },
3375
- __wbg_digest_new: function(arg0) {
3376
- const ret = Digest.__wrap(arg0);
3377
- return ret;
3378
- },
3379
- __wbg_digest_unwrap: function(arg0) {
3380
- const ret = Digest.__unwrap(arg0);
3381
- return ret;
3382
- },
3383
- __wbg_disconnect_849aae59f5879e45: function(arg0) {
3384
- const ret = arg0.disconnect();
3385
- return ret;
3386
- },
3387
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
3388
- let deferred0_0;
3389
- let deferred0_1;
3390
- try {
3391
- deferred0_0 = arg0;
3392
- deferred0_1 = arg1;
3393
- console.error(getStringFromWasm0(arg0, arg1));
3394
- } finally {
3395
- wasm.__wbindgen_export5(deferred0_0, deferred0_1, 1);
3396
- }
3397
- },
3398
- __wbg_exportKey_c43b919dba5a1db2: function() {
3399
- return handleError(function(arg0, arg1, arg2, arg3) {
3400
- const ret = arg0.exportKey(getStringFromWasm0(arg1, arg2), arg3);
3401
- return ret;
3402
- }, arguments);
3403
- },
3404
- __wbg_fetch_5550a88cf343aaa9: function(arg0, arg1) {
3405
- const ret = arg0.fetch(arg1);
3406
- return ret;
3407
- },
3408
- __wbg_fetch_f8a611684c3b5fe5: function(arg0, arg1) {
3409
- const ret = arg0.fetch(arg1);
3410
- return ret;
3411
- },
3412
- __wbg_filterAuthorizedFetch_0d6450fa919b271d: function() {
3413
- return handleError(function(arg0, arg1, arg2) {
3414
- const ret = arg0.filterAuthorizedFetch(arg1, arg2);
3415
- return ret;
3416
- }, arguments);
3417
- },
3418
- __wbg_fragment_new: function(arg0) {
3419
- const ret = Fragment.__wrap(arg0);
3420
- return ret;
3421
- },
3422
- __wbg_fragmentrequested_new: function(arg0) {
3423
- const ret = FragmentRequested.__wrap(arg0);
3424
- return ret;
3425
- },
3426
- __wbg_fragmentwithblob_new: function(arg0) {
3427
- const ret = FragmentWithBlob.__wrap(arg0);
3428
- return ret;
3429
- },
3430
- __wbg_from_4bdf88943703fd48: function(arg0) {
3431
- const ret = Array.from(arg0);
3432
- return ret;
3433
- },
3434
- __wbg_generateKey_2b6cf71e7c9ad526: function() {
3435
- return handleError(function(arg0, arg1, arg2, arg3) {
3436
- const ret = arg0.generateKey(arg1, arg2 !== 0, arg3);
3437
- return ret;
3438
- }, arguments);
3439
- },
3440
- __wbg_getRandomValues_c44a50d8cfdaebeb: function() {
3441
- return handleError(function(arg0, arg1) {
3442
- arg0.getRandomValues(arg1);
3443
- }, arguments);
3444
- },
3445
- __wbg_get_3ef1eba1850ade27: function() {
3446
- return handleError(function(arg0, arg1) {
3447
- const ret = Reflect.get(arg0, arg1);
3448
- return ret;
3449
- }, arguments);
3450
- },
3451
- __wbg_get_6ac8c8119f577720: function() {
3452
- return handleError(function(arg0, arg1) {
3453
- const ret = arg0.get(arg1);
3454
- return ret;
3455
- }, arguments);
3456
- },
3457
- __wbg_get_a867a94064ecd263: function() {
3458
- return handleError(function(arg0, arg1, arg2, arg3) {
3459
- const ret = arg1.get(getStringFromWasm0(arg2, arg3));
3460
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3461
- var len1 = WASM_VECTOR_LEN;
3462
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3463
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3464
- }, arguments);
3465
- },
3466
- __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
3467
- const ret = arg0[arg1 >>> 0];
3468
- return ret;
3469
- },
3470
- __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
3471
- const ret = arg0[arg1 >>> 0];
3472
- return ret;
3473
- },
3474
- __wbg_has_926ef2ff40b308cf: function() {
3475
- return handleError(function(arg0, arg1) {
3476
- const ret = Reflect.has(arg0, arg1);
3477
- return ret;
3478
- }, arguments);
3479
- },
3480
- __wbg_headers_eb2234545f9ff993: function(arg0) {
3481
- const ret = arg0.headers;
3482
- return ret;
3483
- },
3484
- __wbg_host_5b3ec3e9d4d1fc78: function(arg0, arg1) {
3485
- const ret = arg1.host;
3486
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3487
- const len1 = WASM_VECTOR_LEN;
3488
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3489
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3490
- },
3491
- __wbg_href_da367531ce807a58: function(arg0, arg1) {
3492
- const ret = arg1.href;
3493
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3494
- const len1 = WASM_VECTOR_LEN;
3495
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3496
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3497
- },
3498
- __wbg_importKey_397406e38b080c57: function() {
3499
- return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3500
- const ret = arg0.importKey(getStringFromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0, arg6);
3501
- return ret;
3502
- }, arguments);
3503
- },
3504
- __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
3505
- let result;
3506
- try {
3507
- result = arg0 instanceof ArrayBuffer;
3508
- } catch (_) {
3509
- result = false;
3510
- }
3511
- const ret = result;
3512
- return ret;
3513
- },
3514
- __wbg_instanceof_Crypto_5c2a4c15287b0332: function(arg0) {
3515
- let result;
3516
- try {
3517
- result = arg0 instanceof Crypto;
3518
- } catch (_) {
3519
- result = false;
3520
- }
3521
- const ret = result;
3522
- return ret;
3523
- },
3524
- __wbg_instanceof_IdbDatabase_5f436cc89cc07f14: function(arg0) {
3525
- let result;
3526
- try {
3527
- result = arg0 instanceof IDBDatabase;
3528
- } catch (_) {
3529
- result = false;
3530
- }
3531
- const ret = result;
3532
- return ret;
3533
- },
3534
- __wbg_instanceof_IdbFactory_efcffbfd9020e4ac: function(arg0) {
3535
- let result;
3536
- try {
3537
- result = arg0 instanceof IDBFactory;
3538
- } catch (_) {
3539
- result = false;
3540
- }
3541
- const ret = result;
3542
- return ret;
3543
- },
3544
- __wbg_instanceof_IdbOpenDbRequest_10c2576001eb6613: function(arg0) {
3545
- let result;
3546
- try {
3547
- result = arg0 instanceof IDBOpenDBRequest;
3548
- } catch (_) {
3549
- result = false;
3550
- }
3551
- const ret = result;
3552
- return ret;
3553
- },
3554
- __wbg_instanceof_Promise_7c3bdd7805c2c6e6: function(arg0) {
3555
- let result;
3556
- try {
3557
- result = arg0 instanceof Promise;
3558
- } catch (_) {
3559
- result = false;
3560
- }
3561
- const ret = result;
3562
- return ret;
3563
- },
3564
- __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
3565
- let result;
3566
- try {
3567
- result = arg0 instanceof Response;
3568
- } catch (_) {
3569
- result = false;
3570
- }
3571
- const ret = result;
3572
- return ret;
3573
- },
3574
- __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
3575
- let result;
3576
- try {
3577
- result = arg0 instanceof Uint8Array;
3578
- } catch (_) {
3579
- result = false;
3580
- }
3581
- const ret = result;
3582
- return ret;
3583
- },
3584
- __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
3585
- let result;
3586
- try {
3587
- result = arg0 instanceof Window;
3588
- } catch (_) {
3589
- result = false;
3590
- }
3591
- const ret = result;
3592
- return ret;
3593
- },
3594
- __wbg_instanceof_WorkerGlobalScope_de6976d00cb213c6: function(arg0) {
3595
- let result;
3596
- try {
3597
- result = arg0 instanceof WorkerGlobalScope;
3598
- } catch (_) {
3599
- result = false;
3600
- }
3601
- const ret = result;
3602
- return ret;
3603
- },
3604
- __wbg_isArray_33b91feb269ff46e: function(arg0) {
3605
- const ret = Array.isArray(arg0);
3606
- return ret;
3607
- },
3608
- __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
3609
- const ret = Number.isSafeInteger(arg0);
3610
- return ret;
3611
- },
3612
- __wbg_length_b3416cf66a5452c8: function(arg0) {
3613
- const ret = arg0.length;
3614
- return ret;
3615
- },
3616
- __wbg_length_ea16607d7b61445b: function(arg0) {
3617
- const ret = arg0.length;
3618
- return ret;
3619
- },
3620
- __wbg_loadAllCommits_0e97df07ed213aa0: function(arg0, arg1) {
3621
- const ret = arg0.loadAllCommits(arg1);
3622
- return ret;
3623
- },
3624
- __wbg_loadAllFragments_12ecf8f9bd0e0b58: function(arg0, arg1) {
3625
- const ret = arg0.loadAllFragments(arg1);
3626
- return ret;
3627
- },
3628
- __wbg_loadAllSedimentreeIds_1a18451ef1f8e795: function(arg0) {
3629
- const ret = arg0.loadAllSedimentreeIds();
3630
- return ret;
3631
- },
3632
- __wbg_loosecommit_new: function(arg0) {
3633
- const ret = LooseCommit.__wrap(arg0);
3634
- return ret;
3635
- },
3636
- __wbg_messageporttransport_new: function(arg0) {
3637
- const ret = MessagePortTransport.__wrap(arg0);
3638
- return ret;
3639
- },
3640
- __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
3641
- const ret = arg0.msCrypto;
3642
- return ret;
3643
- },
3644
- __wbg_new_0837727332ac86ba: function() {
3645
- return handleError(function() {
3646
- const ret = new Headers();
3647
- return ret;
3648
- }, arguments);
3649
- },
3650
- __wbg_new_227d7c05414eb861: function() {
3651
- const ret = new Error();
3652
- return ret;
3653
- },
3654
- __wbg_new_5f486cdf45a04d78: function(arg0) {
3655
- const ret = new Uint8Array(arg0);
3656
- return ret;
3657
- },
3658
- __wbg_new_a70fbab9066b301f: function() {
3659
- const ret = new Array();
3660
- return ret;
3661
- },
3662
- __wbg_new_ab79df5bd7c26067: function() {
3663
- const ret = new Object();
3664
- return ret;
3665
- },
3666
- __wbg_new_d098e265629cd10f: function(arg0, arg1) {
3667
- try {
3668
- var state0 = { a: arg0, b: arg1 };
3669
- var cb0 = (arg02, arg12) => {
3670
- const a = state0.a;
3671
- state0.a = 0;
3672
- try {
3673
- return __wasm_bindgen_func_elem_1605_191(a, state0.b, arg02, arg12);
3674
- } finally {
3675
- state0.a = a;
3676
- }
3677
- };
3678
- const ret = new Promise(cb0);
3679
- return ret;
3680
- } finally {
3681
- state0.a = state0.b = 0;
3682
- }
3683
- },
3684
- __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
3685
- const ret = new Error(getStringFromWasm0(arg0, arg1));
3686
- return ret;
3687
- },
3688
- __wbg_new_dd50bcc3f60ba434: function() {
3689
- return handleError(function(arg0, arg1) {
3690
- const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
3691
- return ret;
3692
- }, arguments);
3693
- },
3694
- __wbg_new_f7708ba82c4c12f6: function() {
3695
- return handleError(function() {
3696
- const ret = new MessageChannel();
3697
- return ret;
3698
- }, arguments);
3699
- },
3700
- __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
3701
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
3702
- return ret;
3703
- },
3704
- __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
3705
- try {
3706
- var state0 = { a: arg0, b: arg1 };
3707
- var cb0 = (arg02, arg12) => {
3708
- const a = state0.a;
3709
- state0.a = 0;
3710
- try {
3711
- return __wasm_bindgen_func_elem_1605_192(a, state0.b, arg02, arg12);
3712
- } finally {
3713
- state0.a = a;
3714
- }
3715
- };
3716
- const ret = new Promise(cb0);
3717
- return ret;
3718
- } finally {
3719
- state0.a = state0.b = 0;
3720
- }
3721
- },
3722
- __wbg_new_typed_bccac67128ed885a: function() {
3723
- const ret = new Array();
3724
- return ret;
3725
- },
3726
- __wbg_new_with_length_825018a1616e9e55: function(arg0) {
3727
- const ret = new Uint8Array(arg0 >>> 0);
3728
- return ret;
3729
- },
3730
- __wbg_new_with_str_and_init_b4b54d1a819bc724: function() {
3731
- return handleError(function(arg0, arg1, arg2) {
3732
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
3733
- return ret;
3734
- }, arguments);
3735
- },
3736
- __wbg_node_84ea875411254db1: function(arg0) {
3737
- const ret = arg0.node;
3738
- return ret;
3739
- },
3740
- __wbg_now_16f0c993d5dd6c27: function() {
3741
- const ret = Date.now();
3742
- return ret;
3743
- },
3744
- __wbg_objectStoreNames_564985d2e9ae7523: function(arg0) {
3745
- const ret = arg0.objectStoreNames;
3746
- return ret;
3747
- },
3748
- __wbg_objectStore_f314ab152a5c7bd0: function() {
3749
- return handleError(function(arg0, arg1, arg2) {
3750
- const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
3751
- return ret;
3752
- }, arguments);
3753
- },
3754
- __wbg_of_8bf7ed3eca00ea43: function(arg0) {
3755
- const ret = Array.of(arg0);
3756
- return ret;
3757
- },
3758
- __wbg_of_d6376e3774c51f89: function(arg0, arg1) {
3759
- const ret = Array.of(arg0, arg1);
3760
- return ret;
3761
- },
3762
- __wbg_onDisconnect_12d6884490508121: function(arg0, arg1) {
3763
- arg0.onDisconnect(arg1);
3764
- },
3765
- __wbg_open_e7a9d3d6344572f6: function() {
3766
- return handleError(function(arg0, arg1, arg2, arg3) {
3767
- const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
3768
- return ret;
3769
- }, arguments);
3770
- },
3771
- __wbg_peerbatchsyncresult_new: function(arg0) {
3772
- const ret = PeerBatchSyncResult.__wrap(arg0);
3773
- return ret;
3774
- },
3775
- __wbg_peerid_new: function(arg0) {
3776
- const ret = PeerId.__wrap(arg0);
3777
- return ret;
3778
- },
3779
- __wbg_peerresultmap_new: function(arg0) {
3780
- const ret = PeerResultMap.__wrap(arg0);
3781
- return ret;
3782
- },
3783
- __wbg_port1_869a7ef90538dbdf: function(arg0) {
3784
- const ret = arg0.port1;
3785
- return ret;
3786
- },
3787
- __wbg_port2_947a51b8ba00adc9: function(arg0) {
3788
- const ret = arg0.port2;
3789
- return ret;
3790
- },
3791
- __wbg_postMessage_0541d6c31330afe3: function(arg0, arg1) {
3792
- arg0.postMessage(arg1);
3793
- },
3794
- __wbg_process_44c7a14e11e9f69e: function(arg0) {
3795
- const ret = arg0.process;
3796
- return ret;
3797
- },
3798
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
3799
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
3800
- },
3801
- __wbg_push_e87b0e732085a946: function(arg0, arg1) {
3802
- const ret = arg0.push(arg1);
3803
- return ret;
3804
- },
3805
- __wbg_put_f1673d719f93ce22: function() {
3806
- return handleError(function(arg0, arg1, arg2) {
3807
- const ret = arg0.put(arg1, arg2);
3808
- return ret;
3809
- }, arguments);
3810
- },
3811
- __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
3812
- const ret = arg0.queueMicrotask;
3813
- return ret;
3814
- },
3815
- __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
3816
- queueMicrotask(arg0);
3817
- },
3818
- __wbg_randomFillSync_6c25eac9869eb53c: function() {
3819
- return handleError(function(arg0, arg1) {
3820
- arg0.randomFillSync(arg1);
3821
- }, arguments);
3822
- },
3823
- __wbg_readyState_1f1e7f1bdf9f4d42: function(arg0) {
3824
- const ret = arg0.readyState;
3825
- return ret;
3826
- },
3827
- __wbg_recvBytes_c85b12fb48cd7a35: function(arg0) {
3828
- const ret = arg0.recvBytes();
3829
- return ret;
3830
- },
3831
- __wbg_require_b4edbdcf3e2a1ef0: function() {
3832
- return handleError(function() {
3833
- const ret = module.require;
3834
- return ret;
3835
- }, arguments);
3836
- },
3837
- __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
3838
- const ret = Promise.resolve(arg0);
3839
- return ret;
3840
- },
3841
- __wbg_result_c5baa2d3d690a01a: function() {
3842
- return handleError(function(arg0) {
3843
- const ret = arg0.result;
3844
- return ret;
3845
- }, arguments);
3846
- },
3847
- __wbg_saveCommit_02f095436fc502e0: function(arg0, arg1, arg2, arg3, arg4) {
3848
- const ret = arg0.saveCommit(arg1, arg2, arg3, arg4);
3849
- return ret;
3850
- },
3851
- __wbg_saveFragment_7681b2171b8cfb35: function(arg0, arg1, arg2, arg3, arg4) {
3852
- const ret = arg0.saveFragment(arg1, arg2, arg3, arg4);
3853
- return ret;
3854
- },
3855
- __wbg_saveSedimentreeId_c265aaeef5af34b6: function(arg0, arg1) {
3856
- const ret = arg0.saveSedimentreeId(arg1);
3857
- return ret;
3858
- },
3859
- __wbg_sedimentreeid_new: function(arg0) {
3860
- const ret = SedimentreeId.__wrap(arg0);
3861
- return ret;
3862
- },
3863
- __wbg_sedimentreeid_unwrap: function(arg0) {
3864
- const ret = SedimentreeId.__unwrap(arg0);
3865
- return ret;
3866
- },
3867
- __wbg_sendBytes_e6262dd74f1c260a: function(arg0, arg1) {
3868
- const ret = arg0.sendBytes(arg1);
3869
- return ret;
3870
- },
3871
- __wbg_send_d31a693c975dea74: function() {
3872
- return handleError(function(arg0, arg1, arg2) {
3873
- arg0.send(getArrayU8FromWasm0(arg1, arg2));
3874
- }, arguments);
3875
- },
3876
- __wbg_setTimeout_7829585928963a1f: function(arg0, arg1) {
3877
- const ret = setTimeout(arg0, arg1);
3878
- return ret;
3879
- },
3880
- __wbg_set_7eaa4f96924fd6b3: function() {
3881
- return handleError(function(arg0, arg1, arg2) {
3882
- const ret = Reflect.set(arg0, arg1, arg2);
3883
- return ret;
3884
- }, arguments);
3885
- },
3886
- __wbg_set_binaryType_3dcf8281ec100a8f: function(arg0, arg1) {
3887
- arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
3888
- },
3889
- __wbg_set_body_a3d856b097dfda04: function(arg0, arg1) {
3890
- arg0.body = arg1;
3891
- },
3892
- __wbg_set_e09648bea3f1af1e: function() {
3893
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
3894
- arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
3895
- }, arguments);
3896
- },
3897
- __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
3898
- arg0.headers = arg1;
3899
- },
3900
- __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
3901
- arg0.method = getStringFromWasm0(arg1, arg2);
3902
- },
3903
- __wbg_set_mode_5a87f2c809cf37c2: function(arg0, arg1) {
3904
- arg0.mode = __wbindgen_enum_RequestMode[arg1];
3905
- },
3906
- __wbg_set_name_7ef37fe858379aaf: function(arg0, arg1, arg2) {
3907
- arg0.name = getStringFromWasm0(arg1, arg2);
3908
- },
3909
- __wbg_set_onclose_8da801226bdd7a7b: function(arg0, arg1) {
3910
- arg0.onclose = arg1;
3911
- },
3912
- __wbg_set_onerror_8a268cb237177bba: function(arg0, arg1) {
3913
- arg0.onerror = arg1;
3914
- },
3915
- __wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
3916
- arg0.onerror = arg1;
3917
- },
3918
- __wbg_set_onmessage_29558b29aee9a78a: function(arg0, arg1) {
3919
- arg0.onmessage = arg1;
3920
- },
3921
- __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
3922
- arg0.onmessage = arg1;
3923
- },
3924
- __wbg_set_onopen_34e3e24cf9337ddd: function(arg0, arg1) {
3925
- arg0.onopen = arg1;
3926
- },
3927
- __wbg_set_onsuccess_fca94ded107b64af: function(arg0, arg1) {
3928
- arg0.onsuccess = arg1;
3929
- },
3930
- __wbg_set_onupgradeneeded_860ce42184f987e7: function(arg0, arg1) {
3931
- arg0.onupgradeneeded = arg1;
3932
- },
3933
- __wbg_sign_a34d057afd14c54d: function() {
3934
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
3935
- const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
3936
- return ret;
3937
- }, arguments);
3938
- },
3939
- __wbg_sign_d03455abc6736428: function(arg0, arg1) {
3940
- const ret = arg0.sign(arg1);
3941
- return ret;
3942
- },
3943
- __wbg_signedfragment_new: function(arg0) {
3944
- const ret = SignedFragment.__wrap(arg0);
3945
- return ret;
3946
- },
3947
- __wbg_signedloosecommit_new: function(arg0) {
3948
- const ret = SignedLooseCommit.__wrap(arg0);
3949
- return ret;
3950
- },
3951
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
3952
- const ret = arg1.stack;
3953
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3954
- const len1 = WASM_VECTOR_LEN;
3955
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3956
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3957
- },
3958
- __wbg_start_f837ba2bac4733b5: function(arg0) {
3959
- arg0.start();
3960
- },
3961
- __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
3962
- const ret = typeof global === "undefined" ? null : global;
3963
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3964
- },
3965
- __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
3966
- const ret = typeof globalThis === "undefined" ? null : globalThis;
3967
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3968
- },
3969
- __wbg_static_accessor_SELF_f207c857566db248: function() {
3970
- const ret = typeof self === "undefined" ? null : self;
3971
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3972
- },
3973
- __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
3974
- const ret = typeof window === "undefined" ? null : window;
3975
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3976
- },
3977
- __wbg_status_318629ab93a22955: function(arg0) {
3978
- const ret = arg0.status;
3979
- return ret;
3980
- },
3981
- __wbg_subarray_a068d24e39478a8a: function(arg0, arg1, arg2) {
3982
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3983
- return ret;
3984
- },
3985
- __wbg_subduction_new: function(arg0) {
3986
- const ret = Subduction.__wrap(arg0);
3987
- return ret;
3988
- },
3989
- __wbg_subductionhttplongpoll_new: function(arg0) {
3990
- const ret = SubductionHttpLongPoll.__wrap(arg0);
3991
- return ret;
3992
- },
3993
- __wbg_subductionwebsocket_new: function(arg0) {
3994
- const ret = SubductionWebSocket.__wrap(arg0);
3995
- return ret;
3996
- },
3997
- __wbg_subtle_c060fa3eb5c6248d: function(arg0) {
3998
- const ret = arg0.subtle;
3999
- return ret;
4000
- },
4001
- __wbg_target_7bc90f314634b37b: function(arg0) {
4002
- const ret = arg0.target;
4003
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
4004
- },
4005
- __wbg_then_098abe61755d12f6: function(arg0, arg1) {
4006
- const ret = arg0.then(arg1);
4007
- return ret;
4008
- },
4009
- __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
4010
- const ret = arg0.then(arg1, arg2);
4011
- return ret;
4012
- },
4013
- __wbg_transaction_1309b463c399d2b3: function() {
4014
- return handleError(function(arg0, arg1, arg2, arg3) {
4015
- const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
4016
- return ret;
4017
- }, arguments);
4018
- },
4019
- __wbg_transaction_2237af0233efbdf3: function() {
4020
- return handleError(function(arg0, arg1, arg2) {
4021
- const ret = arg0.transaction(getStringFromWasm0(arg1, arg2));
4022
- return ret;
4023
- }, arguments);
4024
- },
4025
- __wbg_tryIntoJsSedimentreeIdsArray_d6337c0aa0f28604: function() {
4026
- return handleError(function(arg0, arg1) {
4027
- const ret = tryIntoJsSedimentreeIdsArray(arg1);
4028
- const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
4029
- const len1 = WASM_VECTOR_LEN;
4030
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4031
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4032
- }, arguments);
4033
- },
4034
- __wbg_verifyingKey_29533740d75f8cdb: function(arg0) {
4035
- const ret = arg0.verifyingKey();
4036
- return ret;
4037
- },
4038
- __wbg_versions_276b2795b1c6a219: function(arg0) {
4039
- const ret = arg0.versions;
4040
- return ret;
4041
- },
4042
- __wbg_webcryptosigner_new: function(arg0) {
4043
- const ret = WebCryptoSigner.__wrap(arg0);
4044
- return ret;
4045
- },
4046
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
4047
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590);
4048
- return ret;
4049
- },
4050
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
4051
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_1);
4052
- return ret;
4053
- },
4054
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
4055
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_2);
4056
- return ret;
4057
- },
4058
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
4059
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_3);
4060
- return ret;
4061
- },
4062
- __wbindgen_cast_0000000000000005: function(arg0, arg1) {
4063
- const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_589);
4064
- return ret;
4065
- },
4066
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
4067
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_1605);
4068
- return ret;
4069
- },
4070
- __wbindgen_cast_0000000000000007: function(arg0) {
4071
- const ret = arg0;
4072
- return ret;
4073
- },
4074
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
4075
- const ret = getArrayU8FromWasm0(arg0, arg1);
4076
- return ret;
4077
- },
4078
- __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4079
- const ret = getStringFromWasm0(arg0, arg1);
4080
- return ret;
4081
- },
4082
- __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4083
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4084
- wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4085
- const ret = v0;
4086
- return ret;
4087
- },
4088
- __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4089
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4090
- wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4091
- const ret = v0;
4092
- return ret;
4093
- },
4094
- __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4095
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4096
- wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4097
- const ret = v0;
4098
- return ret;
4099
- },
4100
- __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4101
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4102
- wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4103
- const ret = v0;
4104
- return ret;
4105
- },
4106
- __wbindgen_cast_000000000000000e: function(arg0, arg1) {
4107
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4108
- wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4109
- const ret = v0;
4110
- return ret;
4111
- },
4112
- __wbindgen_init_externref_table: function() {
4113
- const table = wasm.__wbindgen_externrefs;
4114
- const offset = table.grow(4);
4115
- table.set(0, void 0);
4116
- table.set(offset + 0, void 0);
4117
- table.set(offset + 1, null);
4118
- table.set(offset + 2, true);
4119
- table.set(offset + 3, false);
4120
- }
4121
- };
4122
- return {
4123
- __proto__: null,
4124
- "./subduction_wasm_bg.js": import0,
4125
- "./snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js": inline0_exports
4126
- };
4127
- }
4128
- function __wasm_bindgen_func_elem_589(arg0, arg1) {
4129
- wasm.__wasm_bindgen_func_elem_589(arg0, arg1);
4130
- }
4131
- function __wasm_bindgen_func_elem_590(arg0, arg1, arg2) {
4132
- wasm.__wasm_bindgen_func_elem_590(arg0, arg1, arg2);
4133
- }
4134
- function __wasm_bindgen_func_elem_590_1(arg0, arg1, arg2) {
4135
- wasm.__wasm_bindgen_func_elem_590_1(arg0, arg1, arg2);
4136
- }
4137
- function __wasm_bindgen_func_elem_590_2(arg0, arg1, arg2) {
4138
- wasm.__wasm_bindgen_func_elem_590_2(arg0, arg1, arg2);
4139
- }
4140
- function __wasm_bindgen_func_elem_590_3(arg0, arg1, arg2) {
4141
- wasm.__wasm_bindgen_func_elem_590_3(arg0, arg1, arg2);
4142
- }
4143
- function __wasm_bindgen_func_elem_1605(arg0, arg1, arg2) {
4144
- const ret = wasm.__wasm_bindgen_func_elem_1605(arg0, arg1, arg2);
4145
- if (ret[1]) {
4146
- throw takeFromExternrefTable0(ret[0]);
4147
- }
4148
- }
4149
- function __wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3) {
4150
- wasm.__wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3);
4151
- }
4152
- function __wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3) {
4153
- wasm.__wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3);
4154
- }
4155
- var __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
4156
- var __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
4157
- var __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
4158
- var MemorySignerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4159
- }, unregister: () => {
4160
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_memorysigner_free(ptr >>> 0, 1));
4161
- var MemoryStorageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4162
- }, unregister: () => {
4163
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
4164
- var PeerBatchSyncResultFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4165
- }, unregister: () => {
4166
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerbatchsyncresult_free(ptr >>> 0, 1));
4167
- var AuthenticatedLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4168
- }, unregister: () => {
4169
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedlongpoll_free(ptr >>> 0, 1));
4170
- var AuthenticatedTransportFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4171
- }, unregister: () => {
4172
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedtransport_free(ptr >>> 0, 1));
4173
- var AuthenticatedWebSocketFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4174
- }, unregister: () => {
4175
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_authenticatedwebsocket_free(ptr >>> 0, 1));
4176
- var BatchSyncRequestFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4177
- }, unregister: () => {
4178
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_batchsyncrequest_free(ptr >>> 0, 1));
4179
- var BatchSyncResponseFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4180
- }, unregister: () => {
4181
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_batchsyncresponse_free(ptr >>> 0, 1));
4182
- var BlobMetaFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4183
- }, unregister: () => {
4184
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
4185
- var CallErrorFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4186
- }, unregister: () => {
4187
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_callerror_free(ptr >>> 0, 1));
4188
- var CommitWithBlobFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4189
- }, unregister: () => {
4190
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
4191
- var DepthFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4192
- }, unregister: () => {
4193
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_depth_free(ptr >>> 0, 1));
4194
- var DigestFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4195
- }, unregister: () => {
4196
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_digest_free(ptr >>> 0, 1));
4197
- var FragmentFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4198
- }, unregister: () => {
4199
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragment_free(ptr >>> 0, 1));
4200
- var FragmentRequestedFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4201
- }, unregister: () => {
4202
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentrequested_free(ptr >>> 0, 1));
4203
- var FragmentWithBlobFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4204
- }, unregister: () => {
4205
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
4206
- var FragmentsArrayFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4207
- }, unregister: () => {
4208
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
4209
- var HashMetricFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4210
- }, unregister: () => {
4211
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_hashmetric_free(ptr >>> 0, 1));
4212
- var SubductionHttpLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4213
- }, unregister: () => {
4214
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionhttplongpoll_free(ptr >>> 0, 1));
4215
- var SubductionLongPollFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4216
- }, unregister: () => {
4217
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionlongpoll_free(ptr >>> 0, 1));
4218
- var LooseCommitFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4219
- }, unregister: () => {
4220
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
4221
- var SyncMessageFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4222
- }, unregister: () => {
4223
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_syncmessage_free(ptr >>> 0, 1));
4224
- var MessagePortTransportFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4225
- }, unregister: () => {
4226
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_messageporttransport_free(ptr >>> 0, 1));
4227
- var NonceFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4228
- }, unregister: () => {
4229
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_nonce_free(ptr >>> 0, 1));
4230
- var PeerIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4231
- }, unregister: () => {
4232
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerid_free(ptr >>> 0, 1));
4233
- var PeerResultMapFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4234
- }, unregister: () => {
4235
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_peerresultmap_free(ptr >>> 0, 1));
4236
- var RequestIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4237
- }, unregister: () => {
4238
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_requestid_free(ptr >>> 0, 1));
4239
- var SedimentreeFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4240
- }, unregister: () => {
4241
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
4242
- var SedimentreeIdFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4243
- }, unregister: () => {
4244
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
4245
- var SedimentreeIdsArrayFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4246
- }, unregister: () => {
4247
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
4248
- var SignedFragmentFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4249
- }, unregister: () => {
4250
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
4251
- var SignedLooseCommitFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4252
- }, unregister: () => {
4253
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
4254
- var SubductionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4255
- }, unregister: () => {
4256
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_subduction_free(ptr >>> 0, 1));
4257
- var SyncStatsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4258
- }, unregister: () => {
4259
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_syncstats_free(ptr >>> 0, 1));
4260
- var SubductionWebSocketFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4261
- }, unregister: () => {
4262
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionwebsocket_free(ptr >>> 0, 1));
4263
- var WebCryptoSignerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4264
- }, unregister: () => {
4265
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_webcryptosigner_free(ptr >>> 0, 1));
4266
- function addToExternrefTable0(obj) {
4267
- const idx = wasm.__wbindgen_export4();
4268
- wasm.__wbindgen_externrefs.set(idx, obj);
4269
- return idx;
4270
- }
4271
- function _assertClass(instance, klass) {
4272
- if (!(instance instanceof klass)) {
4273
- throw new Error(`expected instance of ${klass.name}`);
4274
- }
4275
- }
4276
- var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
4277
- }, unregister: () => {
4278
- } } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
4279
- function debugString(val) {
4280
- const type = typeof val;
4281
- if (type == "number" || type == "boolean" || val == null) {
4282
- return `${val}`;
4283
- }
4284
- if (type == "string") {
4285
- return `"${val}"`;
4286
- }
4287
- if (type == "symbol") {
4288
- const description = val.description;
4289
- if (description == null) {
4290
- return "Symbol";
4291
- } else {
4292
- return `Symbol(${description})`;
4293
- }
4294
- }
4295
- if (type == "function") {
4296
- const name = val.name;
4297
- if (typeof name == "string" && name.length > 0) {
4298
- return `Function(${name})`;
4299
- } else {
4300
- return "Function";
4301
- }
4302
- }
4303
- if (Array.isArray(val)) {
4304
- const length = val.length;
4305
- let debug = "[";
4306
- if (length > 0) {
4307
- debug += debugString(val[0]);
4308
- }
4309
- for (let i = 1; i < length; i++) {
4310
- debug += ", " + debugString(val[i]);
4311
- }
4312
- debug += "]";
4313
- return debug;
4314
- }
4315
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
4316
- let className;
4317
- if (builtInMatches && builtInMatches.length > 1) {
4318
- className = builtInMatches[1];
4319
- } else {
4320
- return toString.call(val);
4321
- }
4322
- if (className == "Object") {
4323
- try {
4324
- return "Object(" + JSON.stringify(val) + ")";
4325
- } catch (_) {
4326
- return "Object";
4327
- }
4328
- }
4329
- if (val instanceof Error) {
4330
- return `${val.name}: ${val.message}
4331
- ${val.stack}`;
4332
- }
4333
- return className;
4334
- }
4335
- function getArrayJsValueFromWasm0(ptr, len) {
4336
- ptr = ptr >>> 0;
4337
- const mem = getDataViewMemory0();
4338
- const result = [];
4339
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
4340
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
4341
- }
4342
- wasm.__wbindgen_export6(ptr, len);
4343
- return result;
4344
- }
4345
- function getArrayU8FromWasm0(ptr, len) {
4346
- ptr = ptr >>> 0;
4347
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
4348
- }
4349
- var cachedDataViewMemory0 = null;
4350
- function getDataViewMemory0() {
4351
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
4352
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
4353
- }
4354
- return cachedDataViewMemory0;
4355
- }
4356
- function getStringFromWasm0(ptr, len) {
4357
- ptr = ptr >>> 0;
4358
- return decodeText(ptr, len);
4359
- }
4360
- var cachedUint8ArrayMemory0 = null;
4361
- function getUint8ArrayMemory0() {
4362
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
4363
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
4364
- }
4365
- return cachedUint8ArrayMemory0;
4366
- }
4367
- function handleError(f, args) {
4368
- try {
4369
- return f.apply(this, args);
4370
- } catch (e) {
4371
- const idx = addToExternrefTable0(e);
4372
- wasm.__wbindgen_export3(idx);
4373
- }
4374
- }
4375
- function isLikeNone(x) {
4376
- return x === void 0 || x === null;
4377
- }
4378
- function makeClosure(arg0, arg1, dtor, f) {
4379
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
4380
- const real = (...args) => {
4381
- state.cnt++;
4382
- try {
4383
- return f(state.a, state.b, ...args);
4384
- } finally {
4385
- real._wbg_cb_unref();
4386
- }
4387
- };
4388
- real._wbg_cb_unref = () => {
4389
- if (--state.cnt === 0) {
4390
- state.dtor(state.a, state.b);
4391
- state.a = 0;
4392
- CLOSURE_DTORS.unregister(state);
4393
- }
4394
- };
4395
- CLOSURE_DTORS.register(real, state, state);
4396
- return real;
4397
- }
4398
- function makeMutClosure(arg0, arg1, dtor, f) {
4399
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
4400
- const real = (...args) => {
4401
- state.cnt++;
4402
- const a = state.a;
4403
- state.a = 0;
4404
- try {
4405
- return f(a, state.b, ...args);
4406
- } finally {
4407
- state.a = a;
4408
- real._wbg_cb_unref();
4409
- }
4410
- };
4411
- real._wbg_cb_unref = () => {
4412
- if (--state.cnt === 0) {
4413
- state.dtor(state.a, state.b);
4414
- state.a = 0;
4415
- CLOSURE_DTORS.unregister(state);
4416
- }
4417
- };
4418
- CLOSURE_DTORS.register(real, state, state);
4419
- return real;
4420
- }
4421
- function passArray8ToWasm0(arg, malloc) {
4422
- const ptr = malloc(arg.length * 1, 1) >>> 0;
4423
- getUint8ArrayMemory0().set(arg, ptr / 1);
4424
- WASM_VECTOR_LEN = arg.length;
4425
- return ptr;
4426
- }
4427
- function passArrayJsValueToWasm0(array, malloc) {
4428
- const ptr = malloc(array.length * 4, 4) >>> 0;
4429
- for (let i = 0; i < array.length; i++) {
4430
- const add = addToExternrefTable0(array[i]);
4431
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
4432
- }
4433
- WASM_VECTOR_LEN = array.length;
4434
- return ptr;
4435
- }
4436
- function passStringToWasm0(arg, malloc, realloc) {
4437
- if (realloc === void 0) {
4438
- const buf = cachedTextEncoder.encode(arg);
4439
- const ptr2 = malloc(buf.length, 1) >>> 0;
4440
- getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
4441
- WASM_VECTOR_LEN = buf.length;
4442
- return ptr2;
4443
- }
4444
- let len = arg.length;
4445
- let ptr = malloc(len, 1) >>> 0;
4446
- const mem = getUint8ArrayMemory0();
4447
- let offset = 0;
4448
- for (; offset < len; offset++) {
4449
- const code = arg.charCodeAt(offset);
4450
- if (code > 127) break;
4451
- mem[ptr + offset] = code;
4452
- }
4453
- if (offset !== len) {
4454
- if (offset !== 0) {
4455
- arg = arg.slice(offset);
4456
- }
4457
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
4458
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
4459
- const ret = cachedTextEncoder.encodeInto(arg, view);
4460
- offset += ret.written;
4461
- ptr = realloc(ptr, len, offset, 1) >>> 0;
4462
- }
4463
- WASM_VECTOR_LEN = offset;
4464
- return ptr;
4465
- }
4466
- function takeFromExternrefTable0(idx) {
4467
- const value = wasm.__wbindgen_externrefs.get(idx);
4468
- wasm.__wbindgen_export7(idx);
4469
- return value;
4470
- }
4471
- var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
4472
- cachedTextDecoder.decode();
4473
- var MAX_SAFARI_DECODE_BYTES = 2146435072;
4474
- var numBytesDecoded = 0;
4475
- function decodeText(ptr, len) {
4476
- numBytesDecoded += len;
4477
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
4478
- cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
4479
- cachedTextDecoder.decode();
4480
- numBytesDecoded = len;
4481
- }
4482
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
4483
- }
4484
- var cachedTextEncoder = new TextEncoder();
4485
- if (!("encodeInto" in cachedTextEncoder)) {
4486
- cachedTextEncoder.encodeInto = function(arg, view) {
4487
- const buf = cachedTextEncoder.encode(arg);
4488
- view.set(buf);
4489
- return {
4490
- read: arg.length,
4491
- written: buf.length
4492
- };
4493
- };
4494
- }
4495
- var WASM_VECTOR_LEN = 0;
4496
- var wasmModule;
4497
- var wasm;
4498
- function __wbg_finalize_init(instance, module2) {
4499
- wasm = instance.exports;
4500
- wasmModule = module2;
4501
- cachedDataViewMemory0 = null;
4502
- cachedUint8ArrayMemory0 = null;
4503
- wasm.__wbindgen_start();
4504
- return wasm;
4505
- }
4506
- async function __wbg_load(module2, imports) {
4507
- if (typeof Response === "function" && module2 instanceof Response) {
4508
- if (typeof WebAssembly.instantiateStreaming === "function") {
4509
- try {
4510
- return await WebAssembly.instantiateStreaming(module2, imports);
4511
- } catch (e) {
4512
- const validResponse = module2.ok && expectedResponseType(module2.type);
4513
- if (validResponse && module2.headers.get("Content-Type") !== "application/wasm") {
4514
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
4515
- } else {
4516
- throw e;
4517
- }
4518
- }
4519
- }
4520
- const bytes = await module2.arrayBuffer();
4521
- return await WebAssembly.instantiate(bytes, imports);
4522
- } else {
4523
- const instance = await WebAssembly.instantiate(module2, imports);
4524
- if (instance instanceof WebAssembly.Instance) {
4525
- return { instance, module: module2 };
4526
- } else {
4527
- return instance;
4528
- }
4529
- }
4530
- function expectedResponseType(type) {
4531
- switch (type) {
4532
- case "basic":
4533
- case "cors":
4534
- case "default":
4535
- return true;
4536
- }
4537
- return false;
4538
- }
4539
- }
4540
- function initSync(module2) {
4541
- if (wasm !== void 0) return wasm;
4542
- if (module2 !== void 0) {
4543
- if (Object.getPrototypeOf(module2) === Object.prototype) {
4544
- ({ module: module2 } = module2);
4545
- } else {
4546
- console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
4547
- }
4548
- }
4549
- const imports = __wbg_get_imports();
4550
- if (!(module2 instanceof WebAssembly.Module)) {
4551
- module2 = new WebAssembly.Module(module2);
4552
- }
4553
- const instance = new WebAssembly.Instance(module2, imports);
4554
- return __wbg_finalize_init(instance, module2);
4555
- }
4556
- async function __wbg_init(module_or_path) {
4557
- if (wasm !== void 0) return wasm;
4558
- if (module_or_path !== void 0) {
4559
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
4560
- ({ module_or_path } = module_or_path);
4561
- } else {
4562
- console.warn("using deprecated parameters for the initialization function; pass a single object instead");
4563
- }
4564
- }
4565
- if (module_or_path === void 0) {
4566
- module_or_path = new /* @vite-ignore */
4567
- URL("subduction_wasm_bg.wasm", import_meta.url);
4568
- }
4569
- const imports = __wbg_get_imports();
4570
- if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
4571
- module_or_path = fetch(module_or_path);
4572
- }
4573
- const { instance, module: module2 } = await __wbg_load(await module_or_path, imports);
4574
- return __wbg_finalize_init(instance, module2);
4575
- }
4576
- function __wbg_set_wasm(val) {
4577
- wasm = val;
4578
- }
4579
- // Annotate the CommonJS export names for ESM import in node:
4580
- 0 && (module.exports = {
4581
- AuthenticatedLongPoll,
4582
- AuthenticatedTransport,
4583
- AuthenticatedWebSocket,
4584
- BatchSyncRequest,
4585
- BatchSyncResponse,
4586
- BlobMeta,
4587
- CallError,
4588
- CommitWithBlob,
4589
- Depth,
4590
- Digest,
4591
- Fragment,
4592
- FragmentRequested,
4593
- FragmentWithBlob,
4594
- FragmentsArray,
4595
- HashMetric,
4596
- LooseCommit,
4597
- MemorySigner,
4598
- MemoryStorage,
4599
- MessagePortTransport,
4600
- Nonce,
4601
- PeerBatchSyncResult,
4602
- PeerId,
4603
- PeerResultMap,
4604
- RequestId,
4605
- Sedimentree,
4606
- SedimentreeId,
4607
- SedimentreeIdsArray,
4608
- SignedFragment,
4609
- SignedLooseCommit,
4610
- Subduction,
4611
- SubductionHttpLongPoll,
4612
- SubductionLongPoll,
4613
- SubductionWebSocket,
4614
- SyncMessage,
4615
- SyncStats,
4616
- WebCryptoSigner,
4617
- __wbg_set_wasm,
4618
- initSync,
4619
- makeMessagePortTransport,
4620
- start
4621
- });