@fluidframework/sequence 2.21.0 → 2.22.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 +4 -0
- package/README.md +1 -0
- package/dist/intervalCollection.js +4 -5
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervals/sequenceInterval.js +2 -3
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/intervalCollection.js +4 -5
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervals/sequenceInterval.js +2 -3
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +19 -19
- package/src/packageVersion.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,yCAAyC;AAEzC,kEAA6D;AAE7D,kEAsB6C;AAC7C,uEAAsE;AAEtE,oEAIkC;AAElC,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,O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,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAhFD,wDAgFC;AAED;;;GAGG;AACU,QAAA,uBAAuB,GAAuC;IAC1E,MAAM,EAAE,sBAAsB;CAC9B,CAAC","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/* eslint-disable import/no-deprecated */\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} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tcomputeStickinessFromSide,\n\treservedIntervalIdKey,\n\tsidesFromStickiness,\n} from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IIntervalHelpers,\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\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\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t */\n\tpublic propertyManager?: PropertiesManager;\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\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.properties = addProperties(this.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\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst { startSide, endSide } = sidesFromStickiness(this.stickiness);\n\t\tconst serializedInterval: ISerializedInterval = {\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,\n\t\t\tendSide,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = addProperties(\n\t\t\t\tserializedInterval.properties,\n\t\t\t\tthis.properties,\n\t\t\t);\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceInterval {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\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\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${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\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\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, newInterval);\n\t\treturn newInterval;\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, 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 createSequenceInterval(\n\tlabel: 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): SequenceInterval {\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\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n\n/**\n * @deprecated The methods within have substitutions\n * @internal\n */\nexport const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {\n\tcreate: createSequenceInterval,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,yCAAyC;AAEzC,kEAA6D;AAE7D,kEAsB6C;AAC7C,uEAAsE;AAEtE,oEAIkC;AAElC,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,K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IAC1E,MAAM,EAAE,sBAAsB;CAC9B,CAAC","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/* eslint-disable import/no-deprecated */\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} from \"@fluidframework/merge-tree/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tcomputeStickinessFromSide,\n\treservedIntervalIdKey,\n\tsidesFromStickiness,\n} from \"../intervalCollection.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IIntervalHelpers,\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\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\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet = createMap<any>();\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t */\n\tpublic propertyManager?: PropertiesManager;\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\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.properties = addProperties(this.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\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst { startSide, endSide } = sidesFromStickiness(this.stickiness);\n\t\tconst serializedInterval: ISerializedInterval = {\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,\n\t\t\tendSide,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = addProperties(\n\t\t\t\tserializedInterval.properties,\n\t\t\t\tthis.properties,\n\t\t\t);\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceInterval {\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\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\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${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\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\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, newInterval);\n\t\treturn newInterval;\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, 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 createSequenceInterval(\n\tlabel: 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): SequenceInterval {\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\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n\n/**\n * @deprecated The methods within have substitutions\n * @internal\n */\nexport const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {\n\tcreate: createSequenceInterval,\n};\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
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.
|
|
11
|
+
exports.pkgVersion = "2.22.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,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.
|
|
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.22.0\";\n"]}
|
|
@@ -148,7 +148,6 @@ export class LocalIntervalCollection {
|
|
|
148
148
|
return this.helpers.create(this.label, start, end, this.client, intervalType, op, undefined, this.options.mergeTreeReferencesCanSlideToEndpoint);
|
|
149
149
|
}
|
|
150
150
|
addInterval(start, end, intervalType, props, op) {
|
|
151
|
-
var _a;
|
|
152
151
|
const interval = this.createInterval(start, end, intervalType, op);
|
|
153
152
|
if (interval) {
|
|
154
153
|
if (!interval.properties) {
|
|
@@ -164,7 +163,7 @@ export class LocalIntervalCollection {
|
|
|
164
163
|
}
|
|
165
164
|
interval.properties = addProperties(interval.properties, props);
|
|
166
165
|
}
|
|
167
|
-
|
|
166
|
+
interval.properties[reservedIntervalIdKey] ??= uuid();
|
|
168
167
|
this.add(interval);
|
|
169
168
|
}
|
|
170
169
|
return interval;
|
|
@@ -630,7 +629,7 @@ export class IntervalCollection extends TypedEventEmitter {
|
|
|
630
629
|
let deltaProps;
|
|
631
630
|
let newInterval;
|
|
632
631
|
if (props !== undefined) {
|
|
633
|
-
interval.propertyManager
|
|
632
|
+
interval.propertyManager ??= new PropertiesManager();
|
|
634
633
|
deltaProps = interval.propertyManager.handleProperties({ props }, interval, this.isCollaborating ? UnassignedSequenceNumber : UniversalSequenceNumber, UniversalSequenceNumber, true);
|
|
635
634
|
}
|
|
636
635
|
if (start !== undefined && end !== undefined) {
|
|
@@ -749,7 +748,7 @@ export class IntervalCollection extends TypedEventEmitter {
|
|
|
749
748
|
return;
|
|
750
749
|
}
|
|
751
750
|
if (local) {
|
|
752
|
-
interval.propertyManager
|
|
751
|
+
interval.propertyManager ??= new PropertiesManager();
|
|
753
752
|
// Let the propertyManager prune its pending change-properties set.
|
|
754
753
|
interval.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {
|
|
755
754
|
props: newProps,
|
|
@@ -775,7 +774,7 @@ export class IntervalCollection extends TypedEventEmitter {
|
|
|
775
774
|
newInterval =
|
|
776
775
|
this.localCollection.changeInterval(interval, toOptionalSequencePlace(start, serializedInterval.startSide ?? Side.Before), toOptionalSequencePlace(end, serializedInterval.endSide ?? Side.Before), op) ?? interval;
|
|
777
776
|
}
|
|
778
|
-
newInterval.propertyManager
|
|
777
|
+
newInterval.propertyManager ??= new PropertiesManager();
|
|
779
778
|
const deltaProps = newInterval.propertyManager.handleProperties({ props: newProps }, newInterval, op.sequenceNumber, op.minimumSequenceNumber, true);
|
|
780
779
|
if (this.onDeserialize) {
|
|
781
780
|
this.onDeserialize(newInterval);
|