loro-crdt 1.1.4 → 1.2.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.
@@ -359,7 +359,7 @@ export type TreeNodeJSON<T> = Omit<TreeNodeValue, 'meta' | 'children'> & {
359
359
 
360
360
  interface LoroTree{
361
361
  toArray(): TreeNodeValue[];
362
- getNodes(options?: { withDeleted: boolean = false }): LoroTreeNode[];
362
+ getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode[];
363
363
  }
364
364
 
365
365
  interface LoroMovableList {
@@ -454,7 +454,7 @@ export type ExportMode = {
454
454
  } | {
455
455
  mode: "updates-in-range",
456
456
  spans: {
457
- id: ID,
457
+ id: OpId,
458
458
  len: number,
459
459
  }[],
460
460
  };
@@ -1570,9 +1570,9 @@ export class LoroDoc {
1570
1570
  * @param ids - the changes to visit
1571
1571
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1572
1572
  * @param {({ peer: PeerID, counter: number })[]} ids
1573
- * @param {(change: ChangeMeta) => boolean} f
1573
+ * @param {(change: Change) => boolean} f
1574
1574
  */
1575
- travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: ChangeMeta) => boolean): void;
1575
+ travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: Change) => boolean): void;
1576
1576
  /**
1577
1577
  * Checkout the `DocState` to a specific version.
1578
1578
  *
@@ -1880,8 +1880,9 @@ export class LoroDoc {
1880
1880
  * doc2.importUpdateBatch([snapshot, updates]);
1881
1881
  * ```
1882
1882
  * @param {Array<any>} data
1883
+ * @returns {ImportStatus}
1883
1884
  */
1884
- importUpdateBatch(data: Array<any>): void;
1885
+ importUpdateBatch(data: Array<any>): ImportStatus;
1885
1886
  /**
1886
1887
  * Get the shallow json format of the document state.
1887
1888
  *
@@ -1211,7 +1211,7 @@ export class LoroDoc {
1211
1211
  * @param ids - the changes to visit
1212
1212
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1213
1213
  * @param {({ peer: PeerID, counter: number })[]} ids
1214
- * @param {(change: ChangeMeta) => boolean} f
1214
+ * @param {(change: Change) => boolean} f
1215
1215
  */
