@loro-dev/flock-wasm 0.1.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/LICENSE +661 -0
- package/README.md +26 -0
- package/base64/event-batcher.d.ts +37 -0
- package/base64/event-batcher.js +204 -0
- package/base64/flock_wasm.js +1158 -0
- package/base64/index.d.ts +268 -0
- package/base64/index.js +1012 -0
- package/base64/wasm.d.ts +37 -0
- package/base64/wasm.js +15 -0
- package/bundler/event-batcher.d.ts +37 -0
- package/bundler/event-batcher.js +204 -0
- package/bundler/flock_wasm.d.ts +313 -0
- package/bundler/flock_wasm.js +5 -0
- package/bundler/flock_wasm_bg.js +1119 -0
- package/bundler/flock_wasm_bg.wasm +0 -0
- package/bundler/flock_wasm_bg.wasm.d.ts +40 -0
- package/bundler/index.d.ts +268 -0
- package/bundler/index.js +1012 -0
- package/bundler/wasm.d.ts +37 -0
- package/bundler/wasm.js +4 -0
- package/nodejs/event-batcher.d.ts +37 -0
- package/nodejs/event-batcher.js +208 -0
- package/nodejs/flock_wasm.d.ts +313 -0
- package/nodejs/flock_wasm.js +1126 -0
- package/nodejs/flock_wasm_bg.wasm +0 -0
- package/nodejs/flock_wasm_bg.wasm.d.ts +40 -0
- package/nodejs/index.d.ts +268 -0
- package/nodejs/index.js +1018 -0
- package/nodejs/package.json +1 -0
- package/nodejs/wasm.d.ts +37 -0
- package/nodejs/wasm.js +2 -0
- package/package.json +50 -0
- package/web/event-batcher.d.ts +37 -0
- package/web/event-batcher.js +204 -0
- package/web/flock_wasm.d.ts +377 -0
- package/web/flock_wasm.js +1158 -0
- package/web/flock_wasm_bg.wasm +0 -0
- package/web/flock_wasm_bg.wasm.d.ts +40 -0
- package/web/index.d.ts +268 -0
- package/web/index.js +1012 -0
- package/web/wasm.d.ts +37 -0
- package/web/wasm.js +4 -0
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
|
8
|
+
|
|
9
|
+
let cachedUint8ArrayMemory0 = null;
|
|
10
|
+
|
|
11
|
+
function getUint8ArrayMemory0() {
|
|
12
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
13
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
+
}
|
|
15
|
+
return cachedUint8ArrayMemory0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
19
|
+
|
|
20
|
+
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
21
|
+
|
|
22
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
23
|
+
? function (arg, view) {
|
|
24
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
25
|
+
}
|
|
26
|
+
: function (arg, view) {
|
|
27
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
28
|
+
view.set(buf);
|
|
29
|
+
return {
|
|
30
|
+
read: arg.length,
|
|
31
|
+
written: buf.length
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
36
|
+
|
|
37
|
+
if (realloc === undefined) {
|
|
38
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
39
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
40
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
41
|
+
WASM_VECTOR_LEN = buf.length;
|
|
42
|
+
return ptr;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let len = arg.length;
|
|
46
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
47
|
+
|
|
48
|
+
const mem = getUint8ArrayMemory0();
|
|
49
|
+
|
|
50
|
+
let offset = 0;
|
|
51
|
+
|
|
52
|
+
for (; offset < len; offset++) {
|
|
53
|
+
const code = arg.charCodeAt(offset);
|
|
54
|
+
if (code > 0x7F) break;
|
|
55
|
+
mem[ptr + offset] = code;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (offset !== len) {
|
|
59
|
+
if (offset !== 0) {
|
|
60
|
+
arg = arg.slice(offset);
|
|
61
|
+
}
|
|
62
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
63
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
64
|
+
const ret = encodeString(arg, view);
|
|
65
|
+
|
|
66
|
+
offset += ret.written;
|
|
67
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
WASM_VECTOR_LEN = offset;
|
|
71
|
+
return ptr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let cachedDataViewMemory0 = null;
|
|
75
|
+
|
|
76
|
+
function getDataViewMemory0() {
|
|
77
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
78
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
79
|
+
}
|
|
80
|
+
return cachedDataViewMemory0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function addToExternrefTable0(obj) {
|
|
84
|
+
const idx = wasm.__externref_table_alloc();
|
|
85
|
+
wasm.__wbindgen_export_4.set(idx, obj);
|
|
86
|
+
return idx;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function handleError(f, args) {
|
|
90
|
+
try {
|
|
91
|
+
return f.apply(this, args);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
const idx = addToExternrefTable0(e);
|
|
94
|
+
wasm.__wbindgen_exn_store(idx);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
99
|
+
|
|
100
|
+
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
101
|
+
|
|
102
|
+
cachedTextDecoder.decode();
|
|
103
|
+
|
|
104
|
+
function getStringFromWasm0(ptr, len) {
|
|
105
|
+
ptr = ptr >>> 0;
|
|
106
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isLikeNone(x) {
|
|
110
|
+
return x === undefined || x === null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
114
|
+
? { register: () => {}, unregister: () => {} }
|
|
115
|
+
: new FinalizationRegistry(state => {
|
|
116
|
+
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
120
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
121
|
+
const real = (...args) => {
|
|
122
|
+
// First up with a closure we increment the internal reference
|
|
123
|
+
// count. This ensures that the Rust closure environment won't
|
|
124
|
+
// be deallocated while we're invoking it.
|
|
125
|
+
state.cnt++;
|
|
126
|
+
const a = state.a;
|
|
127
|
+
state.a = 0;
|
|
128
|
+
try {
|
|
129
|
+
return f(a, state.b, ...args);
|
|
130
|
+
} finally {
|
|
131
|
+
if (--state.cnt === 0) {
|
|
132
|
+
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
|
|
133
|
+
CLOSURE_DTORS.unregister(state);
|
|
134
|
+
} else {
|
|
135
|
+
state.a = a;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
real.original = state;
|
|
140
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
141
|
+
return real;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function debugString(val) {
|
|
145
|
+
// primitive types
|
|
146
|
+
const type = typeof val;
|
|
147
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
148
|
+
return `${val}`;
|
|
149
|
+
}
|
|
150
|
+
if (type == 'string') {
|
|
151
|
+
return `"${val}"`;
|
|
152
|
+
}
|
|
153
|
+
if (type == 'symbol') {
|
|
154
|
+
const description = val.description;
|
|
155
|
+
if (description == null) {
|
|
156
|
+
return 'Symbol';
|
|
157
|
+
} else {
|
|
158
|
+
return `Symbol(${description})`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (type == 'function') {
|
|
162
|
+
const name = val.name;
|
|
163
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
164
|
+
return `Function(${name})`;
|
|
165
|
+
} else {
|
|
166
|
+
return 'Function';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// objects
|
|
170
|
+
if (Array.isArray(val)) {
|
|
171
|
+
const length = val.length;
|
|
172
|
+
let debug = '[';
|
|
173
|
+
if (length > 0) {
|
|
174
|
+
debug += debugString(val[0]);
|
|
175
|
+
}
|
|
176
|
+
for(let i = 1; i < length; i++) {
|
|
177
|
+
debug += ', ' + debugString(val[i]);
|
|
178
|
+
}
|
|
179
|
+
debug += ']';
|
|
180
|
+
return debug;
|
|
181
|
+
}
|
|
182
|
+
// Test for built-in
|
|
183
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
184
|
+
let className;
|
|
185
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
186
|
+
className = builtInMatches[1];
|
|
187
|
+
} else {
|
|
188
|
+
// Failed to match the standard '[object ClassName]'
|
|
189
|
+
return toString.call(val);
|
|
190
|
+
}
|
|
191
|
+
if (className == 'Object') {
|
|
192
|
+
// we're a user defined class or Object
|
|
193
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
194
|
+
// easier than looping through ownProperties of `val`.
|
|
195
|
+
try {
|
|
196
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
197
|
+
} catch (_) {
|
|
198
|
+
return 'Object';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// errors
|
|
202
|
+
if (val instanceof Error) {
|
|
203
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
204
|
+
}
|
|
205
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
206
|
+
return className;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Initializes the WASM module.
|
|
210
|
+
*
|
|
211
|
+
* This function is automatically called when the WASM module is loaded.
|
|
212
|
+
* It sets up the panic hook to route Rust panics to the JavaScript console.
|
|
213
|
+
*/
|
|
214
|
+
export function start() {
|
|
215
|
+
wasm.start();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Drains the pending callback queue, invoking all enqueued callbacks.
|
|
220
|
+
*
|
|
221
|
+
* This function is exported to JavaScript and can be called manually,
|
|
222
|
+
* but is typically invoked automatically via microtasks.
|
|
223
|
+
*
|
|
224
|
+
* Callbacks are invoked sequentially. If any callback throws an error,
|
|
225
|
+
* the error is propagated to JavaScript after the current batch completes.
|
|
226
|
+
*/
|
|
227
|
+
export function callPendingEvents() {
|
|
228
|
+
wasm.callPendingEvents();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function takeFromExternrefTable0(idx) {
|
|
232
|
+
const value = wasm.__wbindgen_export_4.get(idx);
|
|
233
|
+
wasm.__externref_table_dealloc(idx);
|
|
234
|
+
return value;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
238
|
+
ptr = ptr >>> 0;
|
|
239
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function _assertClass(instance, klass) {
|
|
243
|
+
if (!(instance instanceof klass)) {
|
|
244
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
249
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
250
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
251
|
+
WASM_VECTOR_LEN = arg.length;
|
|
252
|
+
return ptr;
|
|
253
|
+
}
|
|
254
|
+
function __wbg_adapter_56(arg0, arg1, arg2) {
|
|
255
|
+
wasm.closure38_externref_shim(arg0, arg1, arg2);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const RawFlockFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
259
|
+
? { register: () => {}, unregister: () => {} }
|
|
260
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_rawflock_free(ptr >>> 0, 1));
|
|
261
|
+
/**
|
|
262
|
+
* The main WASM-exposed flock instance.
|
|
263
|
+
*
|
|
264
|
+
* Wraps the underlying [`flock::Flock`] and provides JavaScript-compatible
|
|
265
|
+
* methods for all CRDT operations including put, get, delete, scan, merge,
|
|
266
|
+
* import/export, and event subscription.
|
|
267
|
+
*/
|
|
268
|
+
export class RawFlock {
|
|
269
|
+
|
|
270
|
+
static __wrap(ptr) {
|
|
271
|
+
ptr = ptr >>> 0;
|
|
272
|
+
const obj = Object.create(RawFlock.prototype);
|
|
273
|
+
obj.__wbg_ptr = ptr;
|
|
274
|
+
RawFlockFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
275
|
+
return obj;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
__destroy_into_raw() {
|
|
279
|
+
const ptr = this.__wbg_ptr;
|
|
280
|
+
this.__wbg_ptr = 0;
|
|
281
|
+
RawFlockFinalization.unregister(this);
|
|
282
|
+
return ptr;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
free() {
|
|
286
|
+
const ptr = this.__destroy_into_raw();
|
|
287
|
+
wasm.__wbg_rawflock_free(ptr, 0);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Commits the current transaction.
|
|
291
|
+
*
|
|
292
|
+
* Flushes all buffered operations and delivers batched events.
|
|
293
|
+
*
|
|
294
|
+
* # Errors
|
|
295
|
+
*
|
|
296
|
+
* Returns an error if no transaction is active or if commit fails.
|
|
297
|
+
*/
|
|
298
|
+
txnCommit() {
|
|
299
|
+
const ret = wasm.rawflock_txnCommit(this.__wbg_ptr);
|
|
300
|
+
if (ret[1]) {
|
|
301
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @returns {Uint8Array}
|
|
306
|
+
*/
|
|
307
|
+
exportFile() {
|
|
308
|
+
const ret = wasm.rawflock_exportFile(this.__wbg_ptr);
|
|
309
|
+
if (ret[3]) {
|
|
310
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
311
|
+
}
|
|
312
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
313
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
314
|
+
return v1;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Exports the current state as a JSON bundle.
|
|
318
|
+
*
|
|
319
|
+
* # Arguments
|
|
320
|
+
*
|
|
321
|
+
* * `from` - Optional version vector for incremental export
|
|
322
|
+
* * `prune_tombstones_before` - Optional timestamp to prune tombstones older than this
|
|
323
|
+
* * `peer_id` - Optional peer ID filter to only export entries from this peer
|
|
324
|
+
*
|
|
325
|
+
* # Returns
|
|
326
|
+
*
|
|
327
|
+
* An export bundle containing entries and version information.
|
|
328
|
+
*
|
|
329
|
+
* # Errors
|
|
330
|
+
*
|
|
331
|
+
* Returns an error if arguments are invalid or serialization fails.
|
|
332
|
+
* @param {any} from
|
|
333
|
+
* @param {any} prune_tombstones_before
|
|
334
|
+
* @param {any} peer_id
|
|
335
|
+
* @returns {any}
|
|
336
|
+
*/
|
|
337
|
+
exportJson(from, prune_tombstones_before, peer_id) {
|
|
338
|
+
const ret = wasm.rawflock_exportJson(this.__wbg_ptr, from, prune_tombstones_before, peer_id);
|
|
339
|
+
if (ret[2]) {
|
|
340
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
341
|
+
}
|
|
342
|
+
return takeFromExternrefTable0(ret[0]);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Imports a JSON bundle into this flock instance.
|
|
346
|
+
*
|
|
347
|
+
* # Arguments
|
|
348
|
+
*
|
|
349
|
+
* * `bundle` - The export bundle to import
|
|
350
|
+
*
|
|
351
|
+
* # Returns
|
|
352
|
+
*
|
|
353
|
+
* An import report containing counts of accepted and skipped entries.
|
|
354
|
+
*
|
|
355
|
+
* # Errors
|
|
356
|
+
*
|
|
357
|
+
* Returns an error if the bundle is invalid or import fails.
|
|
358
|
+
* @param {any} bundle
|
|
359
|
+
* @returns {any}
|
|
360
|
+
*/
|
|
361
|
+
importJson(bundle) {
|
|
362
|
+
const ret = wasm.rawflock_importJson(this.__wbg_ptr, bundle);
|
|
363
|
+
if (ret[2]) {
|
|
364
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
365
|
+
}
|
|
366
|
+
return takeFromExternrefTable0(ret[0]);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Sets a new peer ID for this flock instance.
|
|
370
|
+
*
|
|
371
|
+
* # Arguments
|
|
372
|
+
*
|
|
373
|
+
* * `peer_id` - The new peer ID to set
|
|
374
|
+
*
|
|
375
|
+
* # Errors
|
|
376
|
+
*
|
|
377
|
+
* Returns an error if the peer ID is invalid.
|
|
378
|
+
* @param {string} peer_id
|
|
379
|
+
*/
|
|
380
|
+
setPeerId(peer_id) {
|
|
381
|
+
const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
383
|
+
const ret = wasm.rawflock_setPeerId(this.__wbg_ptr, ptr0, len0);
|
|
384
|
+
if (ret[1]) {
|
|
385
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Unsubscribes from change events.
|
|
390
|
+
*
|
|
391
|
+
* # Arguments
|
|
392
|
+
*
|
|
393
|
+
* * `id` - The subscription ID returned from `subscribe`
|
|
394
|
+
*
|
|
395
|
+
* # Returns
|
|
396
|
+
*
|
|
397
|
+
* `true` if a subscription was removed, `false` if the ID was not found.
|
|
398
|
+
* @param {number} id
|
|
399
|
+
* @returns {boolean}
|
|
400
|
+
*/
|
|
401
|
+
unsubscribe(id) {
|
|
402
|
+
const ret = wasm.rawflock_unsubscribe(this.__wbg_ptr, id);
|
|
403
|
+
return ret !== 0;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Rolls back the current transaction.
|
|
407
|
+
*
|
|
408
|
+
* Discards all buffered operations since `txnBegin` was called.
|
|
409
|
+
* Note: Data changes are not rolled back, only event emission is affected.
|
|
410
|
+
*/
|
|
411
|
+
txnRollback() {
|
|
412
|
+
wasm.rawflock_txnRollback(this.__wbg_ptr);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Stores a value with associated metadata at the specified key.
|
|
416
|
+
*
|
|
417
|
+
* # Arguments
|
|
418
|
+
*
|
|
419
|
+
* * `key` - The key as a JSON array
|
|
420
|
+
* * `value` - The value to store
|
|
421
|
+
* * `metadata` - Optional metadata object to associate with this entry
|
|
422
|
+
* * `now` - Optional timestamp in milliseconds
|
|
423
|
+
*
|
|
424
|
+
* # Errors
|
|
425
|
+
*
|
|
426
|
+
* Returns an error if any argument is invalid or the operation fails.
|
|
427
|
+
* @param {any} key
|
|
428
|
+
* @param {any} value
|
|
429
|
+
* @param {any} metadata
|
|
430
|
+
* @param {any} now
|
|
431
|
+
*/
|
|
432
|
+
putWithMeta(key, value, metadata, now) {
|
|
433
|
+
const ret = wasm.rawflock_putWithMeta(this.__wbg_ptr, key, value, metadata, now);
|
|
434
|
+
if (ret[1]) {
|
|
435
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Returns the inclusive version vector for this flock.
|
|
440
|
+
*
|
|
441
|
+
* The inclusive version includes all peers ever seen, even if their
|
|
442
|
+
* entries have been overridden by other peers.
|
|
443
|
+
*
|
|
444
|
+
* # Errors
|
|
445
|
+
*
|
|
446
|
+
* Returns an error if serialization fails.
|
|
447
|
+
* @returns {any}
|
|
448
|
+
*/
|
|
449
|
+
inclusiveVersion() {
|
|
450
|
+
const ret = wasm.rawflock_inclusiveVersion(this.__wbg_ptr);
|
|
451
|
+
if (ret[2]) {
|
|
452
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
453
|
+
}
|
|
454
|
+
return takeFromExternrefTable0(ret[0]);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Returns the maximum physical time across all entries in this flock.
|
|
458
|
+
*
|
|
459
|
+
* This is useful for determining a safe timestamp for tombstone pruning.
|
|
460
|
+
* @returns {number}
|
|
461
|
+
*/
|
|
462
|
+
getMaxPhysicalTime() {
|
|
463
|
+
const ret = wasm.rawflock_getMaxPhysicalTime(this.__wbg_ptr);
|
|
464
|
+
return ret;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Retrieves the value at the specified key.
|
|
468
|
+
*
|
|
469
|
+
* Returns `undefined` if the key doesn't exist or has been deleted.
|
|
470
|
+
*
|
|
471
|
+
* # Arguments
|
|
472
|
+
*
|
|
473
|
+
* * `key` - The key as a JSON array
|
|
474
|
+
*
|
|
475
|
+
* # Errors
|
|
476
|
+
*
|
|
477
|
+
* Returns an error if serialization of the result fails.
|
|
478
|
+
* @param {any} key
|
|
479
|
+
* @returns {any}
|
|
480
|
+
*/
|
|
481
|
+
get(key) {
|
|
482
|
+
const ret = wasm.rawflock_get(this.__wbg_ptr, key);
|
|
483
|
+
if (ret[2]) {
|
|
484
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
485
|
+
}
|
|
486
|
+
return takeFromExternrefTable0(ret[0]);
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Creates a new WASM flock instance with the given peer ID.
|
|
490
|
+
*
|
|
491
|
+
* The instance is created in buffered mode with memtable enabled.
|
|
492
|
+
* Use transactions (`txnBegin` + `txnCommit`) to flush buffered writes explicitly.
|
|
493
|
+
*
|
|
494
|
+
* # Arguments
|
|
495
|
+
*
|
|
496
|
+
* * `peer_id` - The unique identifier for this peer
|
|
497
|
+
*
|
|
498
|
+
* # Errors
|
|
499
|
+
*
|
|
500
|
+
* Returns an error if the peer ID is invalid or if instance creation fails.
|
|
501
|
+
* @param {string} peer_id
|
|
502
|
+
*/
|
|
503
|
+
constructor(peer_id) {
|
|
504
|
+
const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
505
|
+
const len0 = WASM_VECTOR_LEN;
|
|
506
|
+
const ret = wasm.rawflock_new(ptr0, len0);
|
|
507
|
+
if (ret[2]) {
|
|
508
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
509
|
+
}
|
|
510
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
511
|
+
RawFlockFinalization.register(this, this.__wbg_ptr, this);
|
|
512
|
+
return this;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Stores a value at the specified key.
|
|
516
|
+
*
|
|
517
|
+
* # Arguments
|
|
518
|
+
*
|
|
519
|
+
* * `key` - The key as a JSON array
|
|
520
|
+
* * `value` - The value to store (any JSON-serializable value)
|
|
521
|
+
* * `now` - Optional timestamp in milliseconds (uses current time if undefined)
|
|
522
|
+
*
|
|
523
|
+
* # Errors
|
|
524
|
+
*
|
|
525
|
+
* Returns an error if the key or value is invalid, or if the operation fails.
|
|
526
|
+
* @param {any} key
|
|
527
|
+
* @param {any} value
|
|
528
|
+
* @param {any} now
|
|
529
|
+
*/
|
|
530
|
+
put(key, value, now) {
|
|
531
|
+
const ret = wasm.rawflock_put(this.__wbg_ptr, key, value, now);
|
|
532
|
+
if (ret[1]) {
|
|
533
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Scans entries within the specified bounds and prefix.
|
|
538
|
+
*
|
|
539
|
+
* # Arguments
|
|
540
|
+
*
|
|
541
|
+
* * `start` - Optional start bound (inclusive/exclusive/unbounded)
|
|
542
|
+
* * `end` - Optional end bound
|
|
543
|
+
* * `prefix` - Optional key prefix to filter by
|
|
544
|
+
*
|
|
545
|
+
* # Returns
|
|
546
|
+
*
|
|
547
|
+
* An array of scan rows containing keys, values, and raw records.
|
|
548
|
+
*
|
|
549
|
+
* # Errors
|
|
550
|
+
*
|
|
551
|
+
* Returns an error if scan bounds are invalid or serialization fails.
|
|
552
|
+
* @param {any} start
|
|
553
|
+
* @param {any} end
|
|
554
|
+
* @param {any} prefix
|
|
555
|
+
* @returns {any}
|
|
556
|
+
*/
|
|
557
|
+
scan(start, end, prefix) {
|
|
558
|
+
const ret = wasm.rawflock_scan(this.__wbg_ptr, start, end, prefix);
|
|
559
|
+
if (ret[2]) {
|
|
560
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
561
|
+
}
|
|
562
|
+
return takeFromExternrefTable0(ret[0]);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Merges state from another flock instance into this one.
|
|
566
|
+
*
|
|
567
|
+
* # Arguments
|
|
568
|
+
*
|
|
569
|
+
* * `other` - The other flock instance to merge from
|
|
570
|
+
*
|
|
571
|
+
* # Returns
|
|
572
|
+
*
|
|
573
|
+
* An import report containing counts of accepted and skipped entries.
|
|
574
|
+
*
|
|
575
|
+
* # Errors
|
|
576
|
+
*
|
|
577
|
+
* Returns an error if the merge operation fails.
|
|
578
|
+
* @param {RawFlock} other
|
|
579
|
+
* @returns {any}
|
|
580
|
+
*/
|
|
581
|
+
merge(other) {
|
|
582
|
+
_assertClass(other, RawFlock);
|
|
583
|
+
const ret = wasm.rawflock_merge(this.__wbg_ptr, other.__wbg_ptr);
|
|
584
|
+
if (ret[2]) {
|
|
585
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
586
|
+
}
|
|
587
|
+
return takeFromExternrefTable0(ret[0]);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Deletes the value at the specified key (creates a tombstone).
|
|
591
|
+
*
|
|
592
|
+
* # Arguments
|
|
593
|
+
*
|
|
594
|
+
* * `key` - The key as a JSON array
|
|
595
|
+
* * `now` - Optional timestamp in milliseconds
|
|
596
|
+
*
|
|
597
|
+
* # Errors
|
|
598
|
+
*
|
|
599
|
+
* Returns an error if the key is invalid or the operation fails.
|
|
600
|
+
* @param {any} key
|
|
601
|
+
* @param {any} now
|
|
602
|
+
*/
|
|
603
|
+
delete(key, now) {
|
|
604
|
+
const ret = wasm.rawflock_delete(this.__wbg_ptr, key, now);
|
|
605
|
+
if (ret[1]) {
|
|
606
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Returns the current peer ID of this flock instance.
|
|
611
|
+
* @returns {string}
|
|
612
|
+
*/
|
|
613
|
+
peerId() {
|
|
614
|
+
let deferred1_0;
|
|
615
|
+
let deferred1_1;
|
|
616
|
+
try {
|
|
617
|
+
const ret = wasm.rawflock_peerId(this.__wbg_ptr);
|
|
618
|
+
deferred1_0 = ret[0];
|
|
619
|
+
deferred1_1 = ret[1];
|
|
620
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
621
|
+
} finally {
|
|
622
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Returns the exclusive version vector for this flock.
|
|
627
|
+
*
|
|
628
|
+
* The exclusive version only includes peers that have at least one entry
|
|
629
|
+
* in the current state (excluding tombstones and overridden entries).
|
|
630
|
+
*
|
|
631
|
+
* # Errors
|
|
632
|
+
*
|
|
633
|
+
* Returns an error if serialization fails.
|
|
634
|
+
* @returns {any}
|
|
635
|
+
*/
|
|
636
|
+
version() {
|
|
637
|
+
const ret = wasm.rawflock_version(this.__wbg_ptr);
|
|
638
|
+
if (ret[2]) {
|
|
639
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
640
|
+
}
|
|
641
|
+
return takeFromExternrefTable0(ret[0]);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Creates a new flock instance from a file bytes array.
|
|
645
|
+
*
|
|
646
|
+
* # Arguments
|
|
647
|
+
*
|
|
648
|
+
* * `peer_id` - The peer ID for the new instance
|
|
649
|
+
* * `bytes` - The file contents as a Uint8Array
|
|
650
|
+
*
|
|
651
|
+
* # Errors
|
|
652
|
+
*
|
|
653
|
+
* Returns an error if the file format is invalid or loading fails.
|
|
654
|
+
* @param {string} peer_id
|
|
655
|
+
* @param {Uint8Array} bytes
|
|
656
|
+
* @returns {RawFlock}
|
|
657
|
+
*/
|
|
658
|
+
static fromFile(peer_id, bytes) {
|
|
659
|
+
const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
660
|
+
const len0 = WASM_VECTOR_LEN;
|
|
661
|
+
const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
662
|
+
const len1 = WASM_VECTOR_LEN;
|
|
663
|
+
const ret = wasm.rawflock_fromFile(ptr0, len0, ptr1, len1);
|
|
664
|
+
if (ret[2]) {
|
|
665
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
666
|
+
}
|
|
667
|
+
return RawFlock.__wrap(ret[0]);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Creates a new flock instance from a JSON export bundle.
|
|
671
|
+
*
|
|
672
|
+
* # Arguments
|
|
673
|
+
*
|
|
674
|
+
* * `bundle` - The export bundle as a JavaScript object
|
|
675
|
+
* * `peer_id` - The peer ID for the new instance
|
|
676
|
+
*
|
|
677
|
+
* # Errors
|
|
678
|
+
*
|
|
679
|
+
* Returns an error if the bundle is invalid or import fails.
|
|
680
|
+
* @param {any} bundle
|
|
681
|
+
* @param {string} peer_id
|
|
682
|
+
* @returns {RawFlock}
|
|
683
|
+
*/
|
|
684
|
+
static fromJson(bundle, peer_id) {
|
|
685
|
+
const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
686
|
+
const len0 = WASM_VECTOR_LEN;
|
|
687
|
+
const ret = wasm.rawflock_fromJson(bundle, ptr0, len0);
|
|
688
|
+
if (ret[2]) {
|
|
689
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
690
|
+
}
|
|
691
|
+
return RawFlock.__wrap(ret[0]);
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Retrieves complete entry information including data, metadata, and clock.
|
|
695
|
+
*
|
|
696
|
+
* Returns `undefined` if the key doesn't exist.
|
|
697
|
+
*
|
|
698
|
+
* # Arguments
|
|
699
|
+
*
|
|
700
|
+
* * `key` - The key as a JSON array
|
|
701
|
+
*
|
|
702
|
+
* # Errors
|
|
703
|
+
*
|
|
704
|
+
* Returns an error if serialization of the result fails.
|
|
705
|
+
* @param {any} key
|
|
706
|
+
* @returns {any}
|
|
707
|
+
*/
|
|
708
|
+
getEntry(key) {
|
|
709
|
+
const ret = wasm.rawflock_getEntry(this.__wbg_ptr, key);
|
|
710
|
+
if (ret[2]) {
|
|
711
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
712
|
+
}
|
|
713
|
+
return takeFromExternrefTable0(ret[0]);
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Returns whether a transaction is currently active.
|
|
717
|
+
* @returns {boolean}
|
|
718
|
+
*/
|
|
719
|
+
isInTxn() {
|
|
720
|
+
const ret = wasm.rawflock_isInTxn(this.__wbg_ptr);
|
|
721
|
+
return ret !== 0;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Subscribes to change events from this flock instance.
|
|
725
|
+
*
|
|
726
|
+
* # Arguments
|
|
727
|
+
*
|
|
728
|
+
* * `listener` - A JavaScript function that will be called with event batches
|
|
729
|
+
*
|
|
730
|
+
* # Returns
|
|
731
|
+
*
|
|
732
|
+
* A subscription ID that can be used to unsubscribe later.
|
|
733
|
+
*
|
|
734
|
+
* # Errors
|
|
735
|
+
*
|
|
736
|
+
* Returns an error if the subscription fails or the ID overflows.
|
|
737
|
+
* @param {Function} listener
|
|
738
|
+
* @returns {number}
|
|
739
|
+
*/
|
|
740
|
+
subscribe(listener) {
|
|
741
|
+
const ret = wasm.rawflock_subscribe(this.__wbg_ptr, listener);
|
|
742
|
+
if (ret[2]) {
|
|
743
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
744
|
+
}
|
|
745
|
+
return ret[0] >>> 0;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Begins a transaction.
|
|
749
|
+
*
|
|
750
|
+
* All subsequent put/delete operations will be buffered until `txnCommit`
|
|
751
|
+
* is called. Events will be batched and delivered as a single batch on commit.
|
|
752
|
+
*
|
|
753
|
+
* # Errors
|
|
754
|
+
*
|
|
755
|
+
* Returns an error if a transaction is already active or if begin fails.
|
|
756
|
+
*/
|
|
757
|
+
txnBegin() {
|
|
758
|
+
const ret = wasm.rawflock_txnBegin(this.__wbg_ptr);
|
|
759
|
+
if (ret[1]) {
|
|
760
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
766
|
+
const ret = String(arg1);
|
|
767
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
768
|
+
const len1 = WASM_VECTOR_LEN;
|
|
769
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
770
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
export function __wbg_buffer_609cc3eee51ed158(arg0) {
|
|
774
|
+
const ret = arg0.buffer;
|
|
775
|
+
return ret;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) {
|
|
779
|
+
const ret = arg0.call(arg1);
|
|
780
|
+
return ret;
|
|
781
|
+
}, arguments) };
|
|
782
|
+
|
|
783
|
+
export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) {
|
|
784
|
+
const ret = arg0.call(arg1, arg2);
|
|
785
|
+
return ret;
|
|
786
|
+
}, arguments) };
|
|
787
|
+
|
|
788
|
+
export function __wbg_done_769e5ede4b31c67b(arg0) {
|
|
789
|
+
const ret = arg0.done;
|
|
790
|
+
return ret;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
export function __wbg_entries_3265d4158b33e5dc(arg0) {
|
|
794
|
+
const ret = Object.entries(arg0);
|
|
795
|
+
return ret;
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
799
|
+
let deferred0_0;
|
|
800
|
+
let deferred0_1;
|
|
801
|
+
try {
|
|
802
|
+
deferred0_0 = arg0;
|
|
803
|
+
deferred0_1 = arg1;
|
|
804
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
805
|
+
} finally {
|
|
806
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) {
|
|
811
|
+
const ret = Reflect.get(arg0, arg1);
|
|
812
|
+
return ret;
|
|
813
|
+
}, arguments) };
|
|
814
|
+
|
|
815
|
+
export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
|
|
816
|
+
const ret = arg0[arg1 >>> 0];
|
|
817
|
+
return ret;
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
|
|
821
|
+
const ret = arg0[arg1];
|
|
822
|
+
return ret;
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
|
|
826
|
+
let result;
|
|
827
|
+
try {
|
|
828
|
+
result = arg0 instanceof ArrayBuffer;
|
|
829
|
+
} catch (_) {
|
|
830
|
+
result = false;
|
|
831
|
+
}
|
|
832
|
+
const ret = result;
|
|
833
|
+
return ret;
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
|
|
837
|
+
let result;
|
|
838
|
+
try {
|
|
839
|
+
result = arg0 instanceof Map;
|
|
840
|
+
} catch (_) {
|
|
841
|
+
result = false;
|
|
842
|
+
}
|
|
843
|
+
const ret = result;
|
|
844
|
+
return ret;
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
|
|
848
|
+
let result;
|
|
849
|
+
try {
|
|
850
|
+
result = arg0 instanceof Uint8Array;
|
|
851
|
+
} catch (_) {
|
|
852
|
+
result = false;
|
|
853
|
+
}
|
|
854
|
+
const ret = result;
|
|
855
|
+
return ret;
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
export function __wbg_isArray_a1eab7e0d067391b(arg0) {
|
|
859
|
+
const ret = Array.isArray(arg0);
|
|
860
|
+
return ret;
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
|
|
864
|
+
const ret = Number.isSafeInteger(arg0);
|
|
865
|
+
return ret;
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
export function __wbg_iterator_9a24c88df860dc65() {
|
|
869
|
+
const ret = Symbol.iterator;
|
|
870
|
+
return ret;
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
export function __wbg_length_a446193dc22c12f8(arg0) {
|
|
874
|
+
const ret = arg0.length;
|
|
875
|
+
return ret;
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
export function __wbg_length_e2d2a49132c1b256(arg0) {
|
|
879
|
+
const ret = arg0.length;
|
|
880
|
+
return ret;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
export function __wbg_new_405e22f390576ce2() {
|
|
884
|
+
const ret = new Object();
|
|
885
|
+
return ret;
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
export function __wbg_new_5e0be73521bc8c17() {
|
|
889
|
+
const ret = new Map();
|
|
890
|
+
return ret;
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
export function __wbg_new_78feb108b6472713() {
|
|
894
|
+
const ret = new Array();
|
|
895
|
+
return ret;
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
export function __wbg_new_8a6f238a6ece86ea() {
|
|
899
|
+
const ret = new Error();
|
|
900
|
+
return ret;
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
export function __wbg_new_a12002a7f91c75be(arg0) {
|
|
904
|
+
const ret = new Uint8Array(arg0);
|
|
905
|
+
return ret;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
export function __wbg_new_c68d7209be747379(arg0, arg1) {
|
|
909
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
910
|
+
return ret;
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
export function __wbg_next_25feadfc0913fea9(arg0) {
|
|
914
|
+
const ret = arg0.next;
|
|
915
|
+
return ret;
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg0) {
|
|
919
|
+
const ret = arg0.next();
|
|
920
|
+
return ret;
|
|
921
|
+
}, arguments) };
|
|
922
|
+
|
|
923
|
+
export function __wbg_now_807e54c39636c349() {
|
|
924
|
+
const ret = Date.now();
|
|
925
|
+
return ret;
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
export function __wbg_resolve_4851785c9c5f573d(arg0) {
|
|
929
|
+
const ret = Promise.resolve(arg0);
|
|
930
|
+
return ret;
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
|
|
934
|
+
arg0[arg1 >>> 0] = arg2;
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
938
|
+
arg0[arg1] = arg2;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
|
942
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
|
|
946
|
+
const ret = arg0.set(arg1, arg2);
|
|
947
|
+
return ret;
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
951
|
+
const ret = arg1.stack;
|
|
952
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
953
|
+
const len1 = WASM_VECTOR_LEN;
|
|
954
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
955
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
export function __wbg_then_44b73946d2fb3e7d(arg0, arg1) {
|
|
959
|
+
const ret = arg0.then(arg1);
|
|
960
|
+
return ret;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
|
|
964
|
+
const ret = arg0.value;
|
|
965
|
+
return ret;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
export function __wbindgen_as_number(arg0) {
|
|
969
|
+
const ret = +arg0;
|
|
970
|
+
return ret;
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
export function __wbindgen_bigint_from_i64(arg0) {
|
|
974
|
+
const ret = arg0;
|
|
975
|
+
return ret;
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
export function __wbindgen_bigint_from_u64(arg0) {
|
|
979
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
980
|
+
return ret;
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
|
|
984
|
+
const v = arg1;
|
|
985
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
986
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
987
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
export function __wbindgen_boolean_get(arg0) {
|
|
991
|
+
const v = arg0;
|
|
992
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
993
|
+
return ret;
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
export function __wbindgen_cb_drop(arg0) {
|
|
997
|
+
const obj = arg0.original;
|
|
998
|
+
if (obj.cnt-- == 1) {
|
|
999
|
+
obj.a = 0;
|
|
1000
|
+
return true;
|
|
1001
|
+
}
|
|
1002
|
+
const ret = false;
|
|
1003
|
+
return ret;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
export function __wbindgen_closure_wrapper303(arg0, arg1, arg2) {
|
|
1007
|
+
const ret = makeMutClosure(arg0, arg1, 39, __wbg_adapter_56);
|
|
1008
|
+
return ret;
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
export function __wbindgen_debug_string(arg0, arg1) {
|
|
1012
|
+
const ret = debugString(arg1);
|
|
1013
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1014
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1015
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1016
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
export function __wbindgen_error_new(arg0, arg1) {
|
|
1020
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1021
|
+
return ret;
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
export function __wbindgen_in(arg0, arg1) {
|
|
1025
|
+
const ret = arg0 in arg1;
|
|
1026
|
+
return ret;
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
export function __wbindgen_init_externref_table() {
|
|
1030
|
+
const table = wasm.__wbindgen_export_4;
|
|
1031
|
+
const offset = table.grow(4);
|
|
1032
|
+
table.set(0, undefined);
|
|
1033
|
+
table.set(offset + 0, undefined);
|
|
1034
|
+
table.set(offset + 1, null);
|
|
1035
|
+
table.set(offset + 2, true);
|
|
1036
|
+
table.set(offset + 3, false);
|
|
1037
|
+
;
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
export function __wbindgen_is_bigint(arg0) {
|
|
1041
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1042
|
+
return ret;
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
export function __wbindgen_is_function(arg0) {
|
|
1046
|
+
const ret = typeof(arg0) === 'function';
|
|
1047
|
+
return ret;
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
export function __wbindgen_is_null(arg0) {
|
|
1051
|
+
const ret = arg0 === null;
|
|
1052
|
+
return ret;
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
export function __wbindgen_is_object(arg0) {
|
|
1056
|
+
const val = arg0;
|
|
1057
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1058
|
+
return ret;
|
|
1059
|
+
};
|
|
1060
|
+
|
|
1061
|
+
export function __wbindgen_is_string(arg0) {
|
|
1062
|
+
const ret = typeof(arg0) === 'string';
|
|
1063
|
+
return ret;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
export function __wbindgen_is_undefined(arg0) {
|
|
1067
|
+
const ret = arg0 === undefined;
|
|
1068
|
+
return ret;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
1072
|
+
const ret = arg0 === arg1;
|
|
1073
|
+
return ret;
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
export function __wbindgen_jsval_loose_eq(arg0, arg1) {
|
|
1077
|
+
const ret = arg0 == arg1;
|
|
1078
|
+
return ret;
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
export function __wbindgen_memory() {
|
|
1082
|
+
const ret = wasm.memory;
|
|
1083
|
+
return ret;
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
export function __wbindgen_number_get(arg0, arg1) {
|
|
1087
|
+
const obj = arg1;
|
|
1088
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1089
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1090
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
export function __wbindgen_number_new(arg0) {
|
|
1094
|
+
const ret = arg0;
|
|
1095
|
+
return ret;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
export function __wbindgen_rethrow(arg0) {
|
|
1099
|
+
throw arg0;
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
export function __wbindgen_string_get(arg0, arg1) {
|
|
1103
|
+
const obj = arg1;
|
|
1104
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1105
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1106
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1107
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1108
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
|
1112
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1113
|
+
return ret;
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
export function __wbindgen_throw(arg0, arg1) {
|
|
1117
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1118
|
+
};
|
|
1119
|
+
|