@fluidframework/sequence 1.2.7 → 2.0.0-dev.1.3.0.96595

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 (73) hide show
  1. package/.mocharc.js +12 -0
  2. package/README.md +19 -18
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +3 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/intervalCollection.d.ts +39 -17
  8. package/dist/intervalCollection.d.ts.map +1 -1
  9. package/dist/intervalCollection.js +108 -67
  10. package/dist/intervalCollection.js.map +1 -1
  11. package/dist/packageVersion.d.ts +1 -1
  12. package/dist/packageVersion.d.ts.map +1 -1
  13. package/dist/packageVersion.js +1 -1
  14. package/dist/packageVersion.js.map +1 -1
  15. package/dist/sequence.d.ts +13 -22
  16. package/dist/sequence.d.ts.map +1 -1
  17. package/dist/sequence.js +11 -32
  18. package/dist/sequence.js.map +1 -1
  19. package/dist/sequenceDeltaEvent.d.ts +0 -6
  20. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  21. package/dist/sequenceDeltaEvent.js +0 -1
  22. package/dist/sequenceDeltaEvent.js.map +1 -1
  23. package/dist/sharedIntervalCollection.d.ts +5 -5
  24. package/dist/sharedIntervalCollection.js +5 -5
  25. package/dist/sharedIntervalCollection.js.map +1 -1
  26. package/dist/sharedString.d.ts +30 -1
  27. package/dist/sharedString.d.ts.map +1 -1
  28. package/dist/sharedString.js +40 -5
  29. package/dist/sharedString.js.map +1 -1
  30. package/dist/sparsematrix.d.ts +28 -15
  31. package/dist/sparsematrix.d.ts.map +1 -1
  32. package/dist/sparsematrix.js +24 -13
  33. package/dist/sparsematrix.js.map +1 -1
  34. package/lib/index.d.ts +2 -2
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js +2 -2
  37. package/lib/index.js.map +1 -1
  38. package/lib/intervalCollection.d.ts +39 -17
  39. package/lib/intervalCollection.d.ts.map +1 -1
  40. package/lib/intervalCollection.js +107 -67
  41. package/lib/intervalCollection.js.map +1 -1
  42. package/lib/packageVersion.d.ts +1 -1
  43. package/lib/packageVersion.d.ts.map +1 -1
  44. package/lib/packageVersion.js +1 -1
  45. package/lib/packageVersion.js.map +1 -1
  46. package/lib/sequence.d.ts +13 -22
  47. package/lib/sequence.d.ts.map +1 -1
  48. package/lib/sequence.js +12 -33
  49. package/lib/sequence.js.map +1 -1
  50. package/lib/sequenceDeltaEvent.d.ts +0 -6
  51. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  52. package/lib/sequenceDeltaEvent.js +0 -1
  53. package/lib/sequenceDeltaEvent.js.map +1 -1
  54. package/lib/sharedIntervalCollection.d.ts +5 -5
  55. package/lib/sharedIntervalCollection.js +5 -5
  56. package/lib/sharedIntervalCollection.js.map +1 -1
  57. package/lib/sharedString.d.ts +30 -1
  58. package/lib/sharedString.d.ts.map +1 -1
  59. package/lib/sharedString.js +38 -4
  60. package/lib/sharedString.js.map +1 -1
  61. package/lib/sparsematrix.d.ts +28 -15
  62. package/lib/sparsematrix.d.ts.map +1 -1
  63. package/lib/sparsematrix.js +24 -13
  64. package/lib/sparsematrix.js.map +1 -1
  65. package/package.json +70 -25
  66. package/src/index.ts +3 -1
  67. package/src/intervalCollection.ts +169 -85
  68. package/src/packageVersion.ts +1 -1
  69. package/src/sequence.ts +12 -41
  70. package/src/sequenceDeltaEvent.ts +0 -7
  71. package/src/sharedIntervalCollection.ts +5 -5
  72. package/src/sharedString.ts +44 -6
  73. package/src/sparsematrix.ts +48 -35
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAA0B,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EACH,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACzB,M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tB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAS7D;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAuDxD,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAsBlG,SAAS,CAAC,SAAS;IAQnB,SAAS,CAAC,mBAAmB;IAK7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;IAI/C,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,mBAAmB;IAuC3B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,6BAA6B;CAiBxC"}
package/dist/sequence.js CHANGED
@@ -165,25 +165,9 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
165
165
  getRangeExtentsOfPosition(pos) {
166
166
  return this.client.getRangeExtentsOfPosition(pos);
167
167
  }
168
- /**
169
- * @deprecated - use createLocalReferencePosition
170
- */
171
- createPositionReference(segment, offset, refType) {
172
- const lref = new merge_tree_1.LocalReference(this.client, segment, offset, refType);
173
- if (refType !== merge_tree_1.ReferenceType.Transient) {
174
- this.addLocalReference(lref);
175
- }
176
- return lref;
177
- }
178
168
  createLocalReferencePosition(segment, offset, refType, properties) {
179
169
  return this.client.createLocalReferencePosition(segment, offset, refType, properties);
180
170
  }
181
- /**
182
- * @deprecated - use localReferencePositionToPosition
183
- */
184
- localRefToPos(localRef) {
185
- return this.client.localReferencePositionToPosition(localRef);
186
- }
187
171
  localReferencePositionToPosition(lref) {
188
172
  return this.client.localReferencePositionToPosition(lref);
189
173
  }
@@ -220,18 +204,6 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
220
204
  this.submitLocalMessage(translated, metadata);
221
205
  }
222
206
  }
223
- /**
224
- * @deprecated - use createLocalReferencePosition
225
- */
226
- addLocalReference(lref) {
227
- return this.client.addLocalReference(lref);
228
- }
229
- /**
230
- * @deprecated - use removeLocalReferencePosition
231
- */
232
- removeLocalReference(lref) {
233
- return this.client.removeLocalReferencePosition(lref);
234
- }
235
207
  removeLocalReferencePosition(lref) {
236
208
  return this.client.removeLocalReferencePosition(lref);
237
209
  }
@@ -259,6 +231,10 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
259
231
  walkSegments(handler, start, end, accum, splitRange = false) {
260
232
  return this.client.walkSegments(handler, start, end, accum, splitRange);
261
233
  }
234
+ /**
235
+ * @deprecated for internal use only. public export will be removed.
236
+ * @internal
237
+ */
262
238
  getStackContext(startPos, rangeLabels) {
263
239
  return this.client.getStackContext(startPos, rangeLabels);
264
240
  }
@@ -272,8 +248,8 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
272
248
  }
273
249
  }
274
250
  /**
275
- * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
276
- * are supported. Use `getIntervalCollection` instead.
251
+ * @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
252
+ * are supported. Use {@link SharedSegmentSequence.getIntervalCollection} instead.
277
253
  */
278
254
  async waitIntervalCollection(label) {
279
255
  return this.intervalCollections.get(label);
@@ -282,12 +258,15 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
282
258
  return this.intervalCollections.get(label);
283
259
  }
284
260
  /**
285
- * @returns an iterable object that enumerates the IntervalCollection labels
286
- * Usage:
261
+ * @returns An iterable object that enumerates the IntervalCollection labels.
262
+ *
263
+ * @example
264
+ * ```typescript
287
265
  * const iter = this.getIntervalCollectionKeys();
288
266
  * for (key of iter)
289
267
  * const collection = this.getIntervalCollection(key);
290
268
  * ...
269
+ * ```
291
270
  */
