@fluidframework/sequence 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +130 -0
  3. package/api-extractor.json +1 -1
  4. package/api-report/sequence.api.md +717 -0
  5. package/dist/defaultMap.d.ts +1 -1
  6. package/dist/defaultMap.d.ts.map +1 -1
  7. package/dist/defaultMap.js +6 -6
  8. package/dist/defaultMap.js.map +1 -1
  9. package/dist/defaultMapInterfaces.d.ts +22 -2
  10. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  11. package/dist/defaultMapInterfaces.js.map +1 -1
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/intervalCollection.d.ts +164 -16
  17. package/dist/intervalCollection.d.ts.map +1 -1
  18. package/dist/intervalCollection.js +174 -54
  19. package/dist/intervalCollection.js.map +1 -1
  20. package/dist/intervalIndex/endpointInRangeIndex.d.ts +17 -3
  21. package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  22. package/dist/intervalIndex/endpointInRangeIndex.js +12 -6
  23. package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
  24. package/dist/intervalIndex/endpointIndex.d.ts +19 -2
  25. package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
  26. package/dist/intervalIndex/endpointIndex.js +10 -5
  27. package/dist/intervalIndex/endpointIndex.js.map +1 -1
  28. package/dist/intervalIndex/idIntervalIndex.d.ts +6 -0
  29. package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -1
  30. package/dist/intervalIndex/idIntervalIndex.js +3 -0
  31. package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
  32. package/dist/intervalIndex/index.d.ts +4 -4
  33. package/dist/intervalIndex/index.d.ts.map +1 -1
  34. package/dist/intervalIndex/index.js +5 -1
  35. package/dist/intervalIndex/index.js.map +1 -1
  36. package/dist/intervalIndex/intervalIndex.d.ts +1 -0
  37. package/dist/intervalIndex/intervalIndex.d.ts.map +1 -1
  38. package/dist/intervalIndex/intervalIndex.js.map +1 -1
  39. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +17 -6
  40. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  41. package/dist/intervalIndex/overlappingIntervalsIndex.js +17 -4
  42. package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  43. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +5 -2
  44. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
  45. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +9 -1
  46. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  47. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
  48. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  49. package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  50. package/dist/intervalIndex/startpointInRangeIndex.d.ts +17 -3
  51. package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  52. package/dist/intervalIndex/startpointInRangeIndex.js +12 -8
  53. package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
  54. package/dist/intervalTree.d.ts +1 -1
  55. package/dist/intervalTree.d.ts.map +1 -1
  56. package/dist/intervals/interval.d.ts +4 -2
  57. package/dist/intervals/interval.d.ts.map +1 -1
  58. package/dist/intervals/interval.js +14 -5
  59. package/dist/intervals/interval.js.map +1 -1
  60. package/dist/intervals/intervalUtils.d.ts +51 -18
  61. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  62. package/dist/intervals/intervalUtils.js +18 -10
  63. package/dist/intervals/intervalUtils.js.map +1 -1
  64. package/dist/intervals/sequenceInterval.d.ts +28 -13
  65. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  66. package/dist/intervals/sequenceInterval.js +124 -43
  67. package/dist/intervals/sequenceInterval.js.map +1 -1
  68. package/dist/localValues.d.ts.map +1 -1
  69. package/dist/localValues.js.map +1 -1
  70. package/dist/packageVersion.d.ts +1 -1
  71. package/dist/packageVersion.js +1 -1
  72. package/dist/packageVersion.js.map +1 -1
  73. package/dist/revertibles.d.ts +3 -15
  74. package/dist/revertibles.d.ts.map +1 -1
  75. package/dist/revertibles.js +11 -19
  76. package/dist/revertibles.js.map +1 -1
  77. package/dist/sequence-alpha.d.ts +1587 -0
  78. package/dist/sequence-beta.d.ts +1507 -0
  79. package/dist/sequence-public.d.ts +1507 -0
  80. package/dist/sequence-untrimmed.d.ts +1759 -0
  81. package/dist/sequence.d.ts +8 -4
  82. package/dist/sequence.d.ts.map +1 -1
  83. package/dist/sequence.js +53 -48
  84. package/dist/sequence.js.map +1 -1
  85. package/dist/sequenceDeltaEvent.d.ts +4 -0
  86. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  87. package/dist/sequenceDeltaEvent.js +3 -0
  88. package/dist/sequenceDeltaEvent.js.map +1 -1
  89. package/dist/sequenceFactory.d.ts +3 -0
  90. package/dist/sequenceFactory.d.ts.map +1 -1
  91. package/dist/sequenceFactory.js +4 -1
  92. package/dist/sequenceFactory.js.map +1 -1
  93. package/dist/sharedIntervalCollection.d.ts +5 -0
  94. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  95. package/dist/sharedIntervalCollection.js +11 -9
  96. package/dist/sharedIntervalCollection.js.map +1 -1
  97. package/dist/sharedSequence.d.ts +6 -3
  98. package/dist/sharedSequence.d.ts.map +1 -1
  99. package/dist/sharedSequence.js +10 -8
  100. package/dist/sharedSequence.js.map +1 -1
  101. package/dist/sharedString.d.ts +17 -2
  102. package/dist/sharedString.d.ts.map +1 -1
  103. package/dist/sharedString.js +21 -7
  104. package/dist/sharedString.js.map +1 -1
  105. package/dist/tsdoc-metadata.json +1 -1
  106. package/lib/defaultMap.d.ts +1 -1
  107. package/lib/defaultMap.d.ts.map +1 -1
  108. package/lib/defaultMap.js +6 -6
  109. package/lib/defaultMap.js.map +1 -1
  110. package/lib/defaultMapInterfaces.d.ts +22 -2
  111. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  112. package/lib/defaultMapInterfaces.js.map +1 -1
  113. package/lib/index.d.ts +2 -2
  114. package/lib/index.d.ts.map +1 -1
  115. package/lib/index.js +1 -1
  116. package/lib/index.js.map +1 -1
  117. package/lib/intervalCollection.d.ts +164 -16
  118. package/lib/intervalCollection.d.ts.map +1 -1
  119. package/lib/intervalCollection.js +172 -55
  120. package/lib/intervalCollection.js.map +1 -1
  121. package/lib/intervalIndex/endpointInRangeIndex.d.ts +17 -3
  122. package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  123. package/lib/intervalIndex/endpointInRangeIndex.js +12 -7
  124. package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
  125. package/lib/intervalIndex/endpointIndex.d.ts +19 -2
  126. package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
  127. package/lib/intervalIndex/endpointIndex.js +10 -6
  128. package/lib/intervalIndex/endpointIndex.js.map +1 -1
  129. package/lib/intervalIndex/idIntervalIndex.d.ts +6 -0
  130. package/lib/intervalIndex/idIntervalIndex.d.ts.map +1 -1
  131. package/lib/intervalIndex/idIntervalIndex.js +3 -0
  132. package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
  133. package/lib/intervalIndex/index.d.ts +4 -4
  134. package/lib/intervalIndex/index.d.ts.map +1 -1
  135. package/lib/intervalIndex/index.js +4 -4
  136. package/lib/intervalIndex/index.js.map +1 -1
  137. package/lib/intervalIndex/intervalIndex.d.ts +1 -0
  138. package/lib/intervalIndex/intervalIndex.d.ts.map +1 -1
  139. package/lib/intervalIndex/intervalIndex.js.map +1 -1
  140. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +17 -6
  141. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  142. package/lib/intervalIndex/overlappingIntervalsIndex.js +18 -5
  143. package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  144. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +5 -2
  145. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
  146. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +9 -1
  147. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  148. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
  149. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  150. package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  151. package/lib/intervalIndex/startpointInRangeIndex.d.ts +17 -3
  152. package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  153. package/lib/intervalIndex/startpointInRangeIndex.js +12 -9
  154. package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
  155. package/lib/intervalTree.d.ts +1 -1
  156. package/lib/intervalTree.d.ts.map +1 -1
  157. package/lib/intervals/interval.d.ts +4 -2
  158. package/lib/intervals/interval.d.ts.map +1 -1
  159. package/lib/intervals/interval.js +14 -5
  160. package/lib/intervals/interval.js.map +1 -1
  161. package/lib/intervals/intervalUtils.d.ts +51 -18
  162. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  163. package/lib/intervals/intervalUtils.js +14 -6
  164. package/lib/intervals/intervalUtils.js.map +1 -1
  165. package/lib/intervals/sequenceInterval.d.ts +28 -13
  166. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  167. package/lib/intervals/sequenceInterval.js +125 -42
  168. package/lib/intervals/sequenceInterval.js.map +1 -1
  169. package/lib/localValues.d.ts.map +1 -1
  170. package/lib/localValues.js.map +1 -1
  171. package/lib/packageVersion.d.ts +1 -1
  172. package/lib/packageVersion.js +1 -1
  173. package/lib/packageVersion.js.map +1 -1
  174. package/lib/revertibles.d.ts +3 -15
  175. package/lib/revertibles.d.ts.map +1 -1
  176. package/lib/revertibles.js +11 -19
  177. package/lib/revertibles.js.map +1 -1
  178. package/lib/sequence.d.ts +8 -4
  179. package/lib/sequence.d.ts.map +1 -1
  180. package/lib/sequence.js +56 -49
  181. package/lib/sequence.js.map +1 -1
  182. package/lib/sequenceDeltaEvent.d.ts +4 -0
  183. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  184. package/lib/sequenceDeltaEvent.js +3 -0
  185. package/lib/sequenceDeltaEvent.js.map +1 -1
  186. package/lib/sequenceFactory.d.ts +3 -0
  187. package/lib/sequenceFactory.d.ts.map +1 -1
  188. package/lib/sequenceFactory.js +4 -1
  189. package/lib/sequenceFactory.js.map +1 -1
  190. package/lib/sharedIntervalCollection.d.ts +5 -0
  191. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  192. package/lib/sharedIntervalCollection.js +11 -9
  193. package/lib/sharedIntervalCollection.js.map +1 -1
  194. package/lib/sharedSequence.d.ts +6 -3
  195. package/lib/sharedSequence.d.ts.map +1 -1
  196. package/lib/sharedSequence.js +10 -8
  197. package/lib/sharedSequence.js.map +1 -1
  198. package/lib/sharedString.d.ts +17 -2
  199. package/lib/sharedString.d.ts.map +1 -1
  200. package/lib/sharedString.js +21 -7
  201. package/lib/sharedString.js.map +1 -1
  202. package/package.json +31 -30
  203. package/src/defaultMapInterfaces.ts +22 -2
  204. package/src/index.ts +4 -1
  205. package/src/intervalCollection.ts +423 -82
  206. package/src/intervalIndex/endpointInRangeIndex.ts +23 -11
  207. package/src/intervalIndex/endpointIndex.ts +22 -9
  208. package/src/intervalIndex/idIntervalIndex.ts +7 -1
  209. package/src/intervalIndex/index.ts +12 -3
  210. package/src/intervalIndex/intervalIndex.ts +1 -0
  211. package/src/intervalIndex/overlappingIntervalsIndex.ts +40 -15
  212. package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +10 -1
  213. package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -1
  214. package/src/intervalIndex/startpointInRangeIndex.ts +23 -18
  215. package/src/intervals/interval.ts +35 -8
  216. package/src/intervals/intervalUtils.ts +61 -27
  217. package/src/intervals/sequenceInterval.ts +197 -47
  218. package/src/localValues.ts +4 -1
  219. package/src/packageVersion.ts +1 -1
  220. package/src/revertibles.ts +14 -36
  221. package/src/sequence.ts +14 -5
  222. package/src/sequenceDeltaEvent.ts +4 -0
  223. package/src/sequenceFactory.ts +4 -1
  224. package/src/sharedIntervalCollection.ts +5 -0
  225. package/src/sharedSequence.ts +6 -3
  226. package/src/sharedString.ts +25 -2
