@yorkie-js/sdk 0.7.3 → 0.7.4

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.
@@ -1882,6 +1882,16 @@ declare class CRDTTree extends CRDTElement implements GCParent {
1882
1882
  private indexTree;
1883
1883
  private nodeMapByID;
1884
1884
  constructor(root: CRDTTreeNode, createdAt: TimeTicket);
1885
+ /**
1886
+ * `rebuildMergeState` reconstructs the `mergedInto` cache on source
1887
+ * parents from the persisted `mergedFrom` field on moved children.
1888
+ * For snapshots written before `mergedAt` was added to the proto,
1889
+ * it also falls back to the source's `removedAt` — an approximation
1890
+ * that may be wrong if the source was later overwritten by a
1891
+ * concurrent delete, but this is the best we can do without the
1892
+ * persisted merge ticket.
1893
+ */
1894
+ private rebuildMergeState;
1885
1895
  /**
1886
1896
  * `create` creates a new instance of `CRDTTree`.
1887
1897
  */
@@ -1890,6 +1900,19 @@ declare class CRDTTree extends CRDTElement implements GCParent {
1890
1900
  * `findFloorNode` finds node of given id.
1891
1901
  */
1892
1902
  findFloorNode(id: CRDTTreeNodeID): CRDTTreeNode | undefined;
1903
+ /**
1904
+ * `advancePastUnknownSplitSiblings` follows the insNextID chain of the
1905
+ * given node, advancing past element-type split siblings that the editing
1906
+ * client did not know about (not in versionVector).
1907
+ */
1908
+ private advancePastUnknownSplitSiblings;
1909
+ /**
1910
+ * `hasUnknownSplitSibling` checks whether the given element node has a
1911
+ * split sibling (via insNextID) whose creation the editor did not know
1912
+ * about. Used to prevent styling via End tokens when a concurrent split
1913
+ * extended the range into the split sibling.
1914
+ */
1915
+ private hasUnknownSplitSibling;
1893
1916
  /**
1894
1917
  * `registerNode` registers the given node to the tree.
1895
1918
  */
@@ -2079,6 +2102,29 @@ declare class CRDTTreeNode extends IndexTreeNode<CRDTTreeNode> implements GCPare
2079
2102
  * `insNextID` is the previous node id of this node after the node is split.
2080
2103
  */
2081
2104
  insNextID?: CRDTTreeNodeID;
2105
+ /**
2106
+ * `mergedFrom` records the source parent's ID when this node was moved
2107
+ * by a concurrent merge. Persisted in the snapshot encoding as the
2108
+ * witness of the merge relationship.
2109
+ */
2110
+ mergedFrom?: CRDTTreeNodeID;
2111
+ /**
2112
+ * `mergedAt` records the immutable ticket of the merge operation.
2113
+ * Persisted alongside `mergedFrom` because the source parent's
2114
+ * `removedAt` may be overwritten by later LWW tombstones and thus
2115
+ * cannot serve as the merge-time causal boundary for splitElement's
2116
+ * Fix 8 version-vector check.
2117
+ */
2118
+ mergedAt?: TimeTicket;
2119
+ /**
2120
+ * `mergedInto` is a runtime cache set on the source parent pointing
2121
+ * at the merge target. Set locally during merge execution and rebuilt
2122
+ * from `mergedFrom` on snapshot load. Used for the fast
2123
+ * "is this tombstoned parent a merge source?" check in
2124
+ * `FindTreeNodesWithSplitText`; the alternative (scanning
2125
+ * `nodeMapByID` on every position resolution) would be too expensive.
2126
+ */
2127
+ mergedInto?: CRDTTreeNodeID;
2082
2128
  _value: string;
2083
2129
  constructor(id: CRDTTreeNodeID, type: string, opts?: string | Array<CRDTTreeNode>, attributes?: RHT, removedAt?: TimeTicket);
2084
2130
  /**
@@ -2124,7 +2170,7 @@ declare class CRDTTreeNode extends IndexTreeNode<CRDTTreeNode> implements GCPare
2124
2170
  /**
2125
2171
  * `split` splits the given offset of this node.
2126
2172
  */
2127
- split(tree: CRDTTree, offset: number, issueTimeTicket?: () => TimeTicket): [CRDTTreeNode | undefined, DataSize];
2173
+ split(tree: CRDTTree, offset: number, issueTimeTicket?: () => TimeTicket, versionVector?: VersionVector): [CRDTTreeNode | undefined, DataSize];
2128
2174
  /**
2129
2175
  * `getCreatedAt` returns the creation time of this element.
2130
2176
  */
@@ -3493,10 +3539,17 @@ declare abstract class IndexTreeNode<T extends IndexTreeNode<T>> {
3493
3539
  * In this method, the child is physically removed from the tree.
3494
3540
  */
3495
3541
  removeChild(child: T): void;
3542
+ /**
3543
+ * `detachChild` removes the given child from this node's children list
3544
+ * and updates both visibleSize and totalSize. Unlike `removeChild` which
3545
+ * is used for GC purge of tombstoned nodes, `detachChild` is used for
3546
+ * moving alive nodes between parents.
3547
+ */
3548
+ detachChild(child: T): void;
3496
3549
  /**
3497
3550
  * `splitElement` splits the given element at the given offset.
3498
3551
  */
3499
- splitElement(offset: number, issueTimeTicket: () => TimeTicket): [T | undefined, DataSize];
3552
+ splitElement(offset: number, issueTimeTicket: () => TimeTicket, versionVector?: VersionVector): [T | undefined, DataSize];
3500
3553
  /**
3501
3554
  * `insertAfterInternal` inserts the given node after the given child.
3502
3555
  * This method does not update the size of the ancestors.
@@ -6473,6 +6526,22 @@ declare type TreeNode_3 = Message<"yorkie.v1.TreeNode"> & {
6473
6526
  attributes: {
6474
6527
  [key: string]: NodeAttr;
6475
6528
  };
6529
+ /**
6530
+ * merged_from is set when this node was moved to a new parent by a
6531
+ * concurrent merge. It points to the source parent's ID.
6532
+ *
6533
+ * @generated from field: yorkie.v1.TreeNodeID merged_from = 9;
6534
+ */
6535
+ mergedFrom?: TreeNodeID;
6536
+ /**
6537
+ * merged_at records the immutable ticket of the merge operation.
6538
+ * Stored alongside merged_from because the source parent's removed_at
6539
+ * may be overwritten by later LWW tombstones and thus cannot serve as
6540
+ * the merge-time causal boundary for SplitElement.
6541
+ *
6542
+ * @generated from field: yorkie.v1.TimeTicket merged_at = 10;
6543
+ */
6544
+ mergedAt?: TimeTicket_2;
6476
6545
  };
6477
6546
 
6478
6547
  /**