292
271
  getIntervalCollectionLabels() {
293
272
  return this.intervalCollections.keys();
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAgF;A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CAAC;YAC7D,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACpD;IACL,CAAC;CACJ;AA/nBD,sDA+nBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Deferred, bufferToString, assert } from \"@fluidframework/common-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Client,\n createAnnotateRangeOp,\n createGroupOp,\n createInsertOp,\n createRemoveRangeOp,\n ICombiningOp,\n IJSONSegment,\n IMergeTreeAnnotateMsg,\n IMergeTreeDeltaOp,\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n IMergeTreeRemoveMsg,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n LocalReference,\n LocalReferencePosition,\n matchProperties,\n MergeTreeDeltaType,\n PropertySet,\n RangeStackMap,\n ReferencePosition,\n ReferenceType,\n SegmentGroup,\n} from \"@fluidframework/merge-tree\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n SharedObject,\n ISharedObjectEvents,\n SummarySerializer,\n} from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\n\nimport {\n IntervalCollection,\n SequenceInterval,\n SequenceIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { IMapMessageLocalMetadata, IValueChanged } from \"./defaultMapInterfaces\";\nimport { SequenceDeltaEvent, SequenceMaintenanceEvent } from \"./sequenceDeltaEvent\";\nimport { ISharedIntervalCollection } from \"./sharedIntervalCollection\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n (event: \"createIntervalCollection\",\n listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void);\n (event: \"sequenceDelta\", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void);\n (event: \"maintenance\",\n listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void);\n}\n\nexport abstract class SharedSegmentSequence<T extends ISegment>\n extends SharedObject<ISharedSegmentSequenceEvents>\n implements ISharedIntervalCollection<SequenceInterval> {\n get loaded(): Promise<void> {\n return this.loadedDeferred.promise;\n }\n\n private static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n const ops: IMergeTreeDeltaOp[] = [];\n for (const r of event.ranges) {\n switch (event.deltaOperation) {\n case MergeTreeDeltaType.ANNOTATE: {\n const lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n const props = {};\n for (const key of Object.keys(r.propertyDeltas)) {\n props[key] = r.segment.properties?.[key] ?? null;\n }\n if (lastAnnotate && lastAnnotate.pos2 === r.position &&\n matchProperties(lastAnnotate.props, props)) {\n lastAnnotate.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createAnnotateRangeOp(\n r.position,\n r.position + r.segment.cachedLength,\n props,\n undefined));\n }\n break;\n }\n\n case MergeTreeDeltaType.INSERT:\n ops.push(createInsertOp(\n r.position,\n r.segment.clone().toJSONObject()));\n break;\n\n case MergeTreeDeltaType.REMOVE: {\n const lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n if (lastRem?.pos1 === r.position) {\n lastRem.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createRemoveRangeOp(\n r.position,\n r.position + r.segment.cachedLength));\n }\n break;\n }\n\n default:\n }\n }\n return ops;\n }\n\n protected client: Client;\n // Deferred that triggers once the object is loaded\n protected loadedDeferred = new Deferred<void>();\n // cache out going ops created when partial loading\n private readonly loadedDeferredOutgoingOps:\n [IMergeTreeOp, SegmentGroup | SegmentGroup[]][] = [];\n // cache incoming ops that arrive when partial loading\n private deferIncomingOps = true;\n private readonly loadedDeferredIncomingOps: ISequencedDocumentMessage[] = [];\n\n private messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n private readonly intervalCollections: DefaultMap<IntervalCollection<SequenceInterval>>;\n constructor(\n private readonly dataStoreRuntime: IFluidDataStoreRuntime,\n public id: string,\n attributes: IChannelAttributes,\n public readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n ) {\n super(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n this.loadedDeferred.promise.catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n });\n\n this.client = new Client(\n segmentFromSpec,\n ChildLogger.create(this.logger, \"SharedSegmentSequence.MergeTreeClient\"),\n dataStoreRuntime.options);\n\n super.on(\"newListener\", (event) => {\n switch (event) {\n case \"sequenceDelta\":\n if (!this.client.mergeTreeDeltaCallback) {\n this.client.mergeTreeDeltaCallback = (opArgs, deltaArgs) => {\n this.emit(\"sequenceDelta\", new SequenceDeltaEvent(opArgs, deltaArgs, this.client), this);\n };\n }\n break;\n case \"maintenance\":\n if (!this.client.mergeTreeMaintenanceCallback) {\n this.client.mergeTreeMaintenanceCallback = (args, opArgs) => {\n this.emit(\"maintenance\", new SequenceMaintenanceEvent(opArgs, args, this.client), this);\n };\n }\n break;\n default:\n }\n });\n super.on(\"removeListener\", (event: string | symbol) => {\n switch (event) {\n case \"sequenceDelta\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeDeltaCallback = undefined;\n }\n break;\n case \"maintenance\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeMaintenanceCallback = undefined;\n }\n break;\n default:\n break;\n }\n });\n\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new SequenceIntervalCollectionValueType(),\n );\n }\n\n /**\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n */\n public removeRange(start: number, end: number): IMergeTreeRemoveMsg {\n const removeOp = this.client.removeRangeLocal(start, end);\n if (removeOp) {\n this.submitSequenceMessage(removeOp);\n }\n return removeOp;\n }\n\n public groupOperation(groupOp: IMergeTreeGroupMsg) {\n this.client.localTransaction(groupOp);\n this.submitSequenceMessage(groupOp);\n }\n\n public getContainingSegment(pos: number) {\n return this.client.getContainingSegment<T>(pos);\n }\n\n /**\n * Returns the length of the current sequence for the client\n */\n public getLength() {\n return this.client.getLength();\n }\n\n /**\n * Returns the current position of a segment, and -1 if the segment\n * does not exist in this sequence\n * @param segment - The segment to get the position of\n */\n public getPosition(segment: ISegment): number {\n return this.client.getPosition(segment);\n }\n\n /**\n * Annotates the range with the provided properties\n *\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n *\n */\n public annotateRange(\n start: number,\n end: number,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp =\n this.client.annotateRangeLocal(start, end, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n public getPropertiesAtPosition(pos: number) {\n return this.client.getPropertiesAtPosition(pos);\n }\n\n public getRangeExtentsOfPosition(pos: number) {\n return this.client.getRangeExtentsOfPosition(pos);\n }\n\n /**\n * @deprecated - use createLocalReferencePosition\n */\n public createPositionReference(\n segment: T,\n offset: number,\n refType: ReferenceType): LocalReference {\n const lref = new LocalReference(this.client, segment, offset, refType);\n if (refType !== ReferenceType.Transient) {\n this.addLocalReference(lref);\n }\n return lref;\n }\n\n public createLocalReferencePosition(\n segment: T,\n offset: number,\n refType: ReferenceType,\n properties: PropertySet | undefined): LocalReferencePosition {\n return this.client.createLocalReferencePosition(\n segment,\n offset,\n refType,\n properties);\n }\n\n /**\n * @deprecated - use localReferencePositionToPosition\n */\n public localRefToPos(localRef: LocalReference) {\n return this.client.localReferencePositionToPosition(localRef);\n }\n\n public localReferencePositionToPosition(lref: ReferencePosition): number {\n return this.client.localReferencePositionToPosition(lref);\n }\n\n /**\n * Resolves a remote client's position against the local sequence\n * and returns the remote client's position relative to the local\n * sequence. The client ref seq must be above the minimum sequence number\n * or the return value will be undefined.\n * Generally this method is used in conjunction with signals which provide\n * point in time values for the below parameters, and is useful for things\n * like displaying user position. It should not be used with persisted values\n * as persisted values will quickly become invalid as the remoteClientRefSeq\n * moves below the minimum sequence number\n * @param remoteClientPosition - The remote client's position to resolve\n * @param remoteClientRefSeq - The reference sequence number of the remote client\n * @param remoteClientId - The client id of the remote client\n */\n public resolveRemoteClientPosition(\n remoteClientPosition: number,\n remoteClientRefSeq: number,\n remoteClientId: string): number {\n return this.client.resolveRemoteClientPosition(\n remoteClientPosition,\n remoteClientRefSeq,\n remoteClientId);\n }\n\n public submitSequenceMessage(message: IMergeTreeOp) {\n if (!this.isAttached()) {\n return;\n }\n const translated = makeHandlesSerializable(message, this.serializer, this.handle);\n const metadata = this.client.peekPendingSegmentGroups(\n message.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1);\n\n // if loading isn't complete, we need to cache\n // local ops until loading is complete, and then\n // they will be resent\n if (!this.loadedDeferred.isCompleted) {\n this.loadedDeferredOutgoingOps.push([translated, metadata]);\n } else {\n this.submitLocalMessage(translated, metadata);\n }\n }\n\n /**\n * @deprecated - use createLocalReferencePosition\n */\n public addLocalReference(lref: LocalReference) {\n return this.client.addLocalReference(lref);\n }\n\n /**\n * @deprecated - use removeLocalReferencePosition\n */\n public removeLocalReference(lref: LocalReference) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n public removeLocalReferencePosition(lref: LocalReferencePosition) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n /**\n * Given a position specified relative to a marker id, lookup the marker\n * and convert the position to a character position.\n * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n */\n public posFromRelativePos(relativePos: IRelativePosition) {\n return this.client.posFromRelativePos(relativePos);\n }\n\n /**\n * Walk the underlying segments of the sequence.\n * The walked segments may extend beyond the range\n * if the segments cross the ranges start or end boundaries.\n * Set split range to true to ensure only segments within the\n * range are walked.\n *\n * @param handler - The function to handle each segment\n * @param start - Optional. The start of range walk.\n * @param end - Optional. The end of range walk\n * @param accum - Optional. An object that will be passed to the handler for accumulation\n * @param splitRange - Optional. Splits boundary segments on the range boundaries\n */\n public walkSegments<TClientData>(\n handler: ISegmentAction<TClientData>,\n start?: number, end?: number, accum?: TClientData,\n splitRange: boolean = false) {\n return this.client.walkSegments<TClientData>(handler, start, end, accum, splitRange);\n }\n\n public getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {\n return this.client.getStackContext(startPos, rangeLabels);\n }\n\n public getCurrentSeq() {\n return this.client.getCurrentSeq();\n }\n\n public insertAtReferencePosition(pos: ReferencePosition, segment: T) {\n const insertOp = this.client.insertAtReferencePositionLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates\n * are supported. Use `getIntervalCollection` instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<SequenceInterval>> {\n return this.intervalCollections.get(label);\n }\n\n public getIntervalCollection(label: string): IntervalCollection<SequenceInterval> {\n return this.intervalCollections.get(label);\n }\n\n /**\n * @returns an iterable object that enumerates the IntervalCollection labels\n * Usage:\n * const iter = this.getIntervalCollectionKeys();\n * for (key of iter)\n * const collection = this.getIntervalCollection(key);\n * ...\n */\n public getIntervalCollectionLabels(): IterableIterator<string> {\n return this.intervalCollections.keys();\n }\n\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n const builder = new SummaryTreeBuilder();\n\n // conditionally write the interval collection blob\n // only if it has entries\n if (this.intervalCollections.size > 0) {\n builder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n builder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n return builder.getSummaryTree();\n }\n\n /**\n * Runs serializer over the GC data for this SharedMatrix.\n * All the IFluidHandle's represent routes to other objects.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n if (this.intervalCollections.size > 0) {\n this.intervalCollections.serialize(serializer);\n }\n\n this.client.serializeGCData(this.handle, serializer);\n }\n\n /**\n * Replace the range specified from start to end with the provided segment\n * This is done by inserting the segment at the end of the range, followed\n * by removing the contents of the range\n * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n * @param start - The start of the range to replace\n * @param end - The end of the range to replace\n * @param segment - The segment that will replace the range\n */\n protected replaceRange(start: number, end: number, segment: ISegment) {\n // Insert at the max end of the range when start > end, but still remove the range later\n const insertIndex: number = Math.max(start, end);\n\n // Insert first, so local references can slide to the inserted seg if any\n const insert = this.client.insertSegmentLocal(insertIndex, segment);\n if (insert) {\n if (start < end) {\n const remove = this.client.removeRangeLocal(start, end);\n this.submitSequenceMessage(createGroupOp(insert, remove));\n } else {\n this.submitSequenceMessage(insert);\n }\n }\n }\n\n protected onConnect() {\n // Update merge tree collaboration information with new client ID and then resend pending ops\n this.client.startOrUpdateCollaboration(this.runtime.clientId);\n }\n\n protected onDisconnect() { }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n if (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata)) {\n this.submitSequenceMessage(\n this.client.regeneratePendingOp(\n content as IMergeTreeOp,\n localOpMetadata as SegmentGroup | SegmentGroup[]));\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n if (await storage.contains(snapshotFileName)) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n try {\n // this will load the header, and return a promise\n // that will resolve when the body is loaded\n // and the catchup ops are available.\n const { catchupOpsP } = await this.client.load(\n this.runtime,\n new ObjectStoragePartition(storage, contentPath),\n this.serializer);\n\n // setup a promise to process the\n // catch up ops, and finishing the loading process\n const loadCatchUpOps = catchupOpsP\n .then((msgs) => {\n msgs.forEach((m) => {\n const collabWindow = this.client.getCollabWindow();\n if (m.minimumSequenceNumber < collabWindow.minSeq\n || m.referenceSequenceNumber < collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.currentSeq) {\n throw new Error(`Invalid catchup operations in snapshot: ${JSON.stringify({\n op: {\n seq: m.sequenceNumber,\n minSeq: m.minimumSequenceNumber,\n refSeq: m.referenceSequenceNumber,\n },\n collabWindow: {\n seq: collabWindow.currentSeq,\n minSeq: collabWindow.minSeq,\n },\n })}`);\n }\n this.processMergeTreeMsg(m);\n });\n this.loadFinished();\n })\n .catch((error) => {\n this.loadFinished(error);\n });\n if (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) {\n // if we not doing partial load, await the catch up ops,\n // and the finalization of the load\n await loadCatchUpOps;\n }\n } catch (error) {\n this.loadFinished(error);\n }\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n // if loading isn't complete, we need to cache all\n // incoming ops to be applied after loading is complete\n if (this.deferIncomingOps) {\n assert(!local, 0x072 /* \"Unexpected local op when loading not finished\" */);\n this.loadedDeferredIncomingOps.push(message);\n } else {\n assert(message.type === MessageType.Operation, 0x073 /* \"Sequence message not operation\" */);\n\n const handled = this.intervalCollections.tryProcessMessage(\n message.contents,\n local,\n message,\n localOpMetadata,\n );\n\n if (!handled) {\n this.processMergeTreeMsg(message, local);\n }\n }\n }\n\n protected didAttach() {\n // If we are not local, and we've attached we need to start generating and sending ops\n // so start collaboration and provide a default client id incase we are not connected\n if (this.isAttached()) {\n this.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n }\n }\n\n protected initializeLocalCore() {\n super.initializeLocalCore();\n this.loadFinished();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n */\n protected applyStashedOp(content: any): unknown {\n return this.client.applyStashedOp(content);\n }\n\n private summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Are we fully loaded? If not, things will go south\n assert(this.loadedDeferred.isCompleted, 0x074 /* \"Snapshot called when not fully loaded\" */);\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n\n this.processMinSequenceNumberChanged(minSeq);\n\n this.messagesSinceMSNChange.forEach((m) => { m.minimumSequenceNumber = minSeq; });\n\n return this.client.summarize(this.runtime, this.handle, serializer, this.messagesSinceMSNChange);\n }\n\n private processMergeTreeMsg(rawMessage: ISequencedDocumentMessage, local?: boolean) {\n const message = parseHandles(rawMessage, this.serializer);\n\n const ops: IMergeTreeDeltaOp[] = [];\n function transformOps(event: SequenceDeltaEvent) {\n ops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n }\n const needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n let stashMessage: Readonly<ISequencedDocumentMessage> = message;\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.on(\"sequenceDelta\", transformOps);\n }\n }\n\n this.client.applyMsg(message, local);\n\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.removeListener(\"sequenceDelta\", transformOps);\n // shallow clone the message as we only overwrite top level properties,\n // like referenceSequenceNumber and content only\n stashMessage = {\n ...message,\n referenceSequenceNumber: stashMessage.sequenceNumber - 1,\n contents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n };\n }\n\n this.messagesSinceMSNChange.push(stashMessage);\n\n // Do GC every once in a while...\n if (this.messagesSinceMSNChange.length > 20\n && this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {\n this.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n }\n }\n }\n\n private processMinSequenceNumberChanged(minSeq: number) {\n let index = 0;\n for (; index < this.messagesSinceMSNChange.length; index++) {\n if (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n break;\n }\n }\n if (index !== 0) {\n this.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n }\n }\n\n private loadFinished(error?: any) {\n if (!this.loadedDeferred.isCompleted) {\n // Initialize the interval collections\n this.initializeIntervalCollections();\n if (error) {\n this.loadedDeferred.reject(error);\n throw error;\n } else {\n // it is important this series remains synchronous\n // first we stop deferring incoming ops, and apply then all\n this.deferIncomingOps = false;\n for (const message of this.loadedDeferredIncomingOps) {\n this.processCore(message, false, undefined);\n }\n this.loadedDeferredIncomingOps.length = 0;\n\n // then resolve the loaded promise\n // and resubmit all the outstanding ops, as the snapshot\n // is fully loaded, and all outstanding ops are applied\n this.loadedDeferred.resolve();\n\n for (const [messageContent, opMetadata] of this.loadedDeferredOutgoingOps) {\n this.reSubmitCore(messageContent, opMetadata);\n }\n this.loadedDeferredOutgoingOps.length = 0;\n }\n }\n }\n\n private initializeIntervalCollections() {\n // Listen and initialize new SharedIntervalCollections\n this.intervalCollections.eventEmitter.on(\"create\", ({ key, previousValue }: IValueChanged, local: boolean) => {\n const intervalCollection = this.intervalCollections.get(key);\n if (!intervalCollection.attached) {\n intervalCollection.attachGraph(this.client, key);\n }\n assert(previousValue === undefined, 0x2c1 /* \"Creating an interval collection that already exists?\" */);\n this.emit(\"createIntervalCollection\", key, local, this);\n });\n\n // Initialize existing SharedIntervalCollections\n for (const key of this.intervalCollections.keys()) {\n const intervalCollection = this.intervalCollections.get(key);\n intervalCollection.attachGraph(this.client, key);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAgF;AAChF,qEAA8D;AAC9D,+EAG8C;AAM9C,2DAwBoC;AACpC,iEAA2F;AAC3F,2EAO4C;AAI5C,6DAI8B;AAC9B,6CAA0C;AAE1C,6DAAoF;AAGpF,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AA2C9B,MAAsB,qBAClB,SAAQ,iCAA0C;IAiElD,YACqB,gBAAwC,EAClD,EAAU,EACjB,UAA8B,EACd,eAAiD;QAEjE,KAAK,CAAC,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAL1C,qBAAgB,GAAhB,gBAAgB,CAAwB;QAClD,OAAE,GAAF,EAAE,CAAQ;QAED,oBAAe,GAAf,eAAe,CAAkC;QAfrE,mDAAmD;QACzC,mBAAc,GAAG,IAAI,uBAAQ,EAAQ,CAAC;QAChD,mDAAmD;QAClC,8BAAyB,GACY,EAAE,CAAC;QACzD,sDAAsD;QAC9C,qBAAgB,GAAG,IAAI,CAAC;QACf,8BAAyB,GAAgC,EAAE,CAAC;QAErE,2BAAsB,GAAgC,EAAE,CAAC;QAU7D,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,EAAE,KAAK,CAA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,cAAc,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,yBAAyB,EAAE;oBACvE,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;iBACjD;gBACD,IAAI,CAAC,yBAAyB,CAAC,MAAM,GAAG,CAAC,CAAC;aAC7C;SACJ;IACL,CAAC;IAEO,6BAA6B;QACjC,sDAAsD;QACtD,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,EAAiB,EAAE,KAAc,EAAE,EAAE;YACzG,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE;gBAC9B,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aACpD;YACD,IAAA,qBAAM,EAAC,aAAa,KAAK,SAAS,EAAE,KAAK,CAAC,4DAA4D,CAAC,CAAC;YACxG,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,gDAAgD;QAChD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE;YAC/C,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACpD;IACL,CAAC;CACJ;AAnmBD,sDAmmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Deferred, bufferToString, assert } from \"@fluidframework/common-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Client,\n createAnnotateRangeOp,\n createGroupOp,\n createInsertOp,\n createRemoveRangeOp,\n ICombiningOp,\n IJSONSegment,\n IMergeTreeAnnotateMsg,\n IMergeTreeDeltaOp,\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n IMergeTreeRemoveMsg,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n LocalReferencePosition,\n matchProperties,\n MergeTreeDeltaType,\n PropertySet,\n RangeStackMap,\n ReferencePosition,\n ReferenceType,\n SegmentGroup,\n} from \"@fluidframework/merge-tree\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n SharedObject,\n ISharedObjectEvents,\n SummarySerializer,\n} from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\n\nimport {\n IntervalCollection,\n SequenceInterval,\n SequenceIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { IMapMessageLocalMetadata, IValueChanged } from \"./defaultMapInterfaces\";\nimport { SequenceDeltaEvent, SequenceMaintenanceEvent } from \"./sequenceDeltaEvent\";\nimport { ISharedIntervalCollection } from \"./sharedIntervalCollection\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n (event: \"createIntervalCollection\",\n listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void);\n (event: \"sequenceDelta\", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void);\n (event: \"maintenance\",\n listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void);\n}\n\nexport abstract class SharedSegmentSequence<T extends ISegment>\n extends SharedObject<ISharedSegmentSequenceEvents>\n implements ISharedIntervalCollection<SequenceInterval> {\n get loaded(): Promise<void> {\n return this.loadedDeferred.promise;\n }\n\n private static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n const ops: IMergeTreeDeltaOp[] = [];\n for (const r of event.ranges) {\n switch (event.deltaOperation) {\n case MergeTreeDeltaType.ANNOTATE: {\n const lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n const props = {};\n for (const key of Object.keys(r.propertyDeltas)) {\n props[key] = r.segment.properties?.[key] ?? null;\n }\n if (lastAnnotate && lastAnnotate.pos2 === r.position &&\n matchProperties(lastAnnotate.props, props)) {\n lastAnnotate.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createAnnotateRangeOp(\n r.position,\n r.position + r.segment.cachedLength,\n props,\n undefined));\n }\n break;\n }\n\n case MergeTreeDeltaType.INSERT:\n ops.push(createInsertOp(\n r.position,\n r.segment.clone().toJSONObject()));\n break;\n\n case MergeTreeDeltaType.REMOVE: {\n const lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n if (lastRem?.pos1 === r.position) {\n lastRem.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createRemoveRangeOp(\n r.position,\n r.position + r.segment.cachedLength));\n }\n break;\n }\n\n default:\n }\n }\n return ops;\n }\n\n protected client: Client;\n // Deferred that triggers once the object is loaded\n protected loadedDeferred = new Deferred<void>();\n // cache out going ops created when partial loading\n private readonly loadedDeferredOutgoingOps:\n [IMergeTreeOp, SegmentGroup | SegmentGroup[]][] = [];\n // cache incoming ops that arrive when partial loading\n private deferIncomingOps = true;\n private readonly loadedDeferredIncomingOps: ISequencedDocumentMessage[] = [];\n\n private messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n private readonly intervalCollections: DefaultMap<IntervalCollection<SequenceInterval>>;\n constructor(\n private readonly dataStoreRuntime: IFluidDataStoreRuntime,\n public id: string,\n attributes: IChannelAttributes,\n public readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n ) {\n super(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n this.loadedDeferred.promise.catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n });\n\n this.client = new Client(\n segmentFromSpec,\n ChildLogger.create(this.logger, \"SharedSegmentSequence.MergeTreeClient\"),\n dataStoreRuntime.options);\n\n super.on(\"newListener\", (event) => {\n switch (event) {\n case \"sequenceDelta\":\n if (!this.client.mergeTreeDeltaCallback) {\n this.client.mergeTreeDeltaCallback = (opArgs, deltaArgs) => {\n this.emit(\"sequenceDelta\", new SequenceDeltaEvent(opArgs, deltaArgs, this.client), this);\n };\n }\n break;\n case \"maintenance\":\n if (!this.client.mergeTreeMaintenanceCallback) {\n this.client.mergeTreeMaintenanceCallback = (args, opArgs) => {\n this.emit(\"maintenance\", new SequenceMaintenanceEvent(opArgs, args, this.client), this);\n };\n }\n break;\n default:\n }\n });\n super.on(\"removeListener\", (event: string | symbol) => {\n switch (event) {\n case \"sequenceDelta\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeDeltaCallback = undefined;\n }\n break;\n case \"maintenance\":\n if (super.listenerCount(event) === 0) {\n this.client.mergeTreeMaintenanceCallback = undefined;\n }\n break;\n default:\n break;\n }\n });\n\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new SequenceIntervalCollectionValueType(),\n );\n }\n\n /**\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n */\n public removeRange(start: number, end: number): IMergeTreeRemoveMsg {\n const removeOp = this.client.removeRangeLocal(start, end);\n if (removeOp) {\n this.submitSequenceMessage(removeOp);\n }\n return removeOp;\n }\n\n public groupOperation(groupOp: IMergeTreeGroupMsg) {\n this.client.localTransaction(groupOp);\n this.submitSequenceMessage(groupOp);\n }\n\n public getContainingSegment(pos: number) {\n return this.client.getContainingSegment<T>(pos);\n }\n\n /**\n * Returns the length of the current sequence for the client\n */\n public getLength() {\n return this.client.getLength();\n }\n\n /**\n * Returns the current position of a segment, and -1 if the segment\n * does not exist in this sequence\n * @param segment - The segment to get the position of\n */\n public getPosition(segment: ISegment): number {\n return this.client.getPosition(segment);\n }\n\n /**\n * Annotates the range with the provided properties\n *\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n *\n */\n public annotateRange(\n start: number,\n end: number,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp =\n this.client.annotateRangeLocal(start, end, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n public getPropertiesAtPosition(pos: number) {\n return this.client.getPropertiesAtPosition(pos);\n }\n\n public getRangeExtentsOfPosition(pos: number) {\n return this.client.getRangeExtentsOfPosition(pos);\n }\n\n public createLocalReferencePosition(\n segment: T,\n offset: number,\n refType: ReferenceType,\n properties: PropertySet | undefined): LocalReferencePosition {\n return this.client.createLocalReferencePosition(\n segment,\n offset,\n refType,\n properties);\n }\n\n public localReferencePositionToPosition(lref: ReferencePosition): number {\n return this.client.localReferencePositionToPosition(lref);\n }\n\n /**\n * Resolves a remote client's position against the local sequence\n * and returns the remote client's position relative to the local\n * sequence. The client ref seq must be above the minimum sequence number\n * or the return value will be undefined.\n * Generally this method is used in conjunction with signals which provide\n * point in time values for the below parameters, and is useful for things\n * like displaying user position. It should not be used with persisted values\n * as persisted values will quickly become invalid as the remoteClientRefSeq\n * moves below the minimum sequence number\n * @param remoteClientPosition - The remote client's position to resolve\n * @param remoteClientRefSeq - The reference sequence number of the remote client\n * @param remoteClientId - The client id of the remote client\n */\n public resolveRemoteClientPosition(\n remoteClientPosition: number,\n remoteClientRefSeq: number,\n remoteClientId: string): number {\n return this.client.resolveRemoteClientPosition(\n remoteClientPosition,\n remoteClientRefSeq,\n remoteClientId);\n }\n\n public submitSequenceMessage(message: IMergeTreeOp) {\n if (!this.isAttached()) {\n return;\n }\n const translated = makeHandlesSerializable(message, this.serializer, this.handle);\n const metadata = this.client.peekPendingSegmentGroups(\n message.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1);\n\n // if loading isn't complete, we need to cache\n // local ops until loading is complete, and then\n // they will be resent\n if (!this.loadedDeferred.isCompleted) {\n this.loadedDeferredOutgoingOps.push([translated, metadata]);\n } else {\n this.submitLocalMessage(translated, metadata);\n }\n }\n\n public removeLocalReferencePosition(lref: LocalReferencePosition) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n /**\n * Given a position specified relative to a marker id, lookup the marker\n * and convert the position to a character position.\n * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n */\n public posFromRelativePos(relativePos: IRelativePosition) {\n return this.client.posFromRelativePos(relativePos);\n }\n\n /**\n * Walk the underlying segments of the sequence.\n * The walked segments may extend beyond the range\n * if the segments cross the ranges start or end boundaries.\n * Set split range to true to ensure only segments within the\n * range are walked.\n *\n * @param handler - The function to handle each segment\n * @param start - Optional. The start of range walk.\n * @param end - Optional. The end of range walk\n * @param accum - Optional. An object that will be passed to the handler for accumulation\n * @param splitRange - Optional. Splits boundary segments on the range boundaries\n */\n public walkSegments<TClientData>(\n handler: ISegmentAction<TClientData>,\n start?: number, end?: number, accum?: TClientData,\n splitRange: boolean = false) {\n return this.client.walkSegments<TClientData>(handler, start, end, accum, splitRange);\n }\n\n /**\n * @deprecated for internal use only. public export will be removed.\n * @internal\n */\n public getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {\n return this.client.getStackContext(startPos, rangeLabels);\n }\n\n public getCurrentSeq() {\n return this.client.getCurrentSeq();\n }\n\n public insertAtReferencePosition(pos: ReferencePosition, segment: T) {\n const insertOp = this.client.insertAtReferencePositionLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates\n * are supported. Use {@link SharedSegmentSequence.getIntervalCollection} instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<SequenceInterval>> {\n return this.intervalCollections.get(label);\n }\n\n public getIntervalCollection(label: string): IntervalCollection<SequenceInterval> {\n return this.intervalCollections.get(label);\n }\n\n /**\n * @returns An iterable object that enumerates the IntervalCollection labels.\n *\n * @example\n * ```typescript\n * const iter = this.getIntervalCollectionKeys();\n * for (key of iter)\n * const collection = this.getIntervalCollection(key);\n * ...\n * ```\n */\n public getIntervalCollectionLabels(): IterableIterator<string> {\n return this.intervalCollections.keys();\n }\n\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n const builder = new SummaryTreeBuilder();\n\n // conditionally write the interval collection blob\n // only if it has entries\n if (this.intervalCollections.size > 0) {\n builder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n builder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n return builder.getSummaryTree();\n }\n\n /**\n * Runs serializer over the GC data for this SharedMatrix.\n * All the IFluidHandle's represent routes to other objects.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n if (this.intervalCollections.size > 0) {\n this.intervalCollections.serialize(serializer);\n }\n\n this.client.serializeGCData(this.handle, serializer);\n }\n\n /**\n * Replace the range specified from start to end with the provided segment\n * This is done by inserting the segment at the end of the range, followed\n * by removing the contents of the range\n * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n * @param start - The start of the range to replace\n * @param end - The end of the range to replace\n * @param segment - The segment that will replace the range\n */\n protected replaceRange(start: number, end: number, segment: ISegment) {\n // Insert at the max end of the range when start > end, but still remove the range later\n const insertIndex: number = Math.max(start, end);\n\n // Insert first, so local references can slide to the inserted seg if any\n const insert = this.client.insertSegmentLocal(insertIndex, segment);\n if (insert) {\n if (start < end) {\n const remove = this.client.removeRangeLocal(start, end);\n this.submitSequenceMessage(createGroupOp(insert, remove));\n } else {\n this.submitSequenceMessage(insert);\n }\n }\n }\n\n protected onConnect() {\n // Update merge tree collaboration information with new client ID and then resend pending ops\n this.client.startOrUpdateCollaboration(this.runtime.clientId);\n }\n\n protected onDisconnect() { }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n if (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata)) {\n this.submitSequenceMessage(\n this.client.regeneratePendingOp(\n content as IMergeTreeOp,\n localOpMetadata as SegmentGroup | SegmentGroup[]));\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n if (await storage.contains(snapshotFileName)) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n try {\n // this will load the header, and return a promise\n // that will resolve when the body is loaded\n // and the catchup ops are available.\n const { catchupOpsP } = await this.client.load(\n this.runtime,\n new ObjectStoragePartition(storage, contentPath),\n this.serializer);\n\n // setup a promise to process the\n // catch up ops, and finishing the loading process\n const loadCatchUpOps = catchupOpsP\n .then((msgs) => {\n msgs.forEach((m) => {\n const collabWindow = this.client.getCollabWindow();\n if (m.minimumSequenceNumber < collabWindow.minSeq\n || m.referenceSequenceNumber < collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.currentSeq) {\n throw new Error(`Invalid catchup operations in snapshot: ${JSON.stringify({\n op: {\n seq: m.sequenceNumber,\n minSeq: m.minimumSequenceNumber,\n refSeq: m.referenceSequenceNumber,\n },\n collabWindow: {\n seq: collabWindow.currentSeq,\n minSeq: collabWindow.minSeq,\n },\n })}`);\n }\n this.processMergeTreeMsg(m);\n });\n this.loadFinished();\n })\n .catch((error) => {\n this.loadFinished(error);\n });\n if (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) {\n // if we not doing partial load, await the catch up ops,\n // and the finalization of the load\n await loadCatchUpOps;\n }\n } catch (error) {\n this.loadFinished(error);\n }\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n // if loading isn't complete, we need to cache all\n // incoming ops to be applied after loading is complete\n if (this.deferIncomingOps) {\n assert(!local, 0x072 /* \"Unexpected local op when loading not finished\" */);\n this.loadedDeferredIncomingOps.push(message);\n } else {\n assert(message.type === MessageType.Operation, 0x073 /* \"Sequence message not operation\" */);\n\n const handled = this.intervalCollections.tryProcessMessage(\n message.contents,\n local,\n message,\n localOpMetadata,\n );\n\n if (!handled) {\n this.processMergeTreeMsg(message, local);\n }\n }\n }\n\n protected didAttach() {\n // If we are not local, and we've attached we need to start generating and sending ops\n // so start collaboration and provide a default client id incase we are not connected\n if (this.isAttached()) {\n this.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n }\n }\n\n protected initializeLocalCore() {\n super.initializeLocalCore();\n this.loadFinished();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n */\n protected applyStashedOp(content: any): unknown {\n return this.client.applyStashedOp(content);\n }\n\n private summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Are we fully loaded? If not, things will go south\n assert(this.loadedDeferred.isCompleted, 0x074 /* \"Snapshot called when not fully loaded\" */);\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n\n this.processMinSequenceNumberChanged(minSeq);\n\n this.messagesSinceMSNChange.forEach((m) => { m.minimumSequenceNumber = minSeq; });\n\n return this.client.summarize(this.runtime, this.handle, serializer, this.messagesSinceMSNChange);\n }\n\n private processMergeTreeMsg(rawMessage: ISequencedDocumentMessage, local?: boolean) {\n const message = parseHandles(rawMessage, this.serializer);\n\n const ops: IMergeTreeDeltaOp[] = [];\n function transformOps(event: SequenceDeltaEvent) {\n ops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n }\n const needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n let stashMessage: Readonly<ISequencedDocumentMessage> = message;\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.on(\"sequenceDelta\", transformOps);\n }\n }\n\n this.client.applyMsg(message, local);\n\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.removeListener(\"sequenceDelta\", transformOps);\n // shallow clone the message as we only overwrite top level properties,\n // like referenceSequenceNumber and content only\n stashMessage = {\n ...message,\n referenceSequenceNumber: stashMessage.sequenceNumber - 1,\n contents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n };\n }\n\n this.messagesSinceMSNChange.push(stashMessage);\n\n // Do GC every once in a while...\n if (this.messagesSinceMSNChange.length > 20\n && this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {\n this.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n }\n }\n }\n\n private processMinSequenceNumberChanged(minSeq: number) {\n let index = 0;\n for (; index < this.messagesSinceMSNChange.length; index++) {\n if (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n break;\n }\n }\n if (index !== 0) {\n this.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n }\n }\n\n private loadFinished(error?: any) {\n if (!this.loadedDeferred.isCompleted) {\n // Initialize the interval collections\n this.initializeIntervalCollections();\n if (error) {\n this.loadedDeferred.reject(error);\n throw error;\n } else {\n // it is important this series remains synchronous\n // first we stop deferring incoming ops, and apply then all\n this.deferIncomingOps = false;\n for (const message of this.loadedDeferredIncomingOps) {\n this.processCore(message, false, undefined);\n }\n this.loadedDeferredIncomingOps.length = 0;\n\n // then resolve the loaded promise\n // and resubmit all the outstanding ops, as the snapshot\n // is fully loaded, and all outstanding ops are applied\n this.loadedDeferred.resolve();\n\n for (const [messageContent, opMetadata] of this.loadedDeferredOutgoingOps) {\n this.reSubmitCore(messageContent, opMetadata);\n }\n this.loadedDeferredOutgoingOps.length = 0;\n }\n }\n }\n\n private initializeIntervalCollections() {\n // Listen and initialize new SharedIntervalCollections\n this.intervalCollections.eventEmitter.on(\"create\", ({ key, previousValue }: IValueChanged, local: boolean) => {\n const intervalCollection = this.intervalCollections.get(key);\n if (!intervalCollection.attached) {\n intervalCollection.attachGraph(this.client, key);\n }\n assert(previousValue === undefined, 0x2c1 /* \"Creating an interval collection that already exists?\" */);\n this.emit(\"createIntervalCollection\", key, local, this);\n });\n\n // Initialize existing SharedIntervalCollections\n for (const key of this.intervalCollections.keys()) {\n const intervalCollection = this.intervalCollections.get(key);\n intervalCollection.attachGraph(this.client, key);\n }\n }\n}\n"]}
@@ -13,12 +13,6 @@ import { Client, IMergeTreeDeltaCallbackArgs, IMergeTreeDeltaOpArgs, IMergeTreeM
13
13
  export declare abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {
14
14
  readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>;
15
15
  private readonly mergeTreeClient;
16
- /**
17
- * @deprecated - Events no longer fire when the change they correspond to had no impact (e.g. a remote delete
18
- * event for a range that had already been deleted locally).
19
- * Clients can therefore assume this property is false.
20
- */
21
- readonly isEmpty: boolean;
22
16
  readonly deltaOperation: TOperation;
23
17
  private readonly sortedRanges;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AGG;IACH,IAAW,MAAM,IAAI,SAAS,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAExE;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAE5D;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAE3D;CACJ;AAED;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,2BAA2B,CAAC;aAO1D,MAAM,EAAE,qBAAqB;IANjD;;OAEG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAGb,MAAM,EAAE,qBAAqB,EAC7C,SAAS,EAAE,2BAA2B,EACtC,eAAe,EAAE,MAAM;CAK9B;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,aAAa,CAAC,wBAAwB,CAAC;aAE7D,MAAM,EAAE,qBAAqB,GAAG,SAAS;gBAAzC,MAAM,EAAE,qBAAqB,GAAG,SAAS,EACzD,SAAS,EAAE,iCAAiC,EAC5C,eAAe,EAAE,MAAM;CAI9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,UAAU,SAAS,4BAA4B,GAAG,4BAA4B;IAC/G,SAAS,EAAE,UAAU,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC;IAClB,cAAc,EAAE,WAAW,CAAC;CAC/B"}
@@ -19,7 +19,6 @@ class SequenceEvent {
19
19
  this.deltaArgs = deltaArgs;
20
20
  this.mergeTreeClient = mergeTreeClient;
21
21
  (0, common_utils_1.assert)(deltaArgs.deltaSegments.length > 0, 0x2d8 /* "Empty change event should not be emitted." */);
22
- this.isEmpty = false;
23
22
  this.deltaOperation = deltaArgs.operation;
24
23
  this.sortedRanges = new Lazy(() => {
25
24
  const set = new merge_tree_1.SortedSegmentSet();
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,2DAWoC;AAEpC;;;;;;GAMG;AACH,MAAsB,aAAa;IAY/B,YACoB,SAAkD,EACjD,eAAuB;QADxB,cAAS,GAAT,SAAS,CAAyC;QACjD,oBAAe,GAAf,eAAe,CAAQ;QAExC,IAAA,qBAAM,EAAC,SAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACpG,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,SAAS,CAAC;QAE1C,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CACxB,GAAG,EAAE;YACD,MAAM,GAAG,GAAG,IAAI,6BAAgB,EAAmC,CAAC;YACpE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC3C,MAAM,QAAQ,GAAoC;oBAC9C,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS;oBACnC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;oBACzD,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,OAAO,EAAE,KAAK,CAAC,OAAO;iBACzB,CAAC;gBACF,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACf,CAAC,CAAC,CAAC;QAEP,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,CAClB,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACzC,CAAC;QAE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OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SACvC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n Client,\n IMergeTreeDeltaCallbackArgs,\n IMergeTreeDeltaOpArgs,\n IMergeTreeMaintenanceCallbackArgs,\n ISegment,\n MergeTreeDeltaOperationType,\n MergeTreeDeltaOperationTypes,\n MergeTreeMaintenanceType,\n PropertySet,\n SortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n */\nexport abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n /**\n * @deprecated - Events no longer fire when the change they correspond to had no impact (e.g. a remote delete\n * event for a range that had already been deleted locally).\n * Clients can therefore assume this property is false.\n */\n public readonly isEmpty: boolean;\n public readonly deltaOperation: TOperation;\n private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n constructor(\n public readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n private readonly mergeTreeClient: Client,\n ) {\n assert(deltaArgs.deltaSegments.length > 0, 0x2d8 /* \"Empty change event should not be emitted.\" */);\n this.isEmpty = false;\n this.deltaOperation = deltaArgs.operation;\n\n this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(\n () => {\n const set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n this.deltaArgs.deltaSegments.forEach((delta) => {\n const newRange: ISequenceDeltaRange<TOperation> = {\n operation: this.deltaArgs.operation,\n position: this.mergeTreeClient.getPosition(delta.segment),\n propertyDeltas: delta.propertyDeltas,\n segment: delta.segment,\n };\n set.addOrUpdate(newRange);\n });\n return set;\n });\n\n this.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[0],\n );\n\n this.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n );\n }\n\n /**\n * The in-order ranges affected by this delta.\n * These may not be continuous.\n */\n public get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n return this.sortedRanges.value.items;\n }\n\n /**\n * The client id of the client that made the change which caused the delta event\n */\n public get clientId(): string {\n return this.mergeTreeClient.longClientId;\n }\n\n /**\n * The first of the modified ranges.\n */\n public get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pFirst.value;\n }\n\n /**\n * The last of the modified ranges.\n */\n public get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pLast.value;\n }\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n /**\n * Whether the event was caused by a locally-made change.\n */\n public readonly isLocal: boolean;\n\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs,\n deltaArgs: IMergeTreeDeltaCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n this.isLocal = opArgs.sequencedMessage === undefined;\n }\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n deltaArgs: IMergeTreeMaintenanceCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n }\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n */\nexport interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n operation: TOperation;\n /**\n * The index of the start of the range.\n */\n position: number;\n /**\n * The segment that corresponds to the range.\n */\n segment: ISegment;\n propertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n private pValue: T;\n private pEvaluated: boolean;\n constructor(private readonly valueGenerator: () => T) {\n this.pEvaluated = false;\n }\n\n public get evaluated(): boolean {\n return this.pEvaluated;\n }\n\n public get value(): T {\n if (!this.pEvaluated) {\n this.pEvaluated = true;\n this.pValue = this.valueGenerator();\n }\n return this.pValue;\n }\n}\n"]}
1
+ {"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,2DAWoC;AAEpC;;;;;;GAMG;AACH,MAAsB,aAAa;IAM/B,YACoB,SAAkD,EACjD,eAAuB;QADxB,cAAS,GAAT,SAAS,CAAyC;QACjD,oBAAe,GAAf,eAAe,CAAQ;QAExC,IAAA,qBAAM,EAAC,SAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACpG,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,SAAS,CAAC;QAE1C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,KAAK,CAAC;IAC5B,CAAC;CACJ;AAjED,sCAiEC;AAED;;;;;;;;;;GAUG;AACH,MAAa,kBAAmB,SAAQ,aAA0C;IAM9E,YACoB,MAA6B,EAC7C,SAAsC,EACtC,eAAuB;QAEvB,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJlB,WAAM,GAAN,MAAM,CAAuB;QAK7C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,gBAAgB,KAAK,SAAS,CAAC;IACzD,CAAC;CACJ;AAdD,gDAcC;AAED;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,aAAuC;IACjF,YACoB,MAAyC,EACzD,SAA4C,EAC5C,eAAuB;QAEvB,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJlB,WAAM,GAAN,MAAM,CAAmC;IAK7D,CAAC;CACJ;AARD,4DAQC;AAkBD,MAAM,IAAI;IAGN,YAA6B,cAAuB;QAAvB,mBAAc,GAAd,cAAc,CAAS;QAChD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SACvC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n Client,\n IMergeTreeDeltaCallbackArgs,\n IMergeTreeDeltaOpArgs,\n IMergeTreeMaintenanceCallbackArgs,\n ISegment,\n MergeTreeDeltaOperationType,\n MergeTreeDeltaOperationTypes,\n MergeTreeMaintenanceType,\n PropertySet,\n SortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n */\nexport abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n public readonly deltaOperation: TOperation;\n private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n constructor(\n public readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n private readonly mergeTreeClient: Client,\n ) {\n assert(deltaArgs.deltaSegments.length > 0, 0x2d8 /* \"Empty change event should not be emitted.\" */);\n this.deltaOperation = deltaArgs.operation;\n\n this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(\n () => {\n const set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n this.deltaArgs.deltaSegments.forEach((delta) => {\n const newRange: ISequenceDeltaRange<TOperation> = {\n operation: this.deltaArgs.operation,\n position: this.mergeTreeClient.getPosition(delta.segment),\n propertyDeltas: delta.propertyDeltas,\n segment: delta.segment,\n };\n set.addOrUpdate(newRange);\n });\n return set;\n });\n\n this.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[0],\n );\n\n this.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n );\n }\n\n /**\n * The in-order ranges affected by this delta.\n * These may not be continuous.\n */\n public get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n return this.sortedRanges.value.items;\n }\n\n /**\n * The client id of the client that made the change which caused the delta event\n */\n public get clientId(): string {\n return this.mergeTreeClient.longClientId;\n }\n\n /**\n * The first of the modified ranges.\n */\n public get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pFirst.value;\n }\n\n /**\n * The last of the modified ranges.\n */\n public get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pLast.value;\n }\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n /**\n * Whether the event was caused by a locally-made change.\n */\n public readonly isLocal: boolean;\n\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs,\n deltaArgs: IMergeTreeDeltaCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n this.isLocal = opArgs.sequencedMessage === undefined;\n }\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n deltaArgs: IMergeTreeMaintenanceCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n }\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n */\nexport interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n operation: TOperation;\n /**\n * The index of the start of the range.\n */\n position: number;\n /**\n * The segment that corresponds to the range.\n */\n segment: ISegment;\n propertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n private pValue: T;\n private pEvaluated: boolean;\n constructor(private readonly valueGenerator: () => T) {\n this.pEvaluated = false;\n }\n\n public get evaluated(): boolean {\n return this.pEvaluated;\n }\n\n public get value(): T {\n if (!this.pEvaluated) {\n this.pEvaluated = true;\n this.pValue = this.valueGenerator();\n }\n return this.pValue;\n }\n}\n"]}
@@ -8,8 +8,8 @@ import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
8
  import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
