loro-crdt 1.10.1 → 1.10.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.
@@ -236,6 +236,55 @@ function getArrayJsValueFromWasm0(ptr, len) {
236
236
  wasm.__externref_drop_slice(ptr, len);
237
237
  return result;
238
238
  }
239
+ /**
240
+ * Get the version of Loro
241
+ * @returns {string}
242
+ */
243
+ module.exports.LORO_VERSION = function() {
244
+ let deferred1_0;
245
+ let deferred1_1;
246
+ try {
247
+ const ret = wasm.LORO_VERSION();
248
+ deferred1_0 = ret[0];
249
+ deferred1_1 = ret[1];
250
+ return getStringFromWasm0(ret[0], ret[1]);
251
+ } finally {
252
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
253
+ }
254
+ };
255
+
256
+ /**
257
+ * Enable debug info of Loro
258
+ */
259
+ module.exports.setDebug = function() {
260
+ wasm.setDebug();
261
+ };
262
+
263
+ function passArrayJsValueToWasm0(array, malloc) {
264
+ const ptr = malloc(array.length * 4, 4) >>> 0;
265
+ for (let i = 0; i < array.length; i++) {
266
+ const add = addToExternrefTable0(array[i]);
267
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
268
+ }
269
+ WASM_VECTOR_LEN = array.length;
270
+ return ptr;
271
+ }
272
+ /**
273
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
274
+ * @returns {Uint8Array}
275
+ */
276
+ module.exports.encodeFrontiers = function(frontiers) {
277
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ret = wasm.encodeFrontiers(ptr0, len0);
280
+ if (ret[3]) {
281
+ throw takeFromExternrefTable0(ret[2]);
282
+ }
283
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
284
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
285
+ return v2;
286
+ };
287
+
239
288
  /**
240
289
  * Redacts sensitive content in JSON updates within the specified version range.
241
290
  *
@@ -266,6 +315,28 @@ module.exports.redactJsonUpdates = function(json_updates, version_range) {
266
315
  return takeFromExternrefTable0(ret[0]);
267
316
  };
268
317
 
318
+ module.exports.callPendingEvents = function() {
319
+ wasm.callPendingEvents();
320
+ };
321
+
322
+ module.exports.run = function() {
323
+ wasm.run();
324
+ };
325
+
326
+ /**
327
+ * @param {Uint8Array} bytes
328
+ * @returns {{ peer: PeerID, counter: number }[]}
329
+ */
330
+ module.exports.decodeFrontiers = function(bytes) {
331
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
332
+ const len0 = WASM_VECTOR_LEN;
333
+ const ret = wasm.decodeFrontiers(ptr0, len0);
334
+ if (ret[2]) {
335
+ throw takeFromExternrefTable0(ret[1]);
336
+ }
337
+ return takeFromExternrefTable0(ret[0]);
338
+ };
339
+
269
340
  /**
270
341
  * Decode the metadata of the import blob.
271
342
  *
@@ -291,83 +362,12 @@ module.exports.decodeImportBlobMeta = function(blob, check_checksum) {
291
362
  return takeFromExternrefTable0(ret[0]);
292
363
  };
293
364
 
294
- /**
295
- * @param {Uint8Array} bytes
296
- * @returns {{ peer: PeerID, counter: number }[]}
297
- */
298
- module.exports.decodeFrontiers = function(bytes) {
299
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
300
- const len0 = WASM_VECTOR_LEN;
301
- const ret = wasm.decodeFrontiers(ptr0, len0);
302
- if (ret[2]) {
303
- throw takeFromExternrefTable0(ret[1]);
304
- }
305
- return takeFromExternrefTable0(ret[0]);
306
- };
307
-
308
- module.exports.run = function() {
309
- wasm.run();
310
- };
311
-
312
- function passArrayJsValueToWasm0(array, malloc) {
313
- const ptr = malloc(array.length * 4, 4) >>> 0;
314
- for (let i = 0; i < array.length; i++) {
315
- const add = addToExternrefTable0(array[i]);
316
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
317
- }
318
- WASM_VECTOR_LEN = array.length;
319
- return ptr;
320
- }
321
- /**
322
- * @param {({ peer: PeerID, counter: number })[]} frontiers
323
- * @returns {Uint8Array}
324
- */
325
- module.exports.encodeFrontiers = function(frontiers) {
326
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
327
- const len0 = WASM_VECTOR_LEN;
328
- const ret = wasm.encodeFrontiers(ptr0, len0);
329
- if (ret[3]) {
330
- throw takeFromExternrefTable0(ret[2]);
331
- }
332
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
333
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
334
- return v2;
335
- };
336
-
337
- /**
338
- * Enable debug info of Loro
339
- */
340
- module.exports.setDebug = function() {
341
- wasm.setDebug();
342
- };
343
-
344
- module.exports.callPendingEvents = function() {
345
- wasm.callPendingEvents();
346
- };
347
-
348
- /**
349
- * Get the version of Loro
350
- * @returns {string}
351
- */
352
- module.exports.LORO_VERSION = function() {
353
- let deferred1_0;
354
- let deferred1_1;
355
- try {
356
- const ret = wasm.LORO_VERSION();
357
- deferred1_0 = ret[0];
358
- deferred1_1 = ret[1];
359
- return getStringFromWasm0(ret[0], ret[1]);
360
- } finally {
361
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
362
- }
363
- };
364
-
365
365
  function __wbg_adapter_62(arg0, arg1, arg2) {
366
- wasm.closure11_externref_shim(arg0, arg1, arg2);
366
+ wasm.closure9_externref_shim(arg0, arg1, arg2);
367
367
  }
