loro-crdt 1.3.2 → 1.3.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.
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
1023
1023
  */
1024
1024
  setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
1025
1025
  }
1026
+
1026
1027
  interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1027
1028
  new(): LoroMap<T>;
1028
1029
  /**
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1076
1077
  */
1077
1078
  get<Key extends keyof T>(key: Key): T[Key];
1078
1079
  /**
1079
- * Set the key with the value.
1080
+ * Set the key with the value.
1081
+ *
1082
+ * If the key already exists, its value will be updated. If the key doesn't exist,
1083
+ * a new key-value pair will be created.
1080
1084
  *
1081
- * If the value of the key is exist, the old value will be updated.
1085
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
+ * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1082
1087
  *
1083
1088
  * @example
1084
1089
  * ```ts
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
1155
1160
  /**
1156
1161
  * Get LoroTreeNode by the TreeID.
1157
1162
  */
1158
- getNodeByID(target: TreeID): LoroTreeNode<T>;
1163
+ getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
1159
1164
  subscribe(listener: Listener): Subscription;
1160
1165
  toArray(): TreeNodeValue[];
1161
1166
  getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
@@ -1449,6 +1454,10 @@ export class LoroCounter {
1449
1454
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
1450
1455
  * you could build all kind of applications by these.
1451
1456
  *
1457
+ * **Important:** Loro is a pure library and does not handle network protocols.
1458
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
1459
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
1460
+ *
1452
1461
  * @example
1453
1462
  * ```ts
1454
1463
  * import { LoroDoc } from "loro-crdt"
@@ -895,6 +895,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
895
895
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
896
896
  * you could build all kind of applications by these.
897
897
  *
898
+ * **Important:** Loro is a pure library and does not handle network protocols.
899
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
900
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
901
+ *
898
902
  * @example
899
903
  * ```ts
900
904
  * import { LoroDoc } from "loro-crdt"
@@ -5984,13 +5988,13 @@ export function __wbindgen_object_drop_ref(arg0) {
5984
5988
  takeObject(arg0);
5985
5989
  };
5986
5990
 
5987
- export function __wbg_lorotree_new(arg0) {
5988
- const ret = LoroTree.__wrap(arg0);
5991
+ export function __wbg_lorotreenode_new(arg0) {
5992
+ const ret = LoroTreeNode.__wrap(arg0);
5989
5993
  return addHeapObject(ret);
5990
5994
  };
5991
5995
 
5992
- export function __wbg_lorolist_new(arg0) {
5993
- const ret = LoroList.__wrap(arg0);
5996
+ export function __wbg_lorocounter_new(arg0) {
5997
+ const ret = LoroCounter.__wrap(arg0);
5994
5998
  return addHeapObject(ret);
5995
5999
  };
5996
6000
 
@@ -5999,8 +6003,8 @@ export function __wbg_lorotext_new(arg0) {
5999
6003
  return addHeapObject(ret);
6000
6004
  };
6001
6005
 
6002
- export function __wbg_cursor_new(arg0) {
6003
- const ret = Cursor.__wrap(arg0);
6006
+ export function __wbg_lorolist_new(arg0) {
6007
+ const ret = LoroList.__wrap(arg0);
6004
6008
  return addHeapObject(ret);
6005
6009
  };
6006
6010
 
@@ -6009,18 +6013,18 @@ export function __wbg_loromap_new(arg0) {
6009
6013
  return addHeapObject(ret);
6010
6014
  };
6011
6015
 
6012
- export function __wbg_lorotreenode_new(arg0) {
6013
- const ret = LoroTreeNode.__wrap(arg0);
6016
+ export function __wbg_cursor_new(arg0) {
6017
+ const ret = Cursor.__wrap(arg0);
6014
6018
  return addHeapObject(ret);
6015
6019
  };
6016
6020
 
6017
- export function __wbg_lorocounter_new(arg0) {
6018
- const ret = LoroCounter.__wrap(arg0);
6021
+ export function __wbg_loromovablelist_new(arg0) {
6022
+ const ret = LoroMovableList.__wrap(arg0);
6019
6023
  return addHeapObject(ret);
6020
6024
  };
6021
6025
 
6022
- export function __wbg_loromovablelist_new(arg0) {
6023
- const ret = LoroMovableList.__wrap(arg0);
6026
+ export function __wbg_lorotree_new(arg0) {
6027
+ const ret = LoroTree.__wrap(arg0);
6024
6028
  return addHeapObject(ret);
6025
6029
  };
6026
6030
 
@@ -6252,7 +6256,7 @@ export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
6252
6256
  }
6253
6257
  };
6254
6258
 
6255
- export const __wbg_now_2d57022b1935b215 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6259
+ export const __wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6256
6260
 
6257
6261
  export function __wbg_crypto_1d1f22824a6a080c(arg0) {
6258
6262
  const ret = getObject(arg0).crypto;
@@ -6581,7 +6585,7 @@ export function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
6581
6585
  return addHeapObject(ret);
6582
6586
  };
6583
6587
 
6584
- export function __wbindgen_closure_wrapper485(arg0, arg1, arg2) {
6588
+ export function __wbindgen_closure_wrapper484(arg0, arg1, arg2) {
6585
6589
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6586
6590
  return addHeapObject(ret);
6587
6591
  };
Binary file
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
1023
1023
  */
1024
1024
  setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
1025
1025
  }
1026
+
1026
1027
  interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1027
1028
  new(): LoroMap<T>;
1028
1029
  /**
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1076
1077
  */
1077
1078
  get<Key extends keyof T>(key: Key): T[Key];
1078
1079
  /**
1079
- * Set the key with the value.
1080
+ * Set the key with the value.
1081
+ *
1082
+ * If the key already exists, its value will be updated. If the key doesn't exist,
1083
+ * a new key-value pair will be created.
1080
1084
  *
1081
- * If the value of the key is exist, the old value will be updated.
1085
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
+ * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1082
1087
  *
1083
1088
  * @example
1084
1089
  * ```ts
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
1155
1160
  /**
1156
1161
  * Get LoroTreeNode by the TreeID.
1157
1162
  */
1158
- getNodeByID(target: TreeID): LoroTreeNode<T>;
1163
+ getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
1159
1164
  subscribe(listener: Listener): Subscription;
1160
1165
  toArray(): TreeNodeValue[];
1161
1166
  getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
@@ -1449,6 +1454,10 @@ export class LoroCounter {
1449
1454
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
1450
1455
  * you could build all kind of applications by these.
1451
1456
  *
1457
+ * **Important:** Loro is a pure library and does not handle network protocols.
1458
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
1459
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
1460
+ *
1452
1461
  * @example
1453
1462
  * ```ts
1454
1463
  * import { LoroDoc } from "loro-crdt"
@@ -893,6 +893,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
893
893
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
894
894
  * you could build all kind of applications by these.
895
895
  *
896
+ * **Important:** Loro is a pure library and does not handle network protocols.
897
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
898
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
899
+ *
896
900
  * @example
897
901
  * ```ts
898
902
  * import { LoroDoc } from "loro-crdt"
@@ -5991,13 +5995,13 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
5991
5995
  takeObject(arg0);
5992
5996
  };
5993
5997
 
5994
- module.exports.__wbg_lorotree_new = function(arg0) {
5995
- const ret = LoroTree.__wrap(arg0);
5998
+ module.exports.__wbg_lorotreenode_new = function(arg0) {
5999
+ const ret = LoroTreeNode.__wrap(arg0);
5996
6000
  return addHeapObject(ret);
5997
6001
  };
5998
6002
 
5999
- module.exports.__wbg_lorolist_new = function(arg0) {
6000
- const ret = LoroList.__wrap(arg0);
6003
+ module.exports.__wbg_lorocounter_new = function(arg0) {
6004
+ const ret = LoroCounter.__wrap(arg0);
6001
6005
  return addHeapObject(ret);
6002
6006
  };
6003
6007
 
@@ -6006,8 +6010,8 @@ module.exports.__wbg_lorotext_new = function(arg0) {
6006
6010
  return addHeapObject(ret);
6007
6011
  };
6008
6012
 
6009
- module.exports.__wbg_cursor_new = function(arg0) {
6010
- const ret = Cursor.__wrap(arg0);
6013
+ module.exports.__wbg_lorolist_new = function(arg0) {
6014
+ const ret = LoroList.__wrap(arg0);
6011
6015
  return addHeapObject(ret);
6012
6016
  };
6013
6017
 
@@ -6016,18 +6020,18 @@ module.exports.__wbg_loromap_new = function(arg0) {
6016
6020
  return addHeapObject(ret);
6017
6021
  };
6018
6022
 
6019
- module.exports.__wbg_lorotreenode_new = function(arg0) {
6020
- const ret = LoroTreeNode.__wrap(arg0);
6023
+ module.exports.__wbg_cursor_new = function(arg0) {
6024
+ const ret = Cursor.__wrap(arg0);
6021
6025
  return addHeapObject(ret);
6022
6026
  };
6023
6027
 
6024
- module.exports.__wbg_lorocounter_new = function(arg0) {
6025
- const ret = LoroCounter.__wrap(arg0);
6028
+ module.exports.__wbg_loromovablelist_new = function(arg0) {
6029
+ const ret = LoroMovableList.__wrap(arg0);
6026
6030
  return addHeapObject(ret);
6027
6031
  };
6028
6032
 
6029
- module.exports.__wbg_loromovablelist_new = function(arg0) {
6030
- const ret = LoroMovableList.__wrap(arg0);
6033
+ module.exports.__wbg_lorotree_new = function(arg0) {
6034
+ const ret = LoroTree.__wrap(arg0);
6031
6035
  return addHeapObject(ret);
6032
6036
  };
6033
6037
 
@@ -6259,7 +6263,7 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
6259
6263
  }
6260
6264
  };
6261
6265
 
6262
- module.exports.__wbg_now_2d57022b1935b215 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6266
+ module.exports.__wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6263
6267
 
6264
6268
  module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
6265
6269
  const ret = getObject(arg0).crypto;
@@ -6588,7 +6592,7 @@ module.exports.__wbindgen_closure_wrapper482 = function(arg0, arg1, arg2) {
6588
6592
  return addHeapObject(ret);
6589
6593
  };
6590
6594
 
6591
- module.exports.__wbindgen_closure_wrapper485 = function(arg0, arg1, arg2) {
6595
+ module.exports.__wbindgen_closure_wrapper484 = function(arg0, arg1, arg2) {
6592
6596
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6593
6597
  return addHeapObject(ret);
6594
6598
  };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.3.2",
3
+ "version": "1.3.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",
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
1023
1023
  */
1024
1024
  setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
1025
1025
  }
1026
+
1026
1027
  interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1027
1028
  new(): LoroMap<T>;
1028
1029
  /**
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1076
1077
  */
1077
1078
  get<Key extends keyof T>(key: Key): T[Key];
1078
1079
  /**
1079
- * Set the key with the value.
1080
+ * Set the key with the value.
1081
+ *
1082
+ * If the key already exists, its value will be updated. If the key doesn't exist,
1083
+ * a new key-value pair will be created.
1080
1084
  *
1081
- * If the value of the key is exist, the old value will be updated.
1085
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
+ * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1082
1087
  *
1083
1088
  * @example
1084
1089
  * ```ts
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
1155
1160
  /**
1156
1161
  * Get LoroTreeNode by the TreeID.
1157
1162
  */
1158
- getNodeByID(target: TreeID): LoroTreeNode<T>;
1163
+ getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
1159
1164
  subscribe(listener: Listener): Subscription;
1160
1165
  toArray(): TreeNodeValue[];
1161
1166
  getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
@@ -1449,6 +1454,10 @@ export class LoroCounter {
1449
1454
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
1450
1455
  * you could build all kind of applications by these.
1451
1456
  *
1457
+ * **Important:** Loro is a pure library and does not handle network protocols.
1458
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
1459
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
1460
+ *
1452
1461
  * @example
1453
1462
  * ```ts
1454
1463
  * import { LoroDoc } from "loro-crdt"
package/web/loro_wasm.js CHANGED
@@ -887,6 +887,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
887
887
  * [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
888
888
  * you could build all kind of applications by these.
889
889
  *
890
+ * **Important:** Loro is a pure library and does not handle network protocols.
891
+ * It is the responsibility of the user to manage the storage, loading, and synchronization
892
+ * of the bytes exported by Loro in a manner suitable for their specific environment.
893
+ *
890
894
  * @example
891
895
  * ```ts
892
896
  * import { LoroDoc } from "loro-crdt"
@@ -6009,38 +6013,38 @@ function __wbg_get_imports() {
6009
6013
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
6010
6014
  takeObject(arg0);
6011
6015
  };
6012
- imports.wbg.__wbg_lorotree_new = function(arg0) {
6013
- const ret = LoroTree.__wrap(arg0);
6016
+ imports.wbg.__wbg_lorotreenode_new = function(arg0) {
6017
+ const ret = LoroTreeNode.__wrap(arg0);
6014
6018
  return addHeapObject(ret);
6015
6019
  };
6016
- imports.wbg.__wbg_lorolist_new = function(arg0) {
6017
- const ret = LoroList.__wrap(arg0);
6020
+ imports.wbg.__wbg_lorocounter_new = function(arg0) {
6021
+ const ret = LoroCounter.__wrap(arg0);
6018
6022
  return addHeapObject(ret);
6019
6023
  };
6020
6024
  imports.wbg.__wbg_lorotext_new = function(arg0) {
6021
6025
  const ret = LoroText.__wrap(arg0);
6022
6026
  return addHeapObject(ret);
6023
6027
  };
6024
- imports.wbg.__wbg_cursor_new = function(arg0) {
6025
- const ret = Cursor.__wrap(arg0);
6028
+ imports.wbg.__wbg_lorolist_new = function(arg0) {
6029
+ const ret = LoroList.__wrap(arg0);
6026
6030
  return addHeapObject(ret);
6027
6031
  };
6028
6032
  imports.wbg.__wbg_loromap_new = function(arg0) {
6029
6033
  const ret = LoroMap.__wrap(arg0);
6030
6034
  return addHeapObject(ret);
6031
6035
  };
6032
- imports.wbg.__wbg_lorotreenode_new = function(arg0) {
6033
- const ret = LoroTreeNode.__wrap(arg0);
6034
- return addHeapObject(ret);
6035
- };
6036
- imports.wbg.__wbg_lorocounter_new = function(arg0) {
6037
- const ret = LoroCounter.__wrap(arg0);
6036
+ imports.wbg.__wbg_cursor_new = function(arg0) {
6037
+ const ret = Cursor.__wrap(arg0);
6038
6038
  return addHeapObject(ret);
6039
6039
  };
6040
6040
  imports.wbg.__wbg_loromovablelist_new = function(arg0) {
6041
6041
  const ret = LoroMovableList.__wrap(arg0);
6042
6042
  return addHeapObject(ret);
6043
6043
  };
6044
+ imports.wbg.__wbg_lorotree_new = function(arg0) {
6045
+ const ret = LoroTree.__wrap(arg0);
6046
+ return addHeapObject(ret);
6047
+ };
6044
6048
  imports.wbg.__wbg_versionvector_new = function(arg0) {
6045
6049
  const ret = VersionVector.__wrap(arg0);
6046
6050
  return addHeapObject(ret);
@@ -6233,7 +6237,7 @@ function __wbg_get_imports() {
6233
6237
  wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
6234
6238
  }
6235
6239
  };
6236
- imports.wbg.__wbg_now_2d57022b1935b215 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6240
+ imports.wbg.__wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6237
6241
  imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
6238
6242
  const ret = getObject(arg0).crypto;
6239
6243
  return addHeapObject(ret);
@@ -6500,7 +6504,7 @@ function __wbg_get_imports() {
6500
6504
  const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
6501
6505
  return addHeapObject(ret);
6502
6506
  };
6503
- imports.wbg.__wbindgen_closure_wrapper485 = function(arg0, arg1, arg2) {
6507
+ imports.wbg.__wbindgen_closure_wrapper484 = function(arg0, arg1, arg2) {
6504
6508
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6505
6509
  return addHeapObject(ret);
6506
6510
  };
Binary file