9
9
  import { Interval, IntervalCollection, ISerializableInterval } from "./intervalCollection";
10
10
  /**
11
- * The factory that defines the SharedIntervalCollection
12
- * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
11
+ * The factory that defines the SharedIntervalCollection.
12
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
13
13
  */
14
14
  export declare class SharedIntervalCollectionFactory implements IChannelFactory {
15
15
  static readonly Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
@@ -27,7 +27,7 @@ export interface ISharedIntervalCollection<TInterval extends ISerializableInterv
27
27
  getIntervalCollection(label: string): IntervalCollection<TInterval>;
28
28
  }
29
29
  /**
30
- * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
30
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
31
31
  */
32
32
  export declare class SharedIntervalCollection extends SharedObject implements ISharedIntervalCollection<Interval> {
33
33
  /**
@@ -52,8 +52,8 @@ export declare class SharedIntervalCollection extends SharedObject implements IS
52
52
  */
53
53
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
54
54
  /**
55
- * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
56
- * are supported. Use `getIntervalCollection` instead.
55
+ * @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
56
+ * are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.
57
57
  */
58
58
  waitIntervalCollection(label: string): Promise<IntervalCollection<Interval>>;
59
59
  getIntervalCollection(label: string): IntervalCollection<Interval>;
@@ -14,8 +14,8 @@ const defaultMap_1 = require("./defaultMap");
14
14
  const packageVersion_1 = require("./packageVersion");
15
15
  const snapshotFileName = "header";
16
16
  /**
17
- * The factory that defines the SharedIntervalCollection
18
- * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
17
+ * The factory that defines the SharedIntervalCollection.
18
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
19
19
  */
20
20
  class SharedIntervalCollectionFactory {
21
21
  get type() {
@@ -46,7 +46,7 @@ SharedIntervalCollectionFactory.Attributes = {
46
46
  packageVersion: packageVersion_1.pkgVersion,
47
47
  };
48
48
  /**
49
- * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
49
+ * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
50
50
  */
51
51
  class SharedIntervalCollection extends shared_object_base_1.SharedObject {
52
52
  /**
@@ -77,8 +77,8 @@ class SharedIntervalCollection extends shared_object_base_1.SharedObject {
77
77
  return new SharedIntervalCollectionFactory();
78
78
  }
79
79
  /**
80
- * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
81
- * are supported. Use `getIntervalCollection` instead.
80
+ * @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
81
+ * are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.
82
82
  */
83
83
  async waitIntervalCollection(label) {
84
84
  return this.intervalCollections.get(this.getIntervalCollectionPath(label));
@@ -1 +1 @@
1
- {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+DAA8D;AAQ9D,+EAA8F;AAE9F,2EAI4C;AAC5C,6DAK8B;AAC9B,6CAA0C;AAC1C,qDAA8C;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,+BAA+B;IASxC,IAAW,IAAI;QACX,OAAO,+BAA+B,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,+BAA+B,CAAC,UAAU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C,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SACjG;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA/FD,4DA+FC;KAzEoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IMapMessageLocalMetadata } from \"./defaultMapInterfaces\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection\n * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n extends SharedObject implements ISharedIntervalCollection<Interval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_sharedIntervalCollection_\");\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new IntervalCollectionValueType(),\n );\n }\n\n /**\n * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates\n * are supported. Use `getIntervalCollection` instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<Interval>> {\n return this.intervalCollections.get(this.getIntervalCollectionPath(label));\n }\n\n public getIntervalCollection(label: string): IntervalCollection<Interval> {\n const realLabel = this.getIntervalCollectionPath(label);\n const sharedCollection = this.intervalCollections.get(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+DAA8D;AAQ9D,+EAA8F;AAE9F,2EAI4C;AAC5C,6DAK8B;AAC9B,6CAA0C;AAC1C,qDAA8C;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,+BAA+B;IASxC,IAAW,IAAI;QACX,OAAO,+BAA+B,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IA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kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SACjG;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA/FD,4DA+FC;KAzEoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IMapMessageLocalMetadata } from \"./defaultMapInterfaces\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection.\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n extends SharedObject implements ISharedIntervalCollection<Interval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_sharedIntervalCollection_\");\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new IntervalCollectionValueType(),\n );\n }\n\n /**\n * @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates\n * are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<Interval>> {\n return this.intervalCollections.get(this.getIntervalCollectionPath(label));\n }\n\n public getIntervalCollection(label: string): IntervalCollection<Interval> {\n const realLabel = this.getIntervalCollectionPath(label);\n const sharedCollection = this.intervalCollections.get(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
@@ -112,6 +112,9 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
112
112
  tile: ReferencePosition;
113
113
  pos: number;
114
114
  };
115
+ /**
116
+ * @deprecated Use the free function {@link getTextAndMarkers} exported by this package instead.
117
+ */
115
118
  getTextAndMarkers(label: string): {
116
119
  parallelText: string[];
117
120
  parallelMarkers: Marker[];
@@ -126,9 +129,35 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
126
129
  /**
127
130
  * Adds spaces for markers and handles, so that position calculations account for them.
128
131
  */
129
- getTextWithPlaceholders(): string;
132
+ getTextWithPlaceholders(start?: number, end?: number): string;
133
+ /**
134
+ * @deprecated Use {@link SharedString.getTextWithPlaceholders} instead.
135
+ */
130
136
  getTextRangeWithPlaceholders(start: number, end: number): string;
131
137
  getTextRangeWithMarkers(start: number, end: number): string;
132
138
  getMarkerFromId(id: string): ISegment;
139
+ /**
140
+ * Revert an op
141
+ */
142
+ protected rollback(content: any, localOpMetadata: unknown): void;
133
143
  }
144
+ /**
145
+ * Splits the text into regions ending with markers with the given `label`.
146
+ * @param sharedString - String to retrieve text and markers from
147
+ * @param label - label to split on
148
+ * @returns Two parallel lists of text and markers, split by markers with the provided `label`.
149
+ *
150
+ * For example:
151
+ * ```typescript
152
+ * // Say sharedstring has contents "hello<paragraph marker 1>world<paragraph marker 2>missing".
153
+ * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, "paragraph");
154
+ * // parallelText === ["hello", "world"]
155
+ * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]
156
+ * // Note parallelText does not include "missing".
157
+ * ```
158
+ */
159
+ export declare function getTextAndMarkers(sharedString: SharedString, label: string): {
160
+ parallelText: string[];
161
+ parallelMarkers: Marker[];
162
+ };
134
163
  //# sourceMappingURL=sharedString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,MAAM,EAEN,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,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