@fluidframework/sequence 2.0.0-dev.7.3.0.211848 → 2.0.0-dev.7.4.0.214930

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor.json +12 -1
  3. package/api-report/sequence.api.md +10 -5
  4. package/dist/defaultMap.d.ts +3 -3
  5. package/dist/defaultMap.d.ts.map +1 -1
  6. package/dist/defaultMap.js +7 -2
  7. package/dist/defaultMap.js.map +1 -1
  8. package/dist/defaultMapInterfaces.d.ts +10 -8
  9. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  10. package/dist/defaultMapInterfaces.js.map +1 -1
  11. package/dist/intervalCollection.d.ts +33 -4
  12. package/dist/intervalCollection.d.ts.map +1 -1
  13. package/dist/intervalCollection.js +4 -1
  14. package/dist/intervalCollection.js.map +1 -1
  15. package/dist/intervals/intervalUtils.d.ts +4 -0
  16. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  17. package/dist/intervals/intervalUtils.js.map +1 -1
  18. package/dist/localValues.d.ts +2 -1
  19. package/dist/localValues.d.ts.map +1 -1
  20. package/dist/localValues.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/revertibles.d.ts +0 -2
  25. package/dist/revertibles.d.ts.map +1 -1
  26. package/dist/revertibles.js.map +1 -1
  27. package/dist/sequence-alpha.d.ts +1625 -0
  28. package/dist/sequence-beta.d.ts +1540 -0
  29. package/dist/sequence-public.d.ts +1540 -0
  30. package/dist/sequence-untrimmed.d.ts +1798 -0
  31. package/dist/sharedString.d.ts +4 -0
  32. package/dist/sharedString.d.ts.map +1 -1
  33. package/dist/sharedString.js +4 -0
  34. package/dist/sharedString.js.map +1 -1
  35. package/lib/defaultMap.d.ts +3 -3
  36. package/lib/defaultMap.d.ts.map +1 -1
  37. package/lib/defaultMap.js +7 -2
  38. package/lib/defaultMap.js.map +1 -1
  39. package/lib/defaultMapInterfaces.d.ts +10 -8
  40. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  41. package/lib/defaultMapInterfaces.js.map +1 -1
  42. package/lib/intervalCollection.d.ts +33 -4
  43. package/lib/intervalCollection.d.ts.map +1 -1
  44. package/lib/intervalCollection.js +4 -1
  45. package/lib/intervalCollection.js.map +1 -1
  46. package/lib/intervals/intervalUtils.d.ts +4 -0
  47. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  48. package/lib/intervals/intervalUtils.js.map +1 -1
  49. package/lib/localValues.d.ts +2 -1
  50. package/lib/localValues.d.ts.map +1 -1
  51. package/lib/localValues.js.map +1 -1
  52. package/lib/packageVersion.d.ts +1 -1
  53. package/lib/packageVersion.js +1 -1
  54. package/lib/packageVersion.js.map +1 -1
  55. package/lib/revertibles.d.ts +0 -2
  56. package/lib/revertibles.d.ts.map +1 -1
  57. package/lib/revertibles.js.map +1 -1
  58. package/lib/sequence-alpha.d.ts +1625 -0
  59. package/lib/sequence-beta.d.ts +1540 -0
  60. package/lib/sequence-public.d.ts +1540 -0
  61. package/lib/sequence-untrimmed.d.ts +1798 -0
  62. package/lib/sharedString.d.ts +4 -0
  63. package/lib/sharedString.d.ts.map +1 -1
  64. package/lib/sharedString.js +4 -0
  65. package/lib/sharedString.js.map +1 -1
  66. package/package.json +31 -19
  67. package/src/defaultMap.ts +22 -16
  68. package/src/defaultMapInterfaces.ts +14 -10
  69. package/src/intervalCollection.ts +41 -10
  70. package/src/intervals/intervalUtils.ts +4 -1
  71. package/src/localValues.ts +2 -1
  72. package/src/packageVersion.ts +1 -1
  73. package/src/revertibles.ts +0 -2
  74. package/src/sharedString.ts +4 -0
