loro-crdt 1.4.1 → 1.4.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.
- package/CHANGELOG.md +14 -0
- package/base64/index.js +128 -21
- package/base64/loro_wasm.d.ts +59 -1
- package/base64/loro_wasm_bg-231c2a2e.js +64 -0
- package/bundler/loro_wasm.d.ts +59 -1
- package/bundler/loro_wasm_bg.js +125 -19
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +6 -0
- package/nodejs/loro_wasm.d.ts +59 -1
- package/nodejs/loro_wasm.js +125 -19
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +6 -0
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +65 -1
- package/web/loro_wasm.js +124 -18
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +6 -0
- package/base64/loro_wasm_bg-4116d6d8.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2a82396: feat: add new ways to control commit options (#656)
|
|
8
|
+
- 2a82396: fix: mark err on detached LoroText (#659)
|
|
9
|
+
|
|
10
|
+
## 1.4.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- e0948d8: feat: add container existence check methods & avoid panic in wasm/js #651
|
|
15
|
+
- 9955500: fix: an internal iter_change err that may cause fork_at panic #649
|
|
16
|
+
|
|
3
17
|
## 1.4.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/base64/index.js
CHANGED
|
@@ -276,6 +276,27 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
276
276
|
}
|
|
277
277
|
return result;
|
|
278
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Get the version of Loro
|
|
281
|
+
* @returns {string}
|
|
282
|
+
*/
|
|
283
|
+
function LORO_VERSION() {
|
|
284
|
+
let deferred1_0;
|
|
285
|
+
let deferred1_1;
|
|
286
|
+
try {
|
|
287
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
288
|
+
wasm.LORO_VERSION(retptr);
|
|
289
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
290
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
291
|
+
deferred1_0 = r0;
|
|
292
|
+
deferred1_1 = r1;
|
|
293
|
+
return getStringFromWasm0(r0, r1);
|
|
294
|
+
} finally {
|
|
295
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
296
|
+
wasm.__wbindgen_export_5(deferred1_0, deferred1_1, 1);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
279
300
|
/**
|
|
280
301
|
*/
|
|
281
302
|
function run() {
|
|
@@ -1457,6 +1478,8 @@ class LoroDoc {
|
|
|
1457
1478
|
* The object returned is a new js object each time because it need to cross
|
|
1458
1479
|
* the WASM boundary.
|
|
1459
1480
|
*
|
|
1481
|
+
* If the container does not exist, an error will be thrown.
|
|
1482
|
+
*
|
|
1460
1483
|
* @example
|
|
1461
1484
|
* ```ts
|
|
1462
1485
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1489,6 +1512,8 @@ class LoroDoc {
|
|
|
1489
1512
|
* The object returned is a new js object each time because it need to cross
|
|
1490
1513
|
* the WASM boundary.
|
|
1491
1514
|
*
|
|
1515
|
+
* If the container does not exist, an error will be thrown.
|
|
1516
|
+
*
|
|
1492
1517
|
* @example
|
|
1493
1518
|
* ```ts
|
|
1494
1519
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1521,6 +1546,8 @@ class LoroDoc {
|
|
|
1521
1546
|
* The object returned is a new js object each time because it need to cross
|
|
1522
1547
|
* the WASM boundary.
|
|
1523
1548
|
*
|
|
1549
|
+
* If the container does not exist, an error will be thrown.
|
|
1550
|
+
*
|
|
1524
1551
|
* @example
|
|
1525
1552
|
* ```ts
|
|
1526
1553
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1553,6 +1580,8 @@ class LoroDoc {
|
|
|
1553
1580
|
* The object returned is a new js object each time because it need to cross
|
|
1554
1581
|
* the WASM boundary.
|
|
1555
1582
|
*
|
|
1583
|
+
* If the container does not exist, an error will be thrown.
|
|
1584
|
+
*
|
|
1556
1585
|
* @example
|
|
1557
1586
|
* ```ts
|
|
1558
1587
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1581,6 +1610,8 @@ class LoroDoc {
|
|
|
1581
1610
|
}
|
|
1582
1611
|
/**
|
|
1583
1612
|
* Get a LoroCounter by container id
|
|
1613
|
+
*
|
|
1614
|
+
* If the container does not exist, an error will be thrown.
|
|
1584
1615
|
* @param {ContainerID | string} cid
|
|
1585
1616
|
* @returns {LoroCounter}
|
|
1586
1617
|
*/
|
|
@@ -1606,6 +1637,8 @@ class LoroDoc {
|
|
|
1606
1637
|
* The object returned is a new js object each time because it need to cross
|
|
1607
1638
|
* the WASM boundary.
|
|
1608
1639
|
*
|
|
1640
|
+
* If the container does not exist, an error will be thrown.
|
|
1641
|
+
*
|
|
1609
1642
|
* @example
|
|
1610
1643
|
* ```ts
|
|
1611
1644
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1633,8 +1666,42 @@ class LoroDoc {
|
|
|
1633
1666
|
}
|
|
1634
1667
|
}
|
|
1635
1668
|
/**
|
|
1636
|
-
*
|
|
1669
|
+
* Check if the doc contains the target container.
|
|
1670
|
+
*
|
|
1671
|
+
* A root container always exists, while a normal container exists
|
|
1672
|
+
* if it has ever been created on the doc.
|
|
1673
|
+
*
|
|
1674
|
+
* @example
|
|
1675
|
+
* ```ts
|
|
1676
|
+
* import { LoroDoc, LoroMap, LoroText, LoroList } from "loro-crdt";
|
|
1677
|
+
*
|
|
1678
|
+
* const doc = new LoroDoc();
|
|
1679
|
+
* doc.setPeerId("1");
|
|
1680
|
+
* const text = doc.getMap("map").setContainer("text", new LoroText());
|
|
1681
|
+
* const list = doc.getMap("map").setContainer("list", new LoroList());
|
|
1682
|
+
* expect(doc.isContainerExists("cid:root-map:Map")).toBe(true);
|
|
1683
|
+
* expect(doc.isContainerExists("cid:0@1:Text")).toBe(true);
|
|
1684
|
+
* expect(doc.isContainerExists("cid:1@1:List")).toBe(true);
|
|
1685
|
+
*
|
|
1686
|
+
* const doc2 = new LoroDoc();
|
|
1687
|
+
* // Containers exist, as long as the history or the doc state include it
|
|
1688
|
+
* doc.detach();
|
|
1689
|
+
* doc2.import(doc.export({ mode: "update" }));
|
|
1690
|
+
* expect(doc2.isContainerExists("cid:root-map:Map")).toBe(true);
|
|
1691
|
+
* expect(doc2.isContainerExists("cid:0@1:Text")).toBe(true);
|
|
1692
|
+
* expect(doc2.isContainerExists("cid:1@1:List")).toBe(true);
|
|
1693
|
+
* ```
|
|
1694
|
+
* @param {ContainerID} container_id
|
|
1695
|
+
* @returns {boolean}
|
|
1696
|
+
*/
|
|
1697
|
+
hasContainer(container_id) {
|
|
1698
|
+
const ret = wasm.lorodoc_hasContainer(this.__wbg_ptr, addHeapObject(container_id));
|
|
1699
|
+
return ret !== 0;
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Get the container corresponding to the container id.
|
|
1637
1703
|
*
|
|
1704
|
+
* If the container does not exist, it returns `undefined`.
|
|
1638
1705
|
*
|
|
1639
1706
|
* @example
|
|
1640
1707
|
* ```ts
|
|
@@ -1673,6 +1740,45 @@ class LoroDoc {
|
|
|
1673
1740
|
wasm.lorodoc_setNextCommitMessage(this.__wbg_ptr, ptr0, len0);
|
|
1674
1741
|
}
|
|
1675
1742
|
/**
|
|
1743
|
+
* Set the origin of the next commit
|
|
1744
|
+
* @param {string} origin
|
|
1745
|
+
*/
|
|
1746
|
+
setNextCommitOrigin(origin) {
|
|
1747
|
+
const ptr0 = passStringToWasm0(origin, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1748
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1749
|
+
wasm.lorodoc_setNextCommitOrigin(this.__wbg_ptr, ptr0, len0);
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Set the timestamp of the next commit
|
|
1753
|
+
* @param {number} timestamp
|
|
1754
|
+
*/
|
|
1755
|
+
setNextCommitTimestamp(timestamp) {
|
|
1756
|
+
wasm.lorodoc_setNextCommitTimestamp(this.__wbg_ptr, timestamp);
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Set the options of the next commit
|
|
1760
|
+
* @param {{ origin?: string, timestamp?: number, message?: string }} options
|
|
1761
|
+
*/
|
|
1762
|
+
setNextCommitOptions(options) {
|
|
1763
|
+
try {
|
|
1764
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1765
|
+
wasm.lorodoc_setNextCommitOptions(retptr, this.__wbg_ptr, addHeapObject(options));
|
|
1766
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1767
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1768
|
+
if (r1) {
|
|
1769
|
+
throw takeObject(r0);
|
|
1770
|
+
}
|
|
1771
|
+
} finally {
|
|
1772
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Clear the options of the next commit
|
|
1777
|
+
*/
|
|
1778
|
+
clearNextCommitOptions() {
|
|
1779
|
+
wasm.lorodoc_clearNextCommitOptions(this.__wbg_ptr);
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1676
1782
|
* Get deep value of the document with container id
|
|
1677
1783
|
* @returns {any}
|
|
1678
1784
|
*/
|
|
@@ -6012,36 +6118,36 @@ class VersionVector {
|
|
|
6012
6118
|
function __wbindgen_object_drop_ref(arg0) {
|
|
6013
6119
|
takeObject(arg0);
|
|
6014
6120
|
}
|
|
6121
|
+
function __wbg_lorocounter_new(arg0) {
|
|
6122
|
+
const ret = LoroCounter.__wrap(arg0);
|
|
6123
|
+
return addHeapObject(ret);
|
|
6124
|
+
}
|
|
6015
6125
|
function __wbg_lorotreenode_new(arg0) {
|
|
6016
6126
|
const ret = LoroTreeNode.__wrap(arg0);
|
|
6017
6127
|
return addHeapObject(ret);
|
|
6018
6128
|
}
|
|
6019
|
-
function
|
|
6020
|
-
const ret =
|
|
6129
|
+
function __wbg_cursor_new(arg0) {
|
|
6130
|
+
const ret = Cursor.__wrap(arg0);
|
|
6021
6131
|
return addHeapObject(ret);
|
|
6022
6132
|
}
|
|
6023
|
-
function
|
|
6024
|
-
const ret =
|
|
6133
|
+
function __wbg_loromap_new(arg0) {
|
|
6134
|
+
const ret = LoroMap.__wrap(arg0);
|
|
6025
6135
|
return addHeapObject(ret);
|
|
6026
6136
|
}
|
|
6027
|
-
function
|
|
6028
|
-
const ret =
|
|
6137
|
+
function __wbg_lorotext_new(arg0) {
|
|
6138
|
+
const ret = LoroText.__wrap(arg0);
|
|
6029
6139
|
return addHeapObject(ret);
|
|
6030
6140
|
}
|
|
6031
|
-
function
|
|
6032
|
-
const ret =
|
|
6141
|
+
function __wbg_lorotree_new(arg0) {
|
|
6142
|
+
const ret = LoroTree.__wrap(arg0);
|
|
6033
6143
|
return addHeapObject(ret);
|
|
6034
6144
|
}
|
|
6035
6145
|
function __wbg_loromovablelist_new(arg0) {
|
|
6036
6146
|
const ret = LoroMovableList.__wrap(arg0);
|
|
6037
6147
|
return addHeapObject(ret);
|
|
6038
6148
|
}
|
|
6039
|
-
function
|
|
6040
|
-
const ret =
|
|
6041
|
-
return addHeapObject(ret);
|
|
6042
|
-
}
|
|
6043
|
-
function __wbg_cursor_new(arg0) {
|
|
6044
|
-
const ret = Cursor.__wrap(arg0);
|
|
6149
|
+
function __wbg_lorolist_new(arg0) {
|
|
6150
|
+
const ret = LoroList.__wrap(arg0);
|
|
6045
6151
|
return addHeapObject(ret);
|
|
6046
6152
|
}
|
|
6047
6153
|
function __wbg_versionvector_new(arg0) {
|
|
@@ -6236,7 +6342,7 @@ function __wbg_error_f851667af71bcfc6(arg0, arg1) {
|
|
|
6236
6342
|
wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
|
|
6237
6343
|
}
|
|
6238
6344
|
}
|
|
6239
|
-
const
|
|
6345
|
+
const __wbg_now_cd30a09c9b727b65 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
|
|
6240
6346
|
|
|
6241
6347
|
function __wbg_crypto_1d1f22824a6a080c(arg0) {
|
|
6242
6348
|
const ret = getObject(arg0).crypto;
|
|
@@ -6501,11 +6607,11 @@ function __wbindgen_memory() {
|
|
|
6501
6607
|
return addHeapObject(ret);
|
|
6502
6608
|
}
|
|
6503
6609
|
function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
|
|
6504
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6610
|
+
const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
|
|
6505
6611
|
return addHeapObject(ret);
|
|
6506
6612
|
}
|
|
6507
6613
|
function __wbindgen_closure_wrapper485(arg0, arg1, arg2) {
|
|
6508
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6614
|
+
const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
|
|
6509
6615
|
return addHeapObject(ret);
|
|
6510
6616
|
}
|
|
6511
6617
|
|
|
@@ -6513,6 +6619,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6513
6619
|
__proto__: null,
|
|
6514
6620
|
AwarenessWasm: AwarenessWasm,
|
|
6515
6621
|
Cursor: Cursor,
|
|
6622
|
+
LORO_VERSION: LORO_VERSION,
|
|
6516
6623
|
LoroCounter: LoroCounter,
|
|
6517
6624
|
LoroDoc: LoroDoc,
|
|
6518
6625
|
LoroList: LoroList,
|
|
@@ -6579,7 +6686,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6579
6686
|
__wbg_next_196c84450b364254: __wbg_next_196c84450b364254,
|
|
6580
6687
|
__wbg_next_40fc327bfc8770e6: __wbg_next_40fc327bfc8770e6,
|
|
6581
6688
|
__wbg_node_104a2ff8d6ea03a2: __wbg_node_104a2ff8d6ea03a2,
|
|
6582
|
-
|
|
6689
|
+
__wbg_now_cd30a09c9b727b65: __wbg_now_cd30a09c9b727b65,
|
|
6583
6690
|
__wbg_ownKeys_658942b7f28d1fe9: __wbg_ownKeys_658942b7f28d1fe9,
|
|
6584
6691
|
__wbg_process_4a72847cc503995b: __wbg_process_4a72847cc503995b,
|
|
6585
6692
|
__wbg_push_a5b05aedc7234f9f: __wbg_push_a5b05aedc7234f9f,
|
|
@@ -6643,7 +6750,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6643
6750
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6644
6751
|
|
|
6645
6752
|
|
|
6646
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6753
|
+
import loro_wasm_bg_js from './loro_wasm_bg-231c2a2e.js';
|
|
6647
6754
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6648
6755
|
"./loro_wasm_bg.js": imports,
|
|
6649
6756
|
});
|
|
@@ -6848,4 +6955,4 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6848
6955
|
return run(layer);
|
|
6849
6956
|
};
|
|
6850
6957
|
|
|
6851
|
-
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_9384d761bf46409d, __wbg_error_f851667af71bcfc6, __wbg_from_89e3fc3ba5e6fb48, __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_c86c3e1bf097ba35, __wbg_log_c9486ca5d8e2cbe8, __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,
|
|
6958
|
+
export { Awareness, AwarenessWasm, Cursor, LORO_VERSION, 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_9384d761bf46409d, __wbg_error_f851667af71bcfc6, __wbg_from_89e3fc3ba5e6fb48, __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_c86c3e1bf097ba35, __wbg_log_c9486ca5d8e2cbe8, __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_cd30a09c9b727b65, __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_wrapper482, __wbindgen_closure_wrapper485, __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, isContainer, isContainerId, newContainerID, newRootContainerID, run, setDebug };
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
+
* Get the version of Loro
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function LORO_VERSION(): string;
|
|
8
|
+
/**
|
|
4
9
|
*/
|
|
5
10
|
export function run(): void;
|
|
6
11
|
/**
|
|
@@ -109,7 +114,7 @@ interface LoroDoc {
|
|
|
109
114
|
* text = doc.getContainerById(textId);
|
|
110
115
|
* ```
|
|
111
116
|
*/
|
|
112
|
-
getContainerById(id: ContainerID): Container;
|
|
117
|
+
getContainerById(id: ContainerID): Container | undefined;
|
|
113
118
|
|
|
114
119
|
/**
|
|
115
120
|
* Subscribe to updates from local edits.
|
|
@@ -1859,6 +1864,8 @@ export class LoroDoc {
|
|
|
1859
1864
|
* The object returned is a new js object each time because it need to cross
|
|
1860
1865
|
* the WASM boundary.
|
|
1861
1866
|
*
|
|
1867
|
+
* If the container does not exist, an error will be thrown.
|
|
1868
|
+
*
|
|
1862
1869
|
* @example
|
|
1863
1870
|
* ```ts
|
|
1864
1871
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -1872,16 +1879,67 @@ export class LoroDoc {
|
|
|
1872
1879
|
getText(cid: ContainerID | string): LoroText;
|
|
1873
1880
|
/**
|
|
1874
1881
|
* Get a LoroCounter by container id
|
|
1882
|
+
*
|
|
1883
|
+
* If the container does not exist, an error will be thrown.
|
|
1875
1884
|
* @param {ContainerID | string} cid
|
|
1876
1885
|
* @returns {LoroCounter}
|
|
1877
1886
|
*/
|
|
1878
1887
|
getCounter(cid: ContainerID | string): LoroCounter;
|
|
1879
1888
|
/**
|
|
1889
|
+
* Check if the doc contains the target container.
|
|
1890
|
+
*
|
|
1891
|
+
* A root container always exists, while a normal container exists
|
|
1892
|
+
* if it has ever been created on the doc.
|
|
1893
|
+
*
|
|
1894
|
+
* @example
|
|
1895
|
+
* ```ts
|
|
1896
|
+
* import { LoroDoc, LoroMap, LoroText, LoroList } from "loro-crdt";
|
|
1897
|
+
*
|
|
1898
|
+
* const doc = new LoroDoc();
|
|
1899
|
+
* doc.setPeerId("1");
|
|
1900
|
+
* const text = doc.getMap("map").setContainer("text", new LoroText());
|
|
1901
|
+
* const list = doc.getMap("map").setContainer("list", new LoroList());
|
|
1902
|
+
* expect(doc.isContainerExists("cid:root-map:Map")).toBe(true);
|
|
1903
|
+
* expect(doc.isContainerExists("cid:0@1:Text")).toBe(true);
|
|
1904
|
+
* expect(doc.isContainerExists("cid:1@1:List")).toBe(true);
|
|
1905
|
+
*
|
|
1906
|
+
* const doc2 = new LoroDoc();
|
|
1907
|
+
* // Containers exist, as long as the history or the doc state include it
|
|
1908
|
+
* doc.detach();
|
|
1909
|
+
* doc2.import(doc.export({ mode: "update" }));
|
|
1910
|
+
* expect(doc2.isContainerExists("cid:root-map:Map")).toBe(true);
|
|
1911
|
+
* expect(doc2.isContainerExists("cid:0@1:Text")).toBe(true);
|
|
1912
|
+
* expect(doc2.isContainerExists("cid:1@1:List")).toBe(true);
|
|
1913
|
+
* ```
|
|
1914
|
+
* @param {ContainerID} container_id
|
|
1915
|
+
* @returns {boolean}
|
|
1916
|
+
*/
|
|
1917
|
+
hasContainer(container_id: ContainerID): boolean;
|
|
1918
|
+
/**
|
|
1880
1919
|
* Set the commit message of the next commit
|
|
1881
1920
|
* @param {string} msg
|
|
1882
1921
|
*/
|
|
1883
1922
|
setNextCommitMessage(msg: string): void;
|
|
1884
1923
|
/**
|
|
1924
|
+
* Set the origin of the next commit
|
|
1925
|
+
* @param {string} origin
|
|
1926
|
+
*/
|
|
1927
|
+
setNextCommitOrigin(origin: string): void;
|
|
1928
|
+
/**
|
|
1929
|
+
* Set the timestamp of the next commit
|
|
1930
|
+
* @param {number} timestamp
|
|
1931
|
+
*/
|
|
1932
|
+
setNextCommitTimestamp(timestamp: number): void;
|
|
1933
|
+
/**
|
|
1934
|
+
* Set the options of the next commit
|
|
1935
|
+
* @param {{ origin?: string, timestamp?: number, message?: string }} options
|
|
1936
|
+
*/
|
|
1937
|
+
setNextCommitOptions(options: { origin?: string, timestamp?: number, message?: string }): void;
|
|
1938
|
+
/**
|
|
1939
|
+
* Clear the options of the next commit
|
|
1940
|
+
*/
|
|
1941
|
+
clearNextCommitOptions(): void;
|
|
1942
|
+
/**
|
|
1885
1943
|
* Get deep value of the document with container id
|
|
1886
1944
|
* @returns {any}
|
|
1887
1945
|
*/
|