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