loro-crdt 1.13.2 → 1.13.3

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.
@@ -1,25 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Decode the metadata of the import blob.
5
- *
6
- * This method is useful to get the following metadata of the import blob:
7
- *
8
- * - startVersionVector
9
- * - endVersionVector
10
- * - startTimestamp
11
- * - endTimestamp
12
- * - mode
13
- * - changeNum
14
- */
15
- export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
16
- /**
17
- * Get the version of Loro
4
+ * Enable debug info of Loro
18
5
  */
19
- export function LORO_VERSION(): string;
20
- export function run(): void;
21
- export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
22
- export function callPendingEvents(): void;
6
+ export function setDebug(): void;
7
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
23
8
  /**
24
9
  * Redacts sensitive content in JSON updates within the specified version range.
25
10
  *
@@ -40,11 +25,26 @@ export function callPendingEvents(): void;
40
25
  * @returns {Object} The redacted JSON updates
41
26
  */
42
27
  export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
43
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
28
+ export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
44
29
  /**
45
- * Enable debug info of Loro
30
+ * Get the version of Loro
46
31
  */
47
- export function setDebug(): void;
32
+ export function LORO_VERSION(): string;
33
+ export function run(): void;
34
+ /**
35
+ * Decode the metadata of the import blob.
36
+ *
37
+ * This method is useful to get the following metadata of the import blob:
38
+ *
39
+ * - startVersionVector
40
+ * - endVersionVector
41
+ * - startTimestamp
42
+ * - endTimestamp
43
+ * - mode
44
+ * - changeNum
45
+ */
46
+ export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
47
+ export function callPendingEvents(): void;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -4213,8 +4213,8 @@ export interface InitOutput {
4213
4213
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
4214
4214
  readonly __wbindgen_export_4: WebAssembly.Table;
4215
4215
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
4216
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ca1585fb4938203: (a: number, b: number, c: number) => void;
4217
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbcad774514455511: (a: number, b: number) => void;
4216
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha2b51c6fc8df0ff6: (a: number, b: number, c: number) => void;
4217
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h794210845e4bfab8: (a: number, b: number) => void;
4218
4218
  readonly __wbindgen_start: () => void;
4219
4219
  }
4220
4220
 
package/web/loro_wasm.js CHANGED
@@ -256,89 +256,46 @@ function getArrayJsValueFromWasm0(ptr, len) {
256
256
  return result;
257
257
  }
258
258
  /**
259
- * Decode the metadata of the import blob.
260
- *
261
- * This method is useful to get the following metadata of the import blob:
262
- *
263
- * - startVersionVector
264
- * - endVersionVector
265
- * - startTimestamp
266
- * - endTimestamp
267
- * - mode
268
- * - changeNum
269
- * @param {Uint8Array} blob
270
- * @param {boolean} check_checksum
271
- * @returns {ImportBlobMetadata}
259
+ * Enable debug info of Loro
272
260
  */
