@yorkie-js/react 0.6.24 → 0.6.26
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.
|
@@ -8370,12 +8370,12 @@ class ElementRHT {
|
|
|
8370
8370
|
set(key, value, executedAt) {
|
|
8371
8371
|
let removed;
|
|
8372
8372
|
const node = this.nodeMapByKey.get(key);
|
|
8373
|
-
if (node
|
|
8373
|
+
if (!!node && !node.isRemoved() && node.remove(executedAt)) {
|
|
8374
8374
|
removed = node.getValue();
|
|
8375
8375
|
}
|
|
8376
8376
|
const newNode = ElementRHTNode.of(key, value);
|
|
8377
8377
|
this.nodeMapByCreatedAt.set(value.getCreatedAt().toIDString(), newNode);
|
|
8378
|
-
if (node
|
|
8378
|
+
if (!node || executedAt.after(node.getValue().getPositionedAt())) {
|
|
8379
8379
|
this.nodeMapByKey.set(key, newNode);
|
|
8380
8380
|
value.setMovedAt(executedAt);
|
|
8381
8381
|
}
|
|
@@ -8429,7 +8429,7 @@ class ElementRHT {
|
|
|
8429
8429
|
*/
|
|
8430
8430
|
deleteByKey(key, removedAt) {
|
|
8431
8431
|
const node = this.nodeMapByKey.get(key);
|
|
8432
|
-
if (node
|
|
8432
|
+
if (!node) {
|
|
8433
8433
|
return;
|
|
8434
8434
|
}
|
|
8435
8435
|
if (!node.remove(removedAt)) {
|
|
@@ -8442,7 +8442,7 @@ class ElementRHT {
|
|
|
8442
8442
|
*/
|
|
8443
8443
|
has(key) {
|
|
8444
8444
|
const node = this.nodeMapByKey.get(key);
|
|
8445
|
-
if (node
|
|
8445
|
+
if (!node) {
|
|
8446
8446
|
return false;
|
|
8447
8447
|
}
|
|
8448
8448
|
return !node.isRemoved();
|
|
@@ -14413,6 +14413,12 @@ class VersionVector {
|
|
|
14413
14413
|
get(actorID) {
|
|
14414
14414
|
return this.vector.get(actorID);
|
|
14415
14415
|
}
|
|
14416
|
+
/**
|
|
14417
|
+
* `has` checks if the given actor exists in the VersionVector.
|
|
14418
|
+
*/
|
|
14419
|
+
has(actorID) {
|
|
14420
|
+
return this.vector.has(actorID);
|
|
14421
|
+
}
|
|
14416
14422
|
/**
|
|
14417
14423
|
* `maxLamport` returns max lamport value from vector
|
|
14418
14424
|
*/
|
|
@@ -14570,7 +14576,6 @@ class ChangeID {
|
|
|
14570
14576
|
*/
|
|
14571
14577
|
setClocks(otherLamport, vector) {
|
|
14572
14578
|
const lamport = otherLamport > this.lamport ? otherLamport + 1n : this.lamport + 1n;
|
|
14573
|
-
vector.unset(InitialActorID);
|
|
14574
14579
|
const maxVersionVector = this.versionVector.max(vector);
|
|
14575
14580
|
maxVersionVector.set(this.actor, lamport);
|
|
14576
14581
|
return ChangeID.of(this.clientSeq, lamport, this.actor, maxVersionVector);
|
|
@@ -15286,11 +15291,12 @@ class RGATreeSplitNode extends SplayNode {
|
|
|
15286
15291
|
/**
|
|
15287
15292
|
* `canDelete` checks if node is able to delete.
|
|
15288
15293
|
*/
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
+
canRemove(creationKnown) {
|
|
15295
|
+
if (!creationKnown) {
|
|
15296
|
+
return false;
|
|
15297
|
+
}
|
|
15298
|
+
if (!this.removedAt) {
|
|
15299
|
+
return true;
|
|
15294
15300
|
}
|
|
15295
15301
|
return false;
|
|
15296
15302
|
}
|
|
@@ -15302,10 +15308,22 @@ class RGATreeSplitNode extends SplayNode {
|
|
|
15302
15308
|
return nodeExisted && (!this.removedAt || editedAt.after(this.removedAt));
|
|
15303
15309
|
}
|
|
15304
15310
|
/**
|
|
15305
|
-
* `
|
|
15311
|
+
* `setRemovedAt` sets the remove time of this node.
|
|
15306
15312
|
*/
|
|
15307
|
-
|
|
15308
|
-
this.removedAt =
|
|
15313
|
+
setRemovedAt(removedAt) {
|
|
15314
|
+
this.removedAt = removedAt;
|
|
15315
|
+
}
|
|
15316
|
+
/**
|
|
15317
|
+
* `remove` removes the node of the given edited time.
|
|
15318
|
+
*/
|
|
15319
|
+
remove(removedAt, tombstoneKnown) {
|
|
15320
|
+
if (!this.removedAt) {
|
|
15321
|
+
this.removedAt = removedAt;
|
|
15322
|
+
return;
|
|
15323
|
+
}
|
|
15324
|
+
if (!tombstoneKnown && removedAt.after(this.removedAt)) {
|
|
15325
|
+
this.removedAt = removedAt;
|
|
15326
|
+
}
|
|
15309
15327
|
}
|
|
15310
15328
|
/**
|
|
15311
15329
|
* `createRange` creates ranges of RGATreeSplitPos.
|
|
@@ -15636,43 +15654,34 @@ class RGATreeSplit {
|
|
|
15636
15654
|
subDataSize(diff, prvSize);
|
|
15637
15655
|
return [splitNode, diff];
|
|
15638
15656
|
}
|
|
15639
|
-
deleteNodes(candidates, editedAt,
|
|
15657
|
+
deleteNodes(candidates, editedAt, vector) {
|
|
15640
15658
|
if (!candidates.length) {
|
|
15641
15659
|
return [[], /* @__PURE__ */ new Map()];
|
|
15642
15660
|
}
|
|
15643
|
-
const
|
|
15644
|
-
|
|
15645
|
-
editedAt,
|
|
15646
|
-
versionVector
|
|
15647
|
-
);
|
|
15648
|
-
const removedNodes = /* @__PURE__ */ new Map();
|
|
15649
|
-
const changes = this.makeChanges(nodesToKeep, editedAt);
|
|
15650
|
-
for (const node of nodesToDelete) {
|
|
15651
|
-
removedNodes.set(node.getID().toIDString(), node);
|
|
15652
|
-
node.remove(editedAt);
|
|
15653
|
-
}
|
|
15654
|
-
this.deleteIndexNodes(nodesToKeep);
|
|
15655
|
-
return [changes, removedNodes];
|
|
15656
|
-
}
|
|
15657
|
-
filterNodes(candidates, editedAt, versionVector) {
|
|
15658
|
-
const nodesToDelete = [];
|
|
15661
|
+
const isLocal = vector === void 0;
|
|
15662
|
+
const nodesToRemove = [];
|
|
15659
15663
|
const nodesToKeep = [];
|
|
15660
15664
|
const [leftEdge, rightEdge] = this.findEdgesOfCandidates(candidates);
|
|
15661
15665
|
nodesToKeep.push(leftEdge);
|
|
15662
15666
|
for (const node of candidates) {
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
if (versionVector != void 0) {
|
|
15666
|
-
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
15667
|
-
}
|
|
15668
|
-
if (node.canDelete(editedAt, clientLamportAtChange)) {
|
|
15669
|
-
nodesToDelete.push(node);
|
|
15667
|
+
if (node.canRemove(isLocal || vector.afterOrEqual(node.getCreatedAt()))) {
|
|
15668
|
+
nodesToRemove.push(node);
|
|
15670
15669
|
} else {
|
|
15671
15670
|
nodesToKeep.push(node);
|
|
15672
15671
|
}
|
|
15673
15672
|
}
|
|
15674
15673
|
nodesToKeep.push(rightEdge);
|
|
15675
|
-
|
|
15674
|
+
const changes = this.makeChanges(nodesToKeep, editedAt);
|
|
15675
|
+
const removedNodes = /* @__PURE__ */ new Map();
|
|
15676
|
+
for (const node of nodesToRemove) {
|
|
15677
|
+
removedNodes.set(node.getID().toIDString(), node);
|
|
15678
|
+
node.remove(
|
|
15679
|
+
editedAt,
|
|
15680
|
+
node.isRemoved() && (isLocal || vector.afterOrEqual(node.getRemovedAt()))
|
|
15681
|
+
);
|
|
15682
|
+
}
|
|
15683
|
+
this.deleteIndexNodes(nodesToKeep);
|
|
15684
|
+
return [changes, removedNodes];
|
|
15676
15685
|
}
|
|
15677
15686
|
/**
|
|
15678
15687
|
* `findEdgesOfCandidates` finds the edges outside `candidates`,
|
|
@@ -16970,7 +16979,7 @@ function fromTextNode(pbTextNode) {
|
|
|
16970
16979
|
fromTextNodeID(pbTextNode.id),
|
|
16971
16980
|
textValue
|
|
16972
16981
|
);
|
|
16973
|
-
textNode.
|
|
16982
|
+
textNode.setRemovedAt(fromTimeTicket(pbTextNode.removedAt));
|
|
16974
16983
|
return textNode;
|
|
16975
16984
|
}
|
|
16976
16985
|
function fromTreePos(pbTreePos) {
|
|
@@ -17508,6 +17517,7 @@ class Attachment {
|
|
|
17508
17517
|
__publicField(this, "docID");
|
|
17509
17518
|
__publicField(this, "syncMode");
|
|
17510
17519
|
__publicField(this, "remoteChangeEventReceived");
|
|
17520
|
+
__publicField(this, "cancelled");
|
|
17511
17521
|
__publicField(this, "watchStream");
|
|
17512
17522
|
__publicField(this, "watchLoopTimerID");
|
|
17513
17523
|
__publicField(this, "watchAbortController");
|
|
@@ -17517,6 +17527,7 @@ class Attachment {
|
|
|
17517
17527
|
this.docID = docID;
|
|
17518
17528
|
this.syncMode = syncMode;
|
|
17519
17529
|
this.remoteChangeEventReceived = false;
|
|
17530
|
+
this.cancelled = false;
|
|
17520
17531
|
this.unsubscribeBroadcastEvent = unsubscribeBroacastEvent;
|
|
17521
17532
|
}
|
|
17522
17533
|
/**
|
|
@@ -17553,10 +17564,12 @@ class Attachment {
|
|
|
17553
17564
|
[this.watchStream, this.watchAbortController] = await watchStreamCreator(() => {
|
|
17554
17565
|
this.watchStream = void 0;
|
|
17555
17566
|
this.watchAbortController = void 0;
|
|
17556
|
-
this.
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17567
|
+
if (!this.cancelled) {
|
|
17568
|
+
this.watchLoopTimerID = setTimeout(
|
|
17569
|
+
doLoop,
|
|
17570
|
+
this.reconnectStreamDelay
|
|
17571
|
+
);
|
|
17572
|
+
}
|
|
17560
17573
|
});
|
|
17561
17574
|
} catch {
|
|
17562
17575
|
}
|
|
@@ -17567,6 +17580,7 @@ class Attachment {
|
|
|
17567
17580
|
* `cancelWatchStream` cancels the watch stream.
|
|
17568
17581
|
*/
|
|
17569
17582
|
cancelWatchStream() {
|
|
17583
|
+
this.cancelled = true;
|
|
17570
17584
|
if (this.watchStream && this.watchAbortController) {
|
|
17571
17585
|
this.watchAbortController.abort();
|
|
17572
17586
|
this.watchStream = void 0;
|
|
@@ -17625,7 +17639,7 @@ function validateValue(value, rule) {
|
|
|
17625
17639
|
errors: [
|
|
17626
17640
|
{
|
|
17627
17641
|
path: rule.path,
|
|
17628
|
-
message: `
|
|
17642
|
+
message: `expected object at path ${rule.path}`
|
|
17629
17643
|
}
|
|
17630
17644
|
]
|
|
17631
17645
|
};
|
|
@@ -17638,7 +17652,7 @@ function validateValue(value, rule) {
|
|
|
17638
17652
|
errors: [
|
|
17639
17653
|
{
|
|
17640
17654
|
path: rule.path,
|
|
17641
|
-
message: `
|
|
17655
|
+
message: `expected array at path ${rule.path}`
|
|
17642
17656
|
}
|
|
17643
17657
|
]
|
|
17644
17658
|
};
|
|
@@ -17651,7 +17665,7 @@ function validateValue(value, rule) {
|
|
|
17651
17665
|
errors: [
|
|
17652
17666
|
{
|
|
17653
17667
|
path: rule.path,
|
|
17654
|
-
message: `
|
|
17668
|
+
message: `expected yorkie.Text at path ${rule.path}`
|
|
17655
17669
|
}
|
|
17656
17670
|
]
|
|
17657
17671
|
};
|
|
@@ -17664,7 +17678,7 @@ function validateValue(value, rule) {
|
|
|
17664
17678
|
errors: [
|
|
17665
17679
|
{
|
|
17666
17680
|
path: rule.path,
|
|
17667
|
-
message: `
|
|
17681
|
+
message: `expected yorkie.Tree at path ${rule.path}`
|
|
17668
17682
|
}
|
|
17669
17683
|
]
|
|
17670
17684
|
};
|
|
@@ -17677,7 +17691,7 @@ function validateValue(value, rule) {
|
|
|
17677
17691
|
errors: [
|
|
17678
17692
|
{
|
|
17679
17693
|
path: rule.path,
|
|
17680
|
-
message: `
|
|
17694
|
+
message: `expected yorkie.Counter at path ${rule.path}`
|
|
17681
17695
|
}
|
|
17682
17696
|
]
|
|
17683
17697
|
};
|
|
@@ -17721,7 +17735,7 @@ function validatePrimitiveValue(value, rule) {
|
|
|
17721
17735
|
errors: [
|
|
17722
17736
|
{
|
|
17723
17737
|
path: rule.path,
|
|
17724
|
-
message: `
|
|
17738
|
+
message: `expected ${rule.type} at path ${rule.path}`
|
|
17725
17739
|
}
|
|
17726
17740
|
]
|
|
17727
17741
|
};
|
|
@@ -21572,7 +21586,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
21572
21586
|
};
|
|
21573
21587
|
}
|
|
21574
21588
|
const name$1 = "@yorkie-js/sdk";
|
|
21575
|
-
const version$1 = "0.6.
|
|
21589
|
+
const version$1 = "0.6.26";
|
|
21576
21590
|
const pkg$1 = {
|
|
21577
21591
|
name: name$1,
|
|
21578
21592
|
version: version$1
|
|
@@ -22335,6 +22349,7 @@ class Client {
|
|
|
22335
22349
|
return;
|
|
22336
22350
|
}
|
|
22337
22351
|
attachment.cancelWatchStream();
|
|
22352
|
+
attachment.doc.resetOnlineClients();
|
|
22338
22353
|
attachment.unsubscribeBroadcastEvent();
|
|
22339
22354
|
this.attachmentMap.delete(docKey);
|
|
22340
22355
|
}
|
|
@@ -22462,7 +22477,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
22462
22477
|
};
|
|
22463
22478
|
}
|
|
22464
22479
|
const name = "@yorkie-js/react";
|
|
22465
|
-
const version = "0.6.
|
|
22480
|
+
const version = "0.6.26";
|
|
22466
22481
|
const pkg = {
|
|
22467
22482
|
name,
|
|
22468
22483
|
version
|