loro-crdt 1.2.7 → 1.3.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 +126 -0
- package/README.md +1 -3
- package/base64/index.js +213 -33
- package/base64/loro_wasm.d.ts +128 -7
- package/base64/loro_wasm_bg-b0221709.js +64 -0
- package/bundler/loro_wasm.d.ts +128 -7
- package/bundler/loro_wasm_bg.js +208 -28
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +6 -1
- package/nodejs/loro_wasm.d.ts +128 -7
- package/nodejs/loro_wasm.js +208 -28
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +6 -1
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +134 -8
- package/web/loro_wasm.js +206 -28
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +6 -1
- package/base64/loro_wasm_bg-68a6c103.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,131 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 07500da: fix: map.keys() may return keys from deleted entries #618
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ddafb7e: feat: diff, applyDiff, and revertTo #610
|
|
14
|
+
|
|
15
|
+
Add new version-control-related primitives:
|
|
16
|
+
|
|
17
|
+
- **`diff(from, to)`**: calculate the difference between two versions. The returned results have similar structures to the differences in events.
|
|
18
|
+
- **`revertTo(targetVersion)`**: revert the document back to the target version. The difference between this and `checkout(targetVersion)` is this method will generate a series of new operations, which will transform the current doc into the same as the target version.
|
|
19
|
+
- **`applyDiff(diff)`**: you can use it to apply the differences generated from `diff(from, to)`.
|
|
20
|
+
|
|
21
|
+
You can use these primitives to implement version-control functions like `squash` and `revert`.
|
|
22
|
+
|
|
23
|
+
# Examples
|
|
24
|
+
|
|
25
|
+
`revertTo`
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
const doc = new LoroDoc();
|
|
29
|
+
doc.setPeerId("1");
|
|
30
|
+
doc.getText("text").update("Hello");
|
|
31
|
+
doc.commit();
|
|
32
|
+
doc.revertTo([{ peer: "1", counter: 1 }]);
|
|
33
|
+
expect(doc.getText("text").toString()).toBe("He");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`diff`
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const doc = new LoroDoc();
|
|
40
|
+
doc.setPeerId("1");
|
|
41
|
+
// Text edits with formatting
|
|
42
|
+
const text = doc.getText("text");
|
|
43
|
+
text.update("Hello");
|
|
44
|
+
text.mark({ start: 0, end: 5 }, "bold", true);
|
|
45
|
+
doc.commit();
|
|
46
|
+
|
|
47
|
+
// Map edits
|
|
48
|
+
const map = doc.getMap("map");
|
|
49
|
+
map.set("key1", "value1");
|
|
50
|
+
map.set("key2", 42);
|
|
51
|
+
doc.commit();
|
|
52
|
+
|
|
53
|
+
// List edits
|
|
54
|
+
const list = doc.getList("list");
|
|
55
|
+
list.insert(0, "item1");
|
|
56
|
+
list.insert(1, "item2");
|
|
57
|
+
list.delete(1, 1);
|
|
58
|
+
doc.commit();
|
|
59
|
+
|
|
60
|
+
// Tree edits
|
|
61
|
+
const tree = doc.getTree("tree");
|
|
62
|
+
const a = tree.createNode();
|
|
63
|
+
a.createNode();
|
|
64
|
+
doc.commit();
|
|
65
|
+
|
|
66
|
+
const diff = doc.diff([], doc.frontiers());
|
|
67
|
+
expect(diff).toMatchSnapshot();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
{
|
|
72
|
+
"cid:root-list:List": {
|
|
73
|
+
"diff": [
|
|
74
|
+
{
|
|
75
|
+
"insert": [
|
|
76
|
+
"item1",
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
"type": "list",
|
|
81
|
+
},
|
|
82
|
+
"cid:root-map:Map": {
|
|
83
|
+
"type": "map",
|
|
84
|
+
"updated": {
|
|
85
|
+
"key1": "value1",
|
|
86
|
+
"key2": 42,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
"cid:root-text:Text": {
|
|
90
|
+
"diff": [
|
|
91
|
+
{
|
|
92
|
+
"attributes": {
|
|
93
|
+
"bold": true,
|
|
94
|
+
},
|
|
95
|
+
"insert": "Hello",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
"type": "text",
|
|
99
|
+
},
|
|
100
|
+
"cid:root-tree:Tree": {
|
|
101
|
+
"diff": [
|
|
102
|
+
{
|
|
103
|
+
"action": "create",
|
|
104
|
+
"fractionalIndex": "80",
|
|
105
|
+
"index": 0,
|
|
106
|
+
"parent": undefined,
|
|
107
|
+
"target": "12@1",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"action": "create",
|
|
111
|
+
"fractionalIndex": "80",
|
|
112
|
+
"index": 0,
|
|
113
|
+
"parent": "12@1",
|
|
114
|
+
"target": "13@1",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
"type": "tree",
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- ac51ceb: feat: add exportJsonInIdSpan and make peer compression optional
|
|
123
|
+
- 8039e44: feat: find id spans between #607
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- 9c1005d: fix: should not merge remote changes due to small interval
|
|
128
|
+
|
|
3
129
|
## 1.2.7
|
|
4
130
|
|
|
5
131
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Loro is a [CRDTs(Conflict-free Replicated Data Types)](https://crdt.tech/) libra
|
|
|
56
56
|
**Supported CRDT Algorithms**
|
|
57
57
|
|
|
58
58
|
- 📝 Text Editing with [Fugue]
|
|
59
|
-
- 📙 [
|
|
59
|
+
- 📙 [Rich Text CRDT](https://loro.dev/blog/loro-richtext)
|
|
60
60
|
- 🌲 [Moveable Tree](https://loro.dev/docs/tutorial/tree)
|
|
61
61
|
- 🚗 [Moveable List](https://loro.dev/docs/tutorial/list)
|
|
62
62
|
- 🗺️ [Last-Write-Wins Map](https://loro.dev/docs/tutorial/map)
|
|
@@ -137,7 +137,6 @@ test('sync example', () => {
|
|
|
137
137
|
|
|
138
138
|
Loro draws inspiration from the innovative work of the following projects and individuals:
|
|
139
139
|
|
|
140
|
-
- [Ink & Switch](https://inkandswitch.com/): The principles of Local-first Software have greatly influenced this project. The [Peritext](https://www.inkandswitch.com/peritext/) project has also shaped our approach to rich text CRDTs.
|
|
141
140
|
- [Diamond-types](https://github.com/josephg/diamond-types): The [Event Graph Walker (Eg-walker)](https://loro.dev/docs/advanced/event_graph_walker) algorithm from @josephg has been adapted to reduce the computation and space usage of CRDTs.
|
|
142
141
|
- [Automerge](https://github.com/automerge/automerge): Their use of columnar encoding for CRDTs has informed our strategies for efficient data encoding.
|
|
143
142
|
- [Yjs](https://github.com/yjs/yjs): We have incorporated a similar algorithm for effectively merging collaborative editing operations, thanks to their pioneering work.
|
|
@@ -147,4 +146,3 @@ Loro draws inspiration from the innovative work of the following projects and in
|
|
|
147
146
|
|
|
148
147
|
[local-first]: https://www.inkandswitch.com/local-first/
|
|
149
148
|
[Fugue]: https://arxiv.org/abs/2305.00583
|
|
150
|
-
[Peritext]: https://www.inkandswitch.com/peritext/
|
package/base64/index.js
CHANGED
|
@@ -237,11 +237,11 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
237
237
|
CLOSURE_DTORS.register(real, state, state);
|
|
238
238
|
return real;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function __wbg_adapter_60(arg0, arg1, arg2) {
|
|
241
241
|
wasm.__wbindgen_export_3(arg0, arg1, addHeapObject(arg2));
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
function
|
|
244
|
+
function __wbg_adapter_63(arg0, arg1) {
|
|
245
245
|
wasm.__wbindgen_export_4(arg0, arg1);
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -971,9 +971,12 @@ class LoroDoc {
|
|
|
971
971
|
wasm.lorodoc_setRecordTimestamp(this.__wbg_ptr, auto_record);
|
|
972
972
|
}
|
|
973
973
|
/**
|
|
974
|
-
* If two continuous local changes are within the interval, they will be merged into one change.
|
|
974
|
+
* If two continuous local changes are within (<=) the interval(**in seconds**), they will be merged into one change.
|
|
975
975
|
*
|
|
976
|
-
* The default value is
|
|
976
|
+
* The default value is 1_000 seconds.
|
|
977
|
+
*
|
|
978
|
+
* By default, we record timestamps in seconds for each change. So if the merge interval is 1, and changes A and B
|
|
979
|
+
* have timestamps of 3 and 4 respectively, then they will be merged into one change
|
|
977
980
|
* @param {number} interval
|
|
978
981
|
*/
|
|
979
982
|
setChangeMergeInterval(interval) {
|
|
@@ -1237,6 +1240,72 @@ class LoroDoc {
|
|
|
1237
1240
|
}
|
|
1238
1241
|
}
|
|
1239
1242
|
/**
|
|
1243
|
+
* Find the op id spans that between the `from` version and the `to` version.
|
|
1244
|
+
*
|
|
1245
|
+
* You can combine it with `exportJsonInIdSpan` to get the changes between two versions.
|
|
1246
|
+
*
|
|
1247
|
+
* You can use it to travel all the changes from `from` to `to`. `from` and `to` are frontiers,
|
|
1248
|
+
* and they can be concurrent to each other. You can use it to find all the changes related to an event:
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* ```ts
|
|
1252
|
+
* import { LoroDoc } from "loro-crdt";
|
|
1253
|
+
*
|
|
1254
|
+
* const docA = new LoroDoc();
|
|
1255
|
+
* docA.setPeerId("1");
|
|
1256
|
+
* const docB = new LoroDoc();
|
|
1257
|
+
*
|
|
1258
|
+
* docA.getText("text").update("Hello");
|
|
1259
|
+
* docA.commit();
|
|
1260
|
+
* const snapshot = docA.export({ mode: "snapshot" });
|
|
1261
|
+
* let done = false;
|
|
1262
|
+
* docB.subscribe(e => {
|
|
1263
|
+
* const spans = docB.findIdSpansBetween(e.from, e.to);
|
|
1264
|
+
* const changes = docB.exportJsonInIdSpan(spans.forward[0]);
|
|
1265
|
+
* console.log(changes);
|
|
1266
|
+
* // [{
|
|
1267
|
+
* // id: "0@1",
|
|
1268
|
+
* // timestamp: expect.any(Number),
|
|
1269
|
+
* // deps: [],
|
|
1270
|
+
* // lamport: 0,
|
|
1271
|
+
* // msg: undefined,
|
|
1272
|
+
* // ops: [{
|
|
1273
|
+
* // container: "cid:root-text:Text",
|
|
1274
|
+
* // counter: 0,
|
|
1275
|
+
* // content: {
|
|
1276
|
+
* // type: "insert",
|
|
1277
|
+
* // pos: 0,
|
|
1278
|
+
* // text: "Hello"
|
|
1279
|
+
* // }
|
|
1280
|
+
* // }]
|
|
1281
|
+
* // }]
|
|
1282
|
+
* });
|
|
1283
|
+
* docB.import(snapshot);
|
|
1284
|
+
* ```
|
|
1285
|
+
* @param {({ peer: PeerID, counter: number })[]} from
|
|
1286
|
+
* @param {({ peer: PeerID, counter: number })[]} to
|
|
1287
|
+
* @returns {VersionVectorDiff}
|
|
1288
|
+
*/
|
|
1289
|
+
findIdSpansBetween(from, to) {
|
|
1290
|
+
try {
|
|
1291
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1292
|
+
const ptr0 = passArrayJsValueToWasm0(from, wasm.__wbindgen_export_0);
|
|
1293
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1294
|
+
const ptr1 = passArrayJsValueToWasm0(to, wasm.__wbindgen_export_0);
|
|
1295
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1296
|
+
wasm.lorodoc_findIdSpansBetween(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1297
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1298
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1299
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
1300
|
+
if (r2) {
|
|
1301
|
+
throw takeObject(r1);
|
|
1302
|
+
}
|
|
1303
|
+
return takeObject(r0);
|
|
1304
|
+
} finally {
|
|
1305
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1240
1309
|
* Checkout the `DocState` to a specific version.
|
|
1241
1310
|
*
|
|
1242
1311
|
* > The document becomes detached during a `checkout` operation.
|
|
@@ -1315,12 +1384,14 @@ class LoroDoc {
|
|
|
1315
1384
|
}
|
|
1316
1385
|
}
|
|
1317
1386
|
/**
|
|
1318
|
-
* Commit the cumulative auto
|
|
1387
|
+
* Commit the cumulative auto-committed transaction.
|
|
1319
1388
|
*
|
|
1320
1389
|
* You can specify the `origin`, `timestamp`, and `message` of the commit.
|
|
1321
1390
|
*
|
|
1322
1391
|
* - The `origin` is used to mark the event
|
|
1323
1392
|
* - The `message` works like a git commit message, which will be recorded and synced to peers
|
|
1393
|
+
* - The `timestamp` is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970.
|
|
1394
|
+
* It defaults to `Date.now() / 1000` when timestamp recording is enabled
|
|
1324
1395
|
*
|
|
1325
1396
|
* The events will be emitted after a transaction is committed. A transaction is committed when:
|
|
1326
1397
|
*
|
|
@@ -1897,12 +1968,32 @@ class LoroDoc {
|
|
|
1897
1968
|
* Export updates in the given range in JSON format.
|
|
1898
1969
|
* @param {any} start_vv
|
|
1899
1970
|
* @param {any} end_vv
|
|
1971
|
+
* @param {boolean | undefined} [with_peer_compression]
|
|
1900
1972
|
* @returns {JsonSchema}
|
|
1901
1973
|
*/
|
|
1902
|
-
exportJsonUpdates(start_vv, end_vv) {
|
|
1974
|
+
exportJsonUpdates(start_vv, end_vv, with_peer_compression) {
|
|
1903
1975
|
try {
|
|
1904
1976
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1905
|
-
wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, addHeapObject(start_vv), addHeapObject(end_vv));
|
|
1977
|
+
wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, addHeapObject(start_vv), addHeapObject(end_vv), isLikeNone(with_peer_compression) ? 0xFFFFFF : with_peer_compression ? 1 : 0);
|
|
1978
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1979
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1980
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
1981
|
+
if (r2) {
|
|
1982
|
+
throw takeObject(r1);
|
|
1983
|
+
}
|
|
1984
|
+
return takeObject(r0);
|
|
1985
|
+
} finally {
|
|
1986
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* @param {{ peer: PeerID, counter: number, length: number }} idSpan
|
|
1991
|
+
* @returns {any}
|
|
1992
|
+
*/
|
|
1993
|
+
exportJsonInIdSpan(idSpan) {
|
|
1994
|
+
try {
|
|
1995
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1996
|
+
wasm.lorodoc_exportJsonInIdSpan(retptr, this.__wbg_ptr, addHeapObject(idSpan));
|
|
1906
1997
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1907
1998
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1908
1999
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -2101,7 +2192,7 @@ class LoroDoc {
|
|
|
2101
2192
|
*
|
|
2102
2193
|
* @example
|
|
2103
2194
|
* ```ts
|
|
2104
|
-
* import { LoroDoc, LoroText } from "loro-crdt";
|
|
2195
|
+
* import { LoroDoc, LoroText, LoroMap } from "loro-crdt";
|
|
2105
2196
|
*
|
|
2106
2197
|
* const doc = new LoroDoc();
|
|
2107
2198
|
* const list = doc.getList("list");
|
|
@@ -2465,6 +2556,84 @@ class LoroDoc {
|
|
|
2465
2556
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2466
2557
|
}
|
|
2467
2558
|
}
|
|
2559
|
+
/**
|
|
2560
|
+
* Revert the document to the given frontiers.
|
|
2561
|
+
*
|
|
2562
|
+
* The doc will not become detached when using this method. Instead, it will generate a series
|
|
2563
|
+
* of operations to revert the document to the given version.
|
|
2564
|
+
*
|
|
2565
|
+
* @example
|
|
2566
|
+
* ```ts
|
|
2567
|
+
* const doc = new LoroDoc();
|
|
2568
|
+
* doc.setPeerId("1");
|
|
2569
|
+
* const text = doc.getText("text");
|
|
2570
|
+
* text.insert(0, "Hello");
|
|
2571
|
+
* doc.commit();
|
|
2572
|
+
* doc.revertTo([{ peer: "1", counter: 1 }]);
|
|
2573
|
+
* expect(doc.getText("text").toString()).toBe("He");
|
|
2574
|
+
* ```
|
|
2575
|
+
* @param {({ peer: PeerID, counter: number })[]} frontiers
|
|
2576
|
+
*/
|
|
2577
|
+
revertTo(frontiers) {
|
|
2578
|
+
try {
|
|
2579
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2580
|
+
const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_export_0);
|
|
2581
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2582
|
+
wasm.lorodoc_revertTo(retptr, this.__wbg_ptr, ptr0, len0);
|
|
2583
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2584
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2585
|
+
if (r1) {
|
|
2586
|
+
throw takeObject(r0);
|
|
2587
|
+
}
|
|
2588
|
+
} finally {
|
|
2589
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
/**
|
|
2593
|
+
* Apply a diff batch to the document
|
|
2594
|
+
* @param {Record<ContainerID, Diff>} diff
|
|
2595
|
+
*/
|
|
2596
|
+
applyDiff(diff) {
|
|
2597
|
+
try {
|
|
2598
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2599
|
+
wasm.lorodoc_applyDiff(retptr, this.__wbg_ptr, addHeapObject(diff));
|
|
2600
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2601
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2602
|
+
if (r1) {
|
|
2603
|
+
throw takeObject(r0);
|
|
2604
|
+
}
|
|
2605
|
+
} finally {
|
|
2606
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Calculate the differences between two frontiers
|
|
2611
|
+
*
|
|
2612
|
+
* The entries in the returned object are sorted by causal order: the creation of a child container will be
|
|
2613
|
+
* presented before its use.
|
|
2614
|
+
* @param {({ peer: PeerID, counter: number })[]} from
|
|
2615
|
+
* @param {({ peer: PeerID, counter: number })[]} to
|
|
2616
|
+
* @returns {Record<ContainerID, Diff>}
|
|
2617
|
+
*/
|
|
2618
|
+
diff(from, to) {
|
|
2619
|
+
try {
|
|
2620
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2621
|
+
const ptr0 = passArrayJsValueToWasm0(from, wasm.__wbindgen_export_0);
|
|
2622
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2623
|
+
const ptr1 = passArrayJsValueToWasm0(to, wasm.__wbindgen_export_0);
|
|
2624
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2625
|
+
wasm.lorodoc_diff(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2626
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2627
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2628
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
2629
|
+
if (r2) {
|
|
2630
|
+
throw takeObject(r1);
|
|
2631
|
+
}
|
|
2632
|
+
return takeObject(r0);
|
|
2633
|
+
} finally {
|
|
2634
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2468
2637
|
}
|
|
2469
2638
|
|
|
2470
2639
|
const LoroListFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -3362,7 +3531,7 @@ class LoroMap {
|
|
|
3362
3531
|
*
|
|
3363
3532
|
* @example
|
|
3364
3533
|
* ```ts
|
|
3365
|
-
* import { LoroDoc } from "loro-crdt";
|
|
3534
|
+
* import { LoroDoc, LoroText } from "loro-crdt";
|
|
3366
3535
|
*
|
|
3367
3536
|
* const doc = new LoroDoc();
|
|
3368
3537
|
* doc.setPeerId("1");
|
|
@@ -5535,6 +5704,7 @@ class UndoManager {
|
|
|
5535
5704
|
}
|
|
5536
5705
|
/**
|
|
5537
5706
|
* Set the merge interval (in ms).
|
|
5707
|
+
*
|
|
5538
5708
|
* If the interval is set to 0, the undo steps will not be merged.
|
|
5539
5709
|
* Otherwise, the undo steps will be merged if the interval between the two steps is less than the given interval.
|
|
5540
5710
|
* @param {number} interval
|
|
@@ -5807,36 +5977,36 @@ class VersionVector {
|
|
|
5807
5977
|
function __wbindgen_object_drop_ref(arg0) {
|
|
5808
5978
|
takeObject(arg0);
|
|
5809
5979
|
}
|
|
5810
|
-
function
|
|
5811
|
-
const ret =
|
|
5980
|
+
function __wbg_lorolist_new(arg0) {
|
|
5981
|
+
const ret = LoroList.__wrap(arg0);
|
|
5812
5982
|
return addHeapObject(ret);
|
|
5813
5983
|
}
|
|
5814
|
-
function
|
|
5815
|
-
const ret =
|
|
5984
|
+
function __wbg_lorocounter_new(arg0) {
|
|
5985
|
+
const ret = LoroCounter.__wrap(arg0);
|
|
5816
5986
|
return addHeapObject(ret);
|
|
5817
5987
|
}
|
|
5818
|
-
function
|
|
5819
|
-
const ret =
|
|
5988
|
+
function __wbg_loromap_new(arg0) {
|
|
5989
|
+
const ret = LoroMap.__wrap(arg0);
|
|
5820
5990
|
return addHeapObject(ret);
|
|
5821
5991
|
}
|
|
5822
|
-
function
|
|
5823
|
-
const ret =
|
|
5992
|
+
function __wbg_lorotreenode_new(arg0) {
|
|
5993
|
+
const ret = LoroTreeNode.__wrap(arg0);
|
|
5824
5994
|
return addHeapObject(ret);
|
|
5825
5995
|
}
|
|
5826
|
-
function
|
|
5827
|
-
const ret =
|
|
5996
|
+
function __wbg_lorotree_new(arg0) {
|
|
5997
|
+
const ret = LoroTree.__wrap(arg0);
|
|
5828
5998
|
return addHeapObject(ret);
|
|
5829
5999
|
}
|
|
5830
6000
|
function __wbg_loromovablelist_new(arg0) {
|
|
5831
6001
|
const ret = LoroMovableList.__wrap(arg0);
|
|
5832
6002
|
return addHeapObject(ret);
|
|
5833
6003
|
}
|
|
5834
|
-
function
|
|
5835
|
-
const ret =
|
|
6004
|
+
function __wbg_cursor_new(arg0) {
|
|
6005
|
+
const ret = Cursor.__wrap(arg0);
|
|
5836
6006
|
return addHeapObject(ret);
|
|
5837
6007
|
}
|
|
5838
|
-
function
|
|
5839
|
-
const ret =
|
|
6008
|
+
function __wbg_lorotext_new(arg0) {
|
|
6009
|
+
const ret = LoroText.__wrap(arg0);
|
|
5840
6010
|
return addHeapObject(ret);
|
|
5841
6011
|
}
|
|
5842
6012
|
function __wbg_versionvector_new(arg0) {
|
|
@@ -5932,6 +6102,10 @@ function __wbindgen_number_new(arg0) {
|
|
|
5932
6102
|
const ret = arg0;
|
|
5933
6103
|
return addHeapObject(ret);
|
|
5934
6104
|
}
|
|
6105
|
+
function __wbindgen_is_array(arg0) {
|
|
6106
|
+
const ret = Array.isArray(getObject(arg0));
|
|
6107
|
+
return ret;
|
|
6108
|
+
}
|
|
5935
6109
|
function __wbindgen_typeof(arg0) {
|
|
5936
6110
|
const ret = typeof getObject(arg0);
|
|
5937
6111
|
return addHeapObject(ret);
|
|
@@ -6027,7 +6201,7 @@ function __wbg_error_f851667af71bcfc6(arg0, arg1) {
|
|
|
6027
6201
|
wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
|
|
6028
6202
|
}
|
|
6029
6203
|
}
|
|
6030
|
-
const
|
|
6204
|
+
const __wbg_now_15d99db1ebc1f0b2 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
|
|
6031
6205
|
|
|
6032
6206
|
function __wbg_crypto_1d1f22824a6a080c(arg0) {
|
|
6033
6207
|
const ret = getObject(arg0).crypto;
|
|
@@ -6134,6 +6308,10 @@ function __wbg_newwithlength_66ae46612e7f0234(arg0) {
|
|
|
6134
6308
|
function __wbg_set_d4638f722068f043(arg0, arg1, arg2) {
|
|
6135
6309
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
6136
6310
|
}
|
|
6311
|
+
function __wbg_from_89e3fc3ba5e6fb48(arg0) {
|
|
6312
|
+
const ret = Array.from(getObject(arg0));
|
|
6313
|
+
return addHeapObject(ret);
|
|
6314
|
+
}
|
|
6137
6315
|
function __wbg_isArray_2ab64d95e09ea0ae(arg0) {
|
|
6138
6316
|
const ret = Array.isArray(getObject(arg0));
|
|
6139
6317
|
return ret;
|
|
@@ -6287,12 +6465,12 @@ function __wbindgen_memory() {
|
|
|
6287
6465
|
const ret = wasm.memory;
|
|
6288
6466
|
return addHeapObject(ret);
|
|
6289
6467
|
}
|
|
6290
|
-
function
|
|
6291
|
-
const ret = makeMutClosure(arg0, arg1, 9,
|
|
6468
|
+
function __wbindgen_closure_wrapper491(arg0, arg1, arg2) {
|
|
6469
|
+
const ret = makeMutClosure(arg0, arg1, 9, __wbg_adapter_60);
|
|
6292
6470
|
return addHeapObject(ret);
|
|
6293
6471
|
}
|
|
6294
|
-
function
|
|
6295
|
-
const ret = makeMutClosure(arg0, arg1, 11,
|
|
6472
|
+
function __wbindgen_closure_wrapper494(arg0, arg1, arg2) {
|
|
6473
|
+
const ret = makeMutClosure(arg0, arg1, 11, __wbg_adapter_63);
|
|
6296
6474
|
return addHeapObject(ret);
|
|
6297
6475
|
}
|
|
6298
6476
|
|
|
@@ -6324,6 +6502,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6324
6502
|
__wbg_entries_ce844941d0c51880: __wbg_entries_ce844941d0c51880,
|
|
6325
6503
|
__wbg_error_c8c2cca30a630316: __wbg_error_c8c2cca30a630316,
|
|
6326
6504
|
__wbg_error_f851667af71bcfc6: __wbg_error_f851667af71bcfc6,
|
|
6505
|
+
__wbg_from_89e3fc3ba5e6fb48: __wbg_from_89e3fc3ba5e6fb48,
|
|
6327
6506
|
__wbg_getRandomValues_3aa56aa6edec874c: __wbg_getRandomValues_3aa56aa6edec874c,
|
|
6328
6507
|
__wbg_get_bd8e338fbd5f5cc8: __wbg_get_bd8e338fbd5f5cc8,
|
|
6329
6508
|
__wbg_get_e3c254076557e348: __wbg_get_e3c254076557e348,
|
|
@@ -6365,7 +6544,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6365
6544
|
__wbg_next_196c84450b364254: __wbg_next_196c84450b364254,
|
|
6366
6545
|
__wbg_next_40fc327bfc8770e6: __wbg_next_40fc327bfc8770e6,
|
|
6367
6546
|
__wbg_node_104a2ff8d6ea03a2: __wbg_node_104a2ff8d6ea03a2,
|
|
6368
|
-
|
|
6547
|
+
__wbg_now_15d99db1ebc1f0b2: __wbg_now_15d99db1ebc1f0b2,
|
|
6369
6548
|
__wbg_ownKeys_658942b7f28d1fe9: __wbg_ownKeys_658942b7f28d1fe9,
|
|
6370
6549
|
__wbg_process_4a72847cc503995b: __wbg_process_4a72847cc503995b,
|
|
6371
6550
|
__wbg_push_a5b05aedc7234f9f: __wbg_push_a5b05aedc7234f9f,
|
|
@@ -6393,11 +6572,12 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6393
6572
|
__wbindgen_bigint_get_as_i64: __wbindgen_bigint_get_as_i64,
|
|
6394
6573
|
__wbindgen_boolean_get: __wbindgen_boolean_get,
|
|
6395
6574
|
__wbindgen_cb_drop: __wbindgen_cb_drop,
|
|
6396
|
-
|
|
6397
|
-
|
|
6575
|
+
__wbindgen_closure_wrapper491: __wbindgen_closure_wrapper491,
|
|
6576
|
+
__wbindgen_closure_wrapper494: __wbindgen_closure_wrapper494,
|
|
6398
6577
|
__wbindgen_debug_string: __wbindgen_debug_string,
|
|
6399
6578
|
__wbindgen_error_new: __wbindgen_error_new,
|
|
6400
6579
|
__wbindgen_in: __wbindgen_in,
|
|
6580
|
+
__wbindgen_is_array: __wbindgen_is_array,
|
|
6401
6581
|
__wbindgen_is_bigint: __wbindgen_is_bigint,
|
|
6402
6582
|
__wbindgen_is_falsy: __wbindgen_is_falsy,
|
|
6403
6583
|
__wbindgen_is_function: __wbindgen_is_function,
|
|
@@ -6428,7 +6608,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6428
6608
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6429
6609
|
|
|
6430
6610
|
|
|
6431
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6611
|
+
import loro_wasm_bg_js from './loro_wasm_bg-b0221709.js';
|
|
6432
6612
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6433
6613
|
"./loro_wasm_bg.js": imports,
|
|
6434
6614
|
});
|
|
@@ -6633,4 +6813,4 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6633
6813
|
return run(layer);
|
|
6634
6814
|
};
|
|
6635
6815
|
|
|
6636
|
-
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,
|
|
6816
|
+
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_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_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_15d99db1ebc1f0b2, __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_wrapper491, __wbindgen_closure_wrapper494, __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 };
|