@@ -0,0 +1,1625 @@
1
+ /**
2
+ * Supports distributed data structures which are list-like.
3
+ *
4
+ * This library's main export is {@link SharedString}, a DDS for storing and simultaneously editing a sequence of
5
+ * text.
6
+ *
7
+ * See the package's README for a high-level introduction to `SharedString`'s feature set.
8
+ * @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for
9
+ * working with text.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+
14
+ import { BaseSegment } from '@fluidframework/merge-tree';
15
+ import { Client } from '@fluidframework/merge-tree';
16
+ import { Deferred } from '@fluidframework/core-utils';
17
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
18
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
19
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
20
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
21
+ import { ICombiningOp } from '@fluidframework/merge-tree';
22
+ import { IEvent } from '@fluidframework/core-interfaces';
23
+ import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
24
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
25
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
26
+ import { IJSONSegment } from '@fluidframework/merge-tree';
27
+ import { IMergeTreeDeltaCallbackArgs } from '@fluidframework/merge-tree';
28
+ import { IMergeTreeDeltaOpArgs } from '@fluidframework/merge-tree';
29
+ import { IMergeTreeGroupMsg } from '@fluidframework/merge-tree';
30
+ import { IMergeTreeInsertMsg } from '@fluidframework/merge-tree';
31
+ import { IMergeTreeMaintenanceCallbackArgs } from '@fluidframework/merge-tree';
32
+ import { IMergeTreeOp } from '@fluidframework/merge-tree';
33
+ import { IMergeTreeRemoveMsg } from '@fluidframework/merge-tree';
34
+ import { IRelativePosition } from '@fluidframework/merge-tree';
35
+ import { ISegment } from '@fluidframework/merge-tree';
36
+ import { ISegmentAction } from '@fluidframework/merge-tree';
37
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
38
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
39
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
40
+ import { ITelemetryContext } from '@fluidframework/runtime-definitions';
41
+ import { LocalReferencePosition } from '@fluidframework/merge-tree';
42
+ import { Marker } from '@fluidframework/merge-tree';
43
+ import { MergeTreeDeltaOperationType } from '@fluidframework/merge-tree';
44
+ import { MergeTreeDeltaOperationTypes } from '@fluidframework/merge-tree';
45
+ import { MergeTreeDeltaRevertible } from '@fluidframework/merge-tree';
46
+ import { MergeTreeMaintenanceType } from '@fluidframework/merge-tree';
47
+ import { MergeTreeRevertibleDriver } from '@fluidframework/merge-tree';
48
+ import { PropertiesManager } from '@fluidframework/merge-tree';
49
+ import { PropertySet } from '@fluidframework/merge-tree';
50
+ import { RangeStackMap } from '@fluidframework/merge-tree';
51
+ import { ReferencePosition } from '@fluidframework/merge-tree';
52
+ import { ReferenceType } from '@fluidframework/merge-tree';
53
+ import { Serializable } from '@fluidframework/datastore-definitions';
54
+ import { SharedObject } from '@fluidframework/shared-object-base';
55
+ import { SlidingPreference } from '@fluidframework/merge-tree';
56
+ import { SummarySerializer } from '@fluidframework/shared-object-base';
57
+ import { TextSegment } from '@fluidframework/merge-tree';
58
+
59
+ /**
60
+ * Create revertibles for adding an interval
61
+ * @alpha
62
+ */
63
+ export declare function appendAddIntervalToRevertibles(interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
64
+
65
+ /**
66
+ * Create revertibles for moving endpoints of an interval
67
+ * @alpha
68
+ */
69
+ export declare function appendChangeIntervalToRevertibles(string: SharedString, newInterval: SequenceInterval, previousInterval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
70
+
71
+ /**
72
+ * Create revertibles for deleting an interval
73
+ * @alpha
74
+ */
75
+ export declare function appendDeleteIntervalToRevertibles(string: SharedString, interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
76
+
77
+ /**
78
+ * Create revertibles for changing properties of an interval
79
+ * @alpha
80
+ */
81
+ export declare function appendIntervalPropertyChangedToRevertibles(interval: SequenceInterval, deltas: PropertySet, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
82
+
83
+ /**
84
+ * Create revertibles for SharedStringDeltas, handling indirectly modified intervals
85
+ * (e.g. reverting remove of a range that contains an interval will move the interval back)
86
+ *
87
+ * @alpha
88
+ */
89
+ export declare function appendSharedStringDeltaToRevertibles(string: SharedString, delta: SequenceDeltaEvent, revertibles: SharedStringRevertible[]): void;
90
+
91
+ /**
92
+ * @public
93
+ */
94
+ export declare function createEndpointIndex(sharedString: SharedString): IEndpointIndex<SequenceInterval>;
95
+
96
+ /**
97
+ * @public
98
+ */
99
+ export declare function createEndpointInRangeIndex(sharedString: SharedString): IEndpointInRangeIndex<SequenceInterval>;
100
+
101
+ /**
102
+ * @public
103
+ */
104
+ export declare function createIdIntervalIndex<TInterval extends ISerializableInterval>(): IIdIntervalIndex<TInterval>;
105
+
106
+ /**
107
+ * @public
108
+ */
109
+ export declare function createOverlappingIntervalsIndex(sharedString: SharedString): IOverlappingIntervalsIndex<SequenceInterval>;
110
+
111
+ /**
112
+ * @public
113
+ */
114
+ export declare function createOverlappingSequenceIntervalsIndex(sharedString: SharedString): SequenceIntervalIndexes.Overlapping;
115
+
116
+ /**
117
+ * @public
118
+ */
119
+ export declare function createStartpointInRangeIndex(sharedString: SharedString): IStartpointInRangeIndex<SequenceInterval>;
120
+
121
+ /**
122
+ * @public
123
+ */
124
+ export declare type DeserializeCallback = (properties: PropertySet) => void;
125
+
126
+ /**
127
+ * Clean up resources held by revertibles that are no longer needed.
128
+ * @alpha
129
+ */
130
+ export declare function discardSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
131
+
132
+ /**
133
+ * Splits the text into regions ending with markers with the given `label`.
134
+ * @param sharedString - String to retrieve text and markers from
135
+ * @param label - label to split on
136
+ * @returns Two parallel lists of text and markers, split by markers with the provided `label`.
137
+ * For example:
138
+ * ```typescript
139
+ * // Say sharedstring has contents "hello<paragraph marker 1>world<paragraph marker 2>missing".
140
+ * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, "paragraph");
141
+ * // parallelText === ["hello", "world"]
142
+ * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]
143
+ * // Note parallelText does not include "missing".
144
+ * ```
145
+ * @public
146
+ */
147
+ export declare function getTextAndMarkers(sharedString: SharedString, label: string, start?: number, end?: number): {
148
+ parallelText: string[];
149
+ parallelMarkers: Marker[];
150
+ };
151
+
152
+ /**
153
+ * @public
154
+ */
155
+ export declare interface IEndpointIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
156
+ /**
157
+ * @returns the previous interval based on the given position number.
158
+ * If no such interval exists in this index, returns `undefined`
159
+ */
160
+ previousInterval(pos: number): TInterval | undefined;
161
+ /**
162
+ * @returns the next interval based on the given position number.
163
+ * If no such interval exists in this index, returns `undefined`
164
+ */
165
+ nextInterval(pos: number): TInterval | undefined;
166
+ }
167
+
168
+ /**
169
+ * Collection of intervals.
170
+ *
171
+ * Provide additional APIs to support efficiently querying a collection of intervals whose endpoints fall within a specified range.
172
+ * @public
173
+ */
174
+ export declare interface IEndpointInRangeIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
175
+ /**
176
+ * @returns an array of all intervals contained in this collection whose endpoints locate in the range [start, end] (includes both ends)
177
+ */
178
+ findIntervalsWithEndpointInRange(start: number, end: number): TInterval[];
179
+ }
180
+
181
+ /**
182
+ * @public
183
+ */
184
+ export declare interface IIdIntervalIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval>, Iterable<TInterval> {
185
+ getIntervalById(id: string): TInterval | undefined;
186
+ [Symbol.iterator](): Iterator<TInterval>;
187
+ }
188
+
189
+ /**
190
+ * Basic interval abstraction
191
+ * @public
192
+ */
193
+ export declare interface IInterval {
194
+ /**
195
+ * @returns a new interval object with identical semantics.
196
+ */
197
+ clone(): IInterval;
198
+ /**
199
+ * Compares this interval to `b` with standard comparator semantics:
200
+ * - returns -1 if this is less than `b`
201
+ * - returns 1 if this is greater than `b`
202
+ * - returns 0 if this is equivalent to `b`
203
+ * @param b - Interval to compare against
204
+ */
205
+ compare(b: IInterval): number;
206
+ /**
207
+ * Compares the start endpoint of this interval to `b`'s start endpoint.
208
+ * Standard comparator semantics apply.
209
+ * @param b - Interval to compare against
210
+ */
211
+ compareStart(b: IInterval): number;
212
+ /**
213
+ * Compares the end endpoint of this interval to `b`'s end endpoint.
214
+ * Standard comparator semantics apply.
215
+ * @param b - Interval to compare against
216
+ */
217
+ compareEnd(b: IInterval): number;
218
+ /* Excluded from this release type: modify */
219
+ /**
220
+ * @returns whether this interval overlaps with `b`.
221
+ * Intervals are considered to overlap if their intersection is non-empty.
222
+ */
223
+ overlaps(b: IInterval): boolean;
224
+ /* Excluded from this release type: union */
225
+ }
226
+
227
+ /**
228
+ * Collection of intervals that supports addition, modification, removal, and efficient spatial querying.
229
+ * Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).
230
+ * @public
231
+ */
232
+ export declare interface IIntervalCollection<TInterval extends ISerializableInterval> extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {
233
+ readonly attached: boolean;
234
+ /**
235
+ * Attaches an index to this collection.
236
+ * All intervals which are part of this collection will be added to the index, and the index will automatically
237
+ * be updated when this collection updates due to local or remote changes.
238
+ *
239
+ * @remarks After attaching an index to an interval collection, applications should typically store this
240
+ * index somewhere in their in-memory data model for future reference and querying.
241
+ */
242
+ attachIndex(index: IntervalIndex<TInterval>): void;
243
+ /**
244
+ * Detaches an index from this collection.
245
+ * All intervals which are part of this collection will be removed from the index, and updates to this collection
246
+ * due to local or remote changes will no longer incur updates to the index.
247
+ *
248
+ * @returns `false` if the target index cannot be found in the indexes, otherwise remove all intervals in the index and return `true`.
249
+ */
250
+ detachIndex(index: IntervalIndex<TInterval>): boolean;
251
+ /**
252
+ * @returns the interval in this collection that has the provided `id`.
253
+ * If no interval in the collection has this `id`, returns `undefined`.
254
+ */
255
+ getIntervalById(id: string): TInterval | undefined;
256
+ /**
257
+ * Creates a new interval and add it to the collection.
258
+ * @deprecated call IntervalCollection.add without specifying an intervalType
259
+ * @param start - interval start position (inclusive)
260
+ * @param end - interval end position (exclusive)
261
+ * @param intervalType - type of the interval. All intervals are SlideOnRemove. Intervals may not be Transient.
262
+ * @param props - properties of the interval
263
+ * @returns The created interval
264
+ * @remarks See documentation on {@link SequenceInterval} for comments on
265
+ * interval endpoint semantics: there are subtleties with how the current
266
+ * half-open behavior is represented.
267
+ *
268
+ * Note that intervals may behave unexpectedly if the entire contents
269
+ * of the string are deleted. In this case, it is possible for one endpoint
270
+ * of the interval to become detached, while the other remains on the string.
271
+ *
272
+ * By adjusting the `side` and `pos` values of the `start` and `end` parameters,
273
+ * it is possible to control whether the interval expands to include content
274
+ * inserted at its start or end.
275
+ *
276
+ * See {@link SequencePlace} for more details on the model.
277
+ *
278
+ * @example
279
+ *
280
+ * Given the string "ABCD":
281
+ *
282
+ *```typescript
283
+ * // Refers to "BC". If any content is inserted before B or after C, this
284
+ * // interval will include that content
285
+ * //
286
+ * // Picture:
287
+ * // \{start\} - A[- B - C -]D - \{end\}
288
+ * // \{start\} - A - B - C - D - \{end\}
289
+ * collection.add(\{ pos: 0, side: Side.After \}, \{ pos: 3, side: Side.Before \}, IntervalType.SlideOnRemove);
290
+ * // Equivalent to specifying the same positions and Side.Before.
291
+ * // Refers to "ABC". Content inserted after C will be included in the
292
+ * // interval, but content inserted before A will not.
293
+ * // \{start\} -[A - B - C -]D - \{end\}
294
+ * // \{start\} - A - B - C - D - \{end\}
295
+ * collection.add(0, 3, IntervalType.SlideOnRemove);
296
+ *```
297
+ *
298
+ * In the case of the first example, if text is deleted,
299
+ *
300
+ * ```typescript
301
+ * // Delete the character "B"
302
+ * string.removeRange(1, 2);
303
+ * ```
304
+ *
305
+ * The start point of the interval will slide to the position immediately
306
+ * before "C", and the same will be true.
307
+ *
308
+ * ```
309
+ * \{start\} - A[- C -]D - \{end\}
310
+ * ```
311
+ *
312
+ * In this case, text inserted immediately before "C" would be included in
313
+ * the interval.
314
+ *
315
+ * ```typescript
316
+ * string.insertText(1, "EFG");
317
+ * ```
318
+ *
319
+ * With the string now being,
320
+ *
321
+ * ```
322
+ * \{start\} - A[- E - F - G - C -]D - \{end\}
323
+ * ```
324
+ *
325
+ * @privateRemarks TODO: ADO:5205 the above comment regarding behavior in
326
+ * the case that the entire interval has been deleted should be resolved at
327
+ * the same time as this ticket
328
+ */
329
+ add(start: SequencePlace, end: SequencePlace, intervalType: IntervalType, props?: PropertySet): TInterval;
330
+ /**
331
+ * Creates a new interval and add it to the collection.
332
+ * @param start - interval start position (inclusive)
333
+ * @param end - interval end position (exclusive)
334
+ * @param props - properties of the interval
335
+ * @returns - the created interval
336
+ * @remarks - See documentation on {@link SequenceInterval} for comments on interval endpoint semantics: there are subtleties
337
+ * with how the current half-open behavior is represented.
338
+ */
339
+ add({ start, end, props, }: {
340
+ start: SequencePlace;
341
+ end: SequencePlace;
342
+ props?: PropertySet;
343
+ }): TInterval;
344
+ /**
345
+ * Removes an interval from the collection.
346
+ * @param id - Id of the interval to remove
347
+ * @returns the removed interval
348
+ */
349
+ removeIntervalById(id: string): TInterval | undefined;
350
+ /**
351
+ * Changes the properties on an existing interval.
352
+ * @param id - Id of the interval whose properties should be changed
353
+ * @param props - Property set to apply to the interval. Shallow merging is used between any existing properties
354
+ * and `prop`, i.e. the interval will end up with a property object equivalent to `{ ...oldProps, ...props }`.
355
+ */
356
+ changeProperties(id: string, props: PropertySet): any;
357
+ /**
358
+ * Changes the endpoints of an existing interval.
359
+ * @param id - Id of the interval to change
360
+ * @param start - New start value. To leave the endpoint unchanged, pass the current value.
361
+ * @param end - New end value. To leave the endpoint unchanged, pass the current value.
362
+ * @returns the interval that was changed, if it existed in the collection.
363
+ */
364
+ change(id: string, start: SequencePlace, end: SequencePlace): TInterval | undefined;
365
+ attachDeserializer(onDeserialize: DeserializeCallback): void;
366
+ /**
367
+ * @returns an iterator over all intervals in this collection.
368
+ */
369
+ [Symbol.iterator](): Iterator<TInterval>;
370
+ /**
371
+ * @returns a forward iterator over all intervals in this collection with start point equal to `startPosition`.
372
+ */
373
+ CreateForwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;
374
+ /**
375
+ * @returns a backward iterator over all intervals in this collection with start point equal to `startPosition`.
376
+ */
377
+ CreateBackwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;
378
+ /**
379
+ * @returns a forward iterator over all intervals in this collection with end point equal to `endPosition`.
380
+ */
381
+ CreateForwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;
382
+ /**
383
+ * @returns a backward iterator over all intervals in this collection with end point equal to `endPosition`.
384
+ */
385
+ CreateBackwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;
386
+ /**
387
+ * Gathers iteration results that optionally match a start/end criteria into the provided array.
388
+ * @param results - Array to gather the results into. In lieu of a return value, this array will be populated with
389
+ * intervals matching the query upon edit.
390
+ * @param iteratesForward - whether or not iteration should be in the forward direction
391
+ * @param start - If provided, only match intervals whose start point is equal to `start`.
392
+ * @param end - If provided, only match intervals whose end point is equal to `end`.
393
+ */
394
+ gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;
395
+ /**
396
+ * @deprecated - Users must manually attach the corresponding interval index to utilize this functionality, for instance:
397
+ *
398
+ * ```typescript
399
+ * const overlappingIntervalsIndex = createOverlappingIntervalsIndex(sharedString);
400
+ * collection.attachIndex(overlappingIntervalsIndex)
401
+ * const result = overlappingIntervalsIndex.findOverlappingIntervals(start, end);
402
+ * ```
403
+ *
404
+ * @returns an array of all intervals in this collection that overlap with the interval
405
+ * `[startPosition, endPosition]`.
406
+ */
407
+ findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];
408
+ /**
409
+ * Applies a function to each interval in this collection.
410
+ */
411
+ map(fn: (interval: TInterval) => void): void;
412
+ /**
413
+ * @deprecated - due to the forthcoming change where the endpointIndex will no longer be
414
+ * automatically added to the collection. Users are advised to independently attach the
415
+ * index to the collection and utilize the API accordingly, for instance:
416
+ * ```typescript
417
+ * const endpointIndex = createEndpointIndex(sharedString);
418
+ * collection.attachIndex(endpointIndex);
419
+ * const result1 = endpointIndex.previousInterval(pos);
420
+ * ```
421
+ * If an index is used repeatedly, applications should generally attach it once and store it in memory.
422
+ */
423
+ previousInterval(pos: number): TInterval | undefined;
424
+ /**
425
+ * @deprecated - due to the forthcoming change where the endpointIndex will no longer be
426
+ * automatically added to the collection. Users are advised to independently attach the
427
+ * index to the collection and utilize the API accordingly, for instance:
428
+ * ```typescript
429
+ * const endpointIndex = createEndpointIndex(sharedString);
430
+ * collection.attachIndex(endpointIndex);
431
+ * const result2 = endpointIndex.nextInterval(pos);
432
+ * ```
433
+ */
434
+ nextInterval(pos: number): TInterval | undefined;
435
+ }
436
+
437
+ /**
438
+ * Change events emitted by `IntervalCollection`s
439
+ * @public
440
+ */
441
+ export declare interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {
442
+ /**
443
+ * This event is invoked whenever the endpoints of an interval may have changed.
444
+ * This can happen on:
445
+ * - local endpoint modification
446
+ * - ack of a remote endpoint modification
447
+ * - position change due to segment sliding (slides due to mergeTree segment deletion will always appear local)
448
+ * The `interval` argument reflects the new values.
449
+ * `previousInterval` contains transient `ReferencePosition`s at the same location as the interval's original
450
+ * endpoints. These references should be used for position information only.
451
+ * `local` reflects whether the change originated locally.
452
+ * `op` is defined if and only if the server has acked this change.
453
+ * `slide` is true if the change is due to sliding on removal of position
454
+ */
455
+ (event: "changeInterval", listener: (interval: TInterval, previousInterval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined, slide: boolean) => void): any;
456
+ /**
457
+ * This event is invoked whenever an interval is added or removed from the collection.
458
+ * `local` reflects whether the change originated locally.
459
+ * `op` is defined if and only if the server has acked this change.
460
+ */
461
+ (event: "addInterval" | "deleteInterval", listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined) => void): any;
462
+ /**
463
+ * This event is invoked whenever an interval's properties have changed.
464
+ * `interval` reflects the state of the updated properties.
465
+ * `propertyDeltas` is a map-like whose keys contain all values that were changed, and whose
466
+ * values contain all previous values of the property set.
467
+ * This object can be used directly in a call to `changeProperties` to revert the property change if desired.
468
+ * `local` reflects whether the change originated locally.
469
+ * `op` is defined if and only if the server has acked this change.
470
+ */
471
+ (event: "propertyChanged", listener: (interval: TInterval, propertyDeltas: PropertySet, local: boolean, op: ISequencedDocumentMessage | undefined) => void): any;
472
+ }
473
+
474
+ /**
475
+ * @sealed
476
+ * @deprecated The methods within have substitutions
477
+ * @public
478
+ */
479
+ export declare interface IIntervalHelpers<TInterval extends ISerializableInterval> {
480
+ /**
481
+ *
482
+ * @param label - label of the interval collection this interval is being added to. This parameter is
483
+ * irrelevant for transient intervals.
484
+ * @param start - numerical start position of the interval
485
+ * @param end - numerical end position of the interval
486
+ * @param client - client creating the interval
487
+ * @param intervalType - Type of interval to create. Default is SlideOnRemove
488
+ * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)
489
+ * @param fromSnapshot - If this create came from loading a snapshot. Default is false.
490
+ * @param startSide - The side on which the start position lays. See
491
+ * {@link SequencePlace} for additional context
492
+ * @param endSide - The side on which the end position lays. See
493
+ * {@link SequencePlace} for additional context
494
+ */
495
+ create(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client | undefined, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean): TInterval;
496
+ }
497
+
498
+ /**
499
+ * @deprecated IJSONRunSegment will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
500
+ * @public
501
+ */
502
+ export declare interface IJSONRunSegment<T> extends IJSONSegment {
503
+ items: Serializable<T>[];
504
+ }
505
+
506
+ /* Excluded from this release type: IMapMessageLocalMetadata */
507
+
508
+ /**
509
+ * A sequence place that does not refer to the special endpoint segments.
510
+ *
511
+ * See {@link SequencePlace} for additional context.
512
+ * @public
513
+ */
514
+ export declare interface InteriorSequencePlace {
515
+ pos: number;
516
+ side: Side;
517
+ }
518
+
519
+ /**
520
+ * Serializable interval whose endpoints are plain-old numbers.
521
+ * @public
522
+ */
523
+ export declare class Interval implements ISerializableInterval {
524
+ start: number;
525
+ end: number;
526
+ /**
527
+ * {@inheritDoc ISerializableInterval.properties}
528
+ */
529
+ properties: PropertySet;
530
+ /* Excluded from this release type: auxProps */
531
+ /* Excluded from this release type: propertyManager */
532
+ constructor(start: number, end: number, props?: PropertySet);
533
+ /**
534
+ * {@inheritDoc ISerializableInterval.getIntervalId}
535
+ */
536
+ getIntervalId(): string;
537
+ /**
538
+ * @returns an array containing any auxiliary property sets added with `addPropertySet`.
539
+ */
540
+ getAdditionalPropertySets(): PropertySet[];
541
+ /**
542
+ * Adds an auxiliary set of properties to this interval.
543
+ * These properties can be recovered using `getAdditionalPropertySets`
544
+ * @param props - set of properties to add
545
+ * @remarks This gets called as part of the default conflict resolver for `IIntervalCollection<Interval>`
546
+ * (i.e. non-sequence-based interval collections). However, the additional properties don't get serialized.
547
+ * This functionality seems half-baked.
548
+ */
549
+ addPropertySet(props: PropertySet): void;
550
+ /* Excluded from this release type: serialize */
551
+ /**
552
+ * {@inheritDoc IInterval.clone}
553
+ */
554
+ clone(): Interval;
555
+ /**
556
+ * {@inheritDoc IInterval.compare}
557
+ */
558
+ compare(b: Interval): number;
559
+ /**
560
+ * {@inheritDoc IInterval.compareStart}
561
+ */
562
+ compareStart(b: Interval): number;
563
+ /**
564
+ * {@inheritDoc IInterval.compareEnd}
565
+ */
566
+ compareEnd(b: Interval): number;
567
+ /**
568
+ * {@inheritDoc IInterval.overlaps}
569
+ */
570
+ overlaps(b: Interval): boolean;
571
+ /* Excluded from this release type: union */
572
+ getProperties(): PropertySet;
573
+ /* Excluded from this release type: addProperties */
574
+ /* Excluded from this release type: modify */
575
+ private initializeProperties;
576
+ }
577
+
578
+ /**
579
+ * Collection of intervals.
580
+ *
581
+ * Implementers of this interface will typically implement additional APIs to support efficiently querying a collection
582
+ * of intervals in some manner, for example:
583
+ * - "find all intervals with start endpoint between these two points"
584
+ * - "find all intervals which overlap this range"
585
+ * etc.
586
+ * @public
587
+ */
588
+ export declare interface IntervalIndex<TInterval extends ISerializableInterval> {
589
+ /**
590
+ * Adds an interval to the index.
591
+ * @remarks Application code should never need to invoke this method on their index for production scenarios:
592
+ * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.
593
+ */
594
+ add(interval: TInterval): void;
595
+ /**
596
+ * Removes an interval from the index.
597
+ * @remarks Application code should never need to invoke this method on their index for production scenarios:
598
+ * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.
599
+ */
600
+ remove(interval: TInterval): void;
601
+ }
602
+
603
+ /**
604
+ * Information that identifies an interval within a `Sequence`.
605
+ * @public
606
+ */
607
+ export declare interface IntervalLocator {
608
+ /**
609
+ * Label for the collection the interval is a part of
610
+ */
611
+ label: string;
612
+ /**
613
+ * Interval within that collection
614
+ */
615
+ interval: SequenceInterval;
616
+ }
617
+
618
+ /**
619
+ * Returns an object that can be used to find the interval a given LocalReferencePosition belongs to.
620
+ * @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created
621
+ * on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this
622
+ * endpoint is a part of.
623
+ * @public
624
+ */
625
+ export declare function intervalLocatorFromEndpoint(potentialEndpoint: LocalReferencePosition): IntervalLocator | undefined;
626
+
627
+ /**
628
+ * Values are used in persisted formats (ops) and revertibles.
629
+ * @alpha
630
+ */
631
+ export declare const IntervalOpType: {
632
+ readonly ADD: "add";
633
+ readonly DELETE: "delete";
634
+ readonly CHANGE: "change";
635
+ readonly PROPERTY_CHANGED: "propertyChanged";
636
+ readonly POSITION_REMOVE: "positionRemove";
637
+ };
638
+
639
+ /**
640
+ * @alpha
641
+ */
642
+ export declare type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];
643
+
644
+ /**
645
+ * Data for undoing edits affecting Intervals.
646
+ *
647
+ * @alpha
648
+ */
649
+ export declare type IntervalRevertible = {
650
+ event: typeof IntervalOpType.CHANGE;
651
+ interval: SequenceInterval;
652
+ start: LocalReferencePosition;
653
+ end: LocalReferencePosition;
654
+ } | {
655
+ event: typeof IntervalOpType.ADD;
656
+ interval: SequenceInterval;
657
+ } | {
658
+ event: typeof IntervalOpType.DELETE;
659
+ interval: SequenceInterval;
660
+ start: LocalReferencePosition;
661
+ end: LocalReferencePosition;
662
+ } | {
663
+ event: typeof IntervalOpType.PROPERTY_CHANGED;
664
+ interval: SequenceInterval;
665
+ propertyDeltas: PropertySet;
666
+ } | {
667
+ event: typeof IntervalOpType.POSITION_REMOVE;
668
+ intervals: {
669
+ intervalId: string;
670
+ label: string;
671
+ startOffset?: number;
672
+ endOffset?: number;
673
+ }[];
674
+ revertibleRefs: {
675
+ revertible: IntervalRevertible;
676
+ offset: number;
677
+ isStart: boolean;
678
+ }[];
679
+ mergeTreeRevertible: MergeTreeDeltaRevertible;
680
+ };
681
+
682
+ /* Excluded from this release type: IntervalStickiness */
683
+
684
+ /**
685
+ * @public
686
+ */
687
+ export declare enum IntervalType {
688
+ Simple = 0,
689
+ /**
690
+ * @deprecated this functionality is no longer supported and will be removed
691
+ */
692
+ Nest = 1,
693
+ /**
694
+ * SlideOnRemove indicates that the ends of the interval will slide if the segment
695
+ * they reference is removed and acked.
696
+ * See `packages\dds\merge-tree\docs\REFERENCEPOSITIONS.md` for details
697
+ * SlideOnRemove is the default interval behavior and does not need to be specified.
698
+ */
699
+ SlideOnRemove = 2,
700
+ /* Excluded from this release type: Transient */
701
+ }
702
+
703
+ /**
704
+ * @public
705
+ */
706
+ export declare interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
707
+ /**
708
+ * @returns an array of all intervals contained in this collection that overlap the range
709
+ * `[start end]`.
710
+ */
711
+ findOverlappingIntervals(start: SequencePlace, end: SequencePlace): TInterval[];
712
+ /**
713
+ * Gathers the interval results based on specified parameters.
714
+ */
715
+ gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: SequencePlace, end?: SequencePlace): void;
716
+ }
717
+
718
+ /**
719
+ * A range that has changed corresponding to a segment modification.
720
+ * @public
721
+ */
722
+ export declare interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {
723
+ /**
724
+ * The type of operation that changed this range.
725
+ *
726
+ * @remarks Consuming code should typically compare this to the enum values defined in
727
+ * `MergeTreeDeltaOperationTypes`.
728
+ */
729
+ operation: TOperation;
730
+ /**
731
+ * The index of the start of the range.
732
+ */
733
+ position: number;
734
+ /**
735
+ * The segment that corresponds to the range.
736
+ */
737
+ segment: ISegment;
738
+ /**
739
+ * Deltas object which contains all modified properties with their previous values.
740
+ * Since `undefined` doesn't survive a round-trip through JSON serialization, the old value being absent
741
+ * is instead encoded with `null`.
742
+ *
743
+ * @remarks This object is motivated by undo/redo scenarios, and provides a convenient "inverse op" to apply to
744
+ * undo a property change.
745
+ *
746
+ * @example
747
+ *
748
+ * If a segment initially had properties `{ foo: "1", bar: 2 }` and it was annotated with
749
+ * `{ foo: 3, baz: 5 }`, the corresponding event would have a `propertyDeltas` of `{ foo: "1", baz: null }`.
750
+ */
751
+ propertyDeltas: PropertySet;
752
+ }
753
+
754
+ /**
755
+ * @public
756
+ */
757
+ export declare interface ISerializableInterval extends IInterval {
758
+ /** Serializable bag of properties associated with the interval. */
759
+ properties: PropertySet;
760
+ /* Excluded from this release type: propertyManager */
761
+ /* Excluded from this release type: serialize */
762
+ /* Excluded from this release type: addProperties */
763
+ /**
764
+ * Gets the id associated with this interval.
765
+ * When the interval is used as part of an interval collection, this id can be used to modify or remove the
766
+ * interval.
767
+ * @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions
768
+ * of Fluid didn't always write interval ids.
769
+ */
770
+ getIntervalId(): string | undefined;
771
+ }
772
+
773
+ /* Excluded from this release type: ISerializedInterval */
774
+
775
+ /**
776
+ * @public
777
+ */
778
+ export declare interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {
779
+ getIntervalCollection(label: string): IIntervalCollection<TInterval>;
780
+ }
781
+
782
+ /**
783
+ * Events emitted in response to changes to the sequence data.
784
+ *
785
+ * @remarks
786
+ *
787
+ * The following is the list of events emitted.
788
+ *
789
+ * ### "sequenceDelta"
790
+ *
791
+ * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.
792
+ *
793
+ * #### Listener signature
794
+ *
795
+ * ```typescript
796
+ * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void
797
+ * ```
798
+ * - `event` - Various information on the segments that were modified.
799
+ *
800
+ * - `target` - The sequence itself.
801
+ *
802
+ * ### "maintenance"
803
+ *
804
+ * The maintenance event is emitted when segments are modified during merge-tree maintenance.
805
+ *
806
+ * #### Listener signature
807
+ *
808
+ * ```typescript
809
+ * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void
810
+ * ```
811
+ * - `event` - Various information on the segments that were modified.
812
+ *
813
+ * - `target` - The sequence itself.
814
+ * @public
815
+ */
816
+ export declare interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {
817
+ (event: "createIntervalCollection", listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
818
+ (event: "sequenceDelta", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void): any;
819
+ (event: "maintenance", listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void): any;
820
+ }
821
+
822
+ /**
823
+ * Fluid object interface describing access methods on a SharedString
824
+ * @public
825
+ */
826
+ export declare interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {
827
+ /**
828
+ * Inserts the text at the position.
829
+ * @param pos - The position to insert the text at
830
+ * @param text - The text to insert
831
+ * @param props - The properties of the text
832
+ */
833
+ insertText(pos: number, text: string, props?: PropertySet): void;
834
+ /**
835
+ * Inserts a marker at the position.
836
+ * @param pos - The position to insert the marker at
837
+ * @param refType - The reference type of the marker
838
+ * @param props - The properties of the marker
839
+ */
840
+ insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;
841
+ /**
842
+ * {@inheritDoc SharedSegmentSequence.posFromRelativePos}
843
+ */
844
+ posFromRelativePos(relativePos: IRelativePosition): number;
845
+ }
846
+
847
+ /**
848
+ * Collection of intervals.
849
+ *
850
+ * Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.
851
+ * @public
852
+ */
853
+ export declare interface IStartpointInRangeIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
854
+ /**
855
+ * @returns an array of all intervals contained in this collection whose startpoints locate in the range [start, end] (includes both ends)
856
+ */
857
+ findIntervalsWithStartpointInRange(start: number, end: number): TInterval[];
858
+ }
859
+
860
+ /* Excluded from this release type: IValueOpEmitter */
861
+
862
+ /**
863
+ * Invoke revertibles to reverse prior edits
864
+ *
865
+ * @alpha
866
+ */
867
+ export declare function revertSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
868
+
869
+ /**
870
+ * The event object returned on sequenceDelta events.
871
+ *
872
+ * The properties of this object and its sub-objects represent the state of the sequence at the
873
+ * point in time at which the operation was applied.
874
+ * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.
875
+ *
876
+ * For group ops, each op will get its own event, and the group op property will be set on the op args.
877
+ *
878
+ * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.
879
+ * @public
880
+ */
881
+ export declare class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {
882
+ readonly opArgs: IMergeTreeDeltaOpArgs;
883
+ /**
884
+ * Whether the event was caused by a locally-made change.
885
+ */
886
+ readonly isLocal: boolean;
887
+ constructor(opArgs: IMergeTreeDeltaOpArgs, deltaArgs: IMergeTreeDeltaCallbackArgs, mergeTreeClient: Client);
888
+ }
889
+
890
+ /**
891
+ * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.
892
+ *
893
+ * The properties of this object and its sub-objects represent the state of the sequence at the
894
+ * point in time at which the operation was applied.
895
+ * They will not take into any future modifications performed to the underlying sequence and merge tree.
896
+ * @public
897
+ */
898
+ export declare abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {
899
+ readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>;
900
+ private readonly mergeTreeClient;
901
+ readonly deltaOperation: TOperation;
902
+ private readonly sortedRanges;
903
+ private readonly pFirst;
904
+ private readonly pLast;
905
+ constructor(deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>, mergeTreeClient: Client);
906
+ /**
907
+ * The in-order ranges affected by this delta.
908
+ * These may not be continuous.
909
+ */
910
+ get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[];
911
+ /**
912
+ * The client id of the client that made the change which caused the delta event
913
+ */
914
+ get clientId(): string | undefined;
915
+ /**
916
+ * The first of the modified ranges.
917
+ */
918
+ get first(): Readonly<ISequenceDeltaRange<TOperation>>;
919
+ /**
920
+ * The last of the modified ranges.
921
+ */
922
+ get last(): Readonly<ISequenceDeltaRange<TOperation>>;
923
+ }
924
+
925
+ /**
926
+ * Interval implementation whose ends are associated with positions in a mutatable sequence.
927
+ * As such, when content is inserted into the middle of the interval, the interval expands to
928
+ * include that content.
929
+ *
930
+ * @remarks The endpoints' positions should be treated exclusively to get
931
+ * reasonable behavior. E.g., an interval referring to "hello" in "hello world"
932
+ * should have a start position of 0 and an end position of 5.
933
+ *
934
+ * To see why, consider what happens if "llo wor" is removed from the string to make "held".
935
+ * The interval's startpoint remains on the "h" (it isn't altered), but the interval's endpoint
936
+ * slides forward to the next unremoved position, which is the "l" in "held".
937
+ * Users would generally expect the interval to now refer to "he" (as it is the subset of content
938
+ * remaining after the removal), hence the "l" should be excluded.
939
+ * If the interval endpoint was treated inclusively, the interval would now refer to "hel", which
940
+ * is undesirable.
941
+ *
942
+ * Since the endpoints of an interval are treated exclusively but cannot be greater
943
+ * than or equal to the length of the associated sequence, there exist special
944
+ * endpoint segments, "start" and "end", which represent the position immediately
945
+ * before or immediately after the string respectively.
946
+ *
947
+ * If a `SequenceInterval` is created on a sequence with the
948
+ * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
949
+ * of the interval that are exclusive will have the ability to slide to these
950
+ * special endpoint segments.
951
+ * @public
952
+ */
953
+ export declare class SequenceInterval implements ISerializableInterval {
954
+ private readonly client;
955
+ /**
956
+ * Start endpoint of this interval.
957
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
958
+ */
959
+ start: LocalReferencePosition;
960
+ /**
961
+ * End endpoint of this interval.
962
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
963
+ */
964
+ end: LocalReferencePosition;
965
+ intervalType: IntervalType;
966
+ readonly startSide: Side;
967
+ readonly endSide: Side;
968
+ /**
969
+ * {@inheritDoc ISerializableInterval.properties}
970
+ */
971
+ properties: PropertySet;
972
+ /* Excluded from this release type: propertyManager */
973
+ /* Excluded from this release type: stickiness */
974
+ constructor(client: Client,
975
+ /**
976
+ * Start endpoint of this interval.
977
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
978
+ */
979
+ start: LocalReferencePosition,
980
+ /**
981
+ * End endpoint of this interval.
982
+ * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
983
+ */
984
+ end: LocalReferencePosition, intervalType: IntervalType, props?: PropertySet, startSide?: Side, endSide?: Side);
985
+ private callbacks?;
986
+ /* Excluded from this release type: addPositionChangeListeners */
987
+ /* Excluded from this release type: removePositionChangeListeners */
988
+ /* Excluded from this release type: serialize */
989
+ /**
990
+ * {@inheritDoc IInterval.clone}
991
+ */
992
+ clone(): SequenceInterval;
993
+ /**
994
+ * {@inheritDoc IInterval.compare}
995
+ */
996
+ compare(b: SequenceInterval): number;
997
+ /**
998
+ * {@inheritDoc IInterval.compareStart}
999
+ */
1000
+ compareStart(b: SequenceInterval): number;
1001
+ /**
1002
+ * {@inheritDoc IInterval.compareEnd}
1003
+ */
1004
+ compareEnd(b: SequenceInterval): number;
1005
+ /**
1006
+ * {@inheritDoc IInterval.overlaps}
1007
+ */
1008
+ overlaps(b: SequenceInterval): boolean;
1009
+ /**
1010
+ * {@inheritDoc ISerializableInterval.getIntervalId}
1011
+ */
1012
+ getIntervalId(): string;
1013
+ /* Excluded from this release type: union */
1014
+ /* Excluded from this release type: addProperties */
1015
+ /**
1016
+ * @returns whether this interval overlaps two numerical positions.
1017
+ */
1018
+ overlapsPos(bstart: number, bend: number): boolean;
1019
+ /* Excluded from this release type: modify */
1020
+ private initializeProperties;
1021
+ }
1022
+
1023
+ /**
1024
+ * @deprecated The methods within have substitutions
1025
+ * @public
1026
+ */
1027
+ export declare const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval>;
1028
+
1029
+ /**
1030
+ * This namespace contains specialiazations of indexes which support spatial queries
1031
+ * specifically for `SequenceInterval`s.
1032
+ * @public
1033
+ */
1034
+ export declare namespace SequenceIntervalIndexes {
1035
+ /**
1036
+ * Collection of intervals.
1037
+ *
1038
+ * Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.
1039
+ */
1040
+ export interface Overlapping extends IOverlappingIntervalsIndex<SequenceInterval> {
1041
+ /**
1042
+ * Finds overlapping intervals within the specified range.
1043
+ *
1044
+ * @returns an array of all intervals that overlap with the specified SegOff range (includes both ends)
1045
+ */
1046
+ findOverlappingIntervalsBySegoff(startSegoff: {
1047
+ segment: ISegment | undefined;
1048
+ offset: number | undefined;
1049
+ }, endSegoff: {
1050
+ segment: ISegment | undefined;
1051
+ offset: number | undefined;
1052
+ }): Iterable<SequenceInterval>;
1053
+ }
1054
+ }
1055
+
1056
+ /**
1057
+ * The event object returned on maintenance events.
1058
+ *
1059
+ * The properties of this object and its sub-objects represent the state of the sequence at the
1060
+ * point in time at which the operation was applied.
1061
+ * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.
1062
+ * @public
1063
+ */
1064
+ export declare class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {
1065
+ readonly opArgs: IMergeTreeDeltaOpArgs | undefined;
1066
+ constructor(opArgs: IMergeTreeDeltaOpArgs | undefined, deltaArgs: IMergeTreeMaintenanceCallbackArgs, mergeTreeClient: Client);
1067
+ }
1068
+
1069
+ /**
1070
+ * Optional flags that configure options for sequence DDSs
1071
+ * @public
1072
+ */
1073
+ export declare interface SequenceOptions {
1074
+ /**
1075
+ * Enable the ability to use interval APIs that rely on positions before and
1076
+ * after individual characters, referred to as "sides". See {@link SequencePlace}
1077
+ * for additional context.
1078
+ *
1079
+ * This flag must be enabled to pass instances of {@link SequencePlace} to
1080
+ * any IIntervalCollection API.
1081
+ *
1082
+ * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow
1083
+ * endpoints to slide to the special endpoint segments.
1084
+ *
1085
+ * The default value is false.
1086
+ */
1087
+ intervalStickinessEnabled: boolean;
1088
+ /**
1089
+ * Enable the ability for interval endpoints to slide to the special endpoint
1090
+ * segments that exist before and after the bounds of the string. This is
1091
+ * primarily useful for workflows involving interval stickiness, and it is
1092
+ * suggested to enable both this flag and `intervalStickinessEnabled` at the
1093
+ * same time.
1094
+ *
1095
+ * The default value is false.
1096
+ */
1097
+ mergeTreeReferencesCanSlideToEndpoint: boolean;
1098
+ [key: string]: boolean;
1099
+ }
1100
+
1101
+ /**
1102
+ * Defines a position and side relative to a character in a sequence.
1103
+ *
1104
+ * For this purpose, sequences look like:
1105
+ *
1106
+ * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`
1107
+ *
1108
+ * Each `{value}` in the diagram is a character within a sequence.
1109
+ * Each `-` in the above diagram is a position where text could be inserted.
1110
+ * Each position between a `{value}` and a `-` is a `SequencePlace`.
1111
+ *
1112
+ * The special endpoints `{start}` and `{end}` refer to positions outside the
1113
+ * contents of the string.
1114
+ *
1115
+ * This gives us 2N + 2 possible positions to refer to within a string, where N
1116
+ * is the number of characters.
1117
+ *
1118
+ * If the position is specified with a bare number, the side defaults to
1119
+ * `Side.Before`.
1120
+ *
1121
+ * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),
1122
+ * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.
1123
+ * E.g. the start of a range with Side.After is exclusive of the character at the position.
1124
+ * @public
1125
+ */
1126
+ export declare type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
1127
+
1128
+ /* Excluded from this release type: SerializedIntervalDelta */
1129
+
1130
+ /**
1131
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
1132
+ * @public
1133
+ */
1134
+ export declare class SharedIntervalCollection extends SharedObject implements ISharedIntervalCollection<Interval> {
1135
+ /**
1136
+ * Create a SharedIntervalCollection
1137
+ *
1138
+ * @param runtime - data store runtime the new shared map belongs to
1139
+ * @param id - optional name of the shared map
1140
+ * @returns newly create shared map (but not attached yet)
1141
+ */
1142
+ static create(runtime: IFluidDataStoreRuntime, id?: string): SharedIntervalCollection;
1143
+ /**
1144
+ * Get a factory for SharedIntervalCollection to register with the data store.
1145
+ *
1146
+ * @returns a factory that creates and load SharedIntervalCollection
1147
+ */
1148
+ static getFactory(): IChannelFactory;
1149
+ readonly [Symbol.toStringTag]: string;
1150
+ private readonly intervalCollections;
1151
+ /**
1152
+ * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will
1153
+ * be provided
1154
+ */
1155
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
1156
+ getIntervalCollection(label: string): IIntervalCollection<Interval>;
1157
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
1158
+ protected reSubmitCore(content: any, localOpMetadata: unknown): void;
1159
+ protected onDisconnect(): void;
1160
+ /**
1161
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
1162
+ */
1163
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
1164
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
1165
+ /**
1166
+ * Creates the full path of the intervalCollection label
1167
+ * @param label - the incoming label
1168
+ */
1169
+ protected getIntervalCollectionPath(label: string): string;
1170
+ protected applyStashedOp(): void;
1171
+ }
1172
+
1173
+ /**
1174
+ * The factory that defines the SharedIntervalCollection.
1175
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
1176
+ * @public
1177
+ */
1178
+ export declare class SharedIntervalCollectionFactory implements IChannelFactory {
1179
+ static readonly Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
1180
+ static readonly Attributes: IChannelAttributes;
1181
+ get type(): string;
1182
+ get attributes(): IChannelAttributes;
1183
+ /**
1184
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
1185
+ */
1186
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<SharedIntervalCollection>;
1187
+ create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection;
1188
+ }
1189
+
1190
+ /**
1191
+ * @public
1192
+ */
1193
+ export declare abstract class SharedSegmentSequence<T extends ISegment> extends SharedObject<ISharedSegmentSequenceEvents> implements ISharedIntervalCollection<SequenceInterval>, MergeTreeRevertibleDriver {
1194
+ private readonly dataStoreRuntime;
1195
+ id: string;
1196
+ readonly segmentFromSpec: (spec: IJSONSegment) => ISegment;
1197
+ get loaded(): Promise<void>;
1198
+ /* Excluded from this release type: guardReentrancy */
1199
+ private static createOpsFromDelta;
1200
+ protected client: Client;
1201
+ /** `Deferred` that triggers once the object is loaded */
1202
+ protected loadedDeferred: Deferred<void>;
1203
+ private readonly loadedDeferredOutgoingOps;
1204
+ private deferIncomingOps;
1205
+ private readonly loadedDeferredIncomingOps;
1206
+ private messagesSinceMSNChange;
1207
+ private readonly intervalCollections;
1208
+ constructor(dataStoreRuntime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, segmentFromSpec: (spec: IJSONSegment) => ISegment);
1209
+ /**
1210
+ * @param start - The inclusive start of the range to remove
1211
+ * @param end - The exclusive end of the range to remove
1212
+ */
1213
+ removeRange(start: number, end: number): IMergeTreeRemoveMsg;
1214
+ /**
1215
+ * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with the native batching capabilities of the runtime
1216
+ */
1217
+ groupOperation(groupOp: IMergeTreeGroupMsg): void;
1218
+ /**
1219
+ * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.
1220
+ * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.
1221
+ * @param pos - Character position (index) into the current local view of the SharedString.
1222
+ */
1223
+ getContainingSegment(pos: number): {
1224
+ segment: T | undefined;
1225
+ offset: number | undefined;
1226
+ };
1227
+ /**
1228
+ * Returns the length of the current sequence for the client
1229
+ */
1230
+ getLength(): number;
1231
+ /**
1232
+ * Returns the current position of a segment, and -1 if the segment
1233
+ * does not exist in this sequence
1234
+ * @param segment - The segment to get the position of
1235
+ */
1236
+ getPosition(segment: ISegment): number;
1237
+ /**
1238
+ * Annotates the range with the provided properties
1239
+ *
1240
+ * @param start - The inclusive start position of the range to annotate
1241
+ * @param end - The exclusive end position of the range to annotate
1242
+ * @param props - The properties to annotate the range with
1243
+ * @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
1244
+ *
1245
+ */
1246
+ annotateRange(start: number, end: number, props: PropertySet, combiningOp?: ICombiningOp): void;
1247
+ getPropertiesAtPosition(pos: number): PropertySet | undefined;
1248
+ getRangeExtentsOfPosition(pos: number): {
1249
+ posStart: number | undefined;
1250
+ posAfterEnd: number | undefined;
1251
+ };
1252
+ /**
1253
+ * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include
1254
+ * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.
1255
+ * @param segment - Segment to add the local reference on
1256
+ * @param offset - Offset on the segment at which to place the local reference
1257
+ * @param refType - ReferenceType for the created local reference
1258
+ * @param properties - PropertySet to place on the created local reference
1259
+ */
1260
+ createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
1261
+ /**
1262
+ * Resolves a `ReferencePosition` into a character position using this client's perspective.
1263
+ */
1264
+ localReferencePositionToPosition(lref: ReferencePosition): number;
1265
+ /**
1266
+ * Removes a `LocalReferencePosition` from this SharedString.
1267
+ */
1268
+ removeLocalReferencePosition(lref: LocalReferencePosition): LocalReferencePosition | undefined;
1269
+ /**
1270
+ * Resolves a remote client's position against the local sequence
1271
+ * and returns the remote client's position relative to the local
1272
+ * sequence. The client ref seq must be above the minimum sequence number
1273
+ * or the return value will be undefined.
1274
+ * Generally this method is used in conjunction with signals which provide
1275
+ * point in time values for the below parameters, and is useful for things
1276
+ * like displaying user position. It should not be used with persisted values
1277
+ * as persisted values will quickly become invalid as the remoteClientRefSeq
1278
+ * moves below the minimum sequence number
1279
+ * @param remoteClientPosition - The remote client's position to resolve
1280
+ * @param remoteClientRefSeq - The reference sequence number of the remote client
1281
+ * @param remoteClientId - The client id of the remote client
1282
+ */
1283
+ resolveRemoteClientPosition(remoteClientPosition: number, remoteClientRefSeq: number, remoteClientId: string): number | undefined;
1284
+ /**
1285
+ * @deprecated This method will no longer be public in an upcoming release as it is not safe to use outside of this class
1286
+ */
1287
+ submitSequenceMessage(message: IMergeTreeOp): void;
1288
+ /**
1289
+ * Given a position specified relative to a marker id, lookup the marker
1290
+ * and convert the position to a character position.
1291
+ * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.
1292
+ */
1293
+ posFromRelativePos(relativePos: IRelativePosition): number;
1294
+ /**
1295
+ * Walk the underlying segments of the sequence.
1296
+ * The walked segments may extend beyond the range
1297
+ * if the segments cross the ranges start or end boundaries.
1298
+ * Set split range to true to ensure only segments within the
1299
+ * range are walked.
1300
+ *
1301
+ * @param handler - The function to handle each segment
1302
+ * @param start - Optional. The start of range walk.
1303
+ * @param end - Optional. The end of range walk
1304
+ * @param accum - Optional. An object that will be passed to the handler for accumulation
1305
+ * @param splitRange - Optional. Splits boundary segments on the range boundaries
1306
+ */
1307
+ walkSegments<TClientData>(handler: ISegmentAction<TClientData>, start?: number, end?: number, accum?: TClientData, splitRange?: boolean): void;
1308
+ /**
1309
+ * @deprecated this functionality is no longer supported and will be removed
1310
+ */
1311
+ getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap;
1312
+ /**
1313
+ * @returns The most recent sequence number which has been acked by the server and processed by this
1314
+ * SharedSegmentSequence.
1315
+ */
1316
+ getCurrentSeq(): number;
1317
+ /**
1318
+ * Inserts a segment directly before a `ReferencePosition`.
1319
+ * @param refPos - The reference position to insert the segment at
1320
+ * @param segment - The segment to insert
1321
+ */
1322
+ insertAtReferencePosition(pos: ReferencePosition, segment: T): void;
1323
+ /**
1324
+ * Inserts a segment
1325
+ * @param start - The position to insert the segment at
1326
+ * @param spec - The segment to inserts spec
1327
+ */
1328
+ insertFromSpec(pos: number, spec: IJSONSegment): void;
1329
+ /**
1330
+ * Retrieves the interval collection keyed on `label`. If no such interval collection exists,
1331
+ * creates one.
1332
+ */
1333
+ getIntervalCollection(label: string): IIntervalCollection<SequenceInterval>;
1334
+ /**
1335
+ * @returns An iterable object that enumerates the IntervalCollection labels.
1336
+ *
1337
+ * @example
1338
+ *
1339
+ * ```typescript
1340
+ * const iter = this.getIntervalCollectionKeys();
1341
+ * for (key of iter)
1342
+ * const collection = this.getIntervalCollection(key);
1343
+ * ...
1344
+ * ```
1345
+ */
1346
+ getIntervalCollectionLabels(): IterableIterator<string>;
1347
+ /**
1348
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
1349
+ */
1350
+ protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
1351
+ /**
1352
+ * Runs serializer over the GC data for this SharedMatrix.
1353
+ * All the IFluidHandle's represent routes to other objects.
1354
+ */
1355
+ protected processGCDataCore(serializer: SummarySerializer): void;
1356
+ /**
1357
+ * Replace the range specified from start to end with the provided segment
1358
+ * This is done by inserting the segment at the end of the range, followed
1359
+ * by removing the contents of the range
1360
+ * For a zero or reverse range (start \>= end), insert at end do not remove anything
1361
+ * @param start - The start of the range to replace
1362
+ * @param end - The end of the range to replace
1363
+ * @param segment - The segment that will replace the range
1364
+ */
1365
+ protected replaceRange(start: number, end: number, segment: ISegment): void;
1366
+ /**
1367
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}
1368
+ */
1369
+ protected onConnect(): void;
1370
+ /**
1371
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
1372
+ */
1373
+ protected onDisconnect(): void;
1374
+ /**
1375
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
1376
+ */
1377
+ protected reSubmitCore(content: any, localOpMetadata: unknown): void;
1378
+ /**
1379
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
1380
+ */
1381
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
1382
+ /**
1383
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
1384
+ */
1385
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
1386
+ /**
1387
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}
1388
+ */
1389
+ protected didAttach(): void;
1390
+ /**
1391
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}
1392
+ */
1393
+ protected initializeLocalCore(): void;
1394
+ /**
1395
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
1396
+ */
1397
+ protected applyStashedOp(content: any): unknown;
1398
+ private summarizeMergeTree;
1399
+ private processMergeTreeMsg;
1400
+ private processMinSequenceNumberChanged;
1401
+ private loadFinished;
1402
+ private initializeIntervalCollections;
1403
+ }
1404
+
1405
+ /**
1406
+ * @deprecated SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
1407
+ * @public
1408
+ */
1409
+ export declare class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
1410
+ id: string;
1411
+ constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, specToSegment: (spec: IJSONSegment) => ISegment);
1412
+ /**
1413
+ * @param pos - The position to insert the items at.
1414
+ * @param items - The items to insert.
1415
+ * @param props - Optional. Properties to set on the inserted items.
1416
+ */
1417
+ insert(pos: number, items: Serializable<T>[], props?: PropertySet): void;
1418
+ /**
1419
+ * @param start - The inclusive start of the range to remove
1420
+ * @param end - The exclusive end of the range to remove
1421
+ */
1422
+ remove(start: number, end: number): void;
1423
+ /**
1424
+ * Returns the total count of items in the sequence
1425
+ */
1426
+ getItemCount(): number;
1427
+ /**
1428
+ * Gets the items in the specified range
1429
+ *
1430
+ * @param start - The inclusive start of the range
1431
+ * @param end - The exclusive end of the range
1432
+ */
1433
+ getItems(start: number, end?: number): Serializable<T>[];
1434
+ }
1435
+
1436
+ /**
1437
+ * The Shared String is a specialized data structure for handling collaborative
1438
+ * text. It is based on a more general Sequence data structure but has
1439
+ * additional features that make working with text easier.
1440
+ *
1441
+ * In addition to text, a Shared String can also contain markers. Markers can be
1442
+ * used to store metadata at positions within the text, like the details of an
1443
+ * image or Fluid object that should be rendered with the text.
1444
+ *
1445
+ * @public
1446
+ */
1447
+ export declare class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {
1448
+ id: string;
1449
+ /**
1450
+ * Create a new shared string.
1451
+ * @param runtime - data store runtime the new shared string belongs to
1452
+ * @param id - optional name of the shared string
1453
+ * @returns newly create shared string (but not attached yet)
1454
+ */
1455
+ static create(runtime: IFluidDataStoreRuntime, id?: string): SharedString;
1456
+ /**
1457
+ * Get a factory for SharedString to register with the data store.
1458
+ * @returns a factory that creates and load SharedString
1459
+ */
1460
+ static getFactory(): SharedStringFactory;
1461
+ get ISharedString(): ISharedString;
1462
+ private readonly mergeTreeTextHelper;
1463
+ constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
1464
+ /**
1465
+ * Inserts a marker at a relative position.
1466
+ * @param relativePos1 - The relative position to insert the marker at
1467
+ * @param refType - The reference type of the marker
1468
+ * @param props - The properties of the marker
1469
+ */
1470
+ insertMarkerRelative(relativePos1: IRelativePosition, refType: ReferenceType, props?: PropertySet): void;
1471
+ /**
1472
+ * {@inheritDoc ISharedString.insertMarker}
1473
+ */
1474
+ insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;
1475
+ /**
1476
+ * Inserts the text at the position.
1477
+ * @param relativePos1 - The relative position to insert the text at
1478
+ * @param text - The text to insert
1479
+ * @param props - The properties of text
1480
+ */
1481
+ insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet): void;
1482
+ /**
1483
+ * {@inheritDoc ISharedString.insertText}
1484
+ */
1485
+ insertText(pos: number, text: string, props?: PropertySet): void;
1486
+ /**
1487
+ * Replaces a range with the provided text.
1488
+ * @param start - The inclusive start of the range to replace
1489
+ * @param end - The exclusive end of the range to replace
1490
+ * @param text - The text to replace the range with
1491
+ * @param props - Optional. The properties of the replacement text
1492
+ */
1493
+ replaceText(start: number, end: number, text: string, props?: PropertySet): void;
1494
+ /**
1495
+ * Removes the text in the given range.
1496
+ * @param start - The inclusive start of the range to remove
1497
+ * @param end - The exclusive end of the range to replace
1498
+ * @returns the message sent.
1499
+ */
1500
+ removeText(start: number, end: number): IMergeTreeRemoveMsg;
1501
+ /**
1502
+ * Annotates the marker with the provided properties and calls the callback on consensus.
1503
+ * @param marker - The marker to annotate
1504
+ * @param props - The properties to annotate the marker with
1505
+ * @param consensusCallback - The callback called when consensus is reached
1506
+ *
1507
+ * @deprecated We no longer intend to support this functionality and it will
1508
+ * be removed in a future release. There is no replacement for this
1509
+ * functionality.
1510
+ */
1511
+ annotateMarkerNotifyConsensus(marker: Marker, props: PropertySet, callback: (m: Marker) => void): void;
1512
+ /**
1513
+ * Annotates the marker with the provided properties.
1514
+ * @param marker - The marker to annotate
1515
+ * @param props - The properties to annotate the marker with
1516
+ * @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
1517
+ */
1518
+ annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp): void;
1519
+ /**
1520
+ * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.
1521
+ * Note that Markers receive `ReferenceType.Tile` by default.
1522
+ * @deprecated Use `searchForMarker` instead.
1523
+ * @param startPos - Position at which to start the search
1524
+ * @param clientId - clientId dictating the perspective to search from
1525
+ * @param tileLabel - Label of the tile to search for
1526
+ * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`
1527
+ */
1528
+ findTile(startPos: number | undefined, tileLabel: string, preceding?: boolean): {
1529
+ tile: ReferencePosition;
1530
+ pos: number;
1531
+ } | undefined;
1532
+ /**
1533
+ * Searches a string for the nearest marker in either direction to a given start position.
1534
+ * The search will include the start position, so markers at the start position are valid
1535
+ * results of the search.
1536
+ * @param startPos - Position at which to start the search
1537
+ * @param markerLabel - Label of the marker to search for
1538
+ * @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`
1539
+ */
1540
+ searchForMarker(startPos: number, markerLabel: string, forwards?: boolean): Marker | undefined;
1541
+ /**
1542
+ * Retrieve text from the SharedString in string format.
1543
+ * @param start - The starting index of the text to retrieve, or 0 if omitted.
1544
+ * @param end - The ending index of the text to retrieve, or the end of the string if omitted
1545
+ * @returns The requested text content as a string.
1546
+ */
1547
+ getText(start?: number, end?: number): string;
1548
+ /**
1549
+ * Adds spaces for markers and handles, so that position calculations account for them.
1550
+ */
1551
+ getTextWithPlaceholders(start?: number, end?: number): string;
1552
+ getTextRangeWithMarkers(start: number, end: number): string;
1553
+ /**
1554
+ * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided
1555
+ * id in this `SharedString`.
1556
+ */
1557
+ getMarkerFromId(id: string): ISegment | undefined;
1558
+ /**
1559
+ * Revert an op
1560
+ */
1561
+ protected rollback(content: any, localOpMetadata: unknown): void;
1562
+ }
1563
+
1564
+ /**
1565
+ * @public
1566
+ */
1567
+ export declare class SharedStringFactory implements IChannelFactory {
1568
+ static Type: string;
1569
+ static readonly Attributes: IChannelAttributes;
1570
+ static segmentFromSpec(spec: any): SharedStringSegment;
1571
+ get type(): string;
1572
+ get attributes(): IChannelAttributes;
1573
+ /**
1574
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
1575
+ */
1576
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<SharedString>;
1577
+ create(document: IFluidDataStoreRuntime, id: string): SharedString;
1578
+ }
1579
+
1580
+ /**
1581
+ * Data for undoing edits on SharedStrings and Intervals.
1582
+ *
1583
+ * @alpha
1584
+ */
1585
+ export declare type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;
1586
+
1587
+ /**
1588
+ * @public
1589
+ */
1590
+ export declare type SharedStringSegment = TextSegment | Marker;
1591
+
1592
+ /**
1593
+ * Defines a side relative to a character in a sequence.
1594
+ *
1595
+ * @remarks See {@link SequencePlace} for additional context on usage.
1596
+ * @public
1597
+ */
1598
+ export declare enum Side {
1599
+ Before = 0,
1600
+ After = 1
1601
+ }
1602
+
1603
+ /**
1604
+ * @deprecated SubSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
1605
+ * @public
1606
+ */
1607
+ export declare class SubSequence<T> extends BaseSegment {
1608
+ items: Serializable<T>[];
1609
+ static readonly typeString: string;
1610
+ static is(segment: ISegment): segment is SubSequence<any>;
1611
+ static fromJSONObject<U>(spec: Serializable): SubSequence<U> | undefined;
1612
+ readonly type: string;
1613
+ constructor(items: Serializable<T>[]);
1614
+ toJSONObject(): IJSONRunSegment<T>;
1615
+ clone(start?: number, end?: number): SubSequence<T>;
1616
+ canAppend(segment: ISegment): boolean;
1617
+ toString(): string;
1618
+ append(segment: ISegment): void;
1619
+ removeRange(start: number, end: number): boolean;
1620
+ protected createSplitSegmentAt(pos: number): SubSequence<T> | undefined;
1621
+ }
1622
+
1623
+ /* Excluded from this release type: TypedEventEmitter */
1624
+
1625
+ export { }