273
- export function decodeImportBlobMeta(blob, check_checksum) {
274
- try {
275
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
277
- const len0 = WASM_VECTOR_LEN;
278
- wasm.decodeImportBlobMeta(retptr, ptr0, len0, check_checksum);
279
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
280
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
281
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
282
- if (r2) {
283
- throw takeObject(r1);
284
- }
285
- return takeObject(r0);
286
- } finally {
287
- wasm.__wbindgen_add_to_stack_pointer(16);
288
- }
261
+ export function setDebug() {
262
+ wasm.setDebug();
289
263
  }
290
264
 
291
- /**
292
- * Get the version of Loro
293
- * @returns {string}
294
- */
295
- export function LORO_VERSION() {
296
- let deferred1_0;
297
- let deferred1_1;
298
- try {
299
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
300
- wasm.LORO_VERSION(retptr);
301
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
302
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
303
- deferred1_0 = r0;
304
- deferred1_1 = r1;
305
- return getStringFromWasm0(r0, r1);
306
- } finally {
307
- wasm.__wbindgen_add_to_stack_pointer(16);
308
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
265
+ function passArrayJsValueToWasm0(array, malloc) {
266
+ const ptr = malloc(array.length * 4, 4) >>> 0;
267
+ const mem = getDataViewMemory0();
268
+ for (let i = 0; i < array.length; i++) {
269
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
309
270
  }
271
+ WASM_VECTOR_LEN = array.length;
272
+ return ptr;
310
273
  }
311
-
312
- export function run() {
313
- wasm.run();
314
- }
315
-
316
274
  /**
317
- * @param {Uint8Array} bytes
318
- * @returns {{ peer: PeerID, counter: number }[]}
275
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
276
+ * @returns {Uint8Array}
319
277
  */
320
- export function decodeFrontiers(bytes) {
278
+ export function encodeFrontiers(frontiers) {
321
279
  try {
322
280
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
323
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
281
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
324
282
  const len0 = WASM_VECTOR_LEN;
325
- wasm.decodeFrontiers(retptr, ptr0, len0);
283
+ wasm.encodeFrontiers(retptr, ptr0, len0);
326
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
327
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
328
286
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
329
- if (r2) {
330
- throw takeObject(r1);
287
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
288
+ if (r3) {
289
+ throw takeObject(r2);
331
290
  }
332
- return takeObject(r0);
291
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
292
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
293
+ return v2;
333
294
  } finally {
334
295
  wasm.__wbindgen_add_to_stack_pointer(16);
335
296
  }
336
297
  }
337
298
 
338
- export function callPendingEvents() {
339
- wasm.callPendingEvents();
340
- }
341
-
342
299
  /**
343
300
  * Redacts sensitive content in JSON updates within the specified version range.
344
301
  *
@@ -377,53 +334,96 @@ export function redactJsonUpdates(json_updates, version_range) {
377
334
  }
378
335
  }
379
336
 
380
- function passArrayJsValueToWasm0(array, malloc) {
381
- const ptr = malloc(array.length * 4, 4) >>> 0;
382
- const mem = getDataViewMemory0();
383
- for (let i = 0; i < array.length; i++) {
384
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
385
- }
386
- WASM_VECTOR_LEN = array.length;
387
- return ptr;
388
- }
389
337
  /**
390
- * @param {({ peer: PeerID, counter: number })[]} frontiers
391
- * @returns {Uint8Array}
338
+ * @param {Uint8Array} bytes
339
+ * @returns {{ peer: PeerID, counter: number }[]}
392
340
  */
393
- export function encodeFrontiers(frontiers) {
341
+ export function decodeFrontiers(bytes) {
394
342
  try {
395
343
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
396
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
344
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
397
345
  const len0 = WASM_VECTOR_LEN;
398
- wasm.encodeFrontiers(retptr, ptr0, len0);
346
+ wasm.decodeFrontiers(retptr, ptr0, len0);
399
347
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
400
348
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
401
349
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
402
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
403
- if (r3) {
404
- throw takeObject(r2);
350
+ if (r2) {
351
+ throw takeObject(r1);
405
352
  }
406
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
407
- wasm.__wbindgen_free(r0, r1 * 1, 1);
408
- return v2;
353
+ return takeObject(r0);
409
354
  } finally {
410
355
  wasm.__wbindgen_add_to_stack_pointer(16);
411
356
  }
412
357
  }
413
358
 
414
359
  /**
415
- * Enable debug info of Loro
360
+ * Get the version of Loro
361
+ * @returns {string}
416
362
  */
417
- export function setDebug() {
418
- wasm.setDebug();
363
+ export function LORO_VERSION() {
364
+ let deferred1_0;
365
+ let deferred1_1;
366
+ try {
367
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
368
+ wasm.LORO_VERSION(retptr);
369
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
+ deferred1_0 = r0;
372
+ deferred1_1 = r1;
373
+ return getStringFromWasm0(r0, r1);
374
+ } finally {
375
+ wasm.__wbindgen_add_to_stack_pointer(16);
376
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
377
+ }
378
+ }
379
+
380
+ export function run() {
381
+ wasm.run();
382
+ }
383
+
384
+ /**
385
+ * Decode the metadata of the import blob.
386
+ *
387
+ * This method is useful to get the following metadata of the import blob:
388
+ *
389
+ * - startVersionVector
390
+ * - endVersionVector
391
+ * - startTimestamp
392
+ * - endTimestamp
393
+ * - mode
394
+ * - changeNum
395
+ * @param {Uint8Array} blob
396
+ * @param {boolean} check_checksum
397
+ * @returns {ImportBlobMetadata}
398
+ */
399
+ export function decodeImportBlobMeta(blob, check_checksum) {
400
+ try {
401
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
402
+ const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
403
+ const len0 = WASM_VECTOR_LEN;
404
+ wasm.decodeImportBlobMeta(retptr, ptr0, len0, check_checksum);
405
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
406
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
407
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
408
+ if (r2) {
409
+ throw takeObject(r1);
410
+ }
411
+ return takeObject(r0);
412
+ } finally {
413
+ wasm.__wbindgen_add_to_stack_pointer(16);
414
+ }
415
+ }
416
+
417
+ export function callPendingEvents() {
418
+ wasm.callPendingEvents();
419
419
  }
420
420
 
421
421
  function __wbg_adapter_60(arg0, arg1, arg2) {
422
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ca1585fb4938203(arg0, arg1, addHeapObject(arg2));
422
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha2b51c6fc8df0ff6(arg0, arg1, addHeapObject(arg2));
423
423
  }
424
424
 
425
425
  function __wbg_adapter_63(arg0, arg1) {
426
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbcad774514455511(arg0, arg1);
426
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h794210845e4bfab8(arg0, arg1);
427
427
  }
428
428
 
429
429
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -7005,6 +7005,9 @@ function __wbg_get_imports() {
7005
7005
  const ret = getObject(arg0).entries();
7006
7006
  return addHeapObject(ret);
7007
7007
  };
7008
+ imports.wbg.__wbg_error_56998721a304cd56 = function(arg0, arg1) {
7009
+ console.error(getStringFromWasm0(arg0, arg1));
7010
+ };
7008
7011
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
7009
7012
  let deferred0_0;
7010
7013
  let deferred0_1;
@@ -7016,9 +7019,6 @@ function __wbg_get_imports() {
7016
7019
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
7017
7020
  }
7018
7021
  };
7019
- imports.wbg.__wbg_error_eddb9b302feac7d3 = function(arg0, arg1) {
7020
- console.error(getStringFromWasm0(arg0, arg1));
7021
- };
7022
7022
  imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
7023
7023
  const ret = Array.from(getObject(arg0));
7024
7024
  return addHeapObject(ret);
@@ -7117,6 +7117,9 @@ function __wbg_get_imports() {
7117
7117
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
7118
7118
  }
7119
7119
  };
7120
+ imports.wbg.__wbg_log_1fa0a78510bbe830 = function(arg0, arg1) {
7121
+ console.log(getStringFromWasm0(arg0, arg1));
7122
+ };
7120
7123
  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
7121
7124
  let deferred0_0;
7122
7125
  let deferred0_1;
@@ -7128,9 +7131,6 @@ function __wbg_get_imports() {
7128
7131
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
7129
7132
  }
7130
7133
  };
7131
- imports.wbg.__wbg_log_d8b98f6c2e2f68e5 = function(arg0, arg1) {
7132
- console.log(getStringFromWasm0(arg0, arg1));
7133
- };
7134
7134
  imports.wbg.__wbg_lorocounter_new = function(arg0) {
7135
7135
  const ret = LoroCounter.__wrap(arg0);
7136
7136
  return addHeapObject(ret);
@@ -7320,7 +7320,7 @@ function __wbg_get_imports() {
7320
7320
  const ret = VersionVector.__wrap(arg0);
7321
7321
  return addHeapObject(ret);
7322
7322
  };
7323
- imports.wbg.__wbg_warn_a198177f86cf58b2 = function(arg0, arg1) {
7323
+ imports.wbg.__wbg_warn_db4faa19bfbe9598 = function(arg0, arg1) {
7324
7324
  console.warn(getStringFromWasm0(arg0, arg1));
7325
7325
  };
7326
7326
  imports.wbg.__wbindgen_as_number = function(arg0) {
@@ -7359,7 +7359,7 @@ function __wbg_get_imports() {
7359
7359
  const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_60);
7360
7360
  return addHeapObject(ret);
7361
7361
  };
7362
- imports.wbg.__wbindgen_closure_wrapper333 = function(arg0, arg1, arg2) {
7362
+ imports.wbg.__wbindgen_closure_wrapper334 = function(arg0, arg1, arg2) {
7363
7363
  const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_63);
7364
7364
  return addHeapObject(ret);
7365
7365
  };
Binary file
@@ -330,6 +330,6 @@ export const __wbindgen_exn_store: (a: number) => void;
330
330
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
331
331
  export const __wbindgen_export_4: WebAssembly.Table;
332
332
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
333
- export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ca1585fb4938203: (a: number, b: number, c: number) => void;
334
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbcad774514455511: (a: number, b: number) => void;
333
+ export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha2b51c6fc8df0ff6: (a: number, b: number, c: number) => void;
334
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h794210845e4bfab8: (a: number, b: number) => void;
335
335
  export const __wbindgen_start: () => void;