loro-crdt 1.0.7 → 1.0.8-alpha.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/LICENSE CHANGED
@@ -1,21 +1,20 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Loro
3
+ Copyright (c) 2022 Zixuan Chen
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -38,11 +38,11 @@
38
38
  </p>
39
39
 
40
40
 
41
- https://github.com/loro-dev/loro/assets/18425020/fe246c47-a120-44b3-91d4-1e7232a5b4ac
41
+ <h4 align="center">
42
+ ✨ Loro 1.0 is out! Read the <a href="https://loro.dev/blog/v1.0">announcement</a>.
43
+ </h4>
42
44
 
43
- Loro is a [CRDTs(Conflict-free Replicated Data Types)](https://crdt.tech/) library that makes building [local-first apps][local-first] easier. It is currently available for JavaScript (via WASM) and Rust developers.
44
-
45
- Explore our vision in our blog: [**✨ Reimagine State Management with CRDTs**](https://loro.dev/blog/loro-now-open-source).
45
+ Loro is a [CRDTs(Conflict-free Replicated Data Types)](https://crdt.tech/) library that makes building [local-first apps][local-first] easier. It is currently available for JavaScript (via WASM) and Rust developers.
46
46
 
47
47
  # Features
48
48
 
@@ -65,10 +65,13 @@ Explore our vision in our blog: [**✨ Reimagine State Management with CRDTs**](
65
65
 
66
66
  **Advanced Features in Loro**
67
67
 
68
- - 📖 Preserve Editing History in a [Replayable Event Graph](https://loro.dev/docs/advanced/replayable_event_graph)
69
68
  - ⏱️ Fast [Time Travel](https://loro.dev/docs/tutorial/time_travel) Through History
69
+ - 🏛️ [Version Control with Real-Time Collaboration](https://loro.dev/blog/v1.0#version-control)
70
+ - 📦 [Shallow Snapshot](https://loro.dev/docs/advanced/shallow_snapshot) that Works like Git Shallow Clone
71
+
70
72
 
71
- https://github.com/loro-dev/loro/assets/18425020/ec2d20a3-3d8c-4483-a601-b200243c9792
73
+ > In this example, we demonstrate importing an entire Loro codebase into a Loro-powered
74
+ > version controller, preserving the complete Git DAG history while enabling fast version switching.
72
75
 
73
76
  # Example
74
77
 
@@ -76,48 +79,50 @@ https://github.com/loro-dev/loro/assets/18425020/ec2d20a3-3d8c-4483-a601-b200243
76
79
 
77
80
  ```ts
78
81
  import { expect, test } from 'vitest';
79
- import { Loro, LoroList } from 'loro-crdt';
80
-
81
- /**
82
- * Demonstrates synchronization of two documents with two rounds of exchanges.
83
- */
84
- // Initialize document A
85
- const docA = new Loro();
86
- const listA: LoroList = docA.getList('list');
87
- listA.insert(0, 'A');
88
- listA.insert(1, 'B');
89
- listA.insert(2, 'C');
90
-
91
- // Export the state of document A as a byte array
92
- const bytes: Uint8Array = docA.exportFrom();
93
-
94
- // Simulate sending `bytes` across the network to another peer, B
95
- const docB = new Loro();
96
- // Peer B imports the updates from A
97
- docB.import(bytes);
98
-
99
- // Verify that B's state matches A's state
100
- expect(docB.toJSON()).toStrictEqual({
101
- list: ['A', 'B', 'C'],
102
- });
103
-
104
- // Get the current operation log version of document B
105
- const version = docB.oplogVersion();
106
-
107
- // Simulate editing at B: delete item 'B'
108
- const listB: LoroList = docB.getList('list');
109
- listB.delete(1, 1);
110
-
111
- // Export the updates from B since the last synchronization point
112
- const bytesB: Uint8Array = docB.exportFrom(version);
113
-
114
- // Simulate sending `bytesB` back across the network to A
115
- // A imports the updates from B
116
- docA.import(bytesB);
117
-
118
- // Verify that the list at A now matches the list at B after merging
119
- expect(docA.toJSON()).toStrictEqual({
120
- list: ['A', 'C'],
82
+ import { LoroDoc, LoroList } from 'loro-crdt';
83
+
84
+ test('sync example', () => {
85
+ /**
86
+ * Demonstrates synchronization of two documents with two rounds of exchanges.
87
+ */
88
+ // Initialize document A
89
+ const docA = new LoroDoc();
90
+ const listA: LoroList = docA.getList('list');
91
+ listA.insert(0, 'A');
92
+ listA.insert(1, 'B');
93
+ listA.insert(2, 'C');
94
+
95
+ // Export the state of document A as a byte array
96
+ const bytes: Uint8Array = docA.export({ mode: 'update' });
97
+
98
+ // Simulate sending `bytes` across the network to another peer, B
99
+ const docB = new LoroDoc();
100
+ // Peer B imports the updates from A
101
+ docB.import(bytes);
102
+
103
+ // Verify that B's state matches A's state
104
+ expect(docB.toJSON()).toStrictEqual({
105
+ list: ['A', 'B', 'C'],
106
+ });
107
+
108
+ // Get the current operation log version of document B
109
+ const version = docB.oplogVersion();
110
+
111
+ // Simulate editing at B: delete item 'B'
112
+ const listB: LoroList = docB.getList('list');
113
+ listB.delete(1, 1);
114
+
115
+ // Export the updates from B since the last synchronization point
116
+ const bytesB: Uint8Array = docB.export({ mode: 'update', from: version });
117
+
118
+ // Simulate sending `bytesB` back across the network to A
119
+ // A imports the updates from B
120
+ docA.import(bytesB);
121
+
122
+ // Verify that the list at A now matches the list at B after merging
123
+ expect(docA.toJSON()).toStrictEqual({
124
+ list: ['A', 'C'],
125
+ });
121
126
  });
122
127
  ```
123
128
 
@@ -126,9 +131,9 @@ expect(docA.toJSON()).toStrictEqual({
126
131
  Loro draws inspiration from the innovative work of the following projects and individuals:
127
132
 
128
133
  - [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.
129
- - [Diamond-types](https://github.com/josephg/diamond-types): The [Replayable Event Graph (REG)](https://loro.dev/docs/advanced/replayable_event_graph) algorithm from @josephg has been adapted to reduce the computation and space usage of CRDTs.
134
+ - [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.
130
135
  - [Automerge](https://github.com/automerge/automerge): Their use of columnar encoding for CRDTs has informed our strategies for efficient data encoding.
131
- - [Yjs](https://github.com/yjs/yjs): We have incorporated a similar algorithm for effectively merging collaborative editing operations, thanks to their pioneering works.
136
+ - [Yjs](https://github.com/yjs/yjs): We have incorporated a similar algorithm for effectively merging collaborative editing operations, thanks to their pioneering work.
132
137
  - [Matthew Weidner](https://mattweidner.com/): His work on the [Fugue](https://arxiv.org/abs/2305.00583) algorithm has been invaluable, enhancing our text editing capabilities.
133
138
  - [Martin Kleppmann](https://martin.kleppmann.com/): His work on CRDTs has significantly influenced our comprehension of the field.
134
139
 
@@ -0,0 +1,72 @@
1
+ export * from "./loro_wasm";
2
+ export type * from "./loro_wasm";
3
+ import { AwarenessWasm, PeerID, Container, ContainerID, ContainerType, LoroCounter, LoroDoc, LoroList, LoroMap, LoroText, LoroTree, OpId, Value, AwarenessListener } from "./loro_wasm";
4
+ /**
5
+ * @deprecated Please use LoroDoc
6
+ */
7
+ export declare class Loro extends LoroDoc {
8
+ }
9
+ export declare function isContainerId(s: string): s is ContainerID;
10
+ /** Whether the value is a container.
11
+ *
12
+ * # Example
13
+ *
14
+ * ```ts
15
+ * const doc = new LoroDoc();
16
+ * const map = doc.getMap("map");
17
+ * const list = doc.getList("list");
18
+ * const text = doc.getText("text");
19
+ * isContainer(map); // true
20
+ * isContainer(list); // true
21
+ * isContainer(text); // true
22
+ * isContainer(123); // false
23
+ * isContainer("123"); // false
24
+ * isContainer({}); // false
25
+ * ```
26
+ */
27
+ export declare function isContainer(value: any): value is Container;
28
+ /** Get the type of a value that may be a container.
29
+ *
30
+ * # Example
31
+ *
32
+ * ```ts
33
+ * const doc = new LoroDoc();
34
+ * const map = doc.getMap("map");
35
+ * const list = doc.getList("list");
36
+ * const text = doc.getText("text");
37
+ * getType(map); // "Map"
38
+ * getType(list); // "List"
39
+ * getType(text); // "Text"
40
+ * getType(123); // "Json"
41
+ * getType("123"); // "Json"
42
+ * getType({}); // "Json"
43
+ * ```
44
+ */
45
+ export declare function getType<T>(value: T): T extends LoroText ? "Text" : T extends LoroMap<any> ? "Map" : T extends LoroTree<any> ? "Tree" : T extends LoroList<any> ? "List" : T extends LoroCounter ? "Counter" : "Json";
46
+ export declare function newContainerID(id: OpId, type: ContainerType): ContainerID;
47
+ export declare function newRootContainerID(name: string, type: ContainerType): ContainerID;
48
+ /**
49
+ * Awareness is a structure that allows to track the ephemeral state of the peers.
50
+ *
51
+ * If we don't receive a state update from a peer within the timeout, we will remove their state.
52
+ * The timeout is in milliseconds. This can be used to handle the off-line state of a peer.
53
+ */
54
+ export declare class Awareness<T extends Value = Value> {
55
+ inner: AwarenessWasm<T>;
56
+ private peer;
57
+ private timer;
58
+ private timeout;
59
+ private listeners;
60
+ constructor(peer: PeerID, timeout?: number);
61
+ apply(bytes: Uint8Array, origin?: string): void;
62
+ setLocalState(state: T): void;
63
+ getLocalState(): T | undefined;
64
+ getAllStates(): Record<PeerID, T>;
65
+ encode(peers: PeerID[]): Uint8Array;
66
+ encodeAll(): Uint8Array;
67
+ addListener(listener: AwarenessListener): void;
68
+ removeListener(listener: AwarenessListener): void;
69
+ peers(): PeerID[];
70
+ destroy(): void;
71
+ private startTimerIfNotEmpty;
72
+ }
@@ -0,0 +1,156 @@
1
+ import { LoroDoc, AwarenessWasm } from "./loro_wasm";
2
+ export * from "./loro_wasm";
3
+
4
+ /**
5
+ * @deprecated Please use LoroDoc
6
+ */
7
+ class Loro extends LoroDoc {
8
+ }
9
+ const CONTAINER_TYPES = [
10
+ "Map",
11
+ "Text",
12
+ "List",
13
+ "Tree",
14
+ "MovableList",
15
+ "Counter",
16
+ ];
17
+ function isContainerId(s) {
18
+ return s.startsWith("cid:");
19
+ }
20
+ /** Whether the value is a container.
21
+ *
22
+ * # Example
23
+ *
24
+ * ```ts
25
+ * const doc = new LoroDoc();
26
+ * const map = doc.getMap("map");
27
+ * const list = doc.getList("list");
28
+ * const text = doc.getText("text");
29
+ * isContainer(map); // true
30
+ * isContainer(list); // true
31
+ * isContainer(text); // true
32
+ * isContainer(123); // false
33
+ * isContainer("123"); // false
34
+ * isContainer({}); // false
35
+ * ```
36
+ */
37
+ function isContainer(value) {
38
+ if (typeof value !== "object" || value == null) {
39
+ return false;
40
+ }
41
+ const p = Object.getPrototypeOf(value);
42
+ if (p == null || typeof p !== "object" || typeof p["kind"] !== "function") {
43
+ return false;
44
+ }
45
+ return CONTAINER_TYPES.includes(value.kind());
46
+ }
47
+ /** Get the type of a value that may be a container.
48
+ *
49
+ * # Example
50
+ *
51
+ * ```ts
52
+ * const doc = new LoroDoc();
53
+ * const map = doc.getMap("map");
54
+ * const list = doc.getList("list");
55
+ * const text = doc.getText("text");
56
+ * getType(map); // "Map"
57
+ * getType(list); // "List"
58
+ * getType(text); // "Text"
59
+ * getType(123); // "Json"
60
+ * getType("123"); // "Json"
61
+ * getType({}); // "Json"
62
+ * ```
63
+ */
64
+ function getType(value) {
65
+ if (isContainer(value)) {
66
+ return value.kind();
67
+ }
68
+ return "Json";
69
+ }
70
+ function newContainerID(id, type) {
71
+ return `cid:${id.counter}@${id.peer}:${type}`;
72
+ }
73
+ function newRootContainerID(name, type) {
74
+ return `cid:root-${name}:${type}`;
75
+ }
76
+ /**
77
+ * Awareness is a structure that allows to track the ephemeral state of the peers.
78
+ *
79
+ * If we don't receive a state update from a peer within the timeout, we will remove their state.
80
+ * The timeout is in milliseconds. This can be used to handle the off-line state of a peer.
81
+ */
82
+ class Awareness {
83
+ constructor(peer, timeout = 30000) {
84
+ this.listeners = new Set();
85
+ this.inner = new AwarenessWasm(peer, timeout);
86
+ this.peer = peer;
87
+ this.timeout = timeout;
88
+ }
89
+ apply(bytes, origin = "remote") {
90
+ const { updated, added } = this.inner.apply(bytes);
91
+ this.listeners.forEach((listener) => {
92
+ listener({ updated, added, removed: [] }, origin);
93
+ });
94
+ this.startTimerIfNotEmpty();
95
+ }
96
+ setLocalState(state) {
97
+ const wasEmpty = this.inner.getState(this.peer) == null;
98
+ this.inner.setLocalState(state);
99
+ if (wasEmpty) {
100
+ this.listeners.forEach((listener) => {
101
+ listener({ updated: [], added: [this.inner.peer()], removed: [] }, "local");
102
+ });
103
+ }
104
+ else {
105
+ this.listeners.forEach((listener) => {
106
+ listener({ updated: [this.inner.peer()], added: [], removed: [] }, "local");
107
+ });
108
+ }
109
+ this.startTimerIfNotEmpty();
110
+ }
111
+ getLocalState() {
112
+ return this.inner.getState(this.peer);
113
+ }
114
+ getAllStates() {
115
+ return this.inner.getAllStates();
116
+ }
117
+ encode(peers) {
118
+ return this.inner.encode(peers);
119
+ }
120
+ encodeAll() {
121
+ return this.inner.encodeAll();
122
+ }
123
+ addListener(listener) {
124
+ this.listeners.add(listener);
125
+ }
126
+ removeListener(listener) {
127
+ this.listeners.delete(listener);
128
+ }
129
+ peers() {
130
+ return this.inner.peers();
131
+ }
132
+ destroy() {
133
+ clearInterval(this.timer);
134
+ this.listeners.clear();
135
+ }
136
+ startTimerIfNotEmpty() {
137
+ if (this.inner.isEmpty() || this.timer != null) {
138
+ return;
139
+ }
140
+ this.timer = setInterval(() => {
141
+ const removed = this.inner.removeOutdated();
142
+ if (removed.length > 0) {
143
+ this.listeners.forEach((listener) => {
144
+ listener({ updated: [], added: [], removed }, "timeout");
145
+ });
146
+ }
147
+ if (this.inner.isEmpty()) {
148
+ clearInterval(this.timer);
149
+ this.timer = undefined;
150
+ }
151
+ }, this.timeout / 2);
152
+ }
153
+ }
154
+
155
+ export { Awareness, Loro, getType, isContainer, isContainerId, newContainerID, newRootContainerID };
156
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../ts/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAoBA;;AAEG;AACG,MAAO,IAAK,SAAQ,OAAO,CAAA;AAAI,CAAA;AAErC,MAAM,eAAe,GAAG;IACpB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,aAAa;IACb,SAAS;CACZ,CAAC;AAEI,SAAU,aAAa,CAAC,CAAS,EAAA;AACnC,IAAA,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;AAgBG;AACG,SAAU,WAAW,CAAC,KAAU,EAAA;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;AAC5C,QAAA,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,CAAC,GAAG,MAAM,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