loro-crdt 1.1.4 → 1.2.1
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/CHANGELOG.md +16 -0
- package/base64/index.js +35 -26
- package/base64/loro_wasm.d.ts +8 -7
- package/base64/loro_wasm_bg-101e42d1.js +64 -0
- package/bundler/loro_wasm.d.ts +8 -7
- package/bundler/loro_wasm_bg.js +33 -24
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +1 -1
- package/nodejs/loro_wasm.d.ts +8 -7
- package/nodejs/loro_wasm.js +33 -24
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +1 -1
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +9 -8
- package/web/loro_wasm.js +32 -23
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +1 -1
- package/base64/loro_wasm_bg-3397dbb8.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- adb6ab8: fix: panic when returned non-boolean value from text.iter(f) #578
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 01fccc5: Return ImportStatus in the import_batch method
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- d08a865: fix: getOrCreateContainer should not throw if value is null #576
|
|
18
|
+
|
|
3
19
|
## 1.1.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/base64/index.js
CHANGED
|
@@ -1211,7 +1211,7 @@ 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:
|
|
1214
|
+
* @param {(change: Change) => boolean} f
|
|
1215
1215
|
*/
|
|
1216
1216
|
travelChangeAncestors(ids, f) {
|
|
1217
1217
|
try {
|
|
@@ -2004,6 +2004,7 @@ 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 @@ 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
|
-
|
|
2015
|
-
|
|
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
|
}
|
|
@@ -3849,13 +3852,19 @@ class LoroText {
|
|
|
3849
3852
|
* text.insert(0, "Hello");
|
|
3850
3853
|
* text.iter((str) => (console.log(str), true));
|
|
3851
3854
|
* ```
|
|
3852
|
-
* @param {
|
|
3855
|
+
* @param {(string) => boolean} callback
|
|
3853
3856
|
*/
|
|
3854
3857
|
iter(callback) {
|
|
3855
3858
|
try {
|
|
3856
|
-
wasm.
|
|
3859
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3860
|
+
wasm.lorotext_iter(retptr, this.__wbg_ptr, addHeapObject(callback));
|
|
3861
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
3862
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
3863
|
+
if (r1) {
|
|
3864
|
+
throw takeObject(r0);
|
|
3865
|
+
}
|
|
3857
3866
|
} finally {
|
|
3858
|
-
|
|
3867
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3859
3868
|
}
|
|
3860
3869
|
}
|
|
3861
3870
|
/**
|
|
@@ -5627,36 +5636,36 @@ class VersionVector {
|
|
|
5627
5636
|
function __wbindgen_object_drop_ref(arg0) {
|
|
5628
5637
|
takeObject(arg0);
|
|
5629
5638
|
}
|
|
5630
|
-
function
|
|
5631
|
-
const ret =
|
|
5632
|
-
return addHeapObject(ret);
|
|
5633
|
-
}
|
|
5634
|
-
function __wbg_lorotree_new(arg0) {
|
|
5635
|
-
const ret = LoroTree.__wrap(arg0);
|
|
5639
|
+
function __wbg_loromap_new(arg0) {
|
|
5640
|
+
const ret = LoroMap.__wrap(arg0);
|
|
5636
5641
|
return addHeapObject(ret);
|
|
5637
5642
|
}
|
|
5638
5643
|
function __wbg_lorotext_new(arg0) {
|
|
5639
5644
|
const ret = LoroText.__wrap(arg0);
|
|
5640
5645
|
return addHeapObject(ret);
|
|
5641
5646
|
}
|
|
5642
|
-
function
|
|
5643
|
-
const ret =
|
|
5647
|
+
function __wbg_lorolist_new(arg0) {
|
|
5648
|
+
const ret = LoroList.__wrap(arg0);
|
|
5644
5649
|
return addHeapObject(ret);
|
|
5645
5650
|
}
|
|
5646
|
-
function
|
|
5647
|
-
const ret =
|
|
5651
|
+
function __wbg_lorotree_new(arg0) {
|
|
5652
|
+
const ret = LoroTree.__wrap(arg0);
|
|
5648
5653
|
return addHeapObject(ret);
|
|
5649
5654
|
}
|
|
5650
|
-
function
|
|
5651
|
-
const ret =
|
|
5655
|
+
function __wbg_cursor_new(arg0) {
|
|
5656
|
+
const ret = Cursor.__wrap(arg0);
|
|
5652
5657
|
return addHeapObject(ret);
|
|
5653
5658
|
}
|
|
5654
5659
|
function __wbg_loromovablelist_new(arg0) {
|
|
5655
5660
|
const ret = LoroMovableList.__wrap(arg0);
|
|
5656
5661
|
return addHeapObject(ret);
|
|
5657
5662
|
}
|
|
5658
|
-
function
|
|
5659
|
-
const ret =
|
|
5663
|
+
function __wbg_lorocounter_new(arg0) {
|
|
5664
|
+
const ret = LoroCounter.__wrap(arg0);
|
|
5665
|
+
return addHeapObject(ret);
|
|
5666
|
+
}
|
|
5667
|
+
function __wbg_lorotreenode_new(arg0) {
|
|
5668
|
+
const ret = LoroTreeNode.__wrap(arg0);
|
|
5660
5669
|
return addHeapObject(ret);
|
|
5661
5670
|
}
|
|
5662
5671
|
function __wbg_versionvector_new(arg0) {
|
|
@@ -6108,11 +6117,11 @@ function __wbindgen_memory() {
|
|
|
6108
6117
|
return addHeapObject(ret);
|
|
6109
6118
|
}
|
|
6110
6119
|
function __wbindgen_closure_wrapper487(arg0, arg1, arg2) {
|
|
6111
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6120
|
+
const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_58);
|
|
6112
6121
|
return addHeapObject(ret);
|
|
6113
6122
|
}
|
|
6114
|
-
function
|
|
6115
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6123
|
+
function __wbindgen_closure_wrapper489(arg0, arg1, arg2) {
|
|
6124
|
+
const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_61);
|
|
6116
6125
|
return addHeapObject(ret);
|
|
6117
6126
|
}
|
|
6118
6127
|
|
|
@@ -6214,7 +6223,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6214
6223
|
__wbindgen_boolean_get: __wbindgen_boolean_get,
|
|
6215
6224
|
__wbindgen_cb_drop: __wbindgen_cb_drop,
|
|
6216
6225
|
__wbindgen_closure_wrapper487: __wbindgen_closure_wrapper487,
|
|
6217
|
-
|
|
6226
|
+
__wbindgen_closure_wrapper489: __wbindgen_closure_wrapper489,
|
|
6218
6227
|
__wbindgen_debug_string: __wbindgen_debug_string,
|
|
6219
6228
|
__wbindgen_error_new: __wbindgen_error_new,
|
|
6220
6229
|
__wbindgen_in: __wbindgen_in,
|
|
@@ -6248,7 +6257,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6248
6257
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6249
6258
|
|
|
6250
6259
|
|
|
6251
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6260
|
+
import loro_wasm_bg_js from './loro_wasm_bg-101e42d1.js';
|
|
6252
6261
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6253
6262
|
"./loro_wasm_bg.js": imports,
|
|
6254
6263
|
});
|
|
@@ -6406,4 +6415,4 @@ class Awareness {
|
|
|
6406
6415
|
}
|
|
6407
6416
|
}
|
|
6408
6417
|
|
|
6409
|
-
export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880, __wbg_error_c8c2cca30a630316, __wbg_error_f851667af71bcfc6, __wbg_getRandomValues_3aa56aa6edec874c, __wbg_get_bd8e338fbd5f5cc8, __wbg_get_e3c254076557e348, __wbg_getindex_03d06b4e7ea3475e, __wbg_getwithrefkey_edc2c8960f0f1191, __wbg_globalThis_d1e6af4856ba331b, __wbg_global_207b558942527489, __wbg_instanceof_ArrayBuffer_836825be07d4c9d2, __wbg_instanceof_Map_87917e0a7aaf4012, __wbg_instanceof_Object_71ca3c0a59266746, __wbg_instanceof_Uint8Array_2b3bbecd033d19f6, __wbg_isArray_2ab64d95e09ea0ae, __wbg_isSafeInteger_f7b04ef02296c4d2, __wbg_iterator_2cee6dadfd956dfa, __wbg_length_c20a40f15020d68a, __wbg_length_cd7af8117672b8b8, __wbg_log_aba5996d9bde071f, __wbg_log_c9486ca5d8e2cbe8, __wbg_log_d8fdbde28117925d, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_40e050a77cc39fea, __wbg_measure_aa7a73f17813f708, __wbg_msCrypto_eb05e62b530a1508, __wbg_new_16b304a2cfa7ff4a, __wbg_new_63b92bc8671ed464, __wbg_new_72fb9a18b5ae2624, __wbg_new_abda76e883ba8a5f, __wbg_new_d9bc3a0147634640, __wbg_newnoargs_e258087cd0daa0ea, __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb, __wbg_newwithlength_66ae46612e7f0234, __wbg_newwithlength_e9b4878cebadb3d3, __wbg_next_196c84450b364254, __wbg_next_40fc327bfc8770e6, __wbg_node_104a2ff8d6ea03a2, __wbg_now_11683c634f92ae89, __wbg_ownKeys_658942b7f28d1fe9, __wbg_process_4a72847cc503995b, __wbg_push_a5b05aedc7234f9f, __wbg_randomFillSync_5c9c955aa56b6049, __wbg_require_cca90b1a94a0255b, __wbg_resolve_b0083a7967828ec8, __wbg_self_ce0dbfc45cf2f5be, __wbg_set_1f9b04f170055d33, __wbg_set_8417257aaedc936b, __wbg_set_a47bac70306a19a7, __wbg_set_d4638f722068f043, __wbg_set_f975102236d3c502, __wbg_set_wasm, __wbg_setindex_0b7ede192dc5eca8, __wbg_stack_658279fe44541cf6, __wbg_subarray_a1f73cd4b5b42fe1, __wbg_then_0c86a60e8fcfe9f6, __wbg_value_d93c65011f51a456, __wbg_versions_f686565e586dd935, __wbg_versionvector_new, __wbg_window_c6fb939a7f436783, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper487,
|
|
6418
|
+
export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880, __wbg_error_c8c2cca30a630316, __wbg_error_f851667af71bcfc6, __wbg_getRandomValues_3aa56aa6edec874c, __wbg_get_bd8e338fbd5f5cc8, __wbg_get_e3c254076557e348, __wbg_getindex_03d06b4e7ea3475e, __wbg_getwithrefkey_edc2c8960f0f1191, __wbg_globalThis_d1e6af4856ba331b, __wbg_global_207b558942527489, __wbg_instanceof_ArrayBuffer_836825be07d4c9d2, __wbg_instanceof_Map_87917e0a7aaf4012, __wbg_instanceof_Object_71ca3c0a59266746, __wbg_instanceof_Uint8Array_2b3bbecd033d19f6, __wbg_isArray_2ab64d95e09ea0ae, __wbg_isSafeInteger_f7b04ef02296c4d2, __wbg_iterator_2cee6dadfd956dfa, __wbg_length_c20a40f15020d68a, __wbg_length_cd7af8117672b8b8, __wbg_log_aba5996d9bde071f, __wbg_log_c9486ca5d8e2cbe8, __wbg_log_d8fdbde28117925d, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_40e050a77cc39fea, __wbg_measure_aa7a73f17813f708, __wbg_msCrypto_eb05e62b530a1508, __wbg_new_16b304a2cfa7ff4a, __wbg_new_63b92bc8671ed464, __wbg_new_72fb9a18b5ae2624, __wbg_new_abda76e883ba8a5f, __wbg_new_d9bc3a0147634640, __wbg_newnoargs_e258087cd0daa0ea, __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb, __wbg_newwithlength_66ae46612e7f0234, __wbg_newwithlength_e9b4878cebadb3d3, __wbg_next_196c84450b364254, __wbg_next_40fc327bfc8770e6, __wbg_node_104a2ff8d6ea03a2, __wbg_now_11683c634f92ae89, __wbg_ownKeys_658942b7f28d1fe9, __wbg_process_4a72847cc503995b, __wbg_push_a5b05aedc7234f9f, __wbg_randomFillSync_5c9c955aa56b6049, __wbg_require_cca90b1a94a0255b, __wbg_resolve_b0083a7967828ec8, __wbg_self_ce0dbfc45cf2f5be, __wbg_set_1f9b04f170055d33, __wbg_set_8417257aaedc936b, __wbg_set_a47bac70306a19a7, __wbg_set_d4638f722068f043, __wbg_set_f975102236d3c502, __wbg_set_wasm, __wbg_setindex_0b7ede192dc5eca8, __wbg_stack_658279fe44541cf6, __wbg_subarray_a1f73cd4b5b42fe1, __wbg_then_0c86a60e8fcfe9f6, __wbg_value_d93c65011f51a456, __wbg_versions_f686565e586dd935, __wbg_versionvector_new, __wbg_window_c6fb939a7f436783, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper487, __wbindgen_closure_wrapper489, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_is_bigint, __wbindgen_is_falsy, __wbindgen_is_function, __wbindgen_is_null, __wbindgen_is_object, __wbindgen_is_string, __wbindgen_is_undefined, __wbindgen_jsval_eq, __wbindgen_jsval_loose_eq, __wbindgen_memory, __wbindgen_number_get, __wbindgen_number_new, __wbindgen_object_clone_ref, __wbindgen_object_drop_ref, __wbindgen_rethrow, __wbindgen_string_get, __wbindgen_string_new, __wbindgen_throw, __wbindgen_typeof, decodeFrontiers, decodeImportBlobMeta, encodeFrontiers, getType, isContainer, isContainerId, newContainerID, newRootContainerID, run, setDebug };
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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:
|
|
1573
|
+
* @param {(change: Change) => boolean} f
|
|
1574
1574
|
*/
|
|
1575
|
-
travelChangeAncestors(ids: ({ peer: PeerID, counter: number })[], f: (change:
|
|
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>):
|
|
1885
|
+
importUpdateBatch(data: Array<any>): ImportStatus;
|
|
1885
1886
|
/**
|
|
1886
1887
|
* Get the shallow json format of the document state.
|
|
1887
1888
|
*
|
|
@@ -2541,9 +2542,9 @@ export class LoroText {
|
|
|
2541
2542
|
* text.insert(0, "Hello");
|
|
2542
2543
|
* text.iter((str) => (console.log(str), true));
|
|
2543
2544
|
* ```
|
|
2544
|
-
* @param {
|
|
2545
|
+
* @param {(string) => boolean} callback
|
|
2545
2546
|
*/
|
|
2546
|
-
iter(callback:
|
|
2547
|
+
iter(callback: (string) => boolean): void;
|
|
2547
2548
|
/**
|
|
2548
2549
|
* Insert the string at the given index (utf-16 index).
|
|
2549
2550
|
*
|