@@ -1 +1 @@
1
- {"version":3,"file":"startpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/startpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAkF;AAClF,2DAAoD;AACpD,4CAAqF;AAErF,6DAAiG;AAejG,MAAM,sBAAsB;IAK3B,YACkB,OAAoC,EACpC,MAAc;QADd,YAAO,GAAP,OAAO,CAA6B;QACpC,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,YAAY,GAAG,IAAI,yBAAY,CAAuB,CAAC,CAAY,EAAE,CAAY,EAAE,EAAE;YACzF,IAAA,mBAAM,EACL,OAAO,OAAO,CAAC,aAAa,KAAK,UAAU,EAC3C,KAAK,CAAC,iDAAiD,CACvD,CAAC;YAEF,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACxD,IAAI,mBAAmB,KAAK,CAAC,EAAE;gBAC9B,OAAO,mBAAmB,CAAC;aAC3B;YAED,MAAM,uBAAuB,GAAG,IAAA,yCAAoB,EACnD,CAAmC,EACnC,CAAmC,CACnC,CAAC;YACF,IAAI,uBAAuB,KAAK,CAAC,EAAE;gBAClC,OAAO,uBAAuB,CAAC;aAC/B;YACD,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,EAAE,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AM,EAAE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;QAC1F,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAED,SAAgB,4BAA4B,CAC3C,OAAoC,EACpC,MAAc;IAEd,OAAO,IAAI,sBAAsB,CAAY,OAAO,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AALD,oEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Client, PropertyAction, RedBlackTree } from \"@fluidframework/merge-tree\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IIntervalHelpers, ISerializableInterval, IntervalType } from \"../intervals\";\nimport { IntervalIndex } from \"./intervalIndex\";\nimport { HasComparisonOverride, compareOverrideables, forceCompare } from \"./intervalIndexUtils\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.\n */\nexport interface IStartpointInRangeIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose startpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithStartpointInRange(start: number, end: number);\n}\n\nclass StartpointInRangeIndex<TInterval extends ISerializableInterval>\n\timplements IStartpointInRangeIndex<TInterval>\n{\n\tprivate readonly intervalTree;\n\n\tconstructor(\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t\tprivate readonly client: Client,\n\t) {\n\t\tthis.intervalTree = new RedBlackTree<TInterval, TInterval>((a: TInterval, b: TInterval) => {\n\t\t\tassert(\n\t\t\t\ttypeof helpers.compareStarts === \"function\",\n\t\t\t\t0x6d1 /* compareStarts does not exist in the helpers */,\n\t\t\t);\n\n\t\t\tconst compareStartsResult = helpers.compareStarts(a, b);\n\t\t\tif (compareStartsResult !== 0) {\n\t\t\t\treturn compareStartsResult;\n\t\t\t}\n\n\t\t\tconst overrideablesComparison = compareOverrideables(\n\t\t\t\ta as Partial<HasComparisonOverride>,\n\t\t\t\tb as Partial<HasComparisonOverride>,\n\t\t\t);\n\t\t\tif (overrideablesComparison !== 0) {\n\t\t\t\treturn overrideablesComparison;\n\t\t\t}\n\t\t\tconst aId = a.getIntervalId();\n\t\t\tconst bId = b.getIntervalId();\n\t\t\tif (aId !== undefined && bId !== undefined) {\n\t\t\t\treturn aId.localeCompare(bId);\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.intervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: TInterval): void {\n\t\tthis.intervalTree.remove(interval);\n\t}\n\n\tpublic findIntervalsWithStartpointInRange(start: number, end: number) {\n\t\tif (start <= 0 || start > end || this.intervalTree.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results: TInterval[] = [];\n\t\tconst action: PropertyAction<TInterval, TInterval> = (node) => {\n\t\t\tresults.push(node.data);\n\t\t\treturn true;\n\t\t};\n\n\t\tconst transientStartInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tstart,\n\t\t\tstart,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\tconst transientEndInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tend,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\t// Add comparison overrides to the transient intervals\n\t\t(transientStartInterval as Partial<HasComparisonOverride>)[forceCompare] = -1;\n\t\t(transientEndInterval as Partial<HasComparisonOverride>)[forceCompare] = 1;\n\n\t\tthis.intervalTree.mapRange(action, results, transientStartInterval, transientEndInterval);\n\t\treturn results;\n\t}\n}\n\nexport function createStartpointInRangeIndex<TInterval extends ISerializableInterval>(\n\thelpers: IIntervalHelpers<TInterval>,\n\tclient: Client,\n): IStartpointInRangeIndex<TInterval> {\n\treturn new StartpointInRangeIndex<TInterval>(helpers, client);\n}\n"]}
1
+ {"version":3,"file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AK,GAAG,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;YAC7D,OAAO,EAAE,CAAC;SACV;QACD,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,MAAM,MAAM,GAAyC,CAAC,IAAI,EAAE,EAAE;YAC7D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CACjD,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,CAAC,MAAM,EACX,wBAAY,CAAC,SAAS,CACtB,CAAC;QAEF,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAC/C,WAAW,EACX,GAAG,EACH,GAAG,EACH,IAAI,CAAC,MAAM,EACX,wBAAY,CAAC,SAAS,CACtB,CAAC;QAEF,sDAAsD;QACrD,sBAAyD,CAAC,iCAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7E,oBAAuD,CAAC,iCAAY,CAAC,GAAG,CAAC,CAAC;QAE3E,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;QAC1F,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAxED,wDAwEC;AACD;;GAEG;AACH,SAAgB,4BAA4B,CAC3C,YAA0B;IAE1B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,sBAAsB,CAAmB,MAAM,EAAE,mCAAuB,CAAC,CAAC;AACtF,CAAC;AALD,oEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable import/no-deprecated */\n\nimport { Client, PropertyAction, RedBlackTree } from \"@fluidframework/merge-tree\";\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tIntervalType,\n\tSequenceInterval,\n\tsequenceIntervalHelpers,\n} from \"../intervals\";\nimport { SharedString } from \"../sharedString\";\nimport { IntervalIndex } from \"./intervalIndex\";\nimport { HasComparisonOverride, compareOverrideables, forceCompare } from \"./intervalIndexUtils\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.\n * @public\n */\nexport interface IStartpointInRangeIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose startpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithStartpointInRange(start: number, end: number): TInterval[];\n}\n\nexport class StartpointInRangeIndex<TInterval extends ISerializableInterval>\n\timplements IStartpointInRangeIndex<TInterval>\n{\n\tprivate readonly intervalTree;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t) {\n\t\tthis.intervalTree = new RedBlackTree<TInterval, TInterval>((a: TInterval, b: TInterval) => {\n\t\t\tconst compareStartsResult = a.compareStart(b);\n\t\t\tif (compareStartsResult !== 0) {\n\t\t\t\treturn compareStartsResult;\n\t\t\t}\n\n\t\t\tconst overrideablesComparison = compareOverrideables(\n\t\t\t\ta as Partial<HasComparisonOverride>,\n\t\t\t\tb as Partial<HasComparisonOverride>,\n\t\t\t);\n\t\t\tif (overrideablesComparison !== 0) {\n\t\t\t\treturn overrideablesComparison;\n\t\t\t}\n\t\t\tconst aId = a.getIntervalId();\n\t\t\tconst bId = b.getIntervalId();\n\t\t\tif (aId !== undefined && bId !== undefined) {\n\t\t\t\treturn aId.localeCompare(bId);\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.intervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: TInterval): void {\n\t\tthis.intervalTree.remove(interval);\n\t}\n\n\tpublic findIntervalsWithStartpointInRange(start: number, end: number): TInterval[] {\n\t\tif (start <= 0 || start > end || this.intervalTree.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results: TInterval[] = [];\n\t\tconst action: PropertyAction<TInterval, TInterval> = (node) => {\n\t\t\tresults.push(node.data);\n\t\t\treturn true;\n\t\t};\n\n\t\tconst transientStartInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tstart,\n\t\t\tstart,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\tconst transientEndInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tend,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\t// Add comparison overrides to the transient intervals\n\t\t(transientStartInterval as Partial<HasComparisonOverride>)[forceCompare] = -1;\n\t\t(transientEndInterval as Partial<HasComparisonOverride>)[forceCompare] = 1;\n\n\t\tthis.intervalTree.mapRange(action, results, transientStartInterval, transientEndInterval);\n\t\treturn results;\n\t}\n}\n/**\n * @public\n */\nexport function createStartpointInRangeIndex(\n\tsharedString: SharedString,\n): IStartpointInRangeIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new StartpointInRangeIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
@@ -8,7 +8,7 @@ export interface AugmentedIntervalNode {
8
8
  minmax: IInterval;
9
9
  }
10
10
  export declare const integerRangeToString: (range: IIntegerRange) => string;
11
- export declare type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;
11
+ export type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;
12
12
  export declare class IntervalTree<T extends IInterval> implements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode> {
13
13
  intervals: RedBlackTree<T, AugmentedIntervalNode>;
14
14
  remove(x: T): void;
@@ -1 +1 @@
1
- {"version":3,"file":"intervalTree.d.ts","sourceRoot":"","sources":["../src/intervalTree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H,OAAO,EACN,aAAa,EACb,MAAM,EACN,eAAe,EACf,UAAU,EACV,YAAY,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,UAAW,aAAa,WAAoC,CAAC;AAI9F,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,SAAS,IAAI,MAAM,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAEjF,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS,CAC5C,YAAW,eAAe,CAAC,CAAC,EAAE,qBAAqB,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,qBAAqB,CAAC;IAEnF,SAAS,yCAAsE;IAE/E,MAAM,CAAC,CAAC,EAAE,CAAC;IAIX,cAAc,CAAC,CAAC,EAAE,CAAC;IAInB,GAAG,CAAC,CAAC,EAAE,CAAC;IAIR,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI;IAWtB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO;IAU9B,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI;IAY9B,KAAK,CAAC,CAAC,EAAE,CAAC;IAIV,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC;IAInD,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC;IAIzD,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;CAanC"}
@@ -4,9 +4,11 @@
4
4
  */
5
5
  import { ICombiningOp, PropertiesManager, PropertySet } from "@fluidframework/merge-tree";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
+ import { SequencePlace } from "../intervalCollection";
7
8
  import { IIntervalHelpers, ISerializableInterval, ISerializedInterval } from "./intervalUtils";
8
9
  /**
9
10
  * Serializable interval whose endpoints are plain-old numbers.
11
+ * @public
10
12
  */
11
13
  export declare class Interval implements ISerializableInterval {
12
14
  start: number;
@@ -80,9 +82,9 @@ export declare class Interval implements ISerializableInterval {
80
82
  * {@inheritDoc IInterval.modify}
81
83
  * @internal
82
84
  */
83
- modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage): Interval | undefined;
85
+ modify(label: string, start?: SequencePlace, end?: SequencePlace, op?: ISequencedDocumentMessage): Interval | undefined;
84
86
  private initializeProperties;
85
87
  }
86
- export declare function createInterval(label: string, start: number, end: number): Interval;
88
+ export declare function createInterval(label: string, start: SequencePlace, end: SequencePlace): Interval;
87
89
  export declare const intervalHelpers: IIntervalHelpers<Interval>;
88
90
  //# sourceMappingURL=interval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAGX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAI/F;;GAEG;AACH,qBAAa,QAAS,YAAW,qBAAqB;IAYlC,KAAK,EAAE,MAAM;IAAS,GAAG,EAAE,MAAM;IAXpD;;OAEG;IACI,UAAU,EAAE,WAAW,CAAC;IAC/B,gBAAgB;IACT,QAAQ,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAC3C;;;OAGG;IACI,eAAe,EAAE,iBAAiB,CAAC;gBACvB,KAAK,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW;IASzE;;OAEG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AgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,GAAG,QAAQ,CAiBhG;AAED,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,QAAQ,CAEtD,CAAC"}
@@ -3,13 +3,16 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
+ /* eslint-disable import/no-deprecated */
6
7
  Object.defineProperty(exports, "__esModule", { value: true });
7
8
  exports.intervalHelpers = exports.createInterval = exports.Interval = void 0;
8
9
  const merge_tree_1 = require("@fluidframework/merge-tree");
9
10
  const core_utils_1 = require("@fluidframework/core-utils");
11
+ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
12
  const reservedIntervalIdKey = "intervalId";
11
13
  /**
12
14
  * Serializable interval whose endpoints are plain-old numbers.
15
+ * @public
13
16
  */
14
17
  class Interval {
15
18
  constructor(start, end, props) {
@@ -141,8 +144,11 @@ class Interval {
141
144
  * @internal
142
145
  */
143
146
  modify(label, start, end, op) {
144
- const startPos = start ?? this.start;
145
- const endPos = end ?? this.end;
147
+ if (typeof start === "string" || typeof end === "string") {
148
+ throw new telemetry_utils_1.UsageError("The start and end positions of a plain interval may not be on the special endpoint segments.");
149
+ }
150
+ const startPos = typeof start === "number" ? start : start?.pos ?? this.start;
151
+ const endPos = typeof end === "number" ? end : end?.pos ?? this.end;
146
152
  if (this.start === startPos && this.end === endPos) {
147
153
  // Return undefined to indicate that no change is necessary.
148
154
  return;
@@ -165,16 +171,19 @@ class Interval {
165
171
  }
166
172
  exports.Interval = Interval;
167
173
  function createInterval(label, start, end) {
174
+ if (typeof start === "string" || typeof end === "string") {
175
+ throw new telemetry_utils_1.UsageError("The start and end positions of a plain interval may not be on the special endpoint segments.");
176
+ }
168
177
  const rangeProp = {};
169
178
  if (label && label.length > 0) {
170
179
  rangeProp[merge_tree_1.reservedRangeLabelsKey] = [label];
171
180
  }
172
- return new Interval(start, end, rangeProp);
181
+ const startPos = typeof start === "number" ? start : start.pos;
182
+ const endPos = typeof end === "number" ? end : end.pos;
183
+ return new Interval(startPos, endPos, rangeProp);
173
184
  }
174
185
  exports.createInterval = createInterval;
175
186
  exports.intervalHelpers = {
176
- compareEnds: (a, b) => a.end - b.end,
177
- compareStarts: (a, b) => a.start - b.start,
178
187
  create: createInterval,
179
188
  };
180
189
  //# sourceMappingURL=interval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interval.js","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAMoC;AAEpC,2DAAoD;AAGpD,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAa,QAAQ;IAYpB,YAAmB,KAAa,EAAS,GAAW,EAAE,KAAmB;QAAtD,UAAK,GAAL,KAAK,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QACnD,IAAI,CAAC,eAAe,GAAG,IAAI,8BAAiB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,KAAK,EAAE;YACV,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SAC1B;IACF,CAAC;IAED;;OAEG;IACI,aAAa;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,qBAAqB,CAAC,CAAC;QACpD,IAAA,mBAAM,EAAC,EAAE,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC1E,OAAO,GAAG,EAAE,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,yBAAyB;QAC/B,OAAO,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACI,cAAc,CAAC,KAAkB;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;S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K;IAC9D,MAAM,EAAE,cAAc;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICombiningOp,\n\tPropertiesManager,\n\tPropertySet,\n\tcreateMap,\n\treservedRangeLabelsKey,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IIntervalHelpers, ISerializableInterval, ISerializedInterval } from \"./intervalUtils\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\n/**\n * Serializable interval whose endpoints are plain-old numbers.\n */\nexport class Interval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet;\n\t/** @internal */\n\tpublic auxProps: PropertySet[] | undefined;\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t * @internal\n\t */\n\tpublic propertyManager: PropertiesManager;\n\tconstructor(public start: number, public end: number, props?: PropertySet) {\n\t\tthis.propertyManager = new PropertiesManager();\n\t\tthis.properties = {};\n\n\t\tif (props) {\n\t\t\tthis.addProperties(props);\n\t\t}\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, 0x5e1 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * @returns an array containing any auxiliary property sets added with `addPropertySet`.\n\t */\n\tpublic getAdditionalPropertySets(): PropertySet[] {\n\t\treturn this.auxProps ?? [];\n\t}\n\n\t/**\n\t * Adds an auxiliary set of properties to this interval.\n\t * These properties can be recovered using `getAdditionalPropertySets`\n\t * @param props - set of properties to add\n\t * @remarks This gets called as part of the default conflict resolver for `IIntervalCollection<Interval>`\n\t * (i.e. non-sequence-based interval collections). However, the additional properties don't get serialized.\n\t * This functionality seems half-baked.\n\t */\n\tpublic addPropertySet(props: PropertySet) {\n\t\tif (this.auxProps === undefined) {\n\t\t\tthis.auxProps = [];\n\t\t}\n\t\tthis.auxProps.push(props);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: this.end,\n\t\t\tintervalType: 0,\n\t\t\tsequenceNumber: 0,\n\t\t\tstart: this.start,\n\t\t};\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = this.properties;\n\t\t}\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new Interval(this.start, this.end, this.properties);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: Interval) {\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: Interval) {\n\t\treturn this.start - b.start;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: Interval) {\n\t\treturn this.end - b.end;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: Interval) {\n\t\tconst result = this.start <= b.end && this.end >= b.start;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t * @internal\n\t */\n\tpublic union(b: Interval) {\n\t\treturn new Interval(\n\t\t\tMath.min(this.start, b.start),\n\t\t\tMath.max(this.end, b.end),\n\t\t\tthis.properties,\n\t\t);\n\t}\n\n\tpublic getProperties() {\n\t\treturn this.properties;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.addProperties}\n\t * @internal\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tcollaborating: boolean = false,\n\t\tseq?: number,\n\t\top?: ICombiningOp,\n\t): PropertySet | undefined {\n\t\tif (newProps) {\n\t\t\tthis.initializeProperties();\n\t\t\treturn this.propertyManager.addProperties(\n\t\t\t\tthis.properties,\n\t\t\t\tnewProps,\n\t\t\t\top,\n\t\t\t\tseq,\n\t\t\t\tcollaborating,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t * @internal\n\t */\n\tpublic modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage) {\n\t\tconst startPos = start ?? this.start;\n\t\tconst endPos = end ?? this.end;\n\t\tif (this.start === startPos && this.end === endPos) {\n\t\t\t// Return undefined to indicate that no change is necessary.\n\t\t\treturn;\n\t\t}\n\t\tconst newInterval = new Interval(startPos, endPos);\n\t\tif (this.properties) {\n\t\t\tnewInterval.initializeProperties();\n\t\t\tthis.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tnewInterval.properties,\n\t\t\t\tnewInterval.propertyManager,\n\t\t\t);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tprivate initializeProperties(): void {\n\t\tif (!this.propertyManager) {\n\t\t\tthis.propertyManager = new PropertiesManager();\n\t\t}\n\t\tif (!this.properties) {\n\t\t\tthis.properties = createMap<any>();\n\t\t}\n\t}\n}\n\nexport function createInterval(label: string, start: number, end: number): Interval {\n\tconst rangeProp: PropertySet = {};\n\n\tif (label && label.length > 0) {\n\t\trangeProp[reservedRangeLabelsKey] = [label];\n\t}\n\n\treturn new Interval(start, end, rangeProp);\n}\n\nexport const intervalHelpers: IIntervalHelpers<Interval> = {\n\tcompareEnds: (a: Interval, b: Interval) => a.end - b.end,\n\tcompareStarts: (a: Interval, b: Interval) => a.start - b.start,\n\tcreate: createInterval,\n};\n"]}
1
+ {"version":3,"file":"interval.js","sourceRoot":"","sources":["../../src/intervals/interval.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,yCAAyC;;;AAEzC,2DAMoC;AAEpC,2DAAoD;AACpD,qEAA6D;AAI7D,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;GAGG;AACH,MAAa,QAAQ;IAYpB,YACQ,KAAa,EACb,GAAW,EAClB,KAAmB;QAFZ,UAAK,GAAL,KAAK,CAAQ;QACb,QAAG,GAAH,GAAG,CAAQ;QAGlB,IAAI,CAAC,eAAe,GAAG,IAAI,8BAAiB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,KAAK,EAAE;YACV,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SAC1B;IACF,CAAC;IAED;;OAEG;IACI,aAAa;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,qBAAqB,CAAC,CAAC;QACpD,IAAA,mBAAM,EAAC,EAAE,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC1E,OAAO,GAAG,EAAE,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,yBAAyB;QAC/B,OAAO,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACI,cAAc,CAAC,KAAkB;QACvC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;SACnB;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAA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AC,mCAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KAC5C;IAED,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAC/D,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAEvD,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AAjBD,wCAiBC;AAEY,QAAA,eAAe,GAA+B;IAC1D,MAAM,EAAE,cAAc;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable import/no-deprecated */\n\nimport {\n\tICombiningOp,\n\tPropertiesManager,\n\tPropertySet,\n\tcreateMap,\n\treservedRangeLabelsKey,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport { SequencePlace } from \"../intervalCollection\";\nimport { IIntervalHelpers, ISerializableInterval, ISerializedInterval } from \"./intervalUtils\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\n/**\n * Serializable interval whose endpoints are plain-old numbers.\n * @public\n */\nexport class Interval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet;\n\t/** @internal */\n\tpublic auxProps: PropertySet[] | undefined;\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t * @internal\n\t */\n\tpublic propertyManager: PropertiesManager;\n\tconstructor(\n\t\tpublic start: number,\n\t\tpublic end: number,\n\t\tprops?: PropertySet,\n\t) {\n\t\tthis.propertyManager = new PropertiesManager();\n\t\tthis.properties = {};\n\n\t\tif (props) {\n\t\t\tthis.addProperties(props);\n\t\t}\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, 0x5e1 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * @returns an array containing any auxiliary property sets added with `addPropertySet`.\n\t */\n\tpublic getAdditionalPropertySets(): PropertySet[] {\n\t\treturn this.auxProps ?? [];\n\t}\n\n\t/**\n\t * Adds an auxiliary set of properties to this interval.\n\t * These properties can be recovered using `getAdditionalPropertySets`\n\t * @param props - set of properties to add\n\t * @remarks This gets called as part of the default conflict resolver for `IIntervalCollection<Interval>`\n\t * (i.e. non-sequence-based interval collections). However, the additional properties don't get serialized.\n\t * This functionality seems half-baked.\n\t */\n\tpublic addPropertySet(props: PropertySet) {\n\t\tif (this.auxProps === undefined) {\n\t\t\tthis.auxProps = [];\n\t\t}\n\t\tthis.auxProps.push(props);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: this.end,\n\t\t\tintervalType: 0,\n\t\t\tsequenceNumber: 0,\n\t\t\tstart: this.start,\n\t\t};\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = this.properties;\n\t\t}\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new Interval(this.start, this.end, this.properties);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: Interval) {\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: Interval) {\n\t\treturn this.start - b.start;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: Interval) {\n\t\treturn this.end - b.end;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: Interval) {\n\t\tconst result = this.start <= b.end && this.end >= b.start;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t * @internal\n\t */\n\tpublic union(b: Interval) {\n\t\treturn new Interval(\n\t\t\tMath.min(this.start, b.start),\n\t\t\tMath.max(this.end, b.end),\n\t\t\tthis.properties,\n\t\t);\n\t}\n\n\tpublic getProperties() {\n\t\treturn this.properties;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.addProperties}\n\t * @internal\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tcollaborating: boolean = false,\n\t\tseq?: number,\n\t\top?: ICombiningOp,\n\t): PropertySet | undefined {\n\t\tif (newProps) {\n\t\t\tthis.initializeProperties();\n\t\t\treturn this.propertyManager.addProperties(\n\t\t\t\tthis.properties,\n\t\t\t\tnewProps,\n\t\t\t\top,\n\t\t\t\tseq,\n\t\t\t\tcollaborating,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t * @internal\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart?: SequencePlace,\n\t\tend?: SequencePlace,\n\t\top?: ISequencedDocumentMessage,\n\t) {\n\t\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t\t);\n\t\t}\n\n\t\tconst startPos = typeof start === \"number\" ? start : start?.pos ?? this.start;\n\t\tconst endPos = typeof end === \"number\" ? end : end?.pos ?? this.end;\n\n\t\tif (this.start === startPos && this.end === endPos) {\n\t\t\t// Return undefined to indicate that no change is necessary.\n\t\t\treturn;\n\t\t}\n\t\tconst newInterval = new Interval(startPos, endPos);\n\t\tif (this.properties) {\n\t\t\tnewInterval.initializeProperties();\n\t\t\tthis.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tnewInterval.properties,\n\t\t\t\tnewInterval.propertyManager,\n\t\t\t);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tprivate initializeProperties(): void {\n\t\tif (!this.propertyManager) {\n\t\t\tthis.propertyManager = new PropertiesManager();\n\t\t}\n\t\tif (!this.properties) {\n\t\t\tthis.properties = createMap<any>();\n\t\t}\n\t}\n}\n\nexport function createInterval(label: string, start: SequencePlace, end: SequencePlace): Interval {\n\tif (typeof start === \"string\" || typeof end === \"string\") {\n\t\tthrow new UsageError(\n\t\t\t\"The start and end positions of a plain interval may not be on the special endpoint segments.\",\n\t\t);\n\t}\n\n\tconst rangeProp: PropertySet = {};\n\n\tif (label && label.length > 0) {\n\t\trangeProp[reservedRangeLabelsKey] = [label];\n\t}\n\n\tconst startPos = typeof start === \"number\" ? start : start.pos;\n\tconst endPos = typeof end === \"number\" ? end : end.pos;\n\n\treturn new Interval(startPos, endPos, rangeProp);\n}\n\nexport const intervalHelpers: IIntervalHelpers<Interval> = {\n\tcreate: createInterval,\n};\n"]}
@@ -4,8 +4,10 @@
4
4
  */
5
5
  import { Client, PropertiesManager, PropertySet, SlidingPreference } from "@fluidframework/merge-tree";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
+ import { SequencePlace, Side } from "../intervalCollection";
7
8
  /**
8
9
  * Basic interval abstraction
10
+ * @public
9
11
  */
10
12
  export interface IInterval {
11
13
  /**
@@ -36,7 +38,7 @@ export interface IInterval {
36
38
  * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
37
39
  * @internal
38
40
  */
39
- modify(label: string, start: number | undefined, end: number | undefined, op?: ISequencedDocumentMessage, localSeq?: number): IInterval | undefined;
41
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;
40
42
  /**
41
43
  * @returns whether this interval overlaps with `b`.
42
44
  * Intervals are considered to overlap if their intersection is non-empty.
@@ -61,8 +63,14 @@ export declare const IntervalOpType: {
61
63
  readonly PROPERTY_CHANGED: "propertyChanged";
62
64
  readonly POSITION_REMOVE: "positionRemove";
63
65
  };
66
+ /**
67
+ * @public
68
+ */
64
69
  export declare enum IntervalType {
65
70
  Simple = 0,
71
+ /**
72
+ * @deprecated this functionality is no longer supported and will be removed
73
+ */
66
74
  Nest = 1,
67
75
  /**
68
76
  * SlideOnRemove indicates that the ends of the interval will slide if the segment
@@ -92,15 +100,23 @@ export interface ISerializedInterval {
92
100
  */
93
101
  sequenceNumber: number;
94
102
  /** Start position of the interval */
95
- start: number;
103
+ start: number | "start" | "end";
96
104
  /** End position of the interval */
97
- end: number;
105
+ end: number | "start" | "end";
98
106
  /** Interval type to create */
99
107
  intervalType: IntervalType;
108
+ /**
109
+ * The stickiness of this interval
110
+ */
100
111
  stickiness?: IntervalStickiness;
112
+ startSide?: Side;
113
+ endSide?: Side;
101
114
  /** Any properties the interval has */
102
115
  properties?: PropertySet;
103
116
  }
117
+ /**
118
+ * @public
119
+ */
104
120
  export interface ISerializableInterval extends IInterval {
105
121
  /** Serializable bag of properties associated with the interval. */
106
122
  properties: PropertySet;
@@ -124,28 +140,38 @@ export interface ISerializableInterval extends IInterval {
124
140
  * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.
125
141
  * @internal
126
142
  */
127
- export declare type SerializedIntervalDelta = Omit<ISerializedInterval, "start" | "end" | "properties"> & Partial<Pick<ISerializedInterval, "start" | "end" | "properties">>;
143
+ export type SerializedIntervalDelta = Omit<ISerializedInterval, "start" | "end" | "properties"> & Partial<Pick<ISerializedInterval, "start" | "end" | "properties">>;
128
144
  /**
129
145
  * A size optimization to avoid redundantly storing keys when serializing intervals
130
146
  * as JSON for summaries.
131
147
  *
132
148
  * Intervals are of the format:
133
149
  *
134
- * [start, end, sequenceNumber, intervalType, properties, stickiness?]
150
+ * [
151
+ * start,
152
+ * end,
153
+ * sequenceNumber,
154
+ * intervalType,
155
+ * properties,
156
+ * stickiness?,
157
+ * startSide?,
158
+ * endSide?,
159
+ * ]
135
160
  */
136
- export declare type CompressedSerializedInterval = [number, number, number, IntervalType, PropertySet, IntervalStickiness] | [number, number, number, IntervalType, PropertySet];
161
+ export type CompressedSerializedInterval = [
162
+ number | "start" | "end",
163
+ number | "start" | "end",
164
+ number,
165
+ IntervalType,
166
+ PropertySet,
167
+ IntervalStickiness
168
+ ] | [number | "start" | "end", number | "start" | "end", number, IntervalType, PropertySet];
137
169
  /**
138
170
  * @sealed
171
+ * @deprecated The methods within have substitutions
172
+ * @public
139
173
  */
140
174
  export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
141
- /**
142
- * @deprecated Use the method `IInterval.compareEnd` instead
143
- */
144
- compareEnds(a: TInterval, b: TInterval): number;
145
- /**
146
- * @deprecated Use the method `IInterval.compareStart` instead
147
- */
148
- compareStarts?(a: TInterval, b: TInterval): number;
149
175
  /**
150
176
  *
151
177
  * @param label - label of the interval collection this interval is being added to. This parameter is
@@ -156,9 +182,12 @@ export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
156
182
  * @param intervalType - Type of interval to create. Default is SlideOnRemove
157
183
  * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)
158
184
  * @param fromSnapshot - If this create came from loading a snapshot. Default is false.
159
- * @param stickiness - {@link (IntervalStickiness:type)} to apply to the added interval.
185
+ * @param startSide - The side on which the start position lays. See
186
+ * {@link SequencePlace} for additional context
187
+ * @param endSide - The side on which the end position lays. See
188
+ * {@link SequencePlace} for additional context
160
189
  */
161
- create(label: string, start: number | undefined, end: number | undefined, client: Client | undefined, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, stickiness?: IntervalStickiness): TInterval;
190
+ create(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client | undefined, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean): TInterval;
162
191
  }
163
192
  /**
164
193
  * Determines how an interval should expand when segments are inserted adjacent
@@ -166,6 +195,8 @@ export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
166
195
  *
167
196
  * Note that interval stickiness is currently an experimental feature and must
168
197
  * be explicitly enabled with the `intervalStickinessEnabled` flag
198
+ *
199
+ * @internal
169
200
  */
170
201
  export declare const IntervalStickiness: {
171
202
  /**
@@ -193,8 +224,10 @@ export declare const IntervalStickiness: {
193
224
  *
194
225
  * Note that interval stickiness is currently an experimental feature and must
195
226
  * be explicitly enabled with the `intervalStickinessEnabled` flag
227
+ *
228
+ * @internal
196
229
  */
197
- export declare type IntervalStickiness = typeof IntervalStickiness[keyof typeof IntervalStickiness];
198
- export declare function endReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference;
230
+ export type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];
199
231
  export declare function startReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference;
232
+ export declare function endReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference;
200
233
  //# sourceMappingURL=intervalUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO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,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,kBAAkB,GAAG,iBAAiB,CAKjG;AAED,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,kBAAkB,GAAG,iBAAiB,CAK/F"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.startReferenceSlidingPreference = exports.endReferenceSlidingPreference = exports.IntervalStickiness = exports.IntervalType = exports.IntervalOpType = void 0;
7
+ exports.endReferenceSlidingPreference = exports.startReferenceSlidingPreference = exports.IntervalStickiness = exports.IntervalType = exports.IntervalOpType = void 0;
8
8
  /* eslint-disable no-bitwise */
9
9
  const merge_tree_1 = require("@fluidframework/merge-tree");
10
10
  /**
@@ -18,9 +18,15 @@ exports.IntervalOpType = {
18
18
  PROPERTY_CHANGED: "propertyChanged",
19
19
  POSITION_REMOVE: "positionRemove",
20
20
  };
21
+ /**
22
+ * @public
23
+ */
21
24
  var IntervalType;
22
25
  (function (IntervalType) {
23
26
  IntervalType[IntervalType["Simple"] = 0] = "Simple";
27
+ /**
28
+ * @deprecated this functionality is no longer supported and will be removed
29
+ */
24
30
  IntervalType[IntervalType["Nest"] = 1] = "Nest";
25
31
  /**
26
32
  * SlideOnRemove indicates that the ends of the interval will slide if the segment
@@ -34,13 +40,15 @@ var IntervalType;
34
40
  * @internal
35
41
  */
36
42
  IntervalType[IntervalType["Transient"] = 4] = "Transient";
37
- })(IntervalType = exports.IntervalType || (exports.IntervalType = {}));
43
+ })(IntervalType || (exports.IntervalType = IntervalType = {}));
38
44
  /**
39
45
  * Determines how an interval should expand when segments are inserted adjacent
40
46
  * to the range it spans
41
47
  *
42
48
  * Note that interval stickiness is currently an experimental feature and must
43
49
  * be explicitly enabled with the `intervalStickinessEnabled` flag
50
+ *
51
+ * @internal
44
52
  */
45
53
  exports.IntervalStickiness = {
46
54
  /**
@@ -62,18 +70,18 @@ exports.IntervalStickiness = {
62
70
  */
63
71
  FULL: 0b11,
64
72
  };
65
- function endReferenceSlidingPreference(stickiness) {
66
- // if any end stickiness, prefer sliding forwards
67
- return (stickiness & exports.IntervalStickiness.END) !== 0
73
+ function startReferenceSlidingPreference(stickiness) {
74
+ // if any start stickiness, prefer sliding backwards
75
+ return (stickiness & exports.IntervalStickiness.START) === 0
68
76
  ? merge_tree_1.SlidingPreference.FORWARD
69
77
  : merge_tree_1.SlidingPreference.BACKWARD;
70
78
  }
71
- exports.endReferenceSlidingPreference = endReferenceSlidingPreference;
72
- function startReferenceSlidingPreference(stickiness) {
73
- // if any start stickiness, prefer sliding backwards
74
- return (stickiness & exports.IntervalStickiness.START) !== 0
79
+ exports.startReferenceSlidingPreference = startReferenceSlidingPreference;
80
+ function endReferenceSlidingPreference(stickiness) {
81
+ // if any end stickiness, prefer sliding forwards
82
+ return (stickiness & exports.IntervalStickiness.END) === 0
75
83
  ? merge_tree_1.SlidingPreference.BACKWARD
76
84
  : merge_tree_1.SlidingPreference.FORWARD;
77
85
  }
78
- exports.startReferenceSlidingPreference = startReferenceSlidingPreference;
86
+ exports.endReferenceSlidingPreference = endReferenceSlidingPreference;
79
87
  //# sourceMappingURL=intervalUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,2DAKoC;AAuDpC;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAEX,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IACZ,+CAAU,CAAA;IAEV;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAjBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAiBvB;AA2GD;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAWX,SAAgB,6BAA6B,CAAC,UAA8B;IAC3E,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,8BAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,8BAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AALD,sEAKC;AAED,SAAgB,+BAA+B,CAAC,UAA8B;IAC7E,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,8BAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,8BAAiB,CAAC,OAAO,CAAC;AAC9B,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 no-bitwise */\n\nimport {\n\tClient,\n\tPropertiesManager,\n\tPropertySet,\n\tSlidingPreference,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n/**\n * Basic interval abstraction\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\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: IInterval): 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: IInterval): 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: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t * @internal\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t): IInterval | 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: IInterval): 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 * @internal\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops) and revertibles.\n * @alpha\n */\nexport const IntervalOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n\nexport enum IntervalType {\n\tSimple = 0x0,\n\tNest = 0x1,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @internal\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number;\n\t/** End position of the interval */\n\tend: number;\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\tstickiness?: IntervalStickiness;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\t/** @internal */\n\tpropertyManager: PropertiesManager;\n\t/** @internal */\n\tserialize(): ISerializedInterval;\n\t/** @internal */\n\taddProperties(\n\t\tprops: PropertySet,\n\t\tcollaborating?: boolean,\n\t\tseq?: number,\n\t): PropertySet | undefined;\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t * @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions\n\t * of Fluid didn't always write interval ids.\n\t */\n\tgetIntervalId(): string | undefined;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<ISerializedInterval, \"start\" | \"end\" | \"properties\"> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [start, end, sequenceNumber, intervalType, properties, stickiness?]\n */\nexport type CompressedSerializedInterval =\n\t| [number, number, number, IntervalType, PropertySet, IntervalStickiness]\n\t| [number, number, number, IntervalType, PropertySet];\n\n/**\n * @sealed\n */\nexport interface IIntervalHelpers<TInterval extends ISerializableInterval> {\n\t/**\n\t * @deprecated Use the method `IInterval.compareEnd` instead\n\t */\n\tcompareEnds(a: TInterval, b: TInterval): number;\n\n\t/**\n\t * @deprecated Use the method `IInterval.compareStart` instead\n\t */\n\tcompareStarts?(a: TInterval, b: TInterval): number;\n\t/**\n\t *\n\t * @param label - label of the interval collection this interval is being added to. This parameter is\n\t * irrelevant for transient intervals.\n\t * @param start - numerical start position of the interval\n\t * @param end - numerical end position of the interval\n\t * @param client - client creating the interval\n\t * @param intervalType - Type of interval to create. Default is SlideOnRemove\n\t * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)\n\t * @param fromSnapshot - If this create came from loading a snapshot. Default is false.\n\t * @param stickiness - {@link (IntervalStickiness:type)} to apply to the added interval.\n\t */\n\tcreate(\n\t\tlabel: string,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclient: Client | undefined,\n\t\tintervalType: IntervalType,\n\t\top?: ISequencedDocumentMessage,\n\t\tfromSnapshot?: boolean,\n\t\tstickiness?: IntervalStickiness,\n\t): TInterval;\n}\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n */\nexport type IntervalStickiness = typeof IntervalStickiness[keyof typeof IntervalStickiness];\n\nexport function endReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) !== 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function startReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) !== 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
1
+ {"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,2DAKoC;AA2DpC;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAEX;;GAEG;AACH,IAAY,YAoBX;AApBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IACZ;;OAEG;IACH,+CAAU,CAAA;IAEV;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EApBW,YAAY,4BAAZ,YAAY,QAoBvB;AA+HD;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,SAAgB,+BAA+B,CAAC,UAA8B;IAC7E,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,8BAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,8BAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AALD,0EAKC;AAED,SAAgB,6BAA6B,CAAC,UAA8B;IAC3E,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,8BAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,8BAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AALD,sEAKC","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 {\n\tClient,\n\tPropertiesManager,\n\tPropertySet,\n\tSlidingPreference,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { SequencePlace, Side } from \"../intervalCollection\";\n\n/**\n * Basic interval abstraction\n * @public\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\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: IInterval): 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: IInterval): 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: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t * @internal\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): IInterval | 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: IInterval): 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 * @internal\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops) and revertibles.\n * @alpha\n */\nexport const IntervalOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n\n/**\n * @public\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\t/**\n\t * @deprecated this functionality is no longer supported and will be removed\n\t */\n\tNest = 0x1,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @internal\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @public\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\t/** @internal */\n\tpropertyManager: PropertiesManager;\n\t/** @internal */\n\tserialize(): ISerializedInterval;\n\t/** @internal */\n\taddProperties(\n\t\tprops: PropertySet,\n\t\tcollaborating?: boolean,\n\t\tseq?: number,\n\t): PropertySet | undefined;\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t * @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions\n\t * of Fluid didn't always write interval ids.\n\t */\n\tgetIntervalId(): string | undefined;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<ISerializedInterval, \"start\" | \"end\" | \"properties\"> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * @sealed\n * @deprecated The methods within have substitutions\n * @public\n */\nexport interface IIntervalHelpers<TInterval extends ISerializableInterval> {\n\t/**\n\t *\n\t * @param label - label of the interval collection this interval is being added to. This parameter is\n\t * irrelevant for transient intervals.\n\t * @param start - numerical start position of the interval\n\t * @param end - numerical end position of the interval\n\t * @param client - client creating the interval\n\t * @param intervalType - Type of interval to create. Default is SlideOnRemove\n\t * @param op - If this create came from a remote client, op that created it. Default is undefined (i.e. local)\n\t * @param fromSnapshot - If this create came from loading a snapshot. Default is false.\n\t * @param startSide - The side on which the start position lays. See\n\t * {@link SequencePlace} for additional context\n\t * @param endSide - The side on which the end position lays. See\n\t * {@link SequencePlace} for additional context\n\t */\n\tcreate(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\tclient: Client | undefined,\n\t\tintervalType: IntervalType,\n\t\top?: ISequencedDocumentMessage,\n\t\tfromSnapshot?: boolean,\n\t\tuseNewSlidingBehavior?: boolean,\n\t): TInterval;\n}\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @internal\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @internal\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(stickiness: IntervalStickiness): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
@@ -4,15 +4,16 @@
4
4
  */
5
5
  import { Client, ICombiningOp, ISegment, LocalReferencePosition, PropertiesManager, PropertySet, ReferenceType, SlidingPreference } from "@fluidframework/merge-tree";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
+ import { SequencePlace, Side } from "../intervalCollection";
7
8
  import { IIntervalHelpers, ISerializableInterval, ISerializedInterval, IntervalStickiness, IntervalType } from "./intervalUtils";
8
9
  /**
9
10
  * Interval implementation whose ends are associated with positions in a mutatable sequence.
10
11
  * As such, when content is inserted into the middle of the interval, the interval expands to
11
12
  * include that content.
12
13
  *
13
- * @remarks The endpoint's position should be treated exclusively to get reasonable behavior--i.e.
14
- * an interval referring to "hello" in "hello world" should have a start position of 0 and an end
15
- * position of 5.
14
+ * @remarks The endpoints' positions should be treated exclusively to get
15
+ * reasonable behavior. E.g., an interval referring to "hello" in "hello world"
16
+ * should have a start position of 0 and an end position of 5.
16
17
  *
17
18
  * To see why, consider what happens if "llo wor" is removed from the string to make "held".
18
19
  * The interval's startpoint remains on the "h" (it isn't altered), but the interval's endpoint
@@ -22,9 +23,16 @@ import { IIntervalHelpers, ISerializableInterval, ISerializedInterval, IntervalS
22
23
  * If the interval endpoint was treated inclusively, the interval would now refer to "hel", which
23
24
  * is undesirable.
24
25
  *
25
- * Since the end of an interval is treated exclusively but cannot be greater than or equal to the
26
- * length of the associated sequence, application models which leverage interval collections should
27
- * consider inserting a marker at the end of the sequence to represent the end of the content.
26
+ * Since the endpoints of an interval are treated exclusively but cannot be greater
27
+ * than or equal to the length of the associated sequence, there exist special
28
+ * endpoint segments, "start" and "end", which represent the position immediately
29
+ * before or immediately after the string respectively.
30
+ *
31
+ * If a `SequenceInterval` is created on a sequence with the
32
+ * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
33
+ * of the interval that are exclusive will have the ability to slide to these
34
+ * special endpoint segments.
35
+ * @public
28
36
  */
29
37
  export declare class SequenceInterval implements ISerializableInterval {
30
38
  private readonly client;
@@ -39,7 +47,8 @@ export declare class SequenceInterval implements ISerializableInterval {
39
47
  */
40
48
  end: LocalReferencePosition;
41
49
  intervalType: IntervalType;
42
- readonly stickiness: IntervalStickiness;
50
+ readonly startSide: Side;
51
+ readonly endSide: Side;
43
52
  /**
44
53
  * {@inheritDoc ISerializableInterval.properties}
45
54
  */
@@ -49,6 +58,10 @@ export declare class SequenceInterval implements ISerializableInterval {
49
58
  * @internal
50
59
  */
51
60
  propertyManager: PropertiesManager;
61
+ /**
62
+ * @internal
63
+ */
64
+ get stickiness(): IntervalStickiness;
52
65
  constructor(client: Client,
53
66
  /**
54
67
  * Start endpoint of this interval.
@@ -59,7 +72,7 @@ export declare class SequenceInterval implements ISerializableInterval {
59
72
  * End endpoint of this interval.
60
73
  * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
61
74
  */
62
- end: LocalReferencePosition, intervalType: IntervalType, props?: PropertySet, stickiness?: IntervalStickiness);
75
+ end: LocalReferencePosition, intervalType: IntervalType, props?: PropertySet, startSide?: Side, endSide?: Side);
63
76
  private callbacks?;
64
77
  /**
65
78
  * Subscribes to position change events on this interval if there are no current listeners.
@@ -118,15 +131,17 @@ export declare class SequenceInterval implements ISerializableInterval {
118
131
  * {@inheritDoc IInterval.modify}
119
132
  * @internal
120
133
  */
121
- modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage, localSeq?: number, stickiness?: IntervalStickiness): SequenceInterval;
134
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval;
122
135
  private initializeProperties;
123
136
  }
124
137
  export declare function createPositionReferenceFromSegoff(client: Client, segoff: {
125
138
  segment: ISegment | undefined;
126
139
  offset: number | undefined;
127
- }, refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference): LocalReferencePosition;
128
- export declare function createSequenceInterval(label: string, start: number, end: number, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, stickiness?: IntervalStickiness): SequenceInterval;
129
- export declare const compareSequenceIntervalEnds: (a: SequenceInterval, b: SequenceInterval) => number;
130
- export declare const compareSequenceIntervalStarts: (a: SequenceInterval, b: SequenceInterval) => number;
140
+ } | "start" | "end", refType: ReferenceType, op?: ISequencedDocumentMessage, localSeq?: number, fromSnapshot?: boolean, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
141
+ export declare function createSequenceInterval(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, useNewSlidingBehavior?: boolean): SequenceInterval;
142
+ /**
143
+ * @deprecated The methods within have substitutions
144
+ * @public
145
+ */
131
146
  export declare const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval>;
132
147
  //# sourceMappingURL=sequenceInterval.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,iBAAiB,EASjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,MAAM,iBAAiB,CAAC;AAIzB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,YAAW,qBAAqB;IAY5D,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;OAGG;IACI,KAAK,EAAE,sBAAsB;IACpC;;;OAGG;IACI,GAAG,EAAE,sB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