368
368
 
369
369
  function __wbg_adapter_65(arg0, arg1) {
370
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4(arg0, arg1);
370
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df(arg0, arg1);
371
371
  }
372
372
 
373
373
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1656,6 +1656,25 @@ class LoroDoc {
1656
1656
  }
1657
1657
  return takeFromExternrefTable0(ret[0]);
1658
1658
  }
1659
+ /**
1660
+ * Subscribe to changes that may affect a JSONPath query.
1661
+ *
1662
+ * The callback receives no query result; it is a lightweight notifier and may
1663
+ * fire false positives so callers can debounce/throttle before running JSONPath
1664
+ * themselves.
1665
+ * @param {string} jsonpath
1666
+ * @param {Function} f
1667
+ * @returns {any}
1668
+ */
1669
+ subscribeJsonpath(jsonpath, f) {
1670
+ const ptr0 = passStringToWasm0(jsonpath, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1671
+ const len0 = WASM_VECTOR_LEN;
1672
+ const ret = wasm.lorodoc_subscribeJsonpath(this.__wbg_ptr, ptr0, len0, f);
1673
+ if (ret[2]) {
1674
+ throw takeFromExternrefTable0(ret[1]);
1675
+ }
1676
+ return takeFromExternrefTable0(ret[0]);
1677
+ }
1659
1678
  /**
1660
1679
  * Delete all content from a root container and hide it from the document.
1661
1680
  *
@@ -3908,6 +3927,25 @@ class LoroText {
3908
3927
  throw takeFromExternrefTable0(ret[0]);
3909
3928
  }
3910
3929
  }
3930
+ /**
3931
+ * Convert a position between coordinate systems.
3932
+ *
3933
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3934
+ *
3935
+ * Returns `undefined` when out of bounds or unsupported.
3936
+ * @param {number} index
3937
+ * @param {string} from
3938
+ * @param {string} to
3939
+ * @returns {any}
3940
+ */
3941
+ convertPos(index, from, to) {
3942
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3943
+ const len0 = WASM_VECTOR_LEN;
3944
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3945
+ const len1 = WASM_VECTOR_LEN;
3946
+ const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
3947
+ return ret;
3948
+ }
3911
3949
  /**
3912
3950
  * Delete elements from index to utf-8 index + len
3913
3951
  *
@@ -5531,7 +5569,7 @@ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
5531
5569
  }
5532
5570
  };
5533
5571
 
5534
- module.exports.__wbg_error_f6ddbf3300c73fe1 = function(arg0, arg1) {
5572
+ module.exports.__wbg_error_ec1c81ec21690870 = function(arg0, arg1) {
5535
5573
  console.error(getStringFromWasm0(arg0, arg1));
5536
5574
  };
5537
5575
 
@@ -5650,7 +5688,7 @@ module.exports.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg
5650
5688
  }
5651
5689
  };
5652
5690
 
5653
- module.exports.__wbg_log_3c0d0f235e1c209c = function(arg0, arg1) {
5691
+ module.exports.__wbg_log_8c0006defd0ef388 = function(arg0, arg1) {
5654
5692
  console.log(getStringFromWasm0(arg0, arg1));
5655
5693
  };
5656
5694
 
@@ -5787,7 +5825,7 @@ module.exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
5787
5825
  return ret;
5788
5826
  };
5789
5827
 
5790
- module.exports.__wbg_now_d256cd3265ccdaa6 = function() {
5828
+ module.exports.__wbg_now_8a87c5466cc7d560 = function() {
5791
5829
  const ret = Date.now();
5792
5830
  return ret;
5793
5831
  };
@@ -5900,7 +5938,7 @@ module.exports.__wbg_versionvector_new = function(arg0) {
5900
5938
  return ret;
5901
5939
  };
5902
5940
 
5903
- module.exports.__wbg_warn_e3fad33818dd84d2 = function(arg0, arg1) {
5941
+ module.exports.__wbg_warn_6a7b1c2df711ad0a = function(arg0, arg1) {
5904
5942
  console.warn(getStringFromWasm0(arg0, arg1));
5905
5943
  };
5906
5944
 
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];
@@ -212,6 +213,7 @@ export const loromovablelist_toArray: (a: number) => [number, number];
212
213
  export const loromovablelist_toJSON: (a: number) => any;
213
214
  export const lorotext_applyDelta: (a: number, b: any) => [number, number];
214
215
  export const lorotext_charAt: (a: number, b: number) => [number, number, number];
216
+ export const lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
215
217
  export const lorotext_delete: (a: number, b: number, c: number) => [number, number];
216
218
  export const lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
217
219
  export const lorotext_getAttached: (a: number) => any;
@@ -323,6 +325,6 @@ export const __wbindgen_free: (a: number, b: number, c: number) => void;
323
325
  export const __wbindgen_export_6: WebAssembly.Table;
324
326
  export const __externref_table_dealloc: (a: number) => void;
325
327
  export const __externref_drop_slice: (a: number, b: number) => void;
326
- export const closure11_externref_shim: (a: number, b: number, c: any) => void;
327
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4: (a: number, b: number) => void;
328
+ export const closure9_externref_shim: (a: number, b: number, c: any) => void;
329
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df: (a: number, b: number) => void;
328
330
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.",
5
5
  "keywords": [
6
6
  "crdt",
@@ -1,5 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Get the version of Loro
5
+ */
6
+ export function LORO_VERSION(): string;
7
+ /**
8
+ * Enable debug info of Loro
9
+ */
10
+ export function setDebug(): void;
11
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
3
12
  /**
4
13
  * Redacts sensitive content in JSON updates within the specified version range.
5
14
  *
@@ -20,6 +29,9 @@
20
29
  * @returns {Object} The redacted JSON updates
21
30
  */
22
31
  export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
32
+ export function callPendingEvents(): void;
33
+ export function run(): void;
34
+ export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
23
35
  /**
24
36
  * Decode the metadata of the import blob.
25
37
  *
@@ -33,18 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
33
45
  * - changeNum
34
46
  */
35
47
  export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
36
- export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
37
- export function run(): void;
38
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
39
- /**
40
- * Enable debug info of Loro
41
- */
42
- export function setDebug(): void;
43
- export function callPendingEvents(): void;
44
- /**
45
- * Get the version of Loro
46
- */
47
- export function LORO_VERSION(): string;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -63,6 +63,7 @@ export function LORO_VERSION(): string;
63
63
  export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
64
64
 
65
65
  export type PeerID = `${number}`;
66
+ export type TextPosType = "unicode" | "utf16" | "utf8";
66
67
  /**
67
68
  * The unique id of each container.
68
69
  *
@@ -338,7 +339,7 @@ interface LoroDoc {
338
339
  export type Delta<T> =
339
340
  | {
340
341
  insert: T;
341
- attributes?: { [key in string]: {} };
342
+ attributes?: { [key in string]: Value };
342
343
  retain?: undefined;
343
344
  delete?: undefined;
344
345
  }
@@ -350,7 +351,7 @@ export type Delta<T> =
350
351
  }
351
352
  | {
352
353
  retain: number;
353
- attributes?: { [key in string]: {} };
354
+ attributes?: { [key in string]: Value };
354
355
  delete?: undefined;
355
356
  insert?: undefined;
356
357
  };
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
450
451
  }
451
452
 
452
453
  interface LoroText {
454
+ /**
455
+ * Convert a position between coordinate systems.
456
+ */
457
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
458
+
453
459
  /**
454
460
  * Get the cursor position at the given pos.
455
461
  *
@@ -868,6 +874,12 @@ interface Listener {
868
874
 
869
875
  interface LoroDoc {
870
876
  subscribe(listener: Listener): Subscription;
877
+ /**
878
+ * Subscribe to changes that may affect a JSONPath query.
879
+ * Callback may fire false positives and carries no query result.
880
+ * You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
881
+ */
882
+ subscribeJsonpath(path: string, callback: () => void): Subscription;
871
883
  }
