loro-crdt 1.5.10 → 1.5.11
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 +7 -0
- package/base64/index.d.ts +21 -14
- package/base64/index.js +40 -23
- package/base64/loro_wasm_bg-ec172175.js +64 -0
- package/bundler/index.d.ts +21 -14
- package/bundler/index.js +21 -14
- package/bundler/index.js.map +1 -1
- package/bundler/loro_wasm_bg.js +15 -5
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +1 -1
- package/nodejs/index.d.ts +21 -14
- package/nodejs/index.js +21 -14
- package/nodejs/index.js.map +1 -1
- package/nodejs/loro_wasm.js +15 -5
- 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/index.d.ts +21 -14
- package/web/index.js +21 -14
- package/web/index.js.map +1 -1
- package/web/loro_wasm.d.ts +1 -1
- package/web/loro_wasm.js +15 -5
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +1 -1
- package/base64/loro_wasm_bg-90680301.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 34180e7: Fix(js): delete an entry in map should emit an event that set the field as undefined instead of null
|
|
8
|
+
- 0bb9786: Fix: avoid panic when importing data to ephemeral store
|
|
9
|
+
|
|
3
10
|
## 1.5.10
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/base64/index.d.ts
CHANGED
|
@@ -73,27 +73,34 @@ export declare class Awareness<T extends Value = Value> {
|
|
|
73
73
|
private startTimerIfNotEmpty;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* EphemeralStore
|
|
76
|
+
* EphemeralStore tracks ephemeral key-value state across peers.
|
|
77
77
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
78
|
+
* - Use it for lightweight presence/state like cursors, selections, and UI hints.
|
|
79
|
+
* - Conflict resolution is timestamp-based LWW (Last-Write-Wins) per key.
|
|
80
|
+
* - Timeout unit: milliseconds.
|
|
81
|
+
* - After timeout: keys are considered expired. They are omitted from
|
|
82
|
+
* `encode(key)`, `encodeAll()` and `getAllStates()`. A periodic cleanup runs
|
|
83
|
+
* while the store is non-empty and removes expired keys; when removals happen
|
|
84
|
+
* subscribers receive an event with `by: "timeout"` and the `removed` keys.
|
|
80
85
|
*
|
|
81
|
-
*
|
|
82
|
-
* The timeout is in milliseconds. This can be used to handle the offline state of a peer.
|
|
86
|
+
* See: https://loro.dev/docs/tutorial/ephemeral
|
|
83
87
|
*
|
|
84
|
-
* @
|
|
88
|
+
* @param timeout Inactivity timeout in milliseconds (default: 30000). If a key
|
|
89
|
+
* doesn't receive updates within this duration, it will expire and be removed
|
|
90
|
+
* on the next cleanup tick.
|
|
85
91
|
*
|
|
92
|
+
* @example
|
|
86
93
|
* ```ts
|
|
87
94
|
* const store = new EphemeralStore();
|
|
88
95
|
* const store2 = new EphemeralStore();
|
|
89
|
-
* // Subscribe to local updates
|
|
90
|
-
* store.subscribeLocalUpdates((data)=>{
|
|
91
|
-
*
|
|
92
|
-
* })
|
|
93
|
-
* // Subscribe to all updates
|
|
94
|
-
* store2.subscribe((event)=>{
|
|
95
|
-
*
|
|
96
|
-
* })
|
|
96
|
+
* // Subscribe to local updates and forward over the wire
|
|
97
|
+
* store.subscribeLocalUpdates((data) => {
|
|
98
|
+
* store2.apply(data);
|
|
99
|
+
* });
|
|
100
|
+
* // Subscribe to all updates (including removals by timeout)
|
|
101
|
+
* store2.subscribe((event) => {
|
|
102
|
+
* console.log("event:", event);
|
|
103
|
+
* });
|
|
97
104
|
* // Set a value
|
|
98
105
|
* store.set("key", "value");
|
|
99
106
|
* // Encode the value
|
package/base64/index.js
CHANGED
|
@@ -925,9 +925,19 @@ class EphemeralStoreWasm {
|
|
|
925
925
|
* @param {Uint8Array} data
|
|
926
926
|
*/
|
|
927
927
|
apply(data) {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
928
|
+
try {
|
|
929
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
930
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export_0);
|
|
931
|
+
const len0 = WASM_VECTOR_LEN;
|
|
932
|
+
wasm.ephemeralstorewasm_apply(retptr, this.__wbg_ptr, ptr0, len0);
|
|
933
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
934
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
935
|
+
if (r1) {
|
|
936
|
+
throw takeObject(r0);
|
|
937
|
+
}
|
|
938
|
+
} finally {
|
|
939
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
940
|
+
}
|
|
931
941
|
}
|
|
932
942
|
removeOutdated() {
|
|
933
943
|
wasm.ephemeralstorewasm_removeOutdated(this.__wbg_ptr);
|
|
@@ -6757,7 +6767,7 @@ function __wbg_node_02999533c4ea02e3(arg0) {
|
|
|
6757
6767
|
const ret = getObject(arg0).node;
|
|
6758
6768
|
return addHeapObject(ret);
|
|
6759
6769
|
}
|
|
6760
|
-
function
|
|
6770
|
+
function __wbg_now_4f8b2820be8a682c() {
|
|
6761
6771
|
const ret = Date.now();
|
|
6762
6772
|
return ret;
|
|
6763
6773
|
}
|
|
@@ -6871,7 +6881,7 @@ function __wbindgen_cb_drop(arg0) {
|
|
|
6871
6881
|
const ret = false;
|
|
6872
6882
|
return ret;
|
|
6873
6883
|
}
|
|
6874
|
-
function
|
|
6884
|
+
function __wbindgen_closure_wrapper563(arg0, arg1, arg2) {
|
|
6875
6885
|
const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_60);
|
|
6876
6886
|
return addHeapObject(ret);
|
|
6877
6887
|
}
|
|
@@ -7053,7 +7063,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
7053
7063
|
__wbg_next_928df8c15fc0c9b0: __wbg_next_928df8c15fc0c9b0,
|
|
7054
7064
|
__wbg_next_9dc0926f351c7090: __wbg_next_9dc0926f351c7090,
|
|
7055
7065
|
__wbg_node_02999533c4ea02e3: __wbg_node_02999533c4ea02e3,
|
|
7056
|
-
|
|
7066
|
+
__wbg_now_4f8b2820be8a682c: __wbg_now_4f8b2820be8a682c,
|
|
7057
7067
|
__wbg_ownKeys_b16312a839a4152c: __wbg_ownKeys_b16312a839a4152c,
|
|
7058
7068
|
__wbg_process_5c1d670bc53614b8: __wbg_process_5c1d670bc53614b8,
|
|
7059
7069
|
__wbg_push_e7d7247e69dad3ee: __wbg_push_e7d7247e69dad3ee,
|
|
@@ -7081,7 +7091,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
7081
7091
|
__wbindgen_bigint_get_as_i64: __wbindgen_bigint_get_as_i64,
|
|
7082
7092
|
__wbindgen_boolean_get: __wbindgen_boolean_get,
|
|
7083
7093
|
__wbindgen_cb_drop: __wbindgen_cb_drop,
|
|
7084
|
-
|
|
7094
|
+
__wbindgen_closure_wrapper563: __wbindgen_closure_wrapper563,
|
|
7085
7095
|
__wbindgen_closure_wrapper565: __wbindgen_closure_wrapper565,
|
|
7086
7096
|
__wbindgen_debug_string: __wbindgen_debug_string,
|
|
7087
7097
|
__wbindgen_error_new: __wbindgen_error_new,
|
|
@@ -7118,7 +7128,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
7118
7128
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
7119
7129
|
|
|
7120
7130
|
|
|
7121
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
7131
|
+
import loro_wasm_bg_js from './loro_wasm_bg-ec172175.js';
|
|
7122
7132
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
7123
7133
|
"./loro_wasm_bg.js": imports,
|
|
7124
7134
|
});
|
|
@@ -7278,27 +7288,34 @@ class Awareness {
|
|
|
7278
7288
|
}
|
|
7279
7289
|
}
|
|
7280
7290
|
/**
|
|
7281
|
-
* EphemeralStore
|
|
7291
|
+
* EphemeralStore tracks ephemeral key-value state across peers.
|
|
7282
7292
|
*
|
|
7283
|
-
*
|
|
7284
|
-
*
|
|
7293
|
+
* - Use it for lightweight presence/state like cursors, selections, and UI hints.
|
|
7294
|
+
* - Conflict resolution is timestamp-based LWW (Last-Write-Wins) per key.
|
|
7295
|
+
* - Timeout unit: milliseconds.
|
|
7296
|
+
* - After timeout: keys are considered expired. They are omitted from
|
|
7297
|
+
* `encode(key)`, `encodeAll()` and `getAllStates()`. A periodic cleanup runs
|
|
7298
|
+
* while the store is non-empty and removes expired keys; when removals happen
|
|
7299
|
+
* subscribers receive an event with `by: "timeout"` and the `removed` keys.
|
|
7285
7300
|
*
|
|
7286
|
-
*
|
|
7287
|
-
* The timeout is in milliseconds. This can be used to handle the offline state of a peer.
|
|
7301
|
+
* See: https://loro.dev/docs/tutorial/ephemeral
|
|
7288
7302
|
*
|
|
7289
|
-
* @
|
|
7303
|
+
* @param timeout Inactivity timeout in milliseconds (default: 30000). If a key
|
|
7304
|
+
* doesn't receive updates within this duration, it will expire and be removed
|
|
7305
|
+
* on the next cleanup tick.
|
|
7290
7306
|
*
|
|
7307
|
+
* @example
|
|
7291
7308
|
* ```ts
|
|
7292
7309
|
* const store = new EphemeralStore();
|
|
7293
7310
|
* const store2 = new EphemeralStore();
|
|
7294
|
-
* // Subscribe to local updates
|
|
7295
|
-
* store.subscribeLocalUpdates((data)=>{
|
|
7296
|
-
*
|
|
7297
|
-
* })
|
|
7298
|
-
* // Subscribe to all updates
|
|
7299
|
-
* store2.subscribe((event)=>{
|
|
7300
|
-
*
|
|
7301
|
-
* })
|
|
7311
|
+
* // Subscribe to local updates and forward over the wire
|
|
7312
|
+
* store.subscribeLocalUpdates((data) => {
|
|
7313
|
+
* store2.apply(data);
|
|
7314
|
+
* });
|
|
7315
|
+
* // Subscribe to all updates (including removals by timeout)
|
|
7316
|
+
* store2.subscribe((event) => {
|
|
7317
|
+
* console.log("event:", event);
|
|
7318
|
+
* });
|
|
7302
7319
|
* // Set a value
|
|
7303
7320
|
* store.set("key", "value");
|
|
7304
7321
|
* // Encode the value
|
|
@@ -7423,4 +7440,4 @@ function idStrToId(idStr) {
|
|
|
7423
7440
|
};
|
|
7424
7441
|
}
|
|
7425
7442
|
|
|
7426
|
-
export { Awareness, AwarenessWasm, ChangeModifier, Cursor, EphemeralStore, EphemeralStoreWasm, LORO_VERSION, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_8f0eb39a4a4c2f66, __wbg_apply_9bb7fe8fff013a3f, __wbg_buffer_ef9774282e5dab94, __wbg_call_0ad083564791763a, __wbg_call_a34b6b4765f27be0, __wbg_call_d00953b926be4879, __wbg_call_efe5a4db7065d1a2, __wbg_changemodifier_new, __wbg_crypto_ed58b8e10a292839, __wbg_cursor_new, __wbg_done_f4c254830a095eaf, __wbg_entries_4dce6361e3ba6fbc, __wbg_entries_83beb641792ccb9c, __wbg_error_7534b8e9a36f1ab4, __wbg_error_9912f7d6d7835a4b, __wbg_from_3aa0fcaa8eef0104, __wbg_getRandomValues_bcb4912f16000dc4, __wbg_get_0c3cc364764a0b98, __wbg_get_b996a12be035ef4f, __wbg_getindex_a471648b3037c750, __wbg_getwithrefkey_1dc361bd10053bfe, __wbg_globalThis_6b4d52a0b6aaeaea, __wbg_global_49324ce12193de77, __wbg_instanceof_ArrayBuffer_ff40e55b5978e215, __wbg_instanceof_Map_0f3f3653f757ced1, __wbg_instanceof_Object_9108547bac1f91b1, __wbg_instanceof_Uint8Array_db97368f94b1373f, __wbg_isArray_8738f1062fa88586, __wbg_isSafeInteger_a1b3e0811faecf2f, __wbg_iterator_c0c688f37fa815e6, __wbg_length_12246a78d2f65d3a, __wbg_length_c24da17096edfe57, __wbg_log_0cc1b7768397bcfe, __wbg_log_0fd6c49475c7bece, __wbg_log_cb9e190acc5753fb, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_7438147ce31e9d4b, __wbg_measure_fb7825c11612c823, __wbg_msCrypto_0a36e2ec3a343d26, __wbg_new_518e2184725aa711, __wbg_new_59845962d1127937, __wbg_new_67abf4a77618ee3e, __wbg_new_8a6f238a6ece86ea, __wbg_new_e2d07398d7689006, __wbg_newnoargs_a136448eeb7d48ac, __wbg_newwithbyteoffsetandlength_84908302a4c137cf, __wbg_newwithlength_4c216eaaf23f2f9a, __wbg_newwithlength_88b49de1eb24d63e, __wbg_next_928df8c15fc0c9b0, __wbg_next_9dc0926f351c7090, __wbg_node_02999533c4ea02e3,
|
|
7443
|
+
export { Awareness, AwarenessWasm, ChangeModifier, Cursor, EphemeralStore, EphemeralStoreWasm, LORO_VERSION, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_8f0eb39a4a4c2f66, __wbg_apply_9bb7fe8fff013a3f, __wbg_buffer_ef9774282e5dab94, __wbg_call_0ad083564791763a, __wbg_call_a34b6b4765f27be0, __wbg_call_d00953b926be4879, __wbg_call_efe5a4db7065d1a2, __wbg_changemodifier_new, __wbg_crypto_ed58b8e10a292839, __wbg_cursor_new, __wbg_done_f4c254830a095eaf, __wbg_entries_4dce6361e3ba6fbc, __wbg_entries_83beb641792ccb9c, __wbg_error_7534b8e9a36f1ab4, __wbg_error_9912f7d6d7835a4b, __wbg_from_3aa0fcaa8eef0104, __wbg_getRandomValues_bcb4912f16000dc4, __wbg_get_0c3cc364764a0b98, __wbg_get_b996a12be035ef4f, __wbg_getindex_a471648b3037c750, __wbg_getwithrefkey_1dc361bd10053bfe, __wbg_globalThis_6b4d52a0b6aaeaea, __wbg_global_49324ce12193de77, __wbg_instanceof_ArrayBuffer_ff40e55b5978e215, __wbg_instanceof_Map_0f3f3653f757ced1, __wbg_instanceof_Object_9108547bac1f91b1, __wbg_instanceof_Uint8Array_db97368f94b1373f, __wbg_isArray_8738f1062fa88586, __wbg_isSafeInteger_a1b3e0811faecf2f, __wbg_iterator_c0c688f37fa815e6, __wbg_length_12246a78d2f65d3a, __wbg_length_c24da17096edfe57, __wbg_log_0cc1b7768397bcfe, __wbg_log_0fd6c49475c7bece, __wbg_log_cb9e190acc5753fb, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_7438147ce31e9d4b, __wbg_measure_fb7825c11612c823, __wbg_msCrypto_0a36e2ec3a343d26, __wbg_new_518e2184725aa711, __wbg_new_59845962d1127937, __wbg_new_67abf4a77618ee3e, __wbg_new_8a6f238a6ece86ea, __wbg_new_e2d07398d7689006, __wbg_newnoargs_a136448eeb7d48ac, __wbg_newwithbyteoffsetandlength_84908302a4c137cf, __wbg_newwithlength_4c216eaaf23f2f9a, __wbg_newwithlength_88b49de1eb24d63e, __wbg_next_928df8c15fc0c9b0, __wbg_next_9dc0926f351c7090, __wbg_node_02999533c4ea02e3, __wbg_now_4f8b2820be8a682c, __wbg_ownKeys_b16312a839a4152c, __wbg_process_5c1d670bc53614b8, __wbg_push_e7d7247e69dad3ee, __wbg_randomFillSync_ab2cfe79ebbf2740, __wbg_require_79b1e9274cde3c87, __wbg_resolve_267ff08e7e1d2ce4, __wbg_self_cca3ca60d61220f4, __wbg_set_1b50d2de855a9d50, __wbg_set_393f510a6b7e9da5, __wbg_set_3f1d0b984ed272ed, __wbg_set_5deee49b10b2b780, __wbg_set_93ba9407b5476ec6, __wbg_set_wasm, __wbg_setindex_e0b7b31bfc87ba3f, __wbg_stack_0ed75d68575b0f3c, __wbg_subarray_2dc34705c0dc7cdb, __wbg_then_84907e7a6730461e, __wbg_value_51f8a88d4a1805fb, __wbg_versions_c71aa1626a93e0a1, __wbg_versionvector_new, __wbg_window_2aba046d3fc4ad7c, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper563, __wbindgen_closure_wrapper565, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_is_array, __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, idStrToId, isContainer, isContainerId, newContainerID, newRootContainerID, redactJsonUpdates, run, setDebug };
|