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