loro-crdt 1.10.2 → 1.10.4

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/web/loro_wasm.js CHANGED
@@ -232,26 +232,29 @@ function getArrayJsValueFromWasm0(ptr, len) {
232
232
  wasm.__externref_drop_slice(ptr, len);
233
233
  return result;
234
234
  }
235
-
236
- export function callPendingEvents() {
237
- wasm.callPendingEvents();
238
- }
239
-
240
235
  /**
241
- * Get the version of Loro
242
- * @returns {string}
236
+ * Decode the metadata of the import blob.
237
+ *
238
+ * This method is useful to get the following metadata of the import blob:
239
+ *
240
+ * - startVersionVector
241
+ * - endVersionVector
242
+ * - startTimestamp
243
+ * - endTimestamp
244
+ * - mode
245
+ * - changeNum
246
+ * @param {Uint8Array} blob
247
+ * @param {boolean} check_checksum
248
+ * @returns {ImportBlobMetadata}
243
249
  */
244
- export function LORO_VERSION() {
245
- let deferred1_0;
246
- let deferred1_1;
247
- try {
248
- const ret = wasm.LORO_VERSION();
249
- deferred1_0 = ret[0];
250
- deferred1_1 = ret[1];
251
- return getStringFromWasm0(ret[0], ret[1]);
252
- } finally {
253
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
250
+ export function decodeImportBlobMeta(blob, check_checksum) {
251
+ const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ret = wasm.decodeImportBlobMeta(ptr0, len0, check_checksum);
254
+ if (ret[2]) {
255
+ throw takeFromExternrefTable0(ret[1]);
254
256
  }
257
+ return takeFromExternrefTable0(ret[0]);
255
258
  }
256
259
 
257
260
  /**
@@ -261,6 +264,24 @@ export function setDebug() {
261
264
  wasm.setDebug();
262
265
  }
263
266
 
267
+ export function callPendingEvents() {
268
+ wasm.callPendingEvents();
269
+ }
270
+
271
+ /**
272
+ * @param {Uint8Array} bytes
273
+ * @returns {{ peer: PeerID, counter: number }[]}
274
+ */
275
+ export function decodeFrontiers(bytes) {
276
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
277
+ const len0 = WASM_VECTOR_LEN;
278
+ const ret = wasm.decodeFrontiers(ptr0, len0);
279
+ if (ret[2]) {
280
+ throw takeFromExternrefTable0(ret[1]);
281
+ }
282
+ return takeFromExternrefTable0(ret[0]);
283
+ }
284
+
264
285
  function passArrayJsValueToWasm0(array, malloc) {
265
286
  const ptr = malloc(array.length * 4, 4) >>> 0;
266
287
  for (let i = 0; i < array.length; i++) {
@@ -286,24 +307,6 @@ export function encodeFrontiers(frontiers) {
286
307
  return v2;
287
308
  }
288
309
 
289
- /**
290
- * @param {Uint8Array} bytes
291
- * @returns {{ peer: PeerID, counter: number }[]}
292
- */
293
- export function decodeFrontiers(bytes) {
294
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
295
- const len0 = WASM_VECTOR_LEN;
296
- const ret = wasm.decodeFrontiers(ptr0, len0);
297
- if (ret[2]) {
298
- throw takeFromExternrefTable0(ret[1]);
299
- }
300
- return takeFromExternrefTable0(ret[0]);
301
- }
302
-
303
- export function run() {
304
- wasm.run();
305
- }
306
-
307
310
  /**
308
311
  * Redacts sensitive content in JSON updates within the specified version range.
309
312
  *
@@ -335,28 +338,24 @@ export function redactJsonUpdates(json_updates, version_range) {
335
338
  }
336
339
 
337
340
  /**
338
- * Decode the metadata of the import blob.
339
- *
340
- * This method is useful to get the following metadata of the import blob:
341
- *
342
- * - startVersionVector
343
- * - endVersionVector
344
- * - startTimestamp
345
- * - endTimestamp
346
- * - mode
347
- * - changeNum
348
- * @param {Uint8Array} blob
349
- * @param {boolean} check_checksum
350
- * @returns {ImportBlobMetadata}
341
+ * Get the version of Loro
342
+ * @returns {string}
351
343
  */
352
- export function decodeImportBlobMeta(blob, check_checksum) {
353
- const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
354
- const len0 = WASM_VECTOR_LEN;
355
- const ret = wasm.decodeImportBlobMeta(ptr0, len0, check_checksum);
356
- if (ret[2]) {
357
- throw takeFromExternrefTable0(ret[1]);
344
+ export function LORO_VERSION() {
345
+ let deferred1_0;
346
+ let deferred1_1;
347
+ try {
348
+ const ret = wasm.LORO_VERSION();
349
+ deferred1_0 = ret[0];
350
+ deferred1_1 = ret[1];
351
+ return getStringFromWasm0(ret[0], ret[1]);
352
+ } finally {
353
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
358
354
  }
359
- return takeFromExternrefTable0(ret[0]);
355
+ }
356
+
357
+ export function run() {
358
+ wasm.run();
360
359
  }
361
360
 
362
361
  function __wbg_adapter_62(arg0, arg1, arg2) {
@@ -364,7 +363,7 @@ function __wbg_adapter_62(arg0, arg1, arg2) {
364
363
  }
365
364
 
366
365
  function __wbg_adapter_65(arg0, arg1) {
367
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151(arg0, arg1);
366
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb48c49436c48b69d(arg0, arg1);
368
367
  }
369
368
 
370
369
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1648,6 +1647,25 @@ export class LoroDoc {
1648
1647
  }
1649
1648
  return takeFromExternrefTable0(ret[0]);
1650
1649
  }
1650
+ /**
1651
+ * Subscribe to changes that may affect a JSONPath query.
1652
+ *
1653
+ * The callback receives no query result; it is a lightweight notifier and may
1654
+ * fire false positives so callers can debounce/throttle before running JSONPath
1655
+ * themselves.
1656
+ * @param {string} jsonpath
1657
+ * @param {Function} f
1658
+ * @returns {any}
1659
+ */
1660
+ subscribeJsonpath(jsonpath, f) {
1661
+ const ptr0 = passStringToWasm0(jsonpath, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1662
+ const len0 = WASM_VECTOR_LEN;
1663
+ const ret = wasm.lorodoc_subscribeJsonpath(this.__wbg_ptr, ptr0, len0, f);
1664
+ if (ret[2]) {
1665
+ throw takeFromExternrefTable0(ret[1]);
1666
+ }
1667
+ return takeFromExternrefTable0(ret[0]);
1668
+ }
1651
1669
  /**
1652
1670
  * Delete all content from a root container and hide it from the document.
1653
1671
  *
@@ -5541,9 +5559,6 @@ function __wbg_get_imports() {
5541
5559
  const ret = arg0.entries();
5542
5560
  return ret;
5543
5561
  };
5544
- imports.wbg.__wbg_error_4ac2b4fe53215e85 = function(arg0, arg1) {
5545
- console.error(getStringFromWasm0(arg0, arg1));
5546
- };
5547
5562
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
5548
5563
  let deferred0_0;
5549
5564
  let deferred0_1;
@@ -5555,6 +5570,9 @@ function __wbg_get_imports() {
5555
5570
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5556
5571
  }
5557
5572
  };
5573
+ imports.wbg.__wbg_error_fb60fcc2bf54ad8d = function(arg0, arg1) {
5574
+ console.error(getStringFromWasm0(arg0, arg1));
5575
+ };
5558
5576
  imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
5559
5577
  const ret = Array.from(arg0);
5560
5578
  return ret;
@@ -5653,7 +5671,7 @@ function __wbg_get_imports() {
5653
5671
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5654
5672
  }
5655
5673
  };
5656
- imports.wbg.__wbg_log_bd9aa71b996755d3 = function(arg0, arg1) {
5674
+ imports.wbg.__wbg_log_c442f7198a667311 = function(arg0, arg1) {
5657
5675
  console.log(getStringFromWasm0(arg0, arg1));
5658
5676
  };
5659
5677
  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
@@ -5766,7 +5784,7 @@ function __wbg_get_imports() {
5766
5784
  const ret = arg0.node;
5767
5785
  return ret;
5768
5786
  };
5769
- imports.wbg.__wbg_now_d256cd3265ccdaa6 = function() {
5787
+ imports.wbg.__wbg_now_c8bdc8efc8c495eb = function() {
5770
5788
  const ret = Date.now();
5771
5789
  return ret;
5772
5790
  };
@@ -5856,7 +5874,7 @@ function __wbg_get_imports() {
5856
5874
  const ret = VersionVector.__wrap(arg0);
5857
5875
  return ret;
5858
5876
  };
5859
- imports.wbg.__wbg_warn_ba32d63a72098111 = function(arg0, arg1) {
5877
+ imports.wbg.__wbg_warn_175371353b28a2a4 = function(arg0, arg1) {
5860
5878
  console.warn(getStringFromWasm0(arg0, arg1));
5861
5879
  };
5862
5880
  imports.wbg.__wbindgen_as_number = function(arg0) {
@@ -5895,7 +5913,7 @@ function __wbg_get_imports() {
5895
5913
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_62);
5896
5914
  return ret;
5897
5915
  };
5898
- imports.wbg.__wbindgen_closure_wrapper721 = function(arg0, arg1, arg2) {
5916
+ imports.wbg.__wbindgen_closure_wrapper720 = function(arg0, arg1, arg2) {
5899
5917
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_65);
5900
5918
  return ret;
5901
5919
  };
Binary file
@@ -134,6 +134,7 @@ export const lorodoc_shallowSinceFrontiers: (a: number) => [number, number, numb
134
134
  export const lorodoc_shallowSinceVV: (a: number) => number;
135
135
  export const lorodoc_subscribe: (a: number, b: any) => any;
136
136
  export const lorodoc_subscribeFirstCommitFromPeer: (a: number, b: any) => any;
137
+ export const lorodoc_subscribeJsonpath: (a: number, b: number, c: number, d: any) => [number, number, number];
137
138
  export const lorodoc_subscribeLocalUpdates: (a: number, b: any) => any;
138
139
  export const lorodoc_subscribePreCommit: (a: number, b: any) => any;
139
140
  export const lorodoc_toJSON: (a: number) => [number, number, number];
@@ -325,5 +326,5 @@ export const __wbindgen_export_6: WebAssembly.Table;
325
326
  export const __externref_table_dealloc: (a: number) => void;
326
327
  export const __externref_drop_slice: (a: number, b: number) => void;
327
328
  export const closure11_externref_shim: (a: number, b: number, c: any) => void;
328
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151: (a: number, b: number) => void;
329
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb48c49436c48b69d: (a: number, b: number) => void;
329
330
  export const __wbindgen_start: () => void;