@fluidframework/merge-tree 2.0.2 → 2.1.0-276326
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/api-extractor/api-extractor.legacy.json +4 -0
- package/api-report/merge-tree.beta.api.md +0 -11
- package/api-report/{merge-tree.alpha.api.md → merge-tree.legacy.alpha.api.md} +0 -11
- package/api-report/merge-tree.public.api.md +0 -11
- package/dist/attributionCollection.d.ts +5 -0
- package/dist/attributionCollection.d.ts.map +1 -1
- package/dist/attributionCollection.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/localReference.d.ts +4 -0
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js +2 -0
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts +14 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +32 -7
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeDeltaCallback.d.ts +8 -0
- package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
- package/dist/mergeTreeDeltaCallback.js +1 -0
- package/dist/mergeTreeDeltaCallback.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +12 -0
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +5 -0
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/mergeTreeTracking.d.ts +4 -0
- package/dist/mergeTreeTracking.d.ts.map +1 -1
- package/dist/mergeTreeTracking.js +2 -0
- package/dist/mergeTreeTracking.js.map +1 -1
- package/dist/ops.d.ts +14 -0
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js +2 -0
- package/dist/ops.js.map +1 -1
- package/dist/perspective.d.ts +76 -0
- package/dist/perspective.d.ts.map +1 -0
- package/dist/perspective.js +123 -0
- package/dist/perspective.js.map +1 -0
- package/dist/properties.d.ts +2 -0
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js.map +1 -1
- package/dist/referencePositions.d.ts +3 -0
- package/dist/referencePositions.d.ts.map +1 -1
- package/dist/referencePositions.js +2 -0
- package/dist/referencePositions.js.map +1 -1
- package/dist/revertibles.d.ts +5 -0
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +3 -0
- package/dist/revertibles.js.map +1 -1
- package/dist/segmentGroupCollection.d.ts +1 -0
- package/dist/segmentGroupCollection.d.ts.map +1 -1
- package/dist/segmentGroupCollection.js +1 -0
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentPropertiesManager.d.ts +2 -0
- package/dist/segmentPropertiesManager.d.ts.map +1 -1
- package/dist/segmentPropertiesManager.js +2 -0
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +0 -3
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/textSegment.d.ts +3 -0
- package/dist/textSegment.d.ts.map +1 -1
- package/dist/textSegment.js +1 -0
- package/dist/textSegment.js.map +1 -1
- package/lib/attributionCollection.d.ts +5 -0
- package/lib/attributionCollection.d.ts.map +1 -1
- package/lib/attributionCollection.js.map +1 -1
- package/lib/client.d.ts +2 -0
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +1 -0
- package/lib/client.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/localReference.d.ts +4 -0
- package/lib/localReference.d.ts.map +1 -1
- package/lib/localReference.js +2 -0
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts +14 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +32 -7
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeDeltaCallback.d.ts +8 -0
- package/lib/mergeTreeDeltaCallback.d.ts.map +1 -1
- package/lib/mergeTreeDeltaCallback.js +1 -0
- package/lib/mergeTreeDeltaCallback.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +12 -0
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +5 -0
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/mergeTreeTracking.d.ts +4 -0
- package/lib/mergeTreeTracking.d.ts.map +1 -1
- package/lib/mergeTreeTracking.js +2 -0
- package/lib/mergeTreeTracking.js.map +1 -1
- package/lib/ops.d.ts +14 -0
- package/lib/ops.d.ts.map +1 -1
- package/lib/ops.js +2 -0
- package/lib/ops.js.map +1 -1
- package/lib/perspective.d.ts +76 -0
- package/lib/perspective.d.ts.map +1 -0
- package/lib/perspective.js +115 -0
- package/lib/perspective.js.map +1 -0
- package/lib/properties.d.ts +2 -0
- package/lib/properties.d.ts.map +1 -1
- package/lib/properties.js.map +1 -1
- package/lib/referencePositions.d.ts +3 -0
- package/lib/referencePositions.d.ts.map +1 -1
- package/lib/referencePositions.js +2 -0
- package/lib/referencePositions.js.map +1 -1
- package/lib/revertibles.d.ts +5 -0
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +3 -0
- package/lib/revertibles.js.map +1 -1
- package/lib/segmentGroupCollection.d.ts +1 -0
- package/lib/segmentGroupCollection.d.ts.map +1 -1
- package/lib/segmentGroupCollection.js +1 -0
- package/lib/segmentGroupCollection.js.map +1 -1
- package/lib/segmentPropertiesManager.d.ts +2 -0
- package/lib/segmentPropertiesManager.d.ts.map +1 -1
- package/lib/segmentPropertiesManager.js +2 -0
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/snapshotLoader.d.ts.map +1 -1
- package/lib/snapshotLoader.js +0 -3
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/textSegment.d.ts +3 -0
- package/lib/textSegment.d.ts.map +1 -1
- package/lib/textSegment.js +1 -0
- package/lib/textSegment.js.map +1 -1
- package/package.json +26 -68
- package/src/attributionCollection.ts +5 -0
- package/src/client.ts +2 -0
- package/src/localReference.ts +4 -0
- package/src/mergeTree.ts +41 -9
- package/src/mergeTreeDeltaCallback.ts +8 -0
- package/src/mergeTreeNodes.ts +12 -0
- package/src/mergeTreeTracking.ts +4 -0
- package/src/ops.ts +14 -0
- package/src/perspective.ts +142 -0
- package/src/properties.ts +2 -0
- package/src/referencePositions.ts +3 -0
- package/src/revertibles.ts +5 -0
- package/src/segmentGroupCollection.ts +1 -0
- package/src/segmentPropertiesManager.ts +2 -0
- package/src/snapshotLoader.ts +0 -2
- package/src/textSegment.ts +3 -0
package/lib/ops.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Flags enum that dictates behavior of a {@link ReferencePosition}
|
|
7
|
+
* @legacy
|
|
7
8
|
* @alpha
|
|
8
9
|
*/
|
|
9
10
|
export declare enum ReferenceType {
|
|
@@ -43,12 +44,14 @@ export declare enum ReferenceType {
|
|
|
43
44
|
Transient = 256
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
47
|
+
* @legacy
|
|
46
48
|
* @alpha
|
|
47
49
|
*/
|
|
48
50
|
export interface IMarkerDef {
|
|
49
51
|
refType?: ReferenceType;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
54
|
+
* @legacy
|
|
52
55
|
* @alpha
|
|
53
56
|
*/
|
|
54
57
|
export declare const MergeTreeDeltaType: {
|
|
@@ -62,10 +65,12 @@ export declare const MergeTreeDeltaType: {
|
|
|
62
65
|
readonly OBLITERATE: 4;
|
|
63
66
|
};
|
|
64
67
|
/**
|
|
68
|
+
* @legacy
|
|
65
69
|
* @alpha
|
|
66
70
|
*/
|
|
67
71
|
export type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];
|
|
68
72
|
/**
|
|
73
|
+
* @legacy
|
|
69
74
|
* @alpha
|
|
70
75
|
*/
|
|
71
76
|
export interface IMergeTreeDelta {
|
|
@@ -76,6 +81,7 @@ export interface IMergeTreeDelta {
|
|
|
76
81
|
}
|
|
77
82
|
/**
|
|
78
83
|
* A position specified relative to a segment.
|
|
84
|
+
* @legacy
|
|
79
85
|
* @alpha
|
|
80
86
|
*/
|
|
81
87
|
export interface IRelativePosition {
|
|
@@ -95,6 +101,7 @@ export interface IRelativePosition {
|
|
|
95
101
|
offset?: number;
|
|
96
102
|
}
|
|
97
103
|
/**
|
|
104
|
+
* @legacy
|
|
98
105
|
* @alpha
|
|
99
106
|
*/
|
|
100
107
|
export interface IMergeTreeInsertMsg extends IMergeTreeDelta {
|
|
@@ -106,6 +113,7 @@ export interface IMergeTreeInsertMsg extends IMergeTreeDelta {
|
|
|
106
113
|
seg?: any;
|
|
107
114
|
}
|
|
108
115
|
/**
|
|
116
|
+
* @legacy
|
|
109
117
|
* @alpha
|
|
110
118
|
*/
|
|
111
119
|
export interface IMergeTreeRemoveMsg extends IMergeTreeDelta {
|
|
@@ -119,6 +127,7 @@ export interface IMergeTreeRemoveMsg extends IMergeTreeDelta {
|
|
|
119
127
|
* @deprecated We no longer intend to support this functionality and it will
|
|
120
128
|
* be removed in a future release. There is no replacement for this
|
|
121
129
|
* functionality.
|
|
130
|
+
* @legacy
|
|
122
131
|
* @alpha
|
|
123
132
|
*/
|
|
124
133
|
export interface IMergeTreeObliterateMsg extends IMergeTreeDelta {
|
|
@@ -137,6 +146,7 @@ export interface IMergeTreeObliterateMsg extends IMergeTreeDelta {
|
|
|
137
146
|
relativePos2?: never;
|
|
138
147
|
}
|
|
139
148
|
/**
|
|
149
|
+
* @legacy
|
|
140
150
|
* @alpha
|
|
141
151
|
*/
|
|
142
152
|
export interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {
|
|
@@ -152,6 +162,7 @@ export interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {
|
|
|
152
162
|
* release, as group ops are redundant with the native batching capabilities
|
|
153
163
|
* of the runtime
|
|
154
164
|
*
|
|
165
|
+
* @legacy
|
|
155
166
|
* @alpha
|
|
156
167
|
*/
|
|
157
168
|
export interface IMergeTreeGroupMsg extends IMergeTreeDelta {
|
|
@@ -159,16 +170,19 @@ export interface IMergeTreeGroupMsg extends IMergeTreeDelta {
|
|
|
159
170
|
ops: IMergeTreeDeltaOp[];
|
|
160
171
|
}
|
|
161
172
|
/**
|
|
173
|
+
* @legacy
|
|
162
174
|
* @alpha
|
|
163
175
|
*/
|
|
164
176
|
export interface IJSONSegment {
|
|
165
177
|
props?: Record<string, any>;
|
|
166
178
|
}
|
|
167
179
|
/**
|
|
180
|
+
* @legacy
|
|
168
181
|
* @alpha
|
|
169
182
|
*/
|
|
170
183
|
export type IMergeTreeDeltaOp = IMergeTreeInsertMsg | IMergeTreeRemoveMsg | IMergeTreeAnnotateMsg | IMergeTreeObliterateMsg;
|
|
171
184
|
/**
|
|
185
|
+
* @legacy
|
|
172
186
|
* @alpha
|
|
173
187
|
*/
|
|
174
188
|
export type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;
|
package/lib/ops.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,oBAAY,aAAa;IACxB,MAAM,IAAM;IACZ;;OAEG;IACH,IAAI,IAAM;IAEV;;;;OAIG;IACH,UAAU,KAAO;IAEjB;;;;OAIG;IACH,QAAQ,KAAO;IAEf;;;;;;OAMG;IACH,aAAa,KAAO;IACpB;;OAEG;IACH,YAAY,MAAO;IACnB;;;OAGG;IACH,SAAS,MAAQ;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAGD;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;IAI9B;;OAEG;;;CAGM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GA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;IAC7D,IAAI,EAAE,OAAO,kBAAkB,CAAC,QAAQ,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IAC1D,IAAI,EAAE,OAAO,kBAAkB,CAAC,KAAK,CAAC;IACtC,GAAG,EAAE,iBAAiB,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAC1B,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,uBAAuB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC"}
|
package/lib/ops.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Flags enum that dictates behavior of a {@link ReferencePosition}
|
|
7
|
+
* @legacy
|
|
7
8
|
* @alpha
|
|
8
9
|
*/
|
|
9
10
|
export var ReferenceType;
|
|
@@ -45,6 +46,7 @@ export var ReferenceType;
|
|
|
45
46
|
})(ReferenceType || (ReferenceType = {}));
|
|
46
47
|
// Note: Assigned positive integers to avoid clashing with MergeTreeMaintenanceType
|
|
47
48
|
/**
|
|
49
|
+
* @legacy
|
|
48
50
|
* @alpha
|
|
49
51
|
*/
|
|
50
52
|
export const MergeTreeDeltaType = {
|
package/lib/ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,CAAN,IAAY,aAsCX;AAtCD,WAAY,aAAa;IACxB,qDAAY,CAAA;IACZ;;OAEG;IACH,iDAAU,CAAA;IAEV;;;;OAIG;IACH,8DAAiB,CAAA;IAEjB;;;;OAIG;IACH,0DAAe,CAAA;IAEf;;;;;;OAMG;IACH,oEAAoB,CAAA;IACpB;;OAEG;IACH,mEAAmB,CAAA;IACnB;;;OAGG;IACH,6DAAiB,CAAA;AAClB,CAAC,EAtCW,aAAa,KAAb,aAAa,QAsCxB;AAUD,mFAAmF;AACnF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAC;CACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Flags enum that dictates behavior of a {@link ReferencePosition}\n * @legacy\n * @alpha\n */\nexport enum ReferenceType {\n\tSimple = 0x0,\n\t/**\n\t * Allows this reference to be located using the `searchForMarker` API on merge-tree.\n\t */\n\tTile = 0x1,\n\n\t/**\n\t * Denotes that this reference begins the start of an interval. This is\n\t * generally not meaningful outside the context of interval collections\n\t * on SharedString.\n\t */\n\tRangeBegin = 0x10,\n\n\t/**\n\t * Denotes that this reference is the end of an interval. This is\n\t * generally not meaningful outside the context of interval collections\n\t * on SharedString.\n\t */\n\tRangeEnd = 0x20,\n\n\t/**\n\t * When a segment is marked removed (locally or with ack), this reference will slide to the first\n\t * valid option of:\n\t * 1. the start of the next furthest segment\n\t * 2. the end of the next nearest segment\n\t * 3. DetachedReferencePosition\n\t */\n\tSlideOnRemove = 0x40,\n\t/**\n\t * When a segment is marked removed (locally or with ack), this reference will remain on that segment.\n\t */\n\tStayOnRemove = 0x80,\n\t/**\n\t * Specifies that the reference position should never be added to the segment it refers to.\n\t * This is useful for comparison/iteration purposes\n\t */\n\tTransient = 0x100,\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IMarkerDef {\n\trefType?: ReferenceType;\n}\n\n// Note: Assigned positive integers to avoid clashing with MergeTreeMaintenanceType\n/**\n * @legacy\n * @alpha\n */\nexport const MergeTreeDeltaType = {\n\tINSERT: 0,\n\tREMOVE: 1,\n\tANNOTATE: 2,\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with he native batching capabilities of the runtime\n\t */\n\tGROUP: 3,\n\tOBLITERATE: 4,\n} as const;\n\n/**\n * @legacy\n * @alpha\n */\nexport type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeDelta {\n\t/**\n\t * Type of this change.\n\t */\n\ttype: MergeTreeDeltaType;\n}\n\n/**\n * A position specified relative to a segment.\n * @legacy\n * @alpha\n */\nexport interface IRelativePosition {\n\t/**\n\t * String identifier specifying a segment.\n\t */\n\tid?: string;\n\t/**\n\t * If true, insert before the specified segment. If false or not defined,\n\t * insert after the specified segment.\n\t */\n\tbefore?: boolean;\n\t/**\n\t * A positive number \\>= 1. If before is false, offset is added to the position.\n\t * If before is true, offset is subtracted from the position.\n\t */\n\toffset?: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeInsertMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.INSERT;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n\tseg?: any;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeRemoveMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.REMOVE;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n}\n\n/**\n * @deprecated We no longer intend to support this functionality and it will\n * be removed in a future release. There is no replacement for this\n * functionality.\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeObliterateMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.OBLITERATE;\n\tpos1?: number;\n\t/**\n\t * This field is currently unused, but we keep it around to make the union\n\t * type of all merge-tree messages have the same fields\n\t */\n\trelativePos1?: never;\n\tpos2?: number;\n\t/**\n\t * This field is currently unused, but we keep it around to make the union\n\t * type of all merge-tree messages have the same fields\n\t */\n\trelativePos2?: never;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.ANNOTATE;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n\tprops: Record<string, any>;\n}\n\n/**\n * @deprecated The ability to create group ops will be removed in an upcoming\n * release, as group ops are redundant with the native batching capabilities\n * of the runtime\n *\n * @legacy\n * @alpha\n */\nexport interface IMergeTreeGroupMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.GROUP;\n\tops: IMergeTreeDeltaOp[];\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IJSONSegment {\n\tprops?: Record<string, any>;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type IMergeTreeDeltaOp =\n\t| IMergeTreeInsertMsg\n\t| IMergeTreeRemoveMsg\n\t| IMergeTreeAnnotateMsg\n\t| IMergeTreeObliterateMsg;\n\n/**\n * @legacy\n * @alpha\n */\nexport type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { type MergeTree } from "./mergeTree.js";
|
|
6
|
+
import { type ISegment } from "./mergeTreeNodes.js";
|
|
7
|
+
/**
|
|
8
|
+
* Provides a view of a MergeTree from the perspective of a specific client at a specific sequence number.
|
|
9
|
+
*/
|
|
10
|
+
export interface Perspective {
|
|
11
|
+
nextSegment(segment: ISegment, forward?: boolean): ISegment;
|
|
12
|
+
previousSegment(segment: ISegment): ISegment;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Represents a point in time inside the collaboration window.
|
|
16
|
+
*/
|
|
17
|
+
export interface SeqTime {
|
|
18
|
+
refSeq: number;
|
|
19
|
+
localSeq?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Implementation of {@link Perspective}.
|
|
23
|
+
* See {@link Client.createPerspective}.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PerspectiveImpl implements Perspective {
|
|
26
|
+
private readonly _mergeTree;
|
|
27
|
+
private readonly _seqTime;
|
|
28
|
+
/**
|
|
29
|
+
* @param _mergeTree - The {@link MergeTree} to view.
|
|
30
|
+
* @param _seqTime - The latest sequence number and local sequence number to consider.
|
|
31
|
+
*/
|
|
32
|
+
constructor(_mergeTree: MergeTree, _seqTime: SeqTime);
|
|
33
|
+
/**
|
|
34
|
+
* Returns the immediately adjacent segment in the specified direction from this perspective.
|
|
35
|
+
* There may actually be multiple segments between the given segment and the returned segment,
|
|
36
|
+
* but they were either inserted after this perspective, or have been removed or moved before this perspective.
|
|
37
|
+
*
|
|
38
|
+
* @param segment - The segment to start from.
|
|
39
|
+
* @param forward - The direction to search.
|
|
40
|
+
* @returns the next segment in the specified direction, or the start or end of the tree if there is no next segment.
|
|
41
|
+
*/
|
|
42
|
+
nextSegment(segment: ISegment, forward?: boolean): ISegment;
|
|
43
|
+
/**
|
|
44
|
+
* @param segment - The segment to start from.
|
|
45
|
+
* @returns the previous segment, or the start of the tree if there is no previous segment.
|
|
46
|
+
* @remarks This is a convenient equivalent to calling `nextSegment(segment, false)`.
|
|
47
|
+
*/
|
|
48
|
+
previousSegment(segment: ISegment): ISegment;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param seg - The segment to check.
|
|
52
|
+
* @param seq - The latest sequence number to consider.
|
|
53
|
+
* @param localSeq - The latest local sequence number to consider.
|
|
54
|
+
* @returns true iff this segment was removed in the given perspective.
|
|
55
|
+
*/
|
|
56
|
+
export declare function wasRemovedBefore(seg: ISegment, { refSeq, localSeq }: SeqTime): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @param seg - The segment to check.
|
|
59
|
+
* @param refSeq - The latest sequence number to consider.
|
|
60
|
+
* @param localSeq - The latest local sequence number to consider.
|
|
61
|
+
* @returns true iff this segment was moved (aka obliterated) in the given perspective.
|
|
62
|
+
*/
|
|
63
|
+
export declare function wasMovedBefore(seg: ISegment, { refSeq, localSeq }: SeqTime): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* See {@link wasRemovedBefore} and {@link wasMovedBefore}.
|
|
66
|
+
*/
|
|
67
|
+
export declare function wasRemovedOrMovedBefore(seg: ISegment, seqTime: SeqTime): boolean;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param seg - The segment to check.
|
|
71
|
+
* @param seqTime - The latest sequence number and local sequence number to consider.
|
|
72
|
+
* @returns true iff this segment was inserted before the given perspective,
|
|
73
|
+
* and it was not removed or moved in the given perspective.
|
|
74
|
+
*/
|
|
75
|
+
export declare function isSegmentPresent(seg: ISegment, seqTime: SeqTime): boolean;
|
|
76
|
+
//# sourceMappingURL=perspective.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perspective.d.ts","sourceRoot":"","sources":["../src/perspective.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAU,KAAK,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poration and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { UnassignedSequenceNumber } from "./constants.js";
|
|
6
|
+
import { LeafAction, backwardExcursion, forwardExcursion } from "./mergeTreeNodeWalk.js";
|
|
7
|
+
import { seqLTE } from "./mergeTreeNodes.js";
|
|
8
|
+
/**
|
|
9
|
+
* Implementation of {@link Perspective}.
|
|
10
|
+
* See {@link Client.createPerspective}.
|
|
11
|
+
*/
|
|
12
|
+
export class PerspectiveImpl {
|
|
13
|
+
/**
|
|
14
|
+
* @param _mergeTree - The {@link MergeTree} to view.
|
|
15
|
+
* @param _seqTime - The latest sequence number and local sequence number to consider.
|
|
16
|
+
*/
|
|
17
|
+
constructor(_mergeTree, _seqTime) {
|
|
18
|
+
this._mergeTree = _mergeTree;
|
|
19
|
+
this._seqTime = _seqTime;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns the immediately adjacent segment in the specified direction from this perspective.
|
|
23
|
+
* There may actually be multiple segments between the given segment and the returned segment,
|
|
24
|
+
* but they were either inserted after this perspective, or have been removed or moved before this perspective.
|
|
25
|
+
*
|
|
26
|
+
* @param segment - The segment to start from.
|
|
27
|
+
* @param forward - The direction to search.
|
|
28
|
+
* @returns the next segment in the specified direction, or the start or end of the tree if there is no next segment.
|
|
29
|
+
*/
|
|
30
|
+
nextSegment(segment, forward = true) {
|
|
31
|
+
let next;
|
|
32
|
+
const action = (seg) => {
|
|
33
|
+
if (isSegmentPresent(seg, this._seqTime)) {
|
|
34
|
+
next = seg;
|
|
35
|
+
return LeafAction.Exit;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
(forward ? forwardExcursion : backwardExcursion)(segment, action);
|
|
39
|
+
return next ?? (forward ? this._mergeTree.endOfTree : this._mergeTree.startOfTree);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param segment - The segment to start from.
|
|
43
|
+
* @returns the previous segment, or the start of the tree if there is no previous segment.
|
|
44
|
+
* @remarks This is a convenient equivalent to calling `nextSegment(segment, false)`.
|
|
45
|
+
*/
|
|
46
|
+
previousSegment(segment) {
|
|
47
|
+
return this.nextSegment(segment, false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param seg - The segment to check.
|
|
52
|
+
* @param seq - The latest sequence number to consider.
|
|
53
|
+
* @param localSeq - The latest local sequence number to consider.
|
|
54
|
+
* @returns true iff this segment was removed in the given perspective.
|
|
55
|
+
*/
|
|
56
|
+
export function wasRemovedBefore(seg, { refSeq, localSeq }) {
|
|
57
|
+
if (seg.removedSeq === UnassignedSequenceNumber &&
|
|
58
|
+
localSeq !== undefined &&
|
|
59
|
+
seg.localRemovedSeq !== undefined) {
|
|
60
|
+
return seg.localRemovedSeq <= localSeq;
|
|
61
|
+
}
|
|
62
|
+
return seg.removedSeq !== undefined && seqLTE(seg.removedSeq, refSeq);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @param seg - The segment to check.
|
|
66
|
+
* @param refSeq - The latest sequence number to consider.
|
|
67
|
+
* @param localSeq - The latest local sequence number to consider.
|
|
68
|
+
* @returns true iff this segment was moved (aka obliterated) in the given perspective.
|
|
69
|
+
*/
|
|
70
|
+
export function wasMovedBefore(seg, { refSeq, localSeq }) {
|
|
71
|
+
if (seg.movedSeq === UnassignedSequenceNumber &&
|
|
72
|
+
localSeq !== undefined &&
|
|
73
|
+
seg.localMovedSeq !== undefined) {
|
|
74
|
+
return seg.localMovedSeq <= localSeq;
|
|
75
|
+
}
|
|
76
|
+
return seg.movedSeq !== undefined && seqLTE(seg.movedSeq, refSeq);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* See {@link wasRemovedBefore} and {@link wasMovedBefore}.
|
|
80
|
+
*/
|
|
81
|
+
export function wasRemovedOrMovedBefore(seg, seqTime) {
|
|
82
|
+
return wasRemovedBefore(seg, seqTime) || wasMovedBefore(seg, seqTime);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @param seg - The segment to check.
|
|
87
|
+
* @param seqTime - The latest sequence number and local sequence number to consider.
|
|
88
|
+
* @returns true iff this segment was inserted before the given perspective,
|
|
89
|
+
* and it was not removed or moved in the given perspective.
|
|
90
|
+
*/
|
|
91
|
+
export function isSegmentPresent(seg, seqTime) {
|
|
92
|
+
const { refSeq, localSeq } = seqTime;
|
|
93
|
+
// If seg.seq is undefined, then this segment has existed since minSeq.
|
|
94
|
+
// It may have been moved or removed since.
|
|
95
|
+
if (seg.seq !== undefined) {
|
|
96
|
+
if (seg.seq !== UnassignedSequenceNumber) {
|
|
97
|
+
if (!seqLTE(seg.seq, refSeq)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (seg.localSeq !== undefined) {
|
|
102
|
+
// seg.seq === UnassignedSequenceNumber
|
|
103
|
+
// If the current perspective does not include local sequence numbers,
|
|
104
|
+
// then this segment does not exist yet.
|
|
105
|
+
if (localSeq === undefined || seg.localSeq > localSeq) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (wasRemovedOrMovedBefore(seg, seqTime)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=perspective.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perspective.js","sourceRoot":"","sources":["../src/perspective.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAiB,MAAM,qBAAqB,CAAC;AAkB5D;;;GAGG;AACH,MAAM,OAAO,eAAe;IAC3B;;;OAGG;IACH,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AAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UnassignedSequenceNumber } from \"./constants.js\";\nimport { type MergeTree } from \"./mergeTree.js\";\nimport { LeafAction, backwardExcursion, forwardExcursion } from \"./mergeTreeNodeWalk.js\";\nimport { seqLTE, type ISegment } from \"./mergeTreeNodes.js\";\n\n/**\n * Provides a view of a MergeTree from the perspective of a specific client at a specific sequence number.\n */\nexport interface Perspective {\n\tnextSegment(segment: ISegment, forward?: boolean): ISegment;\n\tpreviousSegment(segment: ISegment): ISegment;\n}\n\n/**\n * Represents a point in time inside the collaboration window.\n */\nexport interface SeqTime {\n\trefSeq: number;\n\tlocalSeq?: number;\n}\n\n/**\n * Implementation of {@link Perspective}.\n * See {@link Client.createPerspective}.\n */\nexport class PerspectiveImpl implements Perspective {\n\t/**\n\t * @param _mergeTree - The {@link MergeTree} to view.\n\t * @param _seqTime - The latest sequence number and local sequence number to consider.\n\t */\n\tpublic constructor(\n\t\tprivate readonly _mergeTree: MergeTree,\n\t\tprivate readonly _seqTime: SeqTime,\n\t) {}\n\n\t/**\n\t * Returns the immediately adjacent segment in the specified direction from this perspective.\n\t * There may actually be multiple segments between the given segment and the returned segment,\n\t * but they were either inserted after this perspective, or have been removed or moved before this perspective.\n\t *\n\t * @param segment - The segment to start from.\n\t * @param forward - The direction to search.\n\t * @returns the next segment in the specified direction, or the start or end of the tree if there is no next segment.\n\t */\n\tpublic nextSegment(segment: ISegment, forward: boolean = true): ISegment {\n\t\tlet next: ISegment | undefined;\n\t\tconst action = (seg: ISegment) => {\n\t\t\tif (isSegmentPresent(seg, this._seqTime)) {\n\t\t\t\tnext = seg;\n\t\t\t\treturn LeafAction.Exit;\n\t\t\t}\n\t\t};\n\t\t(forward ? forwardExcursion : backwardExcursion)(segment, action);\n\t\treturn next ?? (forward ? this._mergeTree.endOfTree : this._mergeTree.startOfTree);\n\t}\n\n\t/**\n\t * @param segment - The segment to start from.\n\t * @returns the previous segment, or the start of the tree if there is no previous segment.\n\t * @remarks This is a convenient equivalent to calling `nextSegment(segment, false)`.\n\t */\n\tpublic previousSegment(segment: ISegment): ISegment {\n\t\treturn this.nextSegment(segment, false);\n\t}\n}\n\n/**\n * @param seg - The segment to check.\n * @param seq - The latest sequence number to consider.\n * @param localSeq - The latest local sequence number to consider.\n * @returns true iff this segment was removed in the given perspective.\n */\nexport function wasRemovedBefore(seg: ISegment, { refSeq, localSeq }: SeqTime): boolean {\n\tif (\n\t\tseg.removedSeq === UnassignedSequenceNumber &&\n\t\tlocalSeq !== undefined &&\n\t\tseg.localRemovedSeq !== undefined\n\t) {\n\t\treturn seg.localRemovedSeq <= localSeq;\n\t}\n\treturn seg.removedSeq !== undefined && seqLTE(seg.removedSeq, refSeq);\n}\n\n/**\n * @param seg - The segment to check.\n * @param refSeq - The latest sequence number to consider.\n * @param localSeq - The latest local sequence number to consider.\n * @returns true iff this segment was moved (aka obliterated) in the given perspective.\n */\nexport function wasMovedBefore(seg: ISegment, { refSeq, localSeq }: SeqTime): boolean {\n\tif (\n\t\tseg.movedSeq === UnassignedSequenceNumber &&\n\t\tlocalSeq !== undefined &&\n\t\tseg.localMovedSeq !== undefined\n\t) {\n\t\treturn seg.localMovedSeq <= localSeq;\n\t}\n\treturn seg.movedSeq !== undefined && seqLTE(seg.movedSeq, refSeq);\n}\n\n/**\n * See {@link wasRemovedBefore} and {@link wasMovedBefore}.\n */\nexport function wasRemovedOrMovedBefore(seg: ISegment, seqTime: SeqTime): boolean {\n\treturn wasRemovedBefore(seg, seqTime) || wasMovedBefore(seg, seqTime);\n}\n\n/**\n *\n * @param seg - The segment to check.\n * @param seqTime - The latest sequence number and local sequence number to consider.\n * @returns true iff this segment was inserted before the given perspective,\n * and it was not removed or moved in the given perspective.\n */\nexport function isSegmentPresent(seg: ISegment, seqTime: SeqTime): boolean {\n\tconst { refSeq, localSeq } = seqTime;\n\t// If seg.seq is undefined, then this segment has existed since minSeq.\n\t// It may have been moved or removed since.\n\tif (seg.seq !== undefined) {\n\t\tif (seg.seq !== UnassignedSequenceNumber) {\n\t\t\tif (!seqLTE(seg.seq, refSeq)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (seg.localSeq !== undefined) {\n\t\t\t// seg.seq === UnassignedSequenceNumber\n\t\t\t// If the current perspective does not include local sequence numbers,\n\t\t\t// then this segment does not exist yet.\n\t\t\tif (localSeq === undefined || seg.localSeq > localSeq) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tif (wasRemovedOrMovedBefore(seg, seqTime)) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n"]}
|
package/lib/properties.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Any mapping from a string to values of type `T`
|
|
7
|
+
* @legacy
|
|
7
8
|
* @alpha
|
|
8
9
|
*/
|
|
9
10
|
export interface MapLike<T> {
|
|
@@ -17,6 +18,7 @@ export interface MapLike<T> {
|
|
|
17
18
|
* @privateRemarks PropertySet is typed using `any` because when you include
|
|
18
19
|
* custom methods such as toJSON(), JSON.stringify accepts most types other than
|
|
19
20
|
* functions
|
|
21
|
+
* @legacy
|
|
20
22
|
* @alpha
|
|
21
23
|
*/
|
|
22
24
|
export type PropertySet = MapLike<any>;
|
package/lib/properties.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACzB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,EAAE,CAAC,EAAE,WAAW,GAAG,SAAS,WAyBrF;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,cAc5E;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,0BAazD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,WAAW,GAAG,SAAS,EACjC,QAAQ,EAAE,WAAW,GACnB,WAAW,CAIb;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,cAUvF;AAED;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAEzC"}
|
package/lib/properties.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,CAA0B,EAAE,CAA0B;IACrF,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CA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n * Licensed under the MIT License.\n */\n\n/**\n * Any mapping from a string to values of type `T`\n * @legacy\n * @alpha\n */\nexport interface MapLike<T> {\n\t[index: string]: T;\n}\n\n/**\n * A loosely-typed mapping from strings to any value.\n *\n * @remarks Property sets are expected to be JSON-stringify-able.\n *\n * @privateRemarks PropertySet is typed using `any` because when you include\n * custom methods such as toJSON(), JSON.stringify accepts most types other than\n * functions\n * @legacy\n * @alpha\n */\nexport type PropertySet = MapLike<any>;\n\n/**\n * @internal\n */\nexport function matchProperties(a: PropertySet | undefined, b: PropertySet | undefined) {\n\tif (!a && !b) {\n\t\treturn true;\n\t}\n\n\tconst keysA = a ? Object.keys(a) : [];\n\tconst keysB = b ? Object.keys(b) : [];\n\n\tif (keysA.length !== keysB.length) {\n\t\treturn false;\n\t}\n\n\tfor (const key of keysA) {\n\t\tif (b?.[key] === undefined) {\n\t\t\treturn false;\n\t\t} else if (typeof b[key] === \"object\") {\n\t\t\tif (!matchProperties(a?.[key], b[key])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (b[key] !== a?.[key]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function extend<T>(base: MapLike<T>, extension: MapLike<T> | undefined) {\n\tif (extension !== undefined) {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const key in extension) {\n\t\t\tconst v = extension[key];\n\t\t\tif (v === null) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete base[key];\n\t\t\t} else {\n\t\t\t\tbase[key] = v;\n\t\t\t}\n\t\t}\n\t}\n\treturn base;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function clone<T>(extension: MapLike<T> | undefined) {\n\tif (extension === undefined) {\n\t\treturn undefined;\n\t}\n\tconst cloneMap = createMap<T>();\n\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\tfor (const key in extension) {\n\t\tconst v = extension[key];\n\t\tif (v !== null) {\n\t\t\tcloneMap[key] = v;\n\t\t}\n\t}\n\treturn cloneMap;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function addProperties(\n\toldProps: PropertySet | undefined,\n\tnewProps: PropertySet,\n): PropertySet {\n\tconst _oldProps = oldProps ?? createMap<any>();\n\textend(_oldProps, newProps);\n\treturn { ..._oldProps };\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function extendIfUndefined<T>(base: MapLike<T>, extension: MapLike<T> | undefined) {\n\tif (extension !== undefined) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\tfor (const key in extension) {\n\t\t\tif (base[key] === undefined) {\n\t\t\t\tbase[key] = extension[key];\n\t\t\t}\n\t\t}\n\t}\n\treturn base;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\n// Create a MapLike with good performance.\nexport function createMap<T>(): MapLike<T> {\n\treturn Object.create(null) as MapLike<T>;\n}\n"]}
|
|
@@ -19,10 +19,12 @@ export declare const reservedRangeLabelsKey = "referenceRangeLabels";
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function refTypeIncludesFlag(refPosOrType: ReferencePosition | ReferenceType, flags: ReferenceType): boolean;
|
|
21
21
|
/**
|
|
22
|
+
* @legacy
|
|
22
23
|
* @alpha
|
|
23
24
|
*/
|
|
24
25
|
export declare const refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined;
|
|
25
26
|
/**
|
|
27
|
+
* @legacy
|
|
26
28
|
* @alpha
|
|
27
29
|
*/
|
|
28
30
|
export declare function refHasTileLabel(refPos: ReferencePosition, label: string): boolean;
|
|
@@ -34,6 +36,7 @@ export declare function refHasTileLabels(refPos: ReferencePosition): boolean;
|
|
|
34
36
|
* Represents a reference to a place within a merge tree. This place conceptually remains stable over time
|
|
35
37
|
* by referring to a particular segment and offset within that segment.
|
|
36
38
|
* Thus, this reference's character position changes as the tree is edited.
|
|
39
|
+
* @legacy
|
|
37
40
|
* @alpha
|
|
38
41
|
*/
|
|
39
42
|
export interface ReferencePosition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referencePositions.d.ts","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D;;GAEG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,YAAY,EAAE,iBAAiB,GAAG,aAAa,EAC/C,KAAK,EAAE,aAAa,GAClB,OAAO,CAIT;AAED
|
|
1
|
+
{"version":3,"file":"referencePositions.d.ts","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D;;GAEG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,YAAY,EAAE,iBAAiB,GAAG,aAAa,EAC/C,KAAK,EAAE,aAAa,GAClB,OAAO,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
* @legacy
|
|
23
24
|
* @alpha
|
|
24
25
|
*/
|
|
25
26
|
export const refGetTileLabels = (refPos) => refTypeIncludesFlag(refPos, ReferenceType.Tile) && refPos.properties
|
|
26
27
|
? refPos.properties[reservedTileLabelsKey]
|
|
27
28
|
: undefined;
|
|
28
29
|
/**
|
|
30
|
+
* @legacy
|
|
29
31
|
* @alpha
|
|
30
32
|
*/
|
|
31
33
|
export function refHasTileLabel(refPos, label) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referencePositions.js","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,YAA+C,EAC/C,KAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;IACvF,sCAAsC;IACtC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"referencePositions.js","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,YAA+C,EAC/C,KAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK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B,EAAE,CAAoB;IACnF,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;SAAM,CAAC;QACP,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SlidingPreference } from \"./localReference.js\";\nimport { ISegment } from \"./mergeTreeNodes.js\";\nimport { ReferenceType } from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\n\n/**\n * @internal\n */\nexport const reservedTileLabelsKey = \"referenceTileLabels\";\n/**\n * @internal\n */\nexport const reservedRangeLabelsKey = \"referenceRangeLabels\";\n\n/**\n * @internal\n */\nexport function refTypeIncludesFlag(\n\trefPosOrType: ReferencePosition | ReferenceType,\n\tflags: ReferenceType,\n): boolean {\n\tconst refType = typeof refPosOrType === \"number\" ? refPosOrType : refPosOrType.refType;\n\t// eslint-disable-next-line no-bitwise\n\treturn (refType & flags) !== 0;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport const refGetTileLabels = (refPos: ReferencePosition): string[] | undefined =>\n\trefTypeIncludesFlag(refPos, ReferenceType.Tile) && refPos.properties\n\t\t? (refPos.properties[reservedTileLabelsKey] as string[])\n\t\t: undefined;\n\n/**\n * @legacy\n * @alpha\n */\nexport function refHasTileLabel(refPos: ReferencePosition, label: string): boolean {\n\tconst tileLabels = refGetTileLabels(refPos);\n\treturn tileLabels?.includes(label) ?? false;\n}\n\n/**\n * @internal\n */\nexport function refHasTileLabels(refPos: ReferencePosition): boolean {\n\treturn refGetTileLabels(refPos) !== undefined;\n}\n\n/**\n * Represents a reference to a place within a merge tree. This place conceptually remains stable over time\n * by referring to a particular segment and offset within that segment.\n * Thus, this reference's character position changes as the tree is edited.\n * @legacy\n * @alpha\n */\nexport interface ReferencePosition {\n\t/**\n\t * Properties associated with this reference\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * The direction for this reference position to slide when the segment it\n\t * points to is removed. See {@link (SlidingPreference:type)} for additional context.\n\t *\n\t * Defaults to SlidingPreference.Forward\n\t */\n\tslidingPreference?: SlidingPreference;\n\n\trefType: ReferenceType;\n\n\t/**\n\t * Gets the segment that this reference position is semantically associated with. Returns undefined iff the\n\t * reference became detached from the string.\n\t */\n\tgetSegment(): ISegment | undefined;\n\n\t/**\n\t * Gets the offset for this reference position within its associated segment.\n\t *\n\t * @example\n\t *\n\t * If a merge-tree has 3 leaf segments [\"hello\", \" \", \"world\"] and a ReferencePosition refers to the \"l\"\n\t * in \"world\", that reference's offset would be 3 as \"l\" is the character at index 3 within \"world\".\n\t */\n\tgetOffset(): number;\n\n\t/**\n\t * @param newProps - Properties to add to this reference.\n\t * @remarks Note that merge-tree does not broadcast changes to other clients. It is up to the consumer\n\t * to ensure broadcast happens if that is desired.\n\t */\n\taddProperties(newProps: PropertySet): void;\n\tisLeaf(): this is ISegment;\n}\n\n/**\n * @internal\n */\nexport const DetachedReferencePosition = -1;\n\n/**\n * @internal\n */\nexport function minReferencePosition<T extends ReferencePosition>(a: T, b: T): T {\n\treturn compareReferencePositions(a, b) < 0 ? a : b;\n}\n\n/**\n * @internal\n */\nexport function maxReferencePosition<T extends ReferencePosition>(a: T, b: T): T {\n\treturn compareReferencePositions(a, b) > 0 ? a : b;\n}\n\n/**\n * @internal\n */\nexport function compareReferencePositions(a: ReferencePosition, b: ReferencePosition): number {\n\tconst aSeg = a.getSegment();\n\tconst bSeg = b.getSegment();\n\tif (aSeg === bSeg) {\n\t\treturn a.getOffset() - b.getOffset();\n\t} else {\n\t\treturn aSeg === undefined || (bSeg !== undefined && aSeg.ordinal < bSeg.ordinal) ? -1 : 1;\n\t}\n}\n"]}
|
package/lib/revertibles.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ITrackingGroup } from "./mergeTreeTracking.js";
|
|
|
10
10
|
import { IJSONSegment, MergeTreeDeltaType } from "./ops.js";
|
|
11
11
|
import { PropertySet } from "./properties.js";
|
|
12
12
|
/**
|
|
13
|
+
* @legacy
|
|
13
14
|
* @alpha
|
|
14
15
|
*/
|
|
15
16
|
export type MergeTreeDeltaRevertible = {
|
|
@@ -29,6 +30,7 @@ export type MergeTreeDeltaRevertible = {
|
|
|
29
30
|
*/
|
|
30
31
|
export declare function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible;
|
|
31
32
|
/**
|
|
33
|
+
* @legacy
|
|
32
34
|
* @alpha
|
|
33
35
|
*/
|
|
34
36
|
export interface MergeTreeRevertibleDriver {
|
|
@@ -48,14 +50,17 @@ export interface MergeTreeWithRevert extends MergeTree {
|
|
|
48
50
|
}
|
|
49
51
|
export type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
50
52
|
/**
|
|
53
|
+
* @legacy
|
|
51
54
|
* @alpha
|
|
52
55
|
*/
|
|
53
56
|
export declare function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;
|
|
54
57
|
/**
|
|
58
|
+
* @legacy
|
|
55
59
|
* @alpha
|
|
56
60
|
*/
|
|
57
61
|
export declare function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;
|
|
58
62
|
/**
|
|
63
|
+
* @legacy
|
|
59
64
|
* @alpha
|
|
60
65
|
*/
|
|
61
66
|
export declare function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;
|
package/lib/revertibles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAA4B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAqC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAA4B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAqC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAG/D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GACjC;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,cAAc,CAAC;CAC7B,GACD;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,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,6 +101,7 @@ function appendLocalAnnotateToRevertibles(deltaArgs, revertibles) {
|
|
|
101
101
|
return revertibles;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
+
* @legacy
|
|
104
105
|
* @alpha
|
|
105
106
|
*/
|
|
106
107
|
export function appendToMergeTreeDeltaRevertibles(deltaArgs, revertibles) {
|
|
@@ -124,6 +125,7 @@ export function appendToMergeTreeDeltaRevertibles(deltaArgs, revertibles) {
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
128
|
+
* @legacy
|
|
127
129
|
* @alpha
|
|
128
130
|
*/
|
|
129
131
|
export function discardMergeTreeDeltaRevertible(revertibles) {
|
|
@@ -233,6 +235,7 @@ function getPosition(mergeTreeWithRevert, segment) {
|
|
|
233
235
|
return mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.collabWindow.currentSeq, mergeTreeWithRevert.collabWindow.clientId);
|
|
234
236
|
}
|
|
235
237
|
/**
|
|
238
|
+
* @legacy
|
|
236
239
|
* @alpha
|
|
237
240
|
*/
|
|
238
241
|
export function revertMergeTreeDeltaRevertibles(driver, revertibles) {
|