1216
1216
  travelChangeAncestors(ids, f) {
1217
1217
  try {
@@ -2004,6 +2004,7 @@ export class LoroDoc {
2004
2004
  * doc2.importUpdateBatch([snapshot, updates]);
2005
2005
  * ```
2006
2006
  * @param {Array<any>} data
2007
+ * @returns {ImportStatus}
2007
2008
  */
2008
2009
  importUpdateBatch(data) {
2009
2010
  try {
@@ -2011,9 +2012,11 @@ export class LoroDoc {
2011
2012
  wasm.lorodoc_importUpdateBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2012
2013
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2013
2014
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2014
- if (r1) {
2015
- throw takeObject(r0);
2015
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2016
+ if (r2) {
2017
+ throw takeObject(r1);
2016
2018
  }
2019
+ return takeObject(r0);
2017
2020
  } finally {
2018
2021
  wasm.__wbindgen_add_to_stack_pointer(16);
2019
2022
  }
@@ -5628,13 +5631,8 @@ export function __wbindgen_object_drop_ref(arg0) {
5628
5631
  takeObject(arg0);
5629
5632
  };
5630
5633
 
5631
- export function __wbg_lorotreenode_new(arg0) {
5632
- const ret = LoroTreeNode.__wrap(arg0);
5633
- return addHeapObject(ret);
5634
- };
5635
-
5636
- export function __wbg_lorotree_new(arg0) {
5637
- const ret = LoroTree.__wrap(arg0);
5634
+ export function __wbg_loromap_new(arg0) {
5635
+ const ret = LoroMap.__wrap(arg0);
5638
5636
  return addHeapObject(ret);
5639
5637
  };
5640
5638
 
@@ -5643,18 +5641,18 @@ export function __wbg_lorotext_new(arg0) {
5643
5641
  return addHeapObject(ret);
5644
5642
  };
5645
5643
 
5646
- export function __wbg_loromap_new(arg0) {
5647
- const ret = LoroMap.__wrap(arg0);
5644
+ export function __wbg_lorolist_new(arg0) {
5645
+ const ret = LoroList.__wrap(arg0);
5648
5646
  return addHeapObject(ret);
5649
5647
  };
5650
5648
 
5651
- export function __wbg_lorocounter_new(arg0) {
5652
- const ret = LoroCounter.__wrap(arg0);
5649
+ export function __wbg_lorotree_new(arg0) {
5650
+ const ret = LoroTree.__wrap(arg0);
5653
5651
  return addHeapObject(ret);
5654
5652
  };
5655
5653
 
5656
- export function __wbg_lorolist_new(arg0) {
5657
- const ret = LoroList.__wrap(arg0);
5654
+ export function __wbg_cursor_new(arg0) {
5655
+ const ret = Cursor.__wrap(arg0);
5658
5656
  return addHeapObject(ret);
5659
5657
  };
5660
5658
 
@@ -5663,8 +5661,13 @@ export function __wbg_loromovablelist_new(arg0) {
5663
5661
  return addHeapObject(ret);
5664
5662
  };
5665
5663
 
5666
- export function __wbg_cursor_new(arg0) {
5667
- const ret = Cursor.__wrap(arg0);
5664
+ export function __wbg_lorocounter_new(arg0) {
5665
+ const ret = LoroCounter.__wrap(arg0);
5666
+ return addHeapObject(ret);
5667
+ };
5668
+
5669
+ export function __wbg_lorotreenode_new(arg0) {
5670
+ const ret = LoroTreeNode.__wrap(arg0);
5668
5671
  return addHeapObject(ret);
5669
5672
  };
5670
5673
 
@@ -6211,12 +6214,12 @@ export function __wbindgen_memory() {
6211
6214
  };
6212
6215
 
6213
6216
  export function __wbindgen_closure_wrapper487(arg0, arg1, arg2) {
6214
- const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_58);
6217
+ const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_58);
6215
6218
  return addHeapObject(ret);
6216
6219
  };
6217
6220
 
6218
- export function __wbindgen_closure_wrapper490(arg0, arg1, arg2) {
6219
- const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_61);
6221
+ export function __wbindgen_closure_wrapper489(arg0, arg1, arg2) {
6222
+ const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_61);
6220
6223
  return addHeapObject(ret);
6221
6224
  };
6222
6225
 
Binary file
@@ -359,7 +359,7 @@ export type TreeNodeJSON<T> = Omit<TreeNodeValue, 'meta' | 'children'> & {
359
359
 
360
360
  interface LoroTree{
361
361
  toArray(): TreeNodeValue[];
362
- getNodes(options?: { withDeleted: boolean = false }): LoroTreeNode[];
362
+ getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode[];
363
363
  }
364
364
 
365
365
  interface LoroMovableList {
@@ -454,7 +454,7 @@ export type ExportMode = {
454
454
  } | {
455
455
  mode: "updates-in-range",
456
456
  spans: {
457
- id: ID,
457
+ id: OpId,
458
458
  len: number,
459
459
  }[],
460
460
  };
@@ -1570,9 +1570,9 @@ export class LoroDoc {
1570
1570
  * @param ids - the changes to visit
1571
1571
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1572
1572
  * @param {({ peer: PeerID, counter: number })[]} ids
1573
- * @param {(change: ChangeMeta) => boolean} f
1573
+ * @param {(change: Change) => boolean} f
1574
1574
  */
1575
- travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: ChangeMeta) => boolean): void;
1575
+ travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: Change) => boolean): void;
1576
1576
  /**
1577
1577
  * Checkout the `DocState` to a specific version.
1578
1578
  *
@@ -1880,8 +1880,9 @@ export class LoroDoc {
1880
1880
  * doc2.importUpdateBatch([snapshot, updates]);
1881
1881
  * ```
1882
1882
  * @param {Array<any>} data
1883
+ * @returns {ImportStatus}
1883
1884
  */
1884
- importUpdateBatch(data: Array<any>): void;
1885
+ importUpdateBatch(data: Array<any>): ImportStatus;
1885
1886
  /**
1886
1887
  * Get the shallow json format of the document state.
1887
1888
  *
@@ -1209,7 +1209,7 @@ class LoroDoc {
1209
1209
  * @param ids - the changes to visit
1210
1210
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1211
1211
  * @param {({ peer: PeerID, counter: number })[]} ids
1212
- * @param {(change: ChangeMeta) => boolean} f
1212
+ * @param {(change: Change) => boolean} f
1213
1213
  */
1214
1214
  travelChangeAncestors(ids, f) {
1215
1215
  try {
@@ -2002,6 +2002,7 @@ class LoroDoc {
2002
2002
  * doc2.importUpdateBatch([snapshot, updates]);
2003
2003
  * ```
2004
2004
  * @param {Array<any>} data
2005
+ * @returns {ImportStatus}
2005
2006
  */
2006
2007
  importUpdateBatch(data) {
2007
2008
  try {
@@ -2009,9 +2010,11 @@ class LoroDoc {
2009
2010
  wasm.lorodoc_importUpdateBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2010
2011
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2011
2012
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2012
- if (r1) {
2013
- throw takeObject(r0);
2013
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2014
+ if (r2) {
2015
+ throw takeObject(r1);
2014
2016
  }
2017
+ return takeObject(r0);
2015
2018
  } finally {
2016
2019
  wasm.__wbindgen_add_to_stack_pointer(16);
2017
2020
  }
@@ -5635,13 +5638,8 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
5635
5638
  takeObject(arg0);
5636
5639
  };
5637
5640
 
5638
- module.exports.__wbg_lorotreenode_new = function(arg0) {
5639
- const ret = LoroTreeNode.__wrap(arg0);
5640
- return addHeapObject(ret);
5641
- };
5642
-
5643
- module.exports.__wbg_lorotree_new = function(arg0) {
5644
- const ret = LoroTree.__wrap(arg0);
5641
+ module.exports.__wbg_loromap_new = function(arg0) {
5642
+ const ret = LoroMap.__wrap(arg0);
5645
5643
  return addHeapObject(ret);
5646
5644
  };
5647
5645
 
@@ -5650,18 +5648,18 @@ module.exports.__wbg_lorotext_new = function(arg0) {
5650
5648
  return addHeapObject(ret);
5651
5649
  };
5652
5650
 
5653
- module.exports.__wbg_loromap_new = function(arg0) {
5654
- const ret = LoroMap.__wrap(arg0);
5651
+ module.exports.__wbg_lorolist_new = function(arg0) {
5652
+ const ret = LoroList.__wrap(arg0);
5655
5653
  return addHeapObject(ret);
5656
5654
  };
5657
5655
 
5658
- module.exports.__wbg_lorocounter_new = function(arg0) {
5659
- const ret = LoroCounter.__wrap(arg0);
5656
+ module.exports.__wbg_lorotree_new = function(arg0) {
5657
+ const ret = LoroTree.__wrap(arg0);
5660
5658
  return addHeapObject(ret);
5661
5659
  };
5662
5660
 
5663
- module.exports.__wbg_lorolist_new = function(arg0) {
5664
- const ret = LoroList.__wrap(arg0);
5661
+ module.exports.__wbg_cursor_new = function(arg0) {
5662
+ const ret = Cursor.__wrap(arg0);
5665
5663
  return addHeapObject(ret);
5666
5664
  };
5667
5665
 
@@ -5670,8 +5668,13 @@ module.exports.__wbg_loromovablelist_new = function(arg0) {
5670
5668
  return addHeapObject(ret);
5671
5669
  };
5672
5670
 
5673
- module.exports.__wbg_cursor_new = function(arg0) {
5674
- const ret = Cursor.__wrap(arg0);
5671
+ module.exports.__wbg_lorocounter_new = function(arg0) {
5672
+ const ret = LoroCounter.__wrap(arg0);
5673
+ return addHeapObject(ret);
5674
+ };
5675
+
5676
+ module.exports.__wbg_lorotreenode_new = function(arg0) {
5677
+ const ret = LoroTreeNode.__wrap(arg0);
5675
5678
  return addHeapObject(ret);
5676
5679
  };
5677
5680
 
@@ -6218,12 +6221,12 @@ module.exports.__wbindgen_memory = function() {
6218
6221
  };
6219
6222
 
6220
6223
  module.exports.__wbindgen_closure_wrapper487 = function(arg0, arg1, arg2) {
6221
- const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_58);
6224
+ const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_58);
6222
6225
  return addHeapObject(ret);
6223
6226
  };
6224
6227
 
6225
- module.exports.__wbindgen_closure_wrapper490 = function(arg0, arg1, arg2) {
6226
- const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_61);
6228
+ module.exports.__wbindgen_closure_wrapper489 = function(arg0, arg1, arg2) {
6229
+ const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_61);
6227
6230
  return addHeapObject(ret);
6228
6231
  };
6229
6232
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
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",
@@ -359,7 +359,7 @@ export type TreeNodeJSON<T> = Omit<TreeNodeValue, 'meta' | 'children'> & {
359
359
 
360
360
  interface LoroTree{
361
361
  toArray(): TreeNodeValue[];
362
- getNodes(options?: { withDeleted: boolean = false }): LoroTreeNode[];
362
+ getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode[];
363
363
  }
364
364
 
365
365
  interface LoroMovableList {
@@ -454,7 +454,7 @@ export type ExportMode = {
454
454
  } | {
455
455
  mode: "updates-in-range",
456
456
  spans: {
457
- id: ID,
457
+ id: OpId,
458
458
  len: number,
459
459
  }[],
460
460
  };
@@ -1570,9 +1570,9 @@ export class LoroDoc {
1570
1570
  * @param ids - the changes to visit
1571
1571
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1572
1572
  * @param {({ peer: PeerID, counter: number })[]} ids
1573
- * @param {(change: ChangeMeta) => boolean} f
1573
+ * @param {(change: Change) => boolean} f
1574
1574
  */
1575
- travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: ChangeMeta) => boolean): void;
1575
+ travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change: Change) => boolean): void;
1576
1576
  /**
1577
1577
  * Checkout the `DocState` to a specific version.
1578
1578
  *
@@ -1880,8 +1880,9 @@ export class LoroDoc {
1880
1880
  * doc2.importUpdateBatch([snapshot, updates]);
1881
1881
  * ```
1882
1882
  * @param {Array<any>} data
1883
+ * @returns {ImportStatus}
1883
1884
  */
1884
- importUpdateBatch(data: Array<any>): void;
1885
+ importUpdateBatch(data: Array<any>): ImportStatus;
1885
1886
  /**
1886
1887
  * Get the shallow json format of the document state.
1887
1888
  *
package/web/loro_wasm.js CHANGED
@@ -1203,7 +1203,7 @@ export class LoroDoc {
1203
1203
  * @param ids - the changes to visit
1204
1204
  * @param f - the callback function, return `true` to continue visiting, return `false` to stop
1205
1205
  * @param {({ peer: PeerID, counter: number })[]} ids
1206
- * @param {(change: ChangeMeta) => boolean} f
1206
+ * @param {(change: Change) => boolean} f
1207
1207
  */
1208
1208
  travelChangeAncestors(ids, f) {
1209
1209
  try {
@@ -1996,6 +1996,7 @@ export class LoroDoc {
1996
1996
  * doc2.importUpdateBatch([snapshot, updates]);
1997
1997
  * ```
1998
1998
  * @param {Array<any>} data
1999
+ * @returns {ImportStatus}
1999
2000
  */
2000
2001
  importUpdateBatch(data) {
2001
2002
  try {
@@ -2003,9 +2004,11 @@ export class LoroDoc {
2003
2004
  wasm.lorodoc_importUpdateBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2004
2005
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2005
2006
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2006
- if (r1) {
2007
- throw takeObject(r0);
2007
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2008
+ if (r2) {
2009
+ throw takeObject(r1);
2008
2010
  }
2011
+ return takeObject(r0);
2009
2012
  } finally {
2010
2013
  wasm.__wbindgen_add_to_stack_pointer(16);
2011
2014
  }
@@ -5653,36 +5656,36 @@ function __wbg_get_imports() {
5653
5656
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
5654
5657
  takeObject(arg0);
5655
5658
  };
5656
- imports.wbg.__wbg_lorotreenode_new = function(arg0) {
5657
- const ret = LoroTreeNode.__wrap(arg0);
5658
- return addHeapObject(ret);
5659
- };
5660
- imports.wbg.__wbg_lorotree_new = function(arg0) {
5661
- const ret = LoroTree.__wrap(arg0);
5659
+ imports.wbg.__wbg_loromap_new = function(arg0) {
5660
+ const ret = LoroMap.__wrap(arg0);
5662
5661
  return addHeapObject(ret);
5663
5662
  };
5664
5663
  imports.wbg.__wbg_lorotext_new = function(arg0) {
5665
5664
  const ret = LoroText.__wrap(arg0);
5666
5665
  return addHeapObject(ret);
5667
5666
  };
5668
- imports.wbg.__wbg_loromap_new = function(arg0) {
5669
- const ret = LoroMap.__wrap(arg0);
5667
+ imports.wbg.__wbg_lorolist_new = function(arg0) {
5668
+ const ret = LoroList.__wrap(arg0);
5670
5669
  return addHeapObject(ret);
5671
5670
  };
5672
- imports.wbg.__wbg_lorocounter_new = function(arg0) {
5673
- const ret = LoroCounter.__wrap(arg0);
5671
+ imports.wbg.__wbg_lorotree_new = function(arg0) {
5672
+ const ret = LoroTree.__wrap(arg0);
5674
5673
  return addHeapObject(ret);
5675
5674
  };
5676
- imports.wbg.__wbg_lorolist_new = function(arg0) {
5677
- const ret = LoroList.__wrap(arg0);
5675
+ imports.wbg.__wbg_cursor_new = function(arg0) {
5676
+ const ret = Cursor.__wrap(arg0);
5678
5677
  return addHeapObject(ret);
5679
5678
  };
5680
5679
  imports.wbg.__wbg_loromovablelist_new = function(arg0) {
5681
5680
  const ret = LoroMovableList.__wrap(arg0);
5682
5681
  return addHeapObject(ret);
5683
5682
  };
5684
- imports.wbg.__wbg_cursor_new = function(arg0) {
5685
- const ret = Cursor.__wrap(arg0);
5683
+ imports.wbg.__wbg_lorocounter_new = function(arg0) {
5684
+ const ret = LoroCounter.__wrap(arg0);
5685
+ return addHeapObject(ret);
5686
+ };
5687
+ imports.wbg.__wbg_lorotreenode_new = function(arg0) {
5688
+ const ret = LoroTreeNode.__wrap(arg0);
5686
5689
  return addHeapObject(ret);
5687
5690
  };
5688
5691
  imports.wbg.__wbg_versionvector_new = function(arg0) {
@@ -6133,11 +6136,11 @@ function __wbg_get_imports() {
6133
6136
  return addHeapObject(ret);
6134
6137
  };
6135
6138
  imports.wbg.__wbindgen_closure_wrapper487 = function(arg0, arg1, arg2) {
6136
- const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_58);
6139
+ const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_58);
6137
6140
  return addHeapObject(ret);
6138
6141
  };
6139
- imports.wbg.__wbindgen_closure_wrapper490 = function(arg0, arg1, arg2) {
6140
- const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_61);
6142
+ imports.wbg.__wbindgen_closure_wrapper489 = function(arg0, arg1, arg2) {
6143
+ const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_61);
6141
6144
  return addHeapObject(ret);
6142
6145
  };
6143
6146
 
Binary file