872
884
 
873
885
  interface UndoManager {
@@ -905,6 +917,12 @@ interface UndoManager {
905
917
  groupEnd(): void;
906
918
  }
907
919
  interface LoroDoc<T extends Record<string, Container> = Record<string, Container>> {
920
+ /**
921
+ * Subscribe to changes that may affect a JSONPath query.
922
+ * Callback may fire false positives and carries no query result.
923
+ * You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
924
+ */
925
+ subscribeJsonpath(path: string, callback: () => void): Subscription;
908
926
  /**
909
927
  * Get a LoroMap by container id
910
928
  *
@@ -1264,6 +1282,10 @@ interface LoroText {
1264
1282
  insert(pos: number, text: string): void;
1265
1283
  delete(pos: number, len: number): void;
1266
1284
  subscribe(listener: Listener): Subscription;
1285
+ /**
1286
+ * Convert a position between coordinate systems.
1287
+ */
1288
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
1267
1289
  /**
1268
1290
  * Update the current text to the target text.
1269
1291
  *
@@ -3035,6 +3057,14 @@ export class LoroText {
3035
3057
  * ```
3036
3058
  */
3037
3059
  applyDelta(delta: Delta<string>[]): void;
3060
+ /**
3061
+ * Convert a position between coordinate systems.
3062
+ *
3063
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3064
+ *
3065
+ * Returns `undefined` when out of bounds or unsupported.
3066
+ */
3067
+ convertPos(index: number, from: string, to: string): any;
3038
3068
  /**
3039
3069
  * Delete elements from index to utf-8 index + len
3040
3070
  *
@@ -3827,6 +3857,7 @@ export interface InitOutput {
3827
3857
  readonly lorodoc_shallowSinceVV: (a: number) => number;
3828
3858
  readonly lorodoc_subscribe: (a: number, b: any) => any;
3829
3859
  readonly lorodoc_subscribeFirstCommitFromPeer: (a: number, b: any) => any;
3860
+ readonly lorodoc_subscribeJsonpath: (a: number, b: number, c: number, d: any) => [number, number, number];
3830
3861
  readonly lorodoc_subscribeLocalUpdates: (a: number, b: any) => any;
3831
3862
  readonly lorodoc_subscribePreCommit: (a: number, b: any) => any;
3832
3863
  readonly lorodoc_toJSON: (a: number) => [number, number, number];
@@ -3905,6 +3936,7 @@ export interface InitOutput {
3905
3936
  readonly loromovablelist_toJSON: (a: number) => any;
3906
3937
  readonly lorotext_applyDelta: (a: number, b: any) => [number, number];
3907
3938
  readonly lorotext_charAt: (a: number, b: number) => [number, number, number];
3939
+ readonly lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
3908
3940
  readonly lorotext_delete: (a: number, b: number, c: number) => [number, number];
3909
3941
  readonly lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
3910
3942
  readonly lorotext_getAttached: (a: number) => any;
@@ -4016,8 +4048,8 @@ export interface InitOutput {
4016
4048
  readonly __wbindgen_export_6: WebAssembly.Table;
4017
4049
  readonly __externref_table_dealloc: (a: number) => void;
4018
4050
  readonly __externref_drop_slice: (a: number, b: number) => void;
4019
- readonly closure11_externref_shim: (a: number, b: number, c: any) => void;
4020
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4: (a: number, b: number) => void;
4051
+ readonly closure9_externref_shim: (a: number, b: number, c: any) => void;
4052
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df: (a: number, b: number) => void;
4021
4053
  readonly __wbindgen_start: () => void;
4022
4054
  }
4023
4055
 
package/web/loro_wasm.js CHANGED
@@ -232,6 +232,55 @@ function getArrayJsValueFromWasm0(ptr, len) {
232
232
  wasm.__externref_drop_slice(ptr, len);
233
233
  return result;
234
234
  }
235
+ /**
236
+ * Get the version of Loro
237
+ * @returns {string}
238
+ */
239
+ export function LORO_VERSION() {
240
+ let deferred1_0;
241
+ let deferred1_1;
242
+ try {
243
+ const ret = wasm.LORO_VERSION();
244
+ deferred1_0 = ret[0];
245
+ deferred1_1 = ret[1];
246
+ return getStringFromWasm0(ret[0], ret[1]);
247
+ } finally {
248
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Enable debug info of Loro
254
+ */
255
+ export function setDebug() {
256
+ wasm.setDebug();
257
+ }
258
+
259
+ function passArrayJsValueToWasm0(array, malloc) {
260
+ const ptr = malloc(array.length * 4, 4) >>> 0;
261
+ for (let i = 0; i < array.length; i++) {
262
+ const add = addToExternrefTable0(array[i]);
263
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
264
+ }
265
+ WASM_VECTOR_LEN = array.length;
266
+ return ptr;
267
+ }
268
+ /**
269
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
270
+ * @returns {Uint8Array}
271
+ */
272
+ export function encodeFrontiers(frontiers) {
273
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ret = wasm.encodeFrontiers(ptr0, len0);
276
+ if (ret[3]) {
277
+ throw takeFromExternrefTable0(ret[2]);
278
+ }
279
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
280
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
281
+ return v2;
282
+ }
283
+
235
284
  /**
236
285
  * Redacts sensitive content in JSON updates within the specified version range.
237
286
  *
@@ -262,6 +311,28 @@ export function redactJsonUpdates(json_updates, version_range) {
262
311
  return takeFromExternrefTable0(ret[0]);
263
312
  }
264
313
 
314
+ export function callPendingEvents() {
315
+ wasm.callPendingEvents();
316
+ }
317
+
318
+ export function run() {
319
+ wasm.run();
320
+ }
321
+
322
+ /**
323
+ * @param {Uint8Array} bytes
324
+ * @returns {{ peer: PeerID, counter: number }[]}
325
+ */
326
+ export function decodeFrontiers(bytes) {
327
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ret = wasm.decodeFrontiers(ptr0, len0);
330
+ if (ret[2]) {
331
+ throw takeFromExternrefTable0(ret[1]);
332
+ }
333
+ return takeFromExternrefTable0(ret[0]);
334
+ }
335
+
265
336
  /**
266
337
  * Decode the metadata of the import blob.
267
338
  *
@@ -287,83 +358,12 @@ export function decodeImportBlobMeta(blob, check_checksum) {
287
358
  return takeFromExternrefTable0(ret[0]);
288
359
  }
289
360
 
290
- /**
291
- * @param {Uint8Array} bytes
292
- * @returns {{ peer: PeerID, counter: number }[]}
293
- */
294
- export function decodeFrontiers(bytes) {
295
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
296
- const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.decodeFrontiers(ptr0, len0);
298
- if (ret[2]) {
299
- throw takeFromExternrefTable0(ret[1]);
300
- }
301
- return takeFromExternrefTable0(ret[0]);
302
- }
303
-
304
- export function run() {
305
- wasm.run();
306
- }
307
-
308
- function passArrayJsValueToWasm0(array, malloc) {
309
- const ptr = malloc(array.length * 4, 4) >>> 0;
310
- for (let i = 0; i < array.length; i++) {
311
- const add = addToExternrefTable0(array[i]);
312
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
313
- }
314
- WASM_VECTOR_LEN = array.length;
315
- return ptr;
316
- }
317
- /**
318
- * @param {({ peer: PeerID, counter: number })[]} frontiers
319
- * @returns {Uint8Array}
320
- */
321
- export function encodeFrontiers(frontiers) {
322
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
323
- const len0 = WASM_VECTOR_LEN;
324
- const ret = wasm.encodeFrontiers(ptr0, len0);
325
- if (ret[3]) {
326
- throw takeFromExternrefTable0(ret[2]);
327
- }
328
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
329
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
330
- return v2;
331
- }
332
-
333
- /**
334
- * Enable debug info of Loro
335
- */
336
- export function setDebug() {
337
- wasm.setDebug();
338
- }
339
-
340
- export function callPendingEvents() {
341
- wasm.callPendingEvents();
342
- }
343
-
344
- /**
345
- * Get the version of Loro
346
- * @returns {string}
347
- */
348
- export function LORO_VERSION() {
349
- let deferred1_0;
350
- let deferred1_1;
351
- try {
352
- const ret = wasm.LORO_VERSION();
353
- deferred1_0 = ret[0];
354
- deferred1_1 = ret[1];
355
- return getStringFromWasm0(ret[0], ret[1]);
356
- } finally {
357
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
358
- }
359
- }
360
-
361
361
  function __wbg_adapter_62(arg0, arg1, arg2) {
362
- wasm.closure11_externref_shim(arg0, arg1, arg2);
362
+ wasm.closure9_externref_shim(arg0, arg1, arg2);
363
363
  }
364
364
 
365
365
  function __wbg_adapter_65(arg0, arg1) {
366
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4(arg0, arg1);
366
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df(arg0, arg1);
367
367
  }
368
368
 
369
369
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1647,6 +1647,25 @@ export class LoroDoc {
1647
1647
  }
1648
1648
  return takeFromExternrefTable0(ret[0]);
1649
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
+ }
1650
1669
  /**
1651
1670
  * Delete all content from a root container and hide it from the document.
1652
1671
  *
@@ -3895,6 +3914,25 @@ export class LoroText {
3895
3914
  throw takeFromExternrefTable0(ret[0]);
3896
3915
  }
3897
3916
  }
3917
+ /**
3918
+ * Convert a position between coordinate systems.
3919
+ *
3920
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3921
+ *
3922
+ * Returns `undefined` when out of bounds or unsupported.
3923
+ * @param {number} index
3924
+ * @param {string} from
3925
+ * @param {string} to
3926
+ * @returns {any}
3927
+ */
3928
+ convertPos(index, from, to) {
3929
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3930
+ const len0 = WASM_VECTOR_LEN;
3931
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3932
+ const len1 = WASM_VECTOR_LEN;
3933
+ const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
3934
+ return ret;
3935
+ }
3898
3936
  /**
3899
3937
  * Delete elements from index to utf-8 index + len
3900
3938
  *
@@ -5532,7 +5570,7 @@ function __wbg_get_imports() {
5532
5570
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5533
5571
  }
5534
5572
  };
5535
- imports.wbg.__wbg_error_f6ddbf3300c73fe1 = function(arg0, arg1) {
5573
+ imports.wbg.__wbg_error_ec1c81ec21690870 = function(arg0, arg1) {
5536
5574
  console.error(getStringFromWasm0(arg0, arg1));
5537
5575
  };
5538
5576
  imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
@@ -5633,7 +5671,7 @@ function __wbg_get_imports() {
5633
5671
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5634
5672
  }
5635
5673
  };
5636
- imports.wbg.__wbg_log_3c0d0f235e1c209c = function(arg0, arg1) {
5674
+ imports.wbg.__wbg_log_8c0006defd0ef388 = function(arg0, arg1) {
5637
5675
  console.log(getStringFromWasm0(arg0, arg1));
5638
5676
  };
5639
5677
  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
@@ -5746,7 +5784,7 @@ function __wbg_get_imports() {
5746
5784
  const ret = arg0.node;
5747
5785
  return ret;
5748
5786
  };
5749
- imports.wbg.__wbg_now_d256cd3265ccdaa6 = function() {
5787
+ imports.wbg.__wbg_now_8a87c5466cc7d560 = function() {
5750
5788
  const ret = Date.now();
5751
5789
  return ret;
5752
5790
  };
@@ -5836,7 +5874,7 @@ function __wbg_get_imports() {
5836
5874
  const ret = VersionVector.__wrap(arg0);
5837
5875
  return ret;
5838
5876
  };
5839
- imports.wbg.__wbg_warn_e3fad33818dd84d2 = function(arg0, arg1) {
5877
+ imports.wbg.__wbg_warn_6a7b1c2df711ad0a = function(arg0, arg1) {
5840
5878
  console.warn(getStringFromWasm0(arg0, arg1));
5841
5879
  };
5842
5880
  imports.wbg.__wbindgen_as_number = function(arg0) {