@pluv/crdt-loro 0.18.0 → 0.19.0
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/.turbo/turbo-build.log +15 -15
- package/CHANGELOG.md +7 -0
- package/dist/index.js +24 -48
- package/dist/index.mjs +24 -48
- package/package.json +6 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/crdt-loro@0.
|
|
2
|
+
> @pluv/crdt-loro@0.19.0 build /home/runner/work/pluv/pluv/packages/crdt-loro
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v8.1.0
|
|
8
|
+
CLI Target: es6
|
|
9
|
+
ESM Build start
|
|
10
|
+
CJS Build start
|
|
11
|
+
ESM dist/index.mjs 18.22 KB
|
|
12
|
+
ESM ⚡️ Build success in 114ms
|
|
13
|
+
CJS dist/index.js 19.23 KB
|
|
14
|
+
CJS ⚡️ Build success in 114ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
DTS ⚡️ Build success in 2568ms
|
|
17
|
+
DTS dist/index.d.mts 7.04 KB
|
|
18
|
+
DTS dist/index.d.ts 7.04 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -75,8 +75,7 @@ var CrdtLoroMap = class extends import_crdt.AbstractCrdtType {
|
|
|
75
75
|
this.initialValue = value.map(([k, v]) => [k, v]);
|
|
76
76
|
}
|
|
77
77
|
set doc(doc2) {
|
|
78
|
-
if (this._doc)
|
|
79
|
-
throw new Error("Cannot overwrite array doc");
|
|
78
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
80
79
|
this._doc = doc2;
|
|
81
80
|
}
|
|
82
81
|
get size() {
|
|
@@ -86,8 +85,7 @@ var CrdtLoroMap = class extends import_crdt.AbstractCrdtType {
|
|
|
86
85
|
return this._value;
|
|
87
86
|
}
|
|
88
87
|
set value(value) {
|
|
89
|
-
if (this._initialized)
|
|
90
|
-
throw new Error("Cannot re-assign map");
|
|
88
|
+
if (this._initialized) throw new Error("Cannot re-assign map");
|
|
91
89
|
this._initialized = true;
|
|
92
90
|
this._value = value;
|
|
93
91
|
cloneType({ source: this, target: this.value });
|
|
@@ -113,8 +111,7 @@ var CrdtLoroMap = class extends import_crdt.AbstractCrdtType {
|
|
|
113
111
|
const containerType = getLoroContainerType(value);
|
|
114
112
|
const container = this.value.setContainer(prop, containerType);
|
|
115
113
|
cloneType({ source: value, target: container });
|
|
116
|
-
if (this._doc)
|
|
117
|
-
value.doc = this._doc;
|
|
114
|
+
if (this._doc) value.doc = this._doc;
|
|
118
115
|
(_b = this._doc) == null ? void 0 : _b.value.commit();
|
|
119
116
|
return this;
|
|
120
117
|
}
|
|
@@ -122,8 +119,7 @@ var CrdtLoroMap = class extends import_crdt.AbstractCrdtType {
|
|
|
122
119
|
return this.value.toJson();
|
|
123
120
|
}
|
|
124
121
|
_guardInitialized() {
|
|
125
|
-
if (!this._initialized)
|
|
126
|
-
throw new Error("Array is not yet initialized");
|
|
122
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
127
123
|
}
|
|
128
124
|
};
|
|
129
125
|
|
|
@@ -144,8 +140,7 @@ var CrdtLoroObject = class extends import_crdt2.AbstractCrdtType {
|
|
|
144
140
|
this.initialValue = Object.entries(value).map(([k, v]) => [k, v]);
|
|
145
141
|
}
|
|
146
142
|
set doc(doc2) {
|
|
147
|
-
if (this._doc)
|
|
148
|
-
throw new Error("Cannot overwrite array doc");
|
|
143
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
149
144
|
this._doc = doc2;
|
|
150
145
|
}
|
|
151
146
|
get size() {
|
|
@@ -155,8 +150,7 @@ var CrdtLoroObject = class extends import_crdt2.AbstractCrdtType {
|
|
|
155
150
|
return this._value;
|
|
156
151
|
}
|
|
157
152
|
set value(value) {
|
|
158
|
-
if (this._initialized)
|
|
159
|
-
throw new Error("Cannot re-assign map");
|
|
153
|
+
if (this._initialized) throw new Error("Cannot re-assign map");
|
|
160
154
|
this._initialized = true;
|
|
161
155
|
this._value = value;
|
|
162
156
|
cloneType({ source: this, target: this.value });
|
|
@@ -175,8 +169,7 @@ var CrdtLoroObject = class extends import_crdt2.AbstractCrdtType {
|
|
|
175
169
|
const containerType = getLoroContainerType(value);
|
|
176
170
|
const container = this.value.setContainer(prop, containerType);
|
|
177
171
|
cloneType({ source: value, target: container });
|
|
178
|
-
if (this._doc)
|
|
179
|
-
value.doc = this._doc;
|
|
172
|
+
if (this._doc) value.doc = this._doc;
|
|
180
173
|
(_b = this._doc) == null ? void 0 : _b.value.commit();
|
|
181
174
|
return this;
|
|
182
175
|
}
|
|
@@ -184,8 +177,7 @@ var CrdtLoroObject = class extends import_crdt2.AbstractCrdtType {
|
|
|
184
177
|
return this.value.toJson();
|
|
185
178
|
}
|
|
186
179
|
_guardInitialized() {
|
|
187
|
-
if (!this._initialized)
|
|
188
|
-
throw new Error("Array is not yet initialized");
|
|
180
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
189
181
|
}
|
|
190
182
|
};
|
|
191
183
|
|
|
@@ -207,8 +199,7 @@ var CrdtLoroText = class extends import_crdt3.AbstractCrdtType {
|
|
|
207
199
|
this.value = new import_loro_crdt3.LoroText();
|
|
208
200
|
}
|
|
209
201
|
set doc(doc2) {
|
|
210
|
-
if (this._doc)
|
|
211
|
-
throw new Error("Cannot overwrite array doc");
|
|
202
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
212
203
|
this._doc = doc2;
|
|
213
204
|
}
|
|
214
205
|
get length() {
|
|
@@ -218,8 +209,7 @@ var CrdtLoroText = class extends import_crdt3.AbstractCrdtType {
|
|
|
218
209
|
return this._value;
|
|
219
210
|
}
|
|
220
211
|
set value(value) {
|
|
221
|
-
if (this._initialized)
|
|
222
|
-
throw new Error("Cannot re-assign text");
|
|
212
|
+
if (this._initialized) throw new Error("Cannot re-assign text");
|
|
223
213
|
this._initialized = true;
|
|
224
214
|
this._value = value;
|
|
225
215
|
cloneType({ source: this, target: this.value });
|
|
@@ -242,8 +232,7 @@ var CrdtLoroText = class extends import_crdt3.AbstractCrdtType {
|
|
|
242
232
|
return this.value.toString();
|
|
243
233
|
}
|
|
244
234
|
_guardInitialized() {
|
|
245
|
-
if (!this._initialized)
|
|
246
|
-
throw new Error("Array is not yet initialized");
|
|
235
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
247
236
|
}
|
|
248
237
|
};
|
|
249
238
|
|
|
@@ -386,14 +375,10 @@ var cloneType = (params) => {
|
|
|
386
375
|
|
|
387
376
|
// src/shared/getLoroContainerType.ts
|
|
388
377
|
var getLoroContainerType = (value) => {
|
|
389
|
-
if (value instanceof CrdtLoroArray)
|
|
390
|
-
|
|
391
|
-
if (value instanceof
|
|
392
|
-
|
|
393
|
-
if (value instanceof CrdtLoroObject)
|
|
394
|
-
return "Map";
|
|
395
|
-
if (value instanceof CrdtLoroText)
|
|
396
|
-
return "Text";
|
|
378
|
+
if (value instanceof CrdtLoroArray) return "List";
|
|
379
|
+
if (value instanceof CrdtLoroMap) return "Map";
|
|
380
|
+
if (value instanceof CrdtLoroObject) return "Map";
|
|
381
|
+
if (value instanceof CrdtLoroText) return "Text";
|
|
397
382
|
throw new Error("This type is not yet supported");
|
|
398
383
|
};
|
|
399
384
|
|
|
@@ -412,8 +397,7 @@ var CrdtLoroArray = class extends import_crdt5.AbstractCrdtType {
|
|
|
412
397
|
this.initialValue = value.slice();
|
|
413
398
|
}
|
|
414
399
|
set doc(doc2) {
|
|
415
|
-
if (this._doc)
|
|
416
|
-
throw new Error("Cannot overwrite array doc");
|
|
400
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
417
401
|
this._doc = doc2;
|
|
418
402
|
}
|
|
419
403
|
get length() {
|
|
@@ -423,8 +407,7 @@ var CrdtLoroArray = class extends import_crdt5.AbstractCrdtType {
|
|
|
423
407
|
return this._value;
|
|
424
408
|
}
|
|
425
409
|
set value(value) {
|
|
426
|
-
if (this._initialized)
|
|
427
|
-
throw new Error("Cannot re-assign array");
|
|
410
|
+
if (this._initialized) throw new Error("Cannot re-assign array");
|
|
428
411
|
this._initialized = true;
|
|
429
412
|
this._value = value;
|
|
430
413
|
cloneType({ source: this, target: this.value });
|
|
@@ -452,8 +435,7 @@ var CrdtLoroArray = class extends import_crdt5.AbstractCrdtType {
|
|
|
452
435
|
const containerType = getLoroContainerType(item);
|
|
453
436
|
const container = this.value.insertContainer(index + i, containerType);
|
|
454
437
|
cloneType({ source: item, target: container });
|
|
455
|
-
if (this._doc)
|
|
456
|
-
item.doc = this._doc;
|
|
438
|
+
if (this._doc) item.doc = this._doc;
|
|
457
439
|
return this;
|
|
458
440
|
});
|
|
459
441
|
(_a = this._doc) == null ? void 0 : _a.value.commit();
|
|
@@ -469,8 +451,7 @@ var CrdtLoroArray = class extends import_crdt5.AbstractCrdtType {
|
|
|
469
451
|
return this.value.toJson();
|
|
470
452
|
}
|
|
471
453
|
_guardInitialized() {
|
|
472
|
-
if (!this._initialized)
|
|
473
|
-
throw new Error("Array is not yet initialized");
|
|
454
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
474
455
|
}
|
|
475
456
|
};
|
|
476
457
|
|
|
@@ -511,31 +492,27 @@ var CrdtLoroDoc = class extends import_crdt6.AbstractCrdtDoc {
|
|
|
511
492
|
}
|
|
512
493
|
applyEncodedState(params) {
|
|
513
494
|
const update = typeof params.update === "string" ? (0, import_js_base64.toUint8Array)(params.update) : params.update;
|
|
514
|
-
if (!update)
|
|
515
|
-
return this;
|
|
495
|
+
if (!update) return this;
|
|
516
496
|
this.value.import(update);
|
|
517
497
|
return this;
|
|
518
498
|
}
|
|
519
499
|
batchApplyEncodedState(updates) {
|
|
520
500
|
var _a;
|
|
521
501
|
const _updates = updates.reduce((acc, item) => {
|
|
522
|
-
if (!item)
|
|
523
|
-
return acc;
|
|
502
|
+
if (!item) return acc;
|
|
524
503
|
if (typeof item === "string") {
|
|
525
504
|
acc.push((0, import_js_base64.toUint8Array)(item));
|
|
526
505
|
return acc;
|
|
527
506
|
}
|
|
528
507
|
if (typeof item === "object") {
|
|
529
508
|
const update = typeof item.update === "string" ? (0, import_js_base64.toUint8Array)(item.update) : item.update;
|
|
530
|
-
if (!update)
|
|
531
|
-
return acc;
|
|
509
|
+
if (!update) return acc;
|
|
532
510
|
acc.push(update);
|
|
533
511
|
return acc;
|
|
534
512
|
}
|
|
535
513
|
return acc;
|
|
536
514
|
}, []);
|
|
537
|
-
if (!_updates.length)
|
|
538
|
-
return this;
|
|
515
|
+
if (!_updates.length) return this;
|
|
539
516
|
if (_updates.length === 1) {
|
|
540
517
|
const update = (_a = _updates[0]) != null ? _a : null;
|
|
541
518
|
update && this.value.import(update);
|
|
@@ -562,8 +539,7 @@ var CrdtLoroDoc = class extends import_crdt6.AbstractCrdtDoc {
|
|
|
562
539
|
return;
|
|
563
540
|
}
|
|
564
541
|
get(key) {
|
|
565
|
-
if (typeof key === "undefined")
|
|
566
|
-
return this._storage;
|
|
542
|
+
if (typeof key === "undefined") return this._storage;
|
|
567
543
|
return this._storage[key];
|
|
568
544
|
}
|
|
569
545
|
getEncodedState() {
|
package/dist/index.mjs
CHANGED
|
@@ -56,8 +56,7 @@ var CrdtLoroMap = class extends AbstractCrdtType {
|
|
|
56
56
|
this.initialValue = value.map(([k, v]) => [k, v]);
|
|
57
57
|
}
|
|
58
58
|
set doc(doc2) {
|
|
59
|
-
if (this._doc)
|
|
60
|
-
throw new Error("Cannot overwrite array doc");
|
|
59
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
61
60
|
this._doc = doc2;
|
|
62
61
|
}
|
|
63
62
|
get size() {
|
|
@@ -67,8 +66,7 @@ var CrdtLoroMap = class extends AbstractCrdtType {
|
|
|
67
66
|
return this._value;
|
|
68
67
|
}
|
|
69
68
|
set value(value) {
|
|
70
|
-
if (this._initialized)
|
|
71
|
-
throw new Error("Cannot re-assign map");
|
|
69
|
+
if (this._initialized) throw new Error("Cannot re-assign map");
|
|
72
70
|
this._initialized = true;
|
|
73
71
|
this._value = value;
|
|
74
72
|
cloneType({ source: this, target: this.value });
|
|
@@ -94,8 +92,7 @@ var CrdtLoroMap = class extends AbstractCrdtType {
|
|
|
94
92
|
const containerType = getLoroContainerType(value);
|
|
95
93
|
const container = this.value.setContainer(prop, containerType);
|
|
96
94
|
cloneType({ source: value, target: container });
|
|
97
|
-
if (this._doc)
|
|
98
|
-
value.doc = this._doc;
|
|
95
|
+
if (this._doc) value.doc = this._doc;
|
|
99
96
|
(_b = this._doc) == null ? void 0 : _b.value.commit();
|
|
100
97
|
return this;
|
|
101
98
|
}
|
|
@@ -103,8 +100,7 @@ var CrdtLoroMap = class extends AbstractCrdtType {
|
|
|
103
100
|
return this.value.toJson();
|
|
104
101
|
}
|
|
105
102
|
_guardInitialized() {
|
|
106
|
-
if (!this._initialized)
|
|
107
|
-
throw new Error("Array is not yet initialized");
|
|
103
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
108
104
|
}
|
|
109
105
|
};
|
|
110
106
|
|
|
@@ -125,8 +121,7 @@ var CrdtLoroObject = class extends AbstractCrdtType2 {
|
|
|
125
121
|
this.initialValue = Object.entries(value).map(([k, v]) => [k, v]);
|
|
126
122
|
}
|
|
127
123
|
set doc(doc2) {
|
|
128
|
-
if (this._doc)
|
|
129
|
-
throw new Error("Cannot overwrite array doc");
|
|
124
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
130
125
|
this._doc = doc2;
|
|
131
126
|
}
|
|
132
127
|
get size() {
|
|
@@ -136,8 +131,7 @@ var CrdtLoroObject = class extends AbstractCrdtType2 {
|
|
|
136
131
|
return this._value;
|
|
137
132
|
}
|
|
138
133
|
set value(value) {
|
|
139
|
-
if (this._initialized)
|
|
140
|
-
throw new Error("Cannot re-assign map");
|
|
134
|
+
if (this._initialized) throw new Error("Cannot re-assign map");
|
|
141
135
|
this._initialized = true;
|
|
142
136
|
this._value = value;
|
|
143
137
|
cloneType({ source: this, target: this.value });
|
|
@@ -156,8 +150,7 @@ var CrdtLoroObject = class extends AbstractCrdtType2 {
|
|
|
156
150
|
const containerType = getLoroContainerType(value);
|
|
157
151
|
const container = this.value.setContainer(prop, containerType);
|
|
158
152
|
cloneType({ source: value, target: container });
|
|
159
|
-
if (this._doc)
|
|
160
|
-
value.doc = this._doc;
|
|
153
|
+
if (this._doc) value.doc = this._doc;
|
|
161
154
|
(_b = this._doc) == null ? void 0 : _b.value.commit();
|
|
162
155
|
return this;
|
|
163
156
|
}
|
|
@@ -165,8 +158,7 @@ var CrdtLoroObject = class extends AbstractCrdtType2 {
|
|
|
165
158
|
return this.value.toJson();
|
|
166
159
|
}
|
|
167
160
|
_guardInitialized() {
|
|
168
|
-
if (!this._initialized)
|
|
169
|
-
throw new Error("Array is not yet initialized");
|
|
161
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
170
162
|
}
|
|
171
163
|
};
|
|
172
164
|
|
|
@@ -188,8 +180,7 @@ var CrdtLoroText = class extends AbstractCrdtType3 {
|
|
|
188
180
|
this.value = new LoroText();
|
|
189
181
|
}
|
|
190
182
|
set doc(doc2) {
|
|
191
|
-
if (this._doc)
|
|
192
|
-
throw new Error("Cannot overwrite array doc");
|
|
183
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
193
184
|
this._doc = doc2;
|
|
194
185
|
}
|
|
195
186
|
get length() {
|
|
@@ -199,8 +190,7 @@ var CrdtLoroText = class extends AbstractCrdtType3 {
|
|
|
199
190
|
return this._value;
|
|
200
191
|
}
|
|
201
192
|
set value(value) {
|
|
202
|
-
if (this._initialized)
|
|
203
|
-
throw new Error("Cannot re-assign text");
|
|
193
|
+
if (this._initialized) throw new Error("Cannot re-assign text");
|
|
204
194
|
this._initialized = true;
|
|
205
195
|
this._value = value;
|
|
206
196
|
cloneType({ source: this, target: this.value });
|
|
@@ -223,8 +213,7 @@ var CrdtLoroText = class extends AbstractCrdtType3 {
|
|
|
223
213
|
return this.value.toString();
|
|
224
214
|
}
|
|
225
215
|
_guardInitialized() {
|
|
226
|
-
if (!this._initialized)
|
|
227
|
-
throw new Error("Array is not yet initialized");
|
|
216
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
228
217
|
}
|
|
229
218
|
};
|
|
230
219
|
|
|
@@ -367,14 +356,10 @@ var cloneType = (params) => {
|
|
|
367
356
|
|
|
368
357
|
// src/shared/getLoroContainerType.ts
|
|
369
358
|
var getLoroContainerType = (value) => {
|
|
370
|
-
if (value instanceof CrdtLoroArray)
|
|
371
|
-
|
|
372
|
-
if (value instanceof
|
|
373
|
-
|
|
374
|
-
if (value instanceof CrdtLoroObject)
|
|
375
|
-
return "Map";
|
|
376
|
-
if (value instanceof CrdtLoroText)
|
|
377
|
-
return "Text";
|
|
359
|
+
if (value instanceof CrdtLoroArray) return "List";
|
|
360
|
+
if (value instanceof CrdtLoroMap) return "Map";
|
|
361
|
+
if (value instanceof CrdtLoroObject) return "Map";
|
|
362
|
+
if (value instanceof CrdtLoroText) return "Text";
|
|
378
363
|
throw new Error("This type is not yet supported");
|
|
379
364
|
};
|
|
380
365
|
|
|
@@ -393,8 +378,7 @@ var CrdtLoroArray = class extends AbstractCrdtType5 {
|
|
|
393
378
|
this.initialValue = value.slice();
|
|
394
379
|
}
|
|
395
380
|
set doc(doc2) {
|
|
396
|
-
if (this._doc)
|
|
397
|
-
throw new Error("Cannot overwrite array doc");
|
|
381
|
+
if (this._doc) throw new Error("Cannot overwrite array doc");
|
|
398
382
|
this._doc = doc2;
|
|
399
383
|
}
|
|
400
384
|
get length() {
|
|
@@ -404,8 +388,7 @@ var CrdtLoroArray = class extends AbstractCrdtType5 {
|
|
|
404
388
|
return this._value;
|
|
405
389
|
}
|
|
406
390
|
set value(value) {
|
|
407
|
-
if (this._initialized)
|
|
408
|
-
throw new Error("Cannot re-assign array");
|
|
391
|
+
if (this._initialized) throw new Error("Cannot re-assign array");
|
|
409
392
|
this._initialized = true;
|
|
410
393
|
this._value = value;
|
|
411
394
|
cloneType({ source: this, target: this.value });
|
|
@@ -433,8 +416,7 @@ var CrdtLoroArray = class extends AbstractCrdtType5 {
|
|
|
433
416
|
const containerType = getLoroContainerType(item);
|
|
434
417
|
const container = this.value.insertContainer(index + i, containerType);
|
|
435
418
|
cloneType({ source: item, target: container });
|
|
436
|
-
if (this._doc)
|
|
437
|
-
item.doc = this._doc;
|
|
419
|
+
if (this._doc) item.doc = this._doc;
|
|
438
420
|
return this;
|
|
439
421
|
});
|
|
440
422
|
(_a = this._doc) == null ? void 0 : _a.value.commit();
|
|
@@ -450,8 +432,7 @@ var CrdtLoroArray = class extends AbstractCrdtType5 {
|
|
|
450
432
|
return this.value.toJson();
|
|
451
433
|
}
|
|
452
434
|
_guardInitialized() {
|
|
453
|
-
if (!this._initialized)
|
|
454
|
-
throw new Error("Array is not yet initialized");
|
|
435
|
+
if (!this._initialized) throw new Error("Array is not yet initialized");
|
|
455
436
|
}
|
|
456
437
|
};
|
|
457
438
|
|
|
@@ -492,31 +473,27 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
|
|
|
492
473
|
}
|
|
493
474
|
applyEncodedState(params) {
|
|
494
475
|
const update = typeof params.update === "string" ? toUint8Array(params.update) : params.update;
|
|
495
|
-
if (!update)
|
|
496
|
-
return this;
|
|
476
|
+
if (!update) return this;
|
|
497
477
|
this.value.import(update);
|
|
498
478
|
return this;
|
|
499
479
|
}
|
|
500
480
|
batchApplyEncodedState(updates) {
|
|
501
481
|
var _a;
|
|
502
482
|
const _updates = updates.reduce((acc, item) => {
|
|
503
|
-
if (!item)
|
|
504
|
-
return acc;
|
|
483
|
+
if (!item) return acc;
|
|
505
484
|
if (typeof item === "string") {
|
|
506
485
|
acc.push(toUint8Array(item));
|
|
507
486
|
return acc;
|
|
508
487
|
}
|
|
509
488
|
if (typeof item === "object") {
|
|
510
489
|
const update = typeof item.update === "string" ? toUint8Array(item.update) : item.update;
|
|
511
|
-
if (!update)
|
|
512
|
-
return acc;
|
|
490
|
+
if (!update) return acc;
|
|
513
491
|
acc.push(update);
|
|
514
492
|
return acc;
|
|
515
493
|
}
|
|
516
494
|
return acc;
|
|
517
495
|
}, []);
|
|
518
|
-
if (!_updates.length)
|
|
519
|
-
return this;
|
|
496
|
+
if (!_updates.length) return this;
|
|
520
497
|
if (_updates.length === 1) {
|
|
521
498
|
const update = (_a = _updates[0]) != null ? _a : null;
|
|
522
499
|
update && this.value.import(update);
|
|
@@ -543,8 +520,7 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
|
|
|
543
520
|
return;
|
|
544
521
|
}
|
|
545
522
|
get(key) {
|
|
546
|
-
if (typeof key === "undefined")
|
|
547
|
-
return this._storage;
|
|
523
|
+
if (typeof key === "undefined") return this._storage;
|
|
548
524
|
return this._storage[key];
|
|
549
525
|
}
|
|
550
526
|
getEncodedState() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/crdt-loro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "loro for @pluv/io",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"js-base64": "^3.7.7",
|
|
21
|
-
"@pluv/crdt": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
21
|
+
"@pluv/crdt": "^0.19.0",
|
|
22
|
+
"@pluv/types": "^0.19.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"loro-crdt": "^0.11.0"
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^8.57.0",
|
|
29
29
|
"loro-crdt": "^0.11.1",
|
|
30
|
-
"tsup": "^8.0
|
|
30
|
+
"tsup": "^8.1.0",
|
|
31
31
|
"typescript": "^5.4.5",
|
|
32
|
-
"@pluv/tsconfig": "^0.
|
|
33
|
-
"eslint-config-pluv": "^0.
|
|
32
|
+
"@pluv/tsconfig": "^0.19.0",
|
|
33
|
+
"eslint-config-pluv": "^0.19.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|