@yorkie-js/sdk 0.6.41-rc3 → 0.6.42

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.
@@ -281,6 +281,7 @@ export declare class Change<P extends Indexable> {
281
281
  * `execute` executes the operations of this change to the given root.
282
282
  */
283
283
  execute(root: CRDTRoot, presences: Map<ActorID, P>, source: OpSource): {
284
+ operations: Array<Operation>;
284
285
  opInfos: Array<OpInfo>;
285
286
  reverseOps: Array<HistoryOperation<P>>;
286
287
  };
@@ -1712,7 +1713,13 @@ declare class CRDTText<A extends Indexable = Indexable> extends CRDTElement {
1712
1713
  /**
1713
1714
  * `edit` edits the given range with the given value and attributes.
1714
1715
  */
1715
- edit(range: RGATreeSplitPosRange, content: string, editedAt: TimeTicket, attributes?: Record<string, string>, versionVector?: VersionVector): [Array<TextChange<A>>, Array<GCPair>, DataSize, RGATreeSplitPosRange];
1716
+ edit(range: RGATreeSplitPosRange, content: string, editedAt: TimeTicket, attributes?: Record<string, string>, versionVector?: VersionVector): [
1717
+ Array<TextChange<A>>,
1718
+ Array<GCPair>,
1719
+ DataSize,
1720
+ RGATreeSplitPosRange,
1721
+ Array<CRDTTextValue>
1722
+ ];
1716
1723
  /**
1717
1724
  * `setStyle` applies the style of the given range.
1718
1725
  * 01. split nodes with from and to
@@ -1739,6 +1746,14 @@ declare class CRDTText<A extends Indexable = Indexable> extends CRDTElement {
1739
1746
  * `getTreeByID` returns the tree by ID for debugging.
1740
1747
  */
1741
1748
  getTreeByID(): LLRBTree<RGATreeSplitNodeID, RGATreeSplitNode<CRDTTextValue>>;
1749
+ /**
1750
+ * `refinePos` refines the given RGATreeSplitPos.
1751
+ */
1752
+ refinePos(pos: RGATreeSplitPos): RGATreeSplitPos;
1753
+ /**
1754
+ * `normalizePos` normalizes the given RGATreeSplitPos.
1755
+ */
1756
+ normalizePos(pos: RGATreeSplitPos): RGATreeSplitPos;
1742
1757
  /**
1743
1758
  * `getDataSize` returns the data usage of this element.
1744
1759
  */
@@ -1780,6 +1795,10 @@ declare class CRDTText<A extends Indexable = Indexable> extends CRDTElement {
1780
1795
  * `findIndexesFromRange` returns pair of integer offsets of the given range.
1781
1796
  */
1782
1797
  findIndexesFromRange(range: RGATreeSplitPosRange): [number, number];
1798
+ /**
1799
+ * `posToIndex` converts the given position to index.
1800
+ */
1801
+ posToIndex(pos: RGATreeSplitPos, preferToLeft?: boolean): number;
1783
1802
  /**
1784
1803
  * `getGCPairs` returns the pairs of GC.
1785
1804
  */
@@ -2895,6 +2914,7 @@ declare class Document_2<R, P extends Indexable = Indexable> implements Attachab
2895
2914
  * `applySnapshot` applies the given snapshot into this document.
2896
2915
  */
2897
2916
  applySnapshot(serverSeq: bigint, snapshotVector: VersionVector, snapshot?: Uint8Array, clientSeq?: number): void;
2917
+ private clearHistory;
2898
2918
  /**
2899
2919
  * `applyChanges` applies the given changes into this document.
2900
2920
  */
@@ -4944,9 +4964,15 @@ declare class RGATreeSplit<T extends RGATreeSplitValue> implements GCParent {
4944
4964
  * @param range - range of RGATreeSplitNode
4945
4965
  * @param editedAt - edited time
4946
4966
  * @param value - value
4947
- * @returns `[RGATreeSplitPos, Array<GCPair>, Array<Change>]`
4948
- */
4949
- edit(range: RGATreeSplitPosRange, editedAt: TimeTicket, value?: T, versionVector?: VersionVector): [RGATreeSplitPos, Array<GCPair>, DataSize, Array<ValueChange<T>>];
4967
+ * @returns `[RGATreeSplitPos, Array<GCPair>, DataSize, Array<ValueChange<T>>, Array<T>]`
4968
+ */
4969
+ edit(range: RGATreeSplitPosRange, editedAt: TimeTicket, value?: T, versionVector?: VersionVector): [
4970
+ RGATreeSplitPos,
4971
+ Array<GCPair>,
4972
+ DataSize,
4973
+ Array<ValueChange<T>>,
4974
+ Array<T>
4975
+ ];
4950
4976
  /**
4951
4977
  * `indexToPos` finds RGATreeSplitPos of given offset.
4952
4978
  */
@@ -4988,6 +5014,32 @@ declare class RGATreeSplit<T extends RGATreeSplitValue> implements GCParent {
4988
5014
  * `deepcopy` copies itself deeply.
4989
5015
  */
4990
5016
  deepcopy(): RGATreeSplit<T>;
5017
+ /**
5018
+ * `normalizePos` converts a local position `(id, rel)` into a single
5019
+ * absolute offset measured from the head `(0:0)` of the physical chain.
5020
+ */
5021
+ normalizePos(pos: RGATreeSplitPos): RGATreeSplitPos;
5022
+ /**
5023
+ * `refinePos` remaps the given pos to the current split chain.
5024
+ *
5025
+ * - Traverses the physical `next` chain (not `insNext`).
5026
+ * - Counts only live characters: removed nodes are treated as length 0.
5027
+ * - If the given offset exceeds the length of the current node,
5028
+ * it moves forward through `next` nodes, subtracting lengths,
5029
+ * until the offset fits in a live node.
5030
+ * - If it runs out of nodes, it snaps to the end of the last node.
5031
+ *
5032
+ * Example:
5033
+ * Before split: ["12345"](1:2:0), pos = (1:2:0, rel=5)
5034
+ * After split : ["1"](1:2:0) - ["23"](1:2:1) - ["45"](1:2:3)
5035
+ * refinePos(pos) -> (1:2:3, rel=2)
5036
+ *
5037
+ * Example:
5038
+ * ["12"](1:2:0, live) and pos = (1:2:0, rel=4)
5039
+ * refinePos(pos) -> points two chars after "12",
5040
+ * i.e. advances into following nodes, skipping removed ones.
5041
+ */
5042
+ refinePos(pos: RGATreeSplitPos): RGATreeSplitPos;
4991
5043
  /**
4992
5044
  * `toTestString` returns a String containing the meta data of the node
4993
5045
  * for debugging purpose.