@fluidframework/sequence 2.33.0-333010 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/api-report/sequence.legacy.alpha.api.md +39 -39
- package/dist/intervalCollection.d.ts +7 -4
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +78 -31
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalCollectionMap.d.ts +1 -0
- package/dist/intervalCollectionMap.d.ts.map +1 -1
- package/dist/intervalCollectionMap.js +9 -0
- package/dist/intervalCollectionMap.js.map +1 -1
- package/dist/intervalCollectionMapInterfaces.d.ts +1 -0
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +3 -3
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +10 -9
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +4 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +10 -0
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +1 -1
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedString.d.ts +0 -4
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +0 -11
- package/dist/sharedString.js.map +1 -1
- package/lib/intervalCollection.d.ts +7 -4
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +78 -31
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalCollectionMap.d.ts +1 -0
- package/lib/intervalCollectionMap.d.ts.map +1 -1
- package/lib/intervalCollectionMap.js +9 -0
- package/lib/intervalCollectionMap.js.map +1 -1
- package/lib/intervalCollectionMapInterfaces.d.ts +1 -0
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -3
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +10 -9
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +4 -0
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +10 -0
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedString.d.ts +0 -4
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +0 -11
- package/lib/sharedString.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +18 -20
- package/src/intervalCollection.ts +112 -42
- package/src/intervalCollectionMap.ts +13 -0
- package/src/intervalCollectionMapInterfaces.ts +1 -0
- package/src/intervalIndex/intervalIndex.ts +1 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +1 -1
- package/src/intervals/sequenceInterval.ts +14 -2
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +15 -0
- package/src/sharedIntervalCollection.ts +1 -1
- package/src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AoNC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ValueType, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\n\nimport { makeSerializable } from \"./IntervalCollectionValues.js\";\nimport {\n\tIntervalCollection,\n\ttype ISerializedIntervalCollectionV1,\n\ttype ISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tIIntervalCollectionTypeOperationValue,\n\tIMapMessageLocalMetadata,\n\tISerializableIntervalCollection,\n\tSequenceOptions,\n} from \"./intervalCollectionMapInterfaces.js\";\n\nfunction isMapOperation(op: unknown): op is IMapOperation {\n\treturn typeof op === \"object\" && op !== null && \"type\" in op && op.type === \"act\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport interface IMapOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t */\n\tvalue: IIntervalCollectionTypeOperationValue;\n}\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableIntervalCollection;\n}\n\nexport interface IntervalCollectionMapEvents extends IEvent {\n\t(event: \"createIntervalCollection\", listener: (key: string, local: boolean) => void): void;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class IntervalCollectionMap {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, IntervalCollection>();\n\n\tprivate readonly eventEmitter = new TypedEventEmitter<IntervalCollectionMapEvents>();\n\tpublic get events(): IEventProvider<IntervalCollectionMapEvents> {\n\t\treturn this.eventEmitter;\n\t}\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: IMapOperation,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t) {}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): IntervalCollection {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(\n\t\t\t\tlocalValue,\n\t\t\t\tserializer,\n\t\t\t\tthis.handle,\n\t\t\t\tthis.options?.intervalSerializationFormat ?? \"2\",\n\t\t\t);\n\t\t});\n\t\treturn JSON.stringify(serializableMapData);\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t *\n\t * @param serialized - A JSON string containing serialized map data\n\t */\n\tpublic populate(serialized: string): void {\n\t\tconst parsed = this.serializer.parse(serialized) as IMapDataObjectSerializable;\n\n\t\tfor (const [key, serializable] of Object.entries(parsed)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tassert(\n\t\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t\t);\n\n\t\t\tthis.createCore(normalizedKey, false, serializable.value);\n\t\t}\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param content - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(\n\t\tcontent: unknown,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst localValue = this.data.get(key);\n\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\t\t\tlocalValue.resubmitMessage(value, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryApplyStashedOp(content: unknown): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst map = this.get(key);\n\n\t\t\tmap.applyStashedOp(value);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was recognized and thus processed, false otherwise.\n\t *\n\t * @remarks\n\t * When this returns false and the caller doesn't handle the op itself, then the op could be from a different version of this code.\n\t * In such a case, not applying the op would result in this client becoming out of sync with clients that do handle the op\n\t * and could result in data corruption or data loss as well.\n\t * Therefore, in such cases the caller should typically throw an error, ensuring that this client treats the situation as data corruption\n\t * (since its data no longer matches what other clients think the data should be) and will avoid overriding document content or misleading the users into thinking their current state is accurate.\n\t */\n\tpublic tryProcessMessage(\n\t\tcontent: unknown,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst localValue = this.data.get(key) ?? this.createCore(key, local);\n\t\t\tlocalValue.process(value, local, message, localOpMetadata as IMapMessageLocalMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t */\n\tprivate createCore(\n\t\tkey: string,\n\t\tlocal: boolean,\n\t\tserializedIntervals?: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2,\n\t): IntervalCollection {\n\t\tconst localValue = new IntervalCollection(\n\t\t\t(op, md) => {\n\t\t\t\t{\n\t\t\t\t\tthis.submitMessage(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\ttype: \"act\",\n\t\t\t\t\t\t\tvalue: op,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmd,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tserializedIntervals ?? [],\n\t\t\tthis.options,\n\t\t);\n\t\tthis.data.set(key, localValue);\n\t\tthis.eventEmitter.emit(\"createIntervalCollection\", key, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"intervalCollectionMap.js","sourceRoot":"","sources":["../src/intervalCollectionMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAGjE,kEAA6D;AAE7D,0EAA0F;AAE1F,+EAAiE;AACjE,mEAIiC;AAQjC,SAAS,cAAc,CAAC,EAAW;IAClC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC;AACnF,CAAC;AAiCD;;;;;;GAMG;AACH,MAAa,qBAAqB;IACjC;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IAQD,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;;;;;;OAOG;IACH,YACkB,UAA4B,EAC5B,MAAoB,EACpB,aAGR,EACQ,OAAkC;QANlC,eAAU,GAAV,UAA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AAO,CAAC,EAAE,CAAC;YAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;YAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACrE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,eAA2C,CAAC,CAAC;YACvF,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACK,UAAU,CACjB,GAAW,EACX,KAAc,EACd,mBAAuF;QAEvF,MAAM,UAAU,GAAG,IAAI,0CAAkB,CACxC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;YACV,CAAC;gBACA,IAAI,CAAC,aAAa,CACjB;oBACC,GAAG;oBACH,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE,EAAE;iBACT,EACD,EAAE,CACF,CAAC;YACH,CAAC;QACF,CAAC,EACD,mBAAmB,IAAI,EAAE,EACzB,IAAI,CAAC,OAAO,CACZ,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAClF,OAAO,UAAU,CAAC;IACnB,CAAC;CACD;AAjOD,sDAiOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { IEvent, IEventProvider } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ValueType, IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\n\nimport { makeSerializable } from \"./IntervalCollectionValues.js\";\nimport {\n\tIntervalCollection,\n\ttype ISerializedIntervalCollectionV1,\n\ttype ISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tIIntervalCollectionTypeOperationValue,\n\tIMapMessageLocalMetadata,\n\tISerializableIntervalCollection,\n\tSequenceOptions,\n} from \"./intervalCollectionMapInterfaces.js\";\n\nfunction isMapOperation(op: unknown): op is IMapOperation {\n\treturn typeof op === \"object\" && op !== null && \"type\" in op && op.type === \"act\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport interface IMapOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t */\n\tvalue: IIntervalCollectionTypeOperationValue;\n}\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableIntervalCollection;\n}\n\nexport interface IntervalCollectionMapEvents extends IEvent {\n\t(event: \"createIntervalCollection\", listener: (key: string, local: boolean) => void): void;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class IntervalCollectionMap {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, IntervalCollection>();\n\n\tprivate readonly eventEmitter = new TypedEventEmitter<IntervalCollectionMapEvents>();\n\tpublic get events(): IEventProvider<IntervalCollectionMapEvents> {\n\t\treturn this.eventEmitter;\n\t}\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: IMapOperation,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t) {}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): IntervalCollection {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(\n\t\t\t\tlocalValue,\n\t\t\t\tserializer,\n\t\t\t\tthis.handle,\n\t\t\t\tthis.options?.intervalSerializationFormat ?? \"2\",\n\t\t\t);\n\t\t});\n\t\treturn JSON.stringify(serializableMapData);\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t *\n\t * @param serialized - A JSON string containing serialized map data\n\t */\n\tpublic populate(serialized: string): void {\n\t\tconst parsed = this.serializer.parse(serialized) as IMapDataObjectSerializable;\n\n\t\tfor (const [key, serializable] of Object.entries(parsed)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tassert(\n\t\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t\t);\n\n\t\t\tthis.createCore(normalizedKey, false, serializable.value);\n\t\t}\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param content - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(\n\t\tcontent: unknown,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst localValue = this.data.get(key);\n\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\t\t\tlocalValue.resubmitMessage(value, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryRollback(content: any, localOpMetadata: unknown) {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst localValue = this.data.get(content.key);\n\n\t\t\tassert(localValue !== undefined, 0xb7e /* Local value expected on rollback */);\n\n\t\t\tlocalValue.rollback(content.value, localOpMetadata as IMapMessageLocalMetadata);\n\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryApplyStashedOp(content: unknown): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst map = this.get(key);\n\n\t\t\tmap.applyStashedOp(value);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was recognized and thus processed, false otherwise.\n\t *\n\t * @remarks\n\t * When this returns false and the caller doesn't handle the op itself, then the op could be from a different version of this code.\n\t * In such a case, not applying the op would result in this client becoming out of sync with clients that do handle the op\n\t * and could result in data corruption or data loss as well.\n\t * Therefore, in such cases the caller should typically throw an error, ensuring that this client treats the situation as data corruption\n\t * (since its data no longer matches what other clients think the data should be) and will avoid overriding document content or misleading the users into thinking their current state is accurate.\n\t */\n\tpublic tryProcessMessage(\n\t\tcontent: unknown,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (isMapOperation(content)) {\n\t\t\tconst { value, key } = content;\n\t\t\tconst localValue = this.data.get(key) ?? this.createCore(key, local);\n\t\t\tlocalValue.process(value, local, message, localOpMetadata as IMapMessageLocalMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t */\n\tprivate createCore(\n\t\tkey: string,\n\t\tlocal: boolean,\n\t\tserializedIntervals?: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2,\n\t): IntervalCollection {\n\t\tconst localValue = new IntervalCollection(\n\t\t\t(op, md) => {\n\t\t\t\t{\n\t\t\t\t\tthis.submitMessage(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\ttype: \"act\",\n\t\t\t\t\t\t\tvalue: op,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmd,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tserializedIntervals ?? [],\n\t\t\tthis.options,\n\t\t);\n\t\tthis.data.set(key, localValue);\n\t\tthis.eventEmitter.emit(\"createIntervalCollection\", key, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n}\n"]}
|
|
@@ -8,6 +8,7 @@ import type { IntervalCollection, ISerializedIntervalCollectionV1, ISerializedIn
|
|
|
8
8
|
import { ISerializedInterval, IntervalDeltaOpType, SerializedIntervalDelta } from "./intervals/index.js";
|
|
9
9
|
export interface IMapMessageLocalMetadata {
|
|
10
10
|
localSeq: number;
|
|
11
|
+
previous?: ISerializedInterval;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Optional flags that configure options for sequence DDSs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EACX,kBAAkB,EAClB,+BAA+B,EAC/B,+BAA+B,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,eAChB,SAAQ,IAAI,CACX,iBAAiB,EACf,uCAAuC,GACvC,2BAA2B,GAC3B,gCAAgC,GAChC,+BAA+B,CACjC;IACD;;;;;;;;;;;;OAYG;IACH,yBAAyB,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,2BAA2B,EAAE,GAAG,GAAG,GAAG,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;;;;;OAOG;IACH,OAAO,CACN,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC9C,eAAe,EAAE,wBAAwB,GAAG,SAAS,GACnD,IAAI,CAAC;CACR;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,IAAI,EAAE,gCAAgC,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,+BAA+B,GAAG,+BAA+B,CAAC;CACzE;AAED,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qCAAqC,GAC9C;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC;IAEvC;;OAEG;IACH,KAAK,EAAE,mBAAmB,CAAC;CAC1B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport type { IMergeTreeOptions } from \"@fluidframework/merge-tree/internal\";\n\nimport type {\n\tIntervalCollection,\n\tISerializedIntervalCollectionV1,\n\tISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n} from \"./intervals/index.js\";\n\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions\n\textends Pick<\n\t\tIMergeTreeOptions,\n\t\t| \"mergeTreeReferencesCanSlideToEndpoint\"\n\t\t| \"mergeTreeEnableObliterate\"\n\t\t| \"mergeTreeEnableSidedObliterate\"\n\t\t| \"mergeTreeEnableAnnotateAdjust\"\n\t> {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link @fluidframework/merge-tree#SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link @fluidframework/merge-tree#SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\n\t/**\n\t * This is for testing, and allows us to output intervals in the older formats.\n\t */\n\tintervalSerializationFormat: \"1\" | \"2\";\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n *\n */\nexport interface IIntervalCollectionOperation {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: \"sharedStringIntervalCollection\";\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n */\nexport type IIntervalCollectionTypeOperationValue =\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.ADD;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: ISerializedInterval;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.CHANGE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.DELETE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t };\n"]}
|
|
1
|
+
{"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport type { IMergeTreeOptions } from \"@fluidframework/merge-tree/internal\";\n\nimport type {\n\tIntervalCollection,\n\tISerializedIntervalCollectionV1,\n\tISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n} from \"./intervals/index.js\";\n\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n\tprevious?: ISerializedInterval;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions\n\textends Pick<\n\t\tIMergeTreeOptions,\n\t\t| \"mergeTreeReferencesCanSlideToEndpoint\"\n\t\t| \"mergeTreeEnableObliterate\"\n\t\t| \"mergeTreeEnableSidedObliterate\"\n\t\t| \"mergeTreeEnableAnnotateAdjust\"\n\t> {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link @fluidframework/merge-tree#SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link @fluidframework/merge-tree#SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\n\t/**\n\t * This is for testing, and allows us to output intervals in the older formats.\n\t */\n\tintervalSerializationFormat: \"1\" | \"2\";\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n *\n */\nexport interface IIntervalCollectionOperation {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: \"sharedStringIntervalCollection\";\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n */\nexport type IIntervalCollectionTypeOperationValue =\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.ADD;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: ISerializedInterval;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.CHANGE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.DELETE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t };\n"]}
|
|
@@ -14,7 +14,7 @@ import { ISerializableInterval, type SequenceInterval } from "../intervals/index
|
|
|
14
14
|
* @legacy
|
|
15
15
|
* @alpha
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @deprecated The generic version of this interface is no longer used and will be removed. Use {@link SequenceIntervalIndex} instead.
|
|
18
18
|
*/
|
|
19
19
|
export interface IntervalIndex<TInterval extends ISerializableInterval> {
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/intervalIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISerializableInterval, type SequenceInterval } from \"../intervals/index.js\";\n\n/**\n * Collection of intervals.\n *\n * Implementers of this interface will typically implement additional APIs to support efficiently querying a collection\n * of intervals in some manner, for example:\n * - \"find all intervals with start endpoint between these two points\"\n * - \"find all intervals which overlap this range\"\n * etc.\n * @legacy\n * @alpha\n *\n * @
|
|
1
|
+
{"version":3,"file":"intervalIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/intervalIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISerializableInterval, type SequenceInterval } from \"../intervals/index.js\";\n\n/**\n * Collection of intervals.\n *\n * Implementers of this interface will typically implement additional APIs to support efficiently querying a collection\n * of intervals in some manner, for example:\n * - \"find all intervals with start endpoint between these two points\"\n * - \"find all intervals which overlap this range\"\n * etc.\n * @legacy\n * @alpha\n *\n * @deprecated The generic version of this interface is no longer used and will be removed. Use {@link SequenceIntervalIndex} instead.\n */\nexport interface IntervalIndex<TInterval extends ISerializableInterval> {\n\t/**\n\t * Adds an interval to the index.\n\t * @remarks Application code should never need to invoke this method on their index for production scenarios:\n\t * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.\n\t */\n\tadd(interval: TInterval): void;\n\n\t/**\n\t * Removes an interval from the index.\n\t * @remarks Application code should never need to invoke this method on their index for production scenarios:\n\t * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.\n\t */\n\tremove(interval: TInterval): void;\n}\n\n/**\n * Collection of intervals.\n *\n * Implementers of this interface will typically implement additional APIs to support efficiently querying a collection\n * of intervals in some manner, for example:\n * - \"find all intervals with start endpoint between these two points\"\n * - \"find all intervals which overlap this range\"\n * etc.\n * @legacy\n * @alpha\n */\nexport interface SequenceIntervalIndex {\n\t/**\n\t * Adds an interval to the index.\n\t * @remarks Application code should never need to invoke this method on their index for production scenarios:\n\t * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.\n\t */\n\tadd(interval: SequenceInterval): void;\n\n\t/**\n\t * Removes an interval from the index.\n\t * @remarks Application code should never need to invoke this method on their index for production scenarios:\n\t * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.\n\t */\n\tremove(interval: SequenceInterval): void;\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import { IntervalIndex, type SequenceIntervalIndex } from "./intervalIndex.js";
|
|
|
12
12
|
* Use {@link ISequenceOverlappingIntervalsIndex} instead.
|
|
13
13
|
* @legacy
|
|
14
14
|
* @alpha
|
|
15
|
-
* @
|
|
15
|
+
* @deprecated The generic version of this interface is no longer used and will be removed. Use {@link ISequenceOverlappingIntervalsIndex} instead.
|
|
16
16
|
*/
|
|
17
17
|
export interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
|
|
18
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlappingIntervalsIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/overlappingIntervalsIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAI6C;AAE7C,wDAAgE;AAChE,oDAI+B;AAqD/B,MAAa,yBAAyB;IAIrC,YAAY,MAAc;QAHP,iBAAY,GAAG,IAAI,8BAAY,EAAoB,CAAC;QAItE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAEM,GAAG,CAAC,EAAwC;QAClD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAEM,QAAQ,CAAC,EAA2C;QAC1D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAEM,sBAAsB,CAC5B,OAA2B,EAC3B,eAAwB,EACxB,KAAqB,EACrB,GAAmB;QAEnB,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;YAC3C,OAAO;QACR,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAC9C,uEAAuE;YACvE,IAAI,eAAe,EAAE,CAAC;gBACrB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,QAA0B,EAAE,EAAE;oBACpD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACxB,CAAC,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,QAA0B,EAAE,EAAE;oBAC5D,OAAO,CAAC,IAAI,CAAC,QAAQ,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BAAiB,CAAC,CAAC;QAC5E,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAEM,MAAM,CAAC,QAA0B;QACvC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,GAAG,CAAC,QAA0B;QACpC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACD;AA7HD,8DA6HC;AAED;;;GAGG;AACH,SAAgB,+BAA+B,CAC9C,YAA2B;IAE3B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AALD,0EAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport {\n\tClient,\n\tSequencePlace,\n\tendpointPosAndSide,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport { IntervalNode, IntervalTree } from \"../intervalTree.js\";\nimport {\n\tISerializableInterval,\n\tSequenceInterval,\n\tcreateTransientInterval,\n} from \"../intervals/index.js\";\nimport { ISharedString } from \"../sharedString.js\";\n\nimport { IntervalIndex, type SequenceIntervalIndex } from \"./intervalIndex.js\";\n\n/**\n * The generic version of this interface is deprecated and will be removed in a future release.\n * Use {@link ISequenceOverlappingIntervalsIndex} instead.\n * @legacy\n * @alpha\n * @remarks The generic version of this interface is no longer used and will be removed. Use {@link ISequenceOverlappingIntervalsIndex} instead.\n */\nexport interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection that overlap the range\n\t * `[start end]`.\n\t */\n\tfindOverlappingIntervals(start: SequencePlace, end: SequencePlace): TInterval[];\n\n\t/**\n\t * Gathers the interval results based on specified parameters.\n\t */\n\tgatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISequenceOverlappingIntervalsIndex extends SequenceIntervalIndex {\n\t/**\n\t * @returns an array of all intervals contained in this collection that overlap the range\n\t * `[start end]`.\n\t */\n\tfindOverlappingIntervals(start: SequencePlace, end: SequencePlace): SequenceInterval[];\n\n\t/**\n\t * Gathers the interval results based on specified parameters.\n\t */\n\tgatherIterationResults(\n\t\tresults: SequenceInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void;\n}\n\nexport class OverlappingIntervalsIndex implements ISequenceOverlappingIntervalsIndex {\n\tprotected readonly intervalTree = new IntervalTree<SequenceInterval>();\n\tprotected readonly client: Client;\n\n\tconstructor(client: Client) {\n\t\tthis.client = client;\n\t}\n\n\tpublic map(fn: (interval: SequenceInterval) => void) {\n\t\tthis.intervalTree.map(fn);\n\t}\n\n\tpublic mapUntil(fn: (interval: SequenceInterval) => boolean) {\n\t\tthis.intervalTree.mapUntil(fn);\n\t}\n\n\tpublic gatherIterationResults(\n\t\tresults: SequenceInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void {\n\t\tif (this.intervalTree.intervals.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (start === undefined && end === undefined) {\n\t\t\t// No start/end provided. Gather the whole tree in the specified order.\n\t\t\tif (iteratesForward) {\n\t\t\t\tthis.intervalTree.map((interval: SequenceInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.intervalTree.mapBackward((interval: SequenceInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst transientInterval: SequenceInterval = createTransientInterval(\n\t\t\t\tstart ?? \"start\",\n\t\t\t\tend ?? \"end\",\n\t\t\t\tthis.client,\n\t\t\t);\n\n\t\t\tif (start === undefined) {\n\t\t\t\t// Only end position provided. Since the tree is not sorted by end position,\n\t\t\t\t// walk the whole tree in the specified order, gathering intervals that match the end.\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.map((interval: SequenceInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.mapBackward((interval: SequenceInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Start and (possibly) end provided. Walk the subtrees that may contain\n\t\t\t\t// this start position.\n\t\t\t\tconst compareFn =\n\t\t\t\t\tend === undefined\n\t\t\t\t\t\t? (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compareStart(node.key);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compare(node.key);\n\t\t\t\t\t\t\t};\n\t\t\t\tconst continueLeftFn = (cmpResult: number) => cmpResult <= 0;\n\t\t\t\tconst continueRightFn = (cmpResult: number) => cmpResult >= 0;\n\t\t\t\tconst actionFn = (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\tresults.push(node.key);\n\t\t\t\t};\n\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesForward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesBackward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic findOverlappingIntervals(\n\t\tstart: SequencePlace,\n\t\tend: SequencePlace,\n\t): SequenceInterval[] {\n\t\tconst { startPos, endPos } = endpointPosAndSide(start, end);\n\n\t\tif (\n\t\t\tstartPos === undefined ||\n\t\t\tendPos === undefined ||\n\t\t\t(typeof startPos === \"number\" && typeof endPos === \"number\" && endPos < startPos) ||\n\t\t\t(startPos === \"end\" && endPos !== \"end\") ||\n\t\t\t(startPos !== \"start\" && endPos === \"start\") ||\n\t\t\tthis.intervalTree.intervals.isEmpty()\n\t\t) {\n\t\t\treturn [];\n\t\t}\n\t\tconst transientInterval = createTransientInterval(start, end, this.client);\n\n\t\tconst overlappingIntervalNodes = this.intervalTree.match(transientInterval);\n\t\treturn overlappingIntervalNodes.map((node) => node.key);\n\t}\n\n\tpublic remove(interval: SequenceInterval) {\n\t\tthis.intervalTree.removeExisting(interval);\n\t}\n\n\tpublic add(interval: SequenceInterval) {\n\t\tthis.intervalTree.put(interval);\n\t}\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport function createOverlappingIntervalsIndex(\n\tsharedString: ISharedString,\n): ISequenceOverlappingIntervalsIndex {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new OverlappingIntervalsIndex(client);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"overlappingIntervalsIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/overlappingIntervalsIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAI6C;AAE7C,wDAAgE;AAChE,oDAI+B;AAqD/B,MAAa,yBAAyB;IAIrC,YAAY,MAAc;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AA+B,CAC9C,YAA2B;IAE3B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AALD,0EAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport {\n\tClient,\n\tSequencePlace,\n\tendpointPosAndSide,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport { IntervalNode, IntervalTree } from \"../intervalTree.js\";\nimport {\n\tISerializableInterval,\n\tSequenceInterval,\n\tcreateTransientInterval,\n} from \"../intervals/index.js\";\nimport { ISharedString } from \"../sharedString.js\";\n\nimport { IntervalIndex, type SequenceIntervalIndex } from \"./intervalIndex.js\";\n\n/**\n * The generic version of this interface is deprecated and will be removed in a future release.\n * Use {@link ISequenceOverlappingIntervalsIndex} instead.\n * @legacy\n * @alpha\n * @deprecated The generic version of this interface is no longer used and will be removed. Use {@link ISequenceOverlappingIntervalsIndex} instead.\n */\nexport interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection that overlap the range\n\t * `[start end]`.\n\t */\n\tfindOverlappingIntervals(start: SequencePlace, end: SequencePlace): TInterval[];\n\n\t/**\n\t * Gathers the interval results based on specified parameters.\n\t */\n\tgatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISequenceOverlappingIntervalsIndex extends SequenceIntervalIndex {\n\t/**\n\t * @returns an array of all intervals contained in this collection that overlap the range\n\t * `[start end]`.\n\t */\n\tfindOverlappingIntervals(start: SequencePlace, end: SequencePlace): SequenceInterval[];\n\n\t/**\n\t * Gathers the interval results based on specified parameters.\n\t */\n\tgatherIterationResults(\n\t\tresults: SequenceInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void;\n}\n\nexport class OverlappingIntervalsIndex implements ISequenceOverlappingIntervalsIndex {\n\tprotected readonly intervalTree = new IntervalTree<SequenceInterval>();\n\tprotected readonly client: Client;\n\n\tconstructor(client: Client) {\n\t\tthis.client = client;\n\t}\n\n\tpublic map(fn: (interval: SequenceInterval) => void) {\n\t\tthis.intervalTree.map(fn);\n\t}\n\n\tpublic mapUntil(fn: (interval: SequenceInterval) => boolean) {\n\t\tthis.intervalTree.mapUntil(fn);\n\t}\n\n\tpublic gatherIterationResults(\n\t\tresults: SequenceInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t): void {\n\t\tif (this.intervalTree.intervals.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (start === undefined && end === undefined) {\n\t\t\t// No start/end provided. Gather the whole tree in the specified order.\n\t\t\tif (iteratesForward) {\n\t\t\t\tthis.intervalTree.map((interval: SequenceInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.intervalTree.mapBackward((interval: SequenceInterval) => {\n\t\t\t\t\tresults.push(interval);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tconst transientInterval: SequenceInterval = createTransientInterval(\n\t\t\t\tstart ?? \"start\",\n\t\t\t\tend ?? \"end\",\n\t\t\t\tthis.client,\n\t\t\t);\n\n\t\t\tif (start === undefined) {\n\t\t\t\t// Only end position provided. Since the tree is not sorted by end position,\n\t\t\t\t// walk the whole tree in the specified order, gathering intervals that match the end.\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.map((interval: SequenceInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.mapBackward((interval: SequenceInterval) => {\n\t\t\t\t\t\tif (transientInterval.compareEnd(interval) === 0) {\n\t\t\t\t\t\t\tresults.push(interval);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Start and (possibly) end provided. Walk the subtrees that may contain\n\t\t\t\t// this start position.\n\t\t\t\tconst compareFn =\n\t\t\t\t\tend === undefined\n\t\t\t\t\t\t? (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compareStart(node.key);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\t\t\t\treturn transientInterval.compare(node.key);\n\t\t\t\t\t\t\t};\n\t\t\t\tconst continueLeftFn = (cmpResult: number) => cmpResult <= 0;\n\t\t\t\tconst continueRightFn = (cmpResult: number) => cmpResult >= 0;\n\t\t\t\tconst actionFn = (node: IntervalNode<SequenceInterval>) => {\n\t\t\t\t\tresults.push(node.key);\n\t\t\t\t};\n\n\t\t\t\tif (iteratesForward) {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesForward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.intervalTree.intervals.walkExactMatchesBackward(\n\t\t\t\t\t\tcompareFn,\n\t\t\t\t\t\tactionFn,\n\t\t\t\t\t\tcontinueLeftFn,\n\t\t\t\t\t\tcontinueRightFn,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic findOverlappingIntervals(\n\t\tstart: SequencePlace,\n\t\tend: SequencePlace,\n\t): SequenceInterval[] {\n\t\tconst { startPos, endPos } = endpointPosAndSide(start, end);\n\n\t\tif (\n\t\t\tstartPos === undefined ||\n\t\t\tendPos === undefined ||\n\t\t\t(typeof startPos === \"number\" && typeof endPos === \"number\" && endPos < startPos) ||\n\t\t\t(startPos === \"end\" && endPos !== \"end\") ||\n\t\t\t(startPos !== \"start\" && endPos === \"start\") ||\n\t\t\tthis.intervalTree.intervals.isEmpty()\n\t\t) {\n\t\t\treturn [];\n\t\t}\n\t\tconst transientInterval = createTransientInterval(start, end, this.client);\n\n\t\tconst overlappingIntervalNodes = this.intervalTree.match(transientInterval);\n\t\treturn overlappingIntervalNodes.map((node) => node.key);\n\t}\n\n\tpublic remove(interval: SequenceInterval) {\n\t\tthis.intervalTree.removeExisting(interval);\n\t}\n\n\tpublic add(interval: SequenceInterval) {\n\t\tthis.intervalTree.put(interval);\n\t}\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport function createOverlappingIntervalsIndex(\n\tsharedString: ISharedString,\n): ISequenceOverlappingIntervalsIndex {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new OverlappingIntervalsIndex(client);\n}\n"]}
|
|
@@ -124,7 +124,7 @@ export declare class SequenceIntervalClass implements SequenceInterval {
|
|
|
124
124
|
* {@inheritDoc ISerializableInterval.properties}
|
|
125
125
|
*/
|
|
126
126
|
get properties(): Readonly<PropertySet>;
|
|
127
|
-
changeProperties(props: PropertySet | undefined, op?: ISequencedDocumentMessage): import("@fluidframework/merge-tree/internal").MapLike<unknown> | undefined;
|
|
127
|
+
changeProperties(props: PropertySet | undefined, op?: ISequencedDocumentMessage, rollback?: boolean): import("@fluidframework/merge-tree/internal").MapLike<unknown> | undefined;
|
|
128
128
|
/***/
|
|
129
129
|
get stickiness(): IntervalStickiness;
|
|
130
130
|
constructor(client: Client, id: string, label: string,
|
|
@@ -196,7 +196,7 @@ export declare class SequenceIntervalClass implements SequenceInterval {
|
|
|
196
196
|
export declare function createPositionReferenceFromSegoff(client: Client, segoff: {
|
|
197
197
|
segment: ISegment | undefined;
|
|
198
198
|
offset: number | undefined;
|
|
199
|
-
} | "start" | "end", refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
|
|
199
|
+
} | "start" | "end", refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean, rollback?: boolean): LocalReferencePosition;
|
|
200
200
|
export declare function createTransientInterval(start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client): SequenceIntervalClass;
|
|
201
|
-
export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean, props?: PropertySet): SequenceIntervalClass;
|
|
201
|
+
export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean, props?: PropertySet, rollback?: boolean): SequenceIntervalClass;
|
|
202
202
|
//# sourceMappingURL=sequenceInterval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,MAAM,EACN,QAAQ,EACR,sBAAsB,EAEtB,WAAW,EACX,aAAa,EACb,iBAAiB,EASjB,aAAa,EACb,IAAI,EAOJ,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,KAAK,uBAAuB,EAC5B,MAAM,oBAAoB,CAAC;AAkC5B,wBAAgB,uBAAuB,CACtC,kBAAkB,EAAE,mBAAmB,GAAG,uBAAuB,GAC/D;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
|
57
57
|
return __classPrivateFieldGet(this, _SequenceIntervalClass_props, "f").properties;
|
|
58
58
|
}
|
|
59
|
-
changeProperties(props, op) {
|
|
59
|
+
changeProperties(props, op, rollback) {
|
|
60
60
|
if (props !== undefined) {
|
|
61
61
|
__classPrivateFieldGet(this, _SequenceIntervalClass_props, "f").propertyManager ??= new internal_2.PropertiesManager();
|
|
62
62
|
return __classPrivateFieldGet(this, _SequenceIntervalClass_props, "f").propertyManager.handleProperties({ props }, __classPrivateFieldGet(this, _SequenceIntervalClass_props, "f"), this.client.getCollabWindow().collaborating
|
|
63
63
|
? (op?.sequenceNumber ?? internal_2.UnassignedSequenceNumber)
|
|
64
|
-
: internal_2.UniversalSequenceNumber, op?.minimumSequenceNumber ?? internal_2.UniversalSequenceNumber, this.client.getCollabWindow().collaborating);
|
|
64
|
+
: internal_2.UniversalSequenceNumber, op?.minimumSequenceNumber ?? internal_2.UniversalSequenceNumber, this.client.getCollabWindow().collaborating, rollback);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/***/
|
|
@@ -293,7 +293,7 @@ class SequenceIntervalClass {
|
|
|
293
293
|
}
|
|
294
294
|
exports.SequenceIntervalClass = SequenceIntervalClass;
|
|
295
295
|
_SequenceIntervalClass_props = new WeakMap();
|
|
296
|
-
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint) {
|
|
296
|
+
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback) {
|
|
297
297
|
if (segoff === "start" || segoff === "end") {
|
|
298
298
|
return client.createLocalReferencePosition(segoff, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
|
|
299
299
|
}
|
|
@@ -309,13 +309,14 @@ function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq
|
|
|
309
309
|
if (!op &&
|
|
310
310
|
!localSeq &&
|
|
311
311
|
!fromSnapshot &&
|
|
312
|
-
!(0, internal_2.refTypeIncludesFlag)(refType, internal_2.ReferenceType.Transient)
|
|
312
|
+
!(0, internal_2.refTypeIncludesFlag)(refType, internal_2.ReferenceType.Transient) &&
|
|
313
|
+
!rollback) {
|
|
313
314
|
throw new internal_3.UsageError("Non-transient references need segment");
|
|
314
315
|
}
|
|
315
316
|
return (0, internal_2.createDetachedLocalReferencePosition)(slidingPreference, refType);
|
|
316
317
|
}
|
|
317
318
|
exports.createPositionReferenceFromSegoff = createPositionReferenceFromSegoff;
|
|
318
|
-
function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, exclusive = false, useNewSlidingBehavior = false) {
|
|
319
|
+
function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, exclusive = false, useNewSlidingBehavior = false, rollback) {
|
|
319
320
|
let segoff;
|
|
320
321
|
if (op) {
|
|
321
322
|
(0, internal_1.assert)((refType & internal_2.ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
|
|
@@ -337,13 +338,13 @@ function createPositionReference(client, pos, refType, op, fromSnapshot, localSe
|
|
|
337
338
|
? pos
|
|
338
339
|
: client.getContainingSegment(pos, undefined, localSeq);
|
|
339
340
|
}
|
|
340
|
-
return createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, exclusive);
|
|
341
|
+
return createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, exclusive, rollback);
|
|
341
342
|
}
|
|
342
343
|
function createTransientInterval(start, end, client) {
|
|
343
344
|
return createSequenceInterval("transient", (0, uuid_1.v4)(), start, end, client, intervalUtils_js_1.IntervalType.Transient);
|
|
344
345
|
}
|
|
345
346
|
exports.createTransientInterval = createTransientInterval;
|
|
346
|
-
function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, useNewSlidingBehavior = false, props) {
|
|
347
|
+
function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, useNewSlidingBehavior = false, props, rollback) {
|
|
347
348
|
const { startPos, startSide, endPos, endSide } = (0, internal_2.endpointPosAndSide)(start ?? "start", end ?? "end");
|
|
348
349
|
(0, internal_1.assert)(startPos !== undefined &&
|
|
349
350
|
endPos !== undefined &&
|
|
@@ -369,8 +370,8 @@ function createSequenceInterval(label, id, start, end, client, intervalType, op,
|
|
|
369
370
|
endRefType |= internal_2.ReferenceType.StayOnRemove;
|
|
370
371
|
}
|
|
371
372
|
}
|
|
372
|
-
const startLref = createPositionReference(client, startPos, beginRefType, op, fromSnapshot, undefined, (0, intervalUtils_js_1.startReferenceSlidingPreference)(stickiness), (0, intervalUtils_js_1.startReferenceSlidingPreference)(stickiness) === internal_2.SlidingPreference.BACKWARD, useNewSlidingBehavior);
|
|
373
|
-
const endLref = createPositionReference(client, endPos, endRefType, op, fromSnapshot, undefined, (0, intervalUtils_js_1.endReferenceSlidingPreference)(stickiness), (0, intervalUtils_js_1.endReferenceSlidingPreference)(stickiness) === internal_2.SlidingPreference.FORWARD, useNewSlidingBehavior);
|
|
373
|
+
const startLref = createPositionReference(client, startPos, beginRefType, op, fromSnapshot, undefined, (0, intervalUtils_js_1.startReferenceSlidingPreference)(stickiness), (0, intervalUtils_js_1.startReferenceSlidingPreference)(stickiness) === internal_2.SlidingPreference.BACKWARD, useNewSlidingBehavior, rollback);
|
|
374
|
+
const endLref = createPositionReference(client, endPos, endRefType, op, fromSnapshot, undefined, (0, intervalUtils_js_1.endReferenceSlidingPreference)(stickiness), (0, intervalUtils_js_1.endReferenceSlidingPreference)(stickiness) === internal_2.SlidingPreference.FORWARD, useNewSlidingBehavior, rollback);
|
|
374
375
|
const rangeProp = {
|
|
375
376
|
[internal_2.reservedRangeLabelsKey]: [label],
|
|
376
377
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+BAA+B;AAE/B,k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AA6B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,OAAO,EACvE,qBAAqB,CACrB,CAAC;IAEF,MAAM,SAAS,GAAG;QACjB,CAAC,iCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CACrC,MAAM,EACN,EAAE,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,iCAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAtFD,wDAsFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\tcopyPropertiesAndManager,\n\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { computeStickinessFromSide } from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype SerializedIntervalDelta,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @alpha\n * @legacy\n */\nexport interface SequenceInterval extends ISerializableInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): SequenceInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): SequenceInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: SequenceInterval): SequenceInterval;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\taddPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void;\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tremovePositionChangeListeners(): void;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n}\n\nexport class SequenceIntervalClass implements SequenceInterval {\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic get properties(): Readonly<PropertySet> {\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(props: PropertySet | undefined, op?: ISequencedDocumentMessage) {\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t);\n\t\t}\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly id: string,\n\t\tprivate readonly label: string,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tif (props) {\n\t\t\tthis.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.id,\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.id,\n\t\t\tthis.label,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\treturn this.id;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tuuid(),\n\t\t\tthis.label,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior: boolean = false,\n\t) {\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst stickiness = computeStickinessFromSide(\n\t\t\tstartPos ?? startSegment?.endpointType,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendPos ?? endSegment?.endpointType,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstartPos,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tendPos,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.id,\n\t\t\tthis.label,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tcopyPropertiesAndManager(this.#props, newInterval.#props);\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined } | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient)\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n\texclusive: boolean = false,\n\tuseNewSlidingBehavior: boolean = false,\n): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, undefined, useNewSlidingBehavior);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\texclusive,\n\t);\n}\n\nexport function createTransientInterval(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n) {\n\treturn createSequenceInterval(\n\t\t\"transient\",\n\t\tuuid(),\n\t\tstart,\n\t\tend,\n\t\tclient,\n\t\tIntervalType.Transient,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tuseNewSlidingBehavior: boolean = false,\n\tprops?: PropertySet,\n): SequenceIntervalClass {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstartPos,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tendPos,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+BAA+B;AAE/B,kEAA6D;AAE7D,kEAwB6C;AAC7C,uEAAsE;AACtE,+BAAkC;AAElC,oEAAqE;AAErE,yDAQ4B;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,IAAI,KAAK,KAAK,eAAI,CAAC,KAAK,EAAE,CAAC;QAClD,OAAO,eAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,OAAO,eAAI,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,SAAS,OAAO,CAAC,KAAW,EAAE,KAAW;IACxC,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,IAAI,KAAK,KAAK,eAAI,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,eAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,eAAI,CAAC,KAAK,CAAC;AACnB,CAAC;AAED,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,SAAgB,uBAAuB,CACtC,kBAAiE;IAMjE,MAAM,EACL,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAChC,CAAC,iCAAsB,CAAC,EAAE,M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M,EACN,QAAQ,EACR,YAAY,EACZ,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,kDAA+B,EAAC,UAAU,CAAC,EAC3C,IAAA,kDAA+B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,QAAQ,EAC1E,qBAAqB,EACrB,QAAQ,CACR,CAAC;IAEF,MAAM,OAAO,GAAG,uBAAuB,CACtC,MAAM,EACN,MAAM,EACN,UAAU,EACV,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,gDAA6B,EAAC,UAAU,CAAC,EACzC,IAAA,gDAA6B,EAAC,UAAU,CAAC,KAAK,4BAAiB,CAAC,OAAO,EACvE,qBAAqB,EACrB,QAAQ,CACR,CAAC;IAEF,MAAM,SAAS,GAAG;QACjB,CAAC,iCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CACrC,MAAM,EACN,EAAE,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,iCAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAzFD,wDAyFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\tcopyPropertiesAndManager,\n\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { computeStickinessFromSide } from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype SerializedIntervalDelta,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @alpha\n * @legacy\n */\nexport interface SequenceInterval extends ISerializableInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): SequenceInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): SequenceInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: SequenceInterval): SequenceInterval;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\taddPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void;\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tremovePositionChangeListeners(): void;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n}\n\nexport class SequenceIntervalClass implements SequenceInterval {\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic get properties(): Readonly<PropertySet> {\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(\n\t\tprops: PropertySet | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\trollback?: boolean,\n\t) {\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t\trollback,\n\t\t\t);\n\t\t}\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly id: string,\n\t\tprivate readonly label: string,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tif (props) {\n\t\t\tthis.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.id,\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.id,\n\t\t\tthis.label,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\treturn this.id;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tuuid(),\n\t\t\tthis.label,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior: boolean = false,\n\t) {\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst stickiness = computeStickinessFromSide(\n\t\t\tstartPos ?? startSegment?.endpointType,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendPos ?? endSegment?.endpointType,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstartPos,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tendPos,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.id,\n\t\t\tthis.label,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tcopyPropertiesAndManager(this.#props, newInterval.#props);\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined } | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n\trollback?: boolean,\n): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient) &&\n\t\t!rollback\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n\texclusive: boolean = false,\n\tuseNewSlidingBehavior: boolean = false,\n\trollback?: boolean,\n): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, undefined, useNewSlidingBehavior);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\texclusive,\n\t\trollback,\n\t);\n}\n\nexport function createTransientInterval(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n) {\n\treturn createSequenceInterval(\n\t\t\"transient\",\n\t\tuuid(),\n\t\tstart,\n\t\tend,\n\t\tclient,\n\t\tIntervalType.Transient,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tuseNewSlidingBehavior: boolean = false,\n\tprops?: PropertySet,\n\trollback?: boolean,\n): SequenceIntervalClass {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstartPos,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\tuseNewSlidingBehavior,\n\t\trollback,\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tendPos,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\tuseNewSlidingBehavior,\n\t\trollback,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/sequence";
|
|
8
|
-
export declare const pkgVersion = "2.33.0
|
|
8
|
+
export declare const pkgVersion = "2.33.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,UAAU,WAAW,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/sequence";
|
|
11
|
-
exports.pkgVersion = "2.33.0
|
|
11
|
+
exports.pkgVersion = "2.33.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.33.0\";\n"]}
|
package/dist/sequence.d.ts
CHANGED
|
@@ -350,6 +350,10 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
|
|
|
350
350
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
|
|
351
351
|
*/
|
|
352
352
|
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
353
|
+
/**
|
|
354
|
+
* Revert an op
|
|
355
|
+
*/
|
|
356
|
+
protected rollback(content: any, localOpMetadata: unknown): void;
|
|
353
357
|
/**
|
|
354
358
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
355
359
|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AC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAM5C,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAwC3B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,6BAA6B;IAoBrC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CASzB;AA4BD;;GAEG;AACH,wBAAgB,yBAAyB,SAExC"}
|
package/dist/sequence.js
CHANGED
|
@@ -288,6 +288,16 @@ class SharedSegmentSequence extends internal_5.SharedObject {
|
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Revert an op
|
|
293
|
+
*/
|
|
294
|
+
rollback(content, localOpMetadata) {
|
|
295
|
+
const originalRefSeq = this.inFlightRefSeqs.pop();
|
|
296
|
+
(0, internal_1.assert)(originalRefSeq !== undefined, 0xb7f /* Expected a recorded refSeq when rolling back an op */);
|
|
297
|
+
if (!this.intervalCollections.tryRollback(content, localOpMetadata)) {
|
|
298
|
+
this.client.rollback(content, localOpMetadata);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
291
301
|
/**
|
|
292
302
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
293
303
|
*/
|