@fluidframework/sequence 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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.
Files changed (313) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/api-report/sequence.api.md +32 -32
  4. package/beta.d.ts +11 -0
  5. package/dist/{localValues.d.ts → IntervalCollectionValues.d.ts} +13 -12
  6. package/dist/IntervalCollectionValues.d.ts.map +1 -0
  7. package/dist/{localValues.js → IntervalCollectionValues.js} +6 -6
  8. package/dist/IntervalCollectionValues.js.map +1 -0
  9. package/dist/beta.d.ts +12 -0
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +10 -10
  13. package/dist/index.js.map +1 -1
  14. package/dist/intervalCollection.d.ts +10 -10
  15. package/dist/intervalCollection.d.ts.map +1 -1
  16. package/dist/intervalCollection.js +103 -99
  17. package/dist/intervalCollection.js.map +1 -1
  18. package/dist/{defaultMap.d.ts → intervalCollectionMap.d.ts} +11 -44
  19. package/dist/intervalCollectionMap.d.ts.map +1 -0
  20. package/dist/{defaultMap.js → intervalCollectionMap.js} +15 -70
  21. package/dist/intervalCollectionMap.js.map +1 -0
  22. package/dist/{defaultMapInterfaces.d.ts → intervalCollectionMapInterfaces.d.ts} +17 -16
  23. package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -0
  24. package/dist/{defaultMapInterfaces.js → intervalCollectionMapInterfaces.js} +1 -1
  25. package/dist/intervalCollectionMapInterfaces.js.map +1 -0
  26. package/dist/intervalIndex/endpointInRangeIndex.d.ts +1 -1
  27. package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  28. package/dist/intervalIndex/endpointInRangeIndex.js +3 -3
  29. package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
  30. package/dist/intervalIndex/endpointIndex.d.ts +1 -1
  31. package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
  32. package/dist/intervalIndex/endpointIndex.js +3 -3
  33. package/dist/intervalIndex/endpointIndex.js.map +1 -1
  34. package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -1
  35. package/dist/intervalIndex/idIntervalIndex.js +3 -3
  36. package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
  37. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +3 -3
  38. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  39. package/dist/intervalIndex/overlappingIntervalsIndex.js +2 -3
  40. package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  41. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
  42. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +6 -6
  43. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  44. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +1 -1
  45. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  46. package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  47. package/dist/intervalIndex/startpointInRangeIndex.d.ts +1 -1
  48. package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  49. package/dist/intervalIndex/startpointInRangeIndex.js +3 -3
  50. package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
  51. package/dist/intervalTree.d.ts +1 -1
  52. package/dist/intervalTree.d.ts.map +1 -1
  53. package/dist/intervalTree.js +2 -2
  54. package/dist/intervalTree.js.map +1 -1
  55. package/dist/intervals/interval.d.ts +1 -1
  56. package/dist/intervals/interval.d.ts.map +1 -1
  57. package/dist/intervals/interval.js +10 -10
  58. package/dist/intervals/interval.js.map +1 -1
  59. package/dist/intervals/intervalUtils.d.ts +1 -1
  60. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  61. package/dist/intervals/intervalUtils.js +5 -5
  62. package/dist/intervals/intervalUtils.js.map +1 -1
  63. package/dist/intervals/sequenceInterval.d.ts +1 -1
  64. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  65. package/dist/intervals/sequenceInterval.js +34 -34
  66. package/dist/intervals/sequenceInterval.js.map +1 -1
  67. package/dist/legacy.d.ts +61 -0
  68. package/dist/packageVersion.d.ts +1 -1
  69. package/dist/packageVersion.js +1 -1
  70. package/dist/packageVersion.js.map +1 -1
  71. package/dist/public.d.ts +12 -0
  72. package/dist/revertibles.d.ts +2 -2
  73. package/dist/revertibles.d.ts.map +1 -1
  74. package/dist/revertibles.js +34 -34
  75. package/dist/revertibles.js.map +1 -1
  76. package/dist/sequence.d.ts +7 -6
  77. package/dist/sequence.d.ts.map +1 -1
  78. package/dist/sequence.js +34 -34
  79. package/dist/sequence.js.map +1 -1
  80. package/dist/sequenceDeltaEvent.d.ts +1 -1
  81. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  82. package/dist/sequenceDeltaEvent.js +4 -4
  83. package/dist/sequenceDeltaEvent.js.map +1 -1
  84. package/dist/sequenceFactory.d.ts +1 -1
  85. package/dist/sequenceFactory.d.ts.map +1 -1
  86. package/dist/sequenceFactory.js +3 -3
  87. package/dist/sequenceFactory.js.map +1 -1
  88. package/dist/sharedIntervalCollection.d.ts +4 -3
  89. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  90. package/dist/sharedIntervalCollection.js +5 -5
  91. package/dist/sharedIntervalCollection.js.map +1 -1
  92. package/dist/sharedSequence.d.ts +3 -2
  93. package/dist/sharedSequence.d.ts.map +1 -1
  94. package/dist/sharedSequence.js +4 -4
  95. package/dist/sharedSequence.js.map +1 -1
  96. package/dist/sharedString.d.ts +2 -2
  97. package/dist/sharedString.d.ts.map +1 -1
  98. package/dist/sharedString.js +9 -9
  99. package/dist/sharedString.js.map +1 -1
  100. package/internal.d.ts +11 -0
  101. package/legacy.d.ts +11 -0
  102. package/lib/{localValues.d.ts → IntervalCollectionValues.d.ts} +13 -12
  103. package/lib/IntervalCollectionValues.d.ts.map +1 -0
  104. package/lib/{localValues.js → IntervalCollectionValues.js} +3 -3
  105. package/lib/IntervalCollectionValues.js.map +1 -0
  106. package/lib/beta.d.ts +12 -0
  107. package/lib/index.d.ts +2 -2
  108. package/lib/index.d.ts.map +1 -1
  109. package/lib/index.js +1 -1
  110. package/lib/index.js.map +1 -1
  111. package/lib/intervalCollection.d.ts +10 -10
  112. package/lib/intervalCollection.d.ts.map +1 -1
  113. package/lib/intervalCollection.js +8 -4
  114. package/lib/intervalCollection.js.map +1 -1
  115. package/lib/{defaultMap.d.ts → intervalCollectionMap.d.ts} +11 -44
  116. package/lib/intervalCollectionMap.d.ts.map +1 -0
  117. package/lib/{defaultMap.js → intervalCollectionMap.js} +8 -63
  118. package/lib/intervalCollectionMap.js.map +1 -0
  119. package/lib/{defaultMapInterfaces.d.ts → intervalCollectionMapInterfaces.d.ts} +17 -16
  120. package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -0
  121. package/lib/{defaultMapInterfaces.js → intervalCollectionMapInterfaces.js} +1 -1
  122. package/lib/intervalCollectionMapInterfaces.js.map +1 -0
  123. package/lib/intervalIndex/endpointInRangeIndex.d.ts +1 -1
  124. package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
  125. package/lib/intervalIndex/endpointInRangeIndex.js +1 -1
  126. package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
  127. package/lib/intervalIndex/endpointIndex.d.ts +1 -1
  128. package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
  129. package/lib/intervalIndex/endpointIndex.js +1 -1
  130. package/lib/intervalIndex/endpointIndex.js.map +1 -1
  131. package/lib/intervalIndex/idIntervalIndex.d.ts.map +1 -1
  132. package/lib/intervalIndex/idIntervalIndex.js +1 -1
  133. package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
  134. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +3 -3
  135. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
  136. package/lib/intervalIndex/overlappingIntervalsIndex.js +2 -3
  137. package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  138. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
  139. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +2 -2
  140. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  141. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +1 -1
  142. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  143. package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  144. package/lib/intervalIndex/startpointInRangeIndex.d.ts +1 -1
  145. package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
  146. package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
  147. package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
  148. package/lib/intervalTree.d.ts +1 -1
  149. package/lib/intervalTree.d.ts.map +1 -1
  150. package/lib/intervalTree.js +1 -1
  151. package/lib/intervalTree.js.map +1 -1
  152. package/lib/intervals/interval.d.ts +1 -1
  153. package/lib/intervals/interval.d.ts.map +1 -1
  154. package/lib/intervals/interval.js +3 -3
  155. package/lib/intervals/interval.js.map +1 -1
  156. package/lib/intervals/intervalUtils.d.ts +1 -1
  157. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  158. package/lib/intervals/intervalUtils.js +1 -1
  159. package/lib/intervals/intervalUtils.js.map +1 -1
  160. package/lib/intervals/sequenceInterval.d.ts +1 -1
  161. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  162. package/lib/intervals/sequenceInterval.js +3 -3
  163. package/lib/intervals/sequenceInterval.js.map +1 -1
  164. package/lib/legacy.d.ts +61 -0
  165. package/lib/packageVersion.d.ts +1 -1
  166. package/lib/packageVersion.js +1 -1
  167. package/lib/packageVersion.js.map +1 -1
  168. package/lib/public.d.ts +12 -0
  169. package/lib/revertibles.d.ts +2 -2
  170. package/lib/revertibles.d.ts.map +1 -1
  171. package/lib/revertibles.js +3 -4
  172. package/lib/revertibles.js.map +1 -1
  173. package/lib/sequence.d.ts +7 -6
  174. package/lib/sequence.d.ts.map +1 -1
  175. package/lib/sequence.js +11 -12
  176. package/lib/sequence.js.map +1 -1
  177. package/lib/sequenceDeltaEvent.d.ts +1 -1
  178. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  179. package/lib/sequenceDeltaEvent.js +3 -4
  180. package/lib/sequenceDeltaEvent.js.map +1 -1
  181. package/lib/sequenceFactory.d.ts +1 -1
  182. package/lib/sequenceFactory.d.ts.map +1 -1
  183. package/lib/sequenceFactory.js +1 -1
  184. package/lib/sequenceFactory.js.map +1 -1
  185. package/lib/sharedIntervalCollection.d.ts +4 -3
  186. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  187. package/lib/sharedIntervalCollection.js +4 -4
  188. package/lib/sharedIntervalCollection.js.map +1 -1
  189. package/lib/sharedSequence.d.ts +3 -2
  190. package/lib/sharedSequence.d.ts.map +1 -1
  191. package/lib/sharedSequence.js +2 -2
  192. package/lib/sharedSequence.js.map +1 -1
  193. package/lib/sharedString.d.ts +2 -2
  194. package/lib/sharedString.d.ts.map +1 -1
  195. package/lib/sharedString.js +1 -1
  196. package/lib/sharedString.js.map +1 -1
  197. package/package.json +41 -58
  198. package/src/{localValues.ts → IntervalCollectionValues.ts} +26 -18
  199. package/src/index.ts +2 -2
  200. package/src/intervalCollection.ts +46 -47
  201. package/src/{defaultMap.ts → intervalCollectionMap.ts} +42 -105
  202. package/src/{defaultMapInterfaces.ts → intervalCollectionMapInterfaces.ts} +26 -16
  203. package/src/intervalIndex/endpointInRangeIndex.ts +4 -1
  204. package/src/intervalIndex/endpointIndex.ts +4 -1
  205. package/src/intervalIndex/idIntervalIndex.ts +4 -2
  206. package/src/intervalIndex/overlappingIntervalsIndex.ts +8 -5
  207. package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +6 -3
  208. package/src/intervalIndex/sequenceIntervalIndexes.ts +3 -1
  209. package/src/intervalIndex/startpointInRangeIndex.ts +4 -1
  210. package/src/intervalTree.ts +4 -3
  211. package/src/intervals/interval.ts +6 -3
  212. package/src/intervals/intervalUtils.ts +4 -2
  213. package/src/intervals/sequenceInterval.ts +5 -3
  214. package/src/packageVersion.ts +1 -1
  215. package/src/revertibles.ts +10 -10
  216. package/src/sequence.ts +24 -31
  217. package/src/sequenceDeltaEvent.ts +3 -4
  218. package/src/sequenceFactory.ts +4 -3
  219. package/src/sharedIntervalCollection.ts +12 -18
  220. package/src/sharedSequence.ts +9 -6
  221. package/src/sharedString.ts +4 -3
  222. package/api-extractor-cjs.json +0 -8
  223. package/dist/defaultMap.d.ts.map +0 -1
  224. package/dist/defaultMap.js.map +0 -1
  225. package/dist/defaultMapInterfaces.d.ts.map +0 -1
  226. package/dist/defaultMapInterfaces.js.map +0 -1
  227. package/dist/localValues.d.ts.map +0 -1
  228. package/dist/localValues.js.map +0 -1
  229. package/dist/sequence-alpha.d.ts +0 -1432
  230. package/dist/sequence-beta.d.ts +0 -246
  231. package/dist/sequence-public.d.ts +0 -246
  232. package/dist/sequence-untrimmed.d.ts +0 -1820
  233. package/lib/defaultMap.d.ts.map +0 -1
  234. package/lib/defaultMap.js.map +0 -1
  235. package/lib/defaultMapInterfaces.d.ts.map +0 -1
  236. package/lib/defaultMapInterfaces.js.map +0 -1
  237. package/lib/localValues.d.ts.map +0 -1
  238. package/lib/localValues.js.map +0 -1
  239. package/lib/sequence-alpha.d.ts +0 -1432
  240. package/lib/sequence-beta.d.ts +0 -246
  241. package/lib/sequence-public.d.ts +0 -246
  242. package/lib/sequence-untrimmed.d.ts +0 -1820
  243. package/lib/test/collections.intervalTree.js +0 -73
  244. package/lib/test/collections.intervalTree.js.map +0 -1
  245. package/lib/test/createSnapshotFiles.js +0 -15
  246. package/lib/test/createSnapshotFiles.js.map +0 -1
  247. package/lib/test/dirname.cjs +0 -16
  248. package/lib/test/dirname.cjs.map +0 -1
  249. package/lib/test/endpointInRangeIndex.spec.js +0 -182
  250. package/lib/test/endpointInRangeIndex.spec.js.map +0 -1
  251. package/lib/test/fuzz/fuzzUtils.js +0 -250
  252. package/lib/test/fuzz/fuzzUtils.js.map +0 -1
  253. package/lib/test/fuzz/intervalCollection.fuzz.spec.js +0 -200
  254. package/lib/test/fuzz/intervalCollection.fuzz.spec.js.map +0 -1
  255. package/lib/test/fuzz/intervalRevertibles.fuzz.spec.js +0 -129
  256. package/lib/test/fuzz/intervalRevertibles.fuzz.spec.js.map +0 -1
  257. package/lib/test/fuzz/sharedString.fuzz.spec.js +0 -91
  258. package/lib/test/fuzz/sharedString.fuzz.spec.js.map +0 -1
  259. package/lib/test/generateSharedStrings.js +0 -138
  260. package/lib/test/generateSharedStrings.js.map +0 -1
  261. package/lib/test/intervalCollection.detached.spec.js +0 -126
  262. package/lib/test/intervalCollection.detached.spec.js.map +0 -1
  263. package/lib/test/intervalCollection.events.spec.js +0 -491
  264. package/lib/test/intervalCollection.events.spec.js.map +0 -1
  265. package/lib/test/intervalCollection.perf.spec.js +0 -88
  266. package/lib/test/intervalCollection.perf.spec.js.map +0 -1
  267. package/lib/test/intervalCollection.snapshot.spec.js +0 -171
  268. package/lib/test/intervalCollection.snapshot.spec.js.map +0 -1
  269. package/lib/test/intervalCollection.spec.js +0 -1660
  270. package/lib/test/intervalCollection.spec.js.map +0 -1
  271. package/lib/test/intervalIndexTestUtils.js +0 -49
  272. package/lib/test/intervalIndexTestUtils.js.map +0 -1
  273. package/lib/test/intervalRebasing.spec.js +0 -589
  274. package/lib/test/intervalRebasing.spec.js.map +0 -1
  275. package/lib/test/intervalStashedOps.spec.js +0 -142
  276. package/lib/test/intervalStashedOps.spec.js.map +0 -1
  277. package/lib/test/intervalTestUtils.js +0 -81
  278. package/lib/test/intervalTestUtils.js.map +0 -1
  279. package/lib/test/marshalling.spec.js +0 -55
  280. package/lib/test/marshalling.spec.js.map +0 -1
  281. package/lib/test/memory/sharedSequence.spec.js +0 -82
  282. package/lib/test/memory/sharedSequence.spec.js.map +0 -1
  283. package/lib/test/memory/sharedString.spec.js +0 -134
  284. package/lib/test/memory/sharedString.spec.js.map +0 -1
  285. package/lib/test/overlappingSequenceIntervalsIndex.spec.js +0 -348
  286. package/lib/test/overlappingSequenceIntervalsIndex.spec.js.map +0 -1
  287. package/lib/test/partialLoad.spec.js +0 -211
  288. package/lib/test/partialLoad.spec.js.map +0 -1
  289. package/lib/test/rebasing.spec.js +0 -81
  290. package/lib/test/rebasing.spec.js.map +0 -1
  291. package/lib/test/reentrancy.spec.js +0 -174
  292. package/lib/test/reentrancy.spec.js.map +0 -1
  293. package/lib/test/revertibles.spec.js +0 -971
  294. package/lib/test/revertibles.spec.js.map +0 -1
  295. package/lib/test/sequenceDeltaEvent.spec.js +0 -2144
  296. package/lib/test/sequenceDeltaEvent.spec.js.map +0 -1
  297. package/lib/test/sharedIntervalCollection.spec.js +0 -159
  298. package/lib/test/sharedIntervalCollection.spec.js.map +0 -1
  299. package/lib/test/sharedString.spec.js +0 -532
  300. package/lib/test/sharedString.spec.js.map +0 -1
  301. package/lib/test/snapshotEmptyProps.spec.js +0 -45
  302. package/lib/test/snapshotEmptyProps.spec.js.map +0 -1
  303. package/lib/test/snapshotVersion.spec.js +0 -149
  304. package/lib/test/snapshotVersion.spec.js.map +0 -1
  305. package/lib/test/startpointInRangeIndex.spec.js +0 -182
  306. package/lib/test/startpointInRangeIndex.spec.js.map +0 -1
  307. package/lib/test/subSequence.spec.js +0 -92
  308. package/lib/test/subSequence.spec.js.map +0 -1
  309. package/lib/test/types/validateSequencePrevious.generated.js +0 -162
  310. package/lib/test/types/validateSequencePrevious.generated.js.map +0 -1
  311. package/lib/test/v1IntervalCollectionHelpers.js +0 -93
  312. package/lib/test/v1IntervalCollectionHelpers.js.map +0 -1
  313. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -2,16 +2,17 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
5
6
  import { IFluidHandle } from "@fluidframework/core-interfaces";
6
7
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
8
  import { IFluidSerializer } from "@fluidframework/shared-object-base";
8
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
9
- import { ISerializableValue, ISerializedValue, IValueType, ISharedDefaultMapEvents, IMapMessageLocalMetadata, SequenceOptions, IValueTypeOperationValue } from "./defaultMapInterfaces.js";
10
9
  import { type IntervalCollection } from "./intervalCollection.js";
10
+ import { IIntervalCollectionType, IIntervalCollectionTypeOperationValue, IMapMessageLocalMetadata, ISerializableIntervalCollection, ISharedDefaultMapEvents, SequenceOptions } from "./intervalCollectionMapInterfaces.js";
11
+ import { type ISerializableInterval } from "./intervals/index.js";
11
12
  /**
12
- * Describes an operation specific to a value type.
13
+ * Description of a map delta operation
13
14
  */
14
- export interface IMapValueTypeOperation {
15
+ export interface IMapOperation {
15
16
  /**
16
17
  * String identifier of the operation type.
17
18
  */
@@ -23,21 +24,14 @@ export interface IMapValueTypeOperation {
23
24
  /**
24
25
  * Value of the operation, specific to the value type.
25
26
  */
26
- value: IValueTypeOperationValue;
27
+ value: IIntervalCollectionTypeOperationValue;
27
28
  }
28
- /**
29
- * Description of a map delta operation
30
- */
31
- export type IMapOperation = IMapValueTypeOperation;
32
29
  /**
33
30
  * Defines the in-memory object structure to be used for the conversion to/from serialized.
34
31
  * Directly used in JSON.stringify, direct result from JSON.parse
35
32
  */
36
33
  export interface IMapDataObjectSerializable {
37
- [key: string]: ISerializableValue;
38
- }
39
- export interface IMapDataObjectSerialized {
40
- [key: string]: ISerializedValue;
34
+ [key: string]: ISerializableIntervalCollection;
41
35
  }
42
36
  /**
43
37
  * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by
@@ -46,7 +40,7 @@ export interface IMapDataObjectSerialized {
46
40
  * Creation of values is implicit on access (either via `get` or a remote op application referring to
47
41
  * a collection that wasn't previously known)
48
42
  */
49
- export declare class DefaultMap<T extends IntervalCollection<any> = IntervalCollection<any>> {
43
+ export declare class IntervalCollectionMap<T extends ISerializableInterval> {
50
44
  private readonly serializer;
51
45
  private readonly handle;
52
46
  private readonly submitMessage;
@@ -73,48 +67,21 @@ export declare class DefaultMap<T extends IntervalCollection<any> = IntervalColl
73
67
  * @param type - The value type to create at values of this map
74
68
  * @param eventEmitter - The object that will emit map events
75
69
  */
76
- constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => void, type: IValueType<T>, options?: Partial<SequenceOptions> | undefined, eventEmitter?: TypedEventEmitter<ISharedDefaultMapEvents>);
70
+ constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => void, type: IIntervalCollectionType<T>, options?: Partial<SequenceOptions> | undefined, eventEmitter?: TypedEventEmitter<ISharedDefaultMapEvents>);
77
71
  /**
78
72
  * Get an iterator over the keys in this map.
79
73
  * @returns The iterator
80
74
  */
81
75
  keys(): IterableIterator<string>;
82
- /**
83
- * Get an iterator over the entries in this map.
84
- * @returns The iterator
85
- */
86
- entries(): IterableIterator<[string, any]>;
87
76
  /**
88
77
  * Get an iterator over the values in this map.
89
78
  * @returns The iterator
90
79
  */
91
80
  values(): IterableIterator<any>;
92
- /**
93
- * Get an iterator over the entries in this map.
94
- * @returns The iterator
95
- */
96
- [Symbol.iterator](): IterableIterator<[string, any]>;
97
- /**
98
- * Executes the given callback on each entry in the map.
99
- * @param callbackFn - Callback function
100
- */
101
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
102
81
  /**
103
82
  * {@inheritDoc ISharedMap.get}
104
83
  */
105
- get(key: string): T;
106
- /**
107
- * Check if a key exists in the map.
108
- * @param key - The key to check
109
- * @returns True if the key exists, false otherwise
110
- */
111
- has(key: string): boolean;
112
- /**
113
- * Serializes the data stored in the shared map to a JSON string
114
- * @param serializer - The serializer to use to serialize handles in its values.
115
- * @returns A JSON string containing serialized map data
116
- */
117
- getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized;
84
+ get(key: string): IntervalCollection<T>;
118
85
  getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable;
119
86
  serialize(serializer: IFluidSerializer): string;
120
87
  /**
@@ -167,4 +134,4 @@ export declare class DefaultMap<T extends IntervalCollection<any> = IntervalColl
167
134
  */
168
135
  private makeMapValueOpEmitter;
169
136
  }
170
- //# sourceMappingURL=defaultMap.d.ts.map
137
+ //# sourceMappingURL=intervalCollectionMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalCollectionMap.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAItE,OAAO,EACN,KAAK,kBAAkB,EAIvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,uBAAuB,EACvB,qCAAqC,EACrC,wBAAwB,EACxB,+BAA+B,EAC/B,uBAAuB,EAIvB,eAAe,EACf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,KAAK,qBAAqB,EAG1B,MAAM,sBAAsB,CAAC;AAM9B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,qCAAqC,CAAC;CAC7C;AACD;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,+BAA+B,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,qBAAa,qB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X,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,EAClC,eAAe,EAAE,OAAO,GACtB,OAAO;IAaV;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAYlB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAkBjB;;;;OAIG;IAEH,OAAO,CAAC,qBAAqB;CAyB7B"}
@@ -4,11 +4,11 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DefaultMap = void 0;
8
- const shared_object_base_1 = require("@fluidframework/shared-object-base");
7
+ exports.IntervalCollectionMap = void 0;
9
8
  const client_utils_1 = require("@fluid-internal/client-utils");
10
- const core_utils_1 = require("@fluidframework/core-utils");
11
- const localValues_js_1 = require("./localValues.js");
9
+ const internal_1 = require("@fluidframework/core-utils/internal");
10
+ const internal_2 = require("@fluidframework/shared-object-base/internal");
11
+ const IntervalCollectionValues_js_1 = require("./IntervalCollectionValues.js");
12
12
  const intervalCollection_js_1 = require("./intervalCollection.js");
13
13
  function isMapOperation(op) {
14
14
  return typeof op === "object" && op !== null && "type" in op && op.type === "act";
@@ -20,7 +20,7 @@ function isMapOperation(op) {
20
20
  * Creation of values is implicit on access (either via `get` or a remote op application referring to
21
21
  * a collection that wasn't previously known)
22
22
  */
23
- class DefaultMap {
23
+ class IntervalCollectionMap {
24
24
  /**
25
25
  * The number of key/value pairs stored in the map.
26
26
  */
@@ -60,7 +60,7 @@ class DefaultMap {
60
60
  },
61
61
  resubmit: (op, localOpMetadata) => {
62
62
  const localValue = this.data.get(op.key);
63
- (0, core_utils_1.assert)(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);
63
+ (0, internal_1.assert)(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);
64
64
  const handler = localValue.getOpHandler(op.value.opName);
65
65
  const rebased = handler.rebase(localValue.value, op.value, localOpMetadata);
66
66
  if (rebased !== undefined) {
@@ -81,25 +81,6 @@ class DefaultMap {
81
81
  keys() {
82
82
  return this.data.keys();
83
83
  }
84
- /**
85
- * Get an iterator over the entries in this map.
86
- * @returns The iterator
87
- */
88
- entries() {
89
- const localEntriesIterator = this.data.entries();
90
- const iterator = {
91
- next() {
92
- const nextVal = localEntriesIterator.next();
93
- return nextVal.done
94
- ? { value: undefined, done: true }
95
- : { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value
96
- },
97
- [Symbol.iterator]() {
98
- return this;
99
- },
100
- };
101
- return iterator;
102
- }
103
84
  /**
104
85
  * Get an iterator over the values in this map.
105
86
  * @returns The iterator
@@ -119,22 +100,6 @@ class DefaultMap {
119
100
  };
120
101
  return iterator;
121
102
  }
122
- /**
123
- * Get an iterator over the entries in this map.
124
- * @returns The iterator
125
- */
126
- [Symbol.iterator]() {
127
- return this.entries();
128
- }
129
- /**
130
- * Executes the given callback on each entry in the map.
131
- * @param callbackFn - Callback function
132
- */
133
- forEach(callbackFn) {
134
- this.data.forEach((localValue, key, m) => {
135
- callbackFn(localValue.value, key, m);
136
- });
137
- }
138
103
  /**
139
104
  * {@inheritDoc ISharedMap.get}
140
105
  */
@@ -142,30 +107,10 @@ class DefaultMap {
142
107
  const localValue = this.data.get(key) ?? this.createCore(key, true);
143
108
  return localValue.value;
144
109
  }
145
- /**
146
- * Check if a key exists in the map.
147
- * @param key - The key to check
148
- * @returns True if the key exists, false otherwise
149
- */
150
- has(key) {
151
- return this.data.has(key);
152
- }
153
- /**
154
- * Serializes the data stored in the shared map to a JSON string
155
- * @param serializer - The serializer to use to serialize handles in its values.
156
- * @returns A JSON string containing serialized map data
157
- */
158
- getSerializedStorage(serializer) {
159
- const serializableMapData = {};
160
- this.data.forEach((localValue, key) => {
161
- serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);
162
- });
163
- return serializableMapData;
164
- }
165
110
  getSerializableStorage(serializer) {
166
111
  const serializableMapData = {};
167
112
  this.data.forEach((localValue, key) => {
168
- serializableMapData[key] = (0, localValues_js_1.makeSerializable)(localValue, serializer, this.handle);
113
+ serializableMapData[key] = (0, IntervalCollectionValues_js_1.makeSerializable)(localValue, serializer, this.handle);
169
114
  });
170
115
  return serializableMapData;
171
116
  }
@@ -182,8 +127,8 @@ class DefaultMap {
182
127
  for (const [key, serializable] of Object.entries(parsed)) {
183
128
  // Back-compat: legacy documents may have handles to an intervalCollection map kernel.
184
129
  // These collections should be empty, and ValueTypes are no longer supported.
185
- if (serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
186
- serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared]) {
130
+ if (serializable.type === internal_2.ValueType[internal_2.ValueType.Plain] ||
131
+ serializable.type === internal_2.ValueType[internal_2.ValueType.Shared]) {
187
132
  continue;
188
133
  }
189
134
  // Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with
@@ -271,7 +216,7 @@ class DefaultMap {
271
216
  * @param local - Whether the message originated from the local client
272
217
  */
273
218
  createCore(key, local) {
274
- const localValue = new localValues_js_1.ValueTypeLocalValue(this.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options), this.type);
219
+ const localValue = new IntervalCollectionValues_js_1.IntervalCollectionTypeLocalValue(this.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options), this.type);
275
220
  const previousValue = this.data.get(key);
276
221
  this.data.set(key, localValue);
277
222
  const event = { key, previousValue };
@@ -289,10 +234,10 @@ class DefaultMap {
289
234
  * @returns The local value that was produced
290
235
  */
291
236
  makeLocal(key, serializable) {
292
- (0, core_utils_1.assert)(serializable.type !== shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] &&
293
- serializable.type !== shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared], 0x2e1 /* "Support for plain value types removed." */);
237
+ (0, internal_1.assert)(serializable.type !== internal_2.ValueType[internal_2.ValueType.Plain] &&
238
+ serializable.type !== internal_2.ValueType[internal_2.ValueType.Shared], 0x2e1 /* "Support for plain value types removed." */);
294
239
  const localValue = this.type.factory.load(this.makeMapValueOpEmitter(key), serializable.value, this.options);
295
- return new localValues_js_1.ValueTypeLocalValue(localValue, this.type);
240
+ return new IntervalCollectionValues_js_1.IntervalCollectionTypeLocalValue(localValue, this.type);
296
241
  }
297
242
  /**
298
243
  * Create an emitter for a value type to emit ops from the given key.
@@ -318,5 +263,5 @@ class DefaultMap {
318
263
  return { emit };
319
264
  }
320
265
  }
321
- exports.DefaultMap = DefaultMap;
322
- //# sourceMappingURL=defaultMap.js.map
266
+ exports.IntervalCollectionMap = IntervalCollectionMap;
267
+ //# sourceMappingURL=intervalCollectionMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalCollectionMap.js","sourceRoot":"","sources":["../src/intervalCollectionMap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAEjE,kEAA6D;AAG7D,0EAAwE;AAExE,+EAAmG;AACnG,mEAKiC;AAkBjC,SAAS,cAAc,CAAC,EAAW;IAClC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC;AACnF,CAAC;AA6BD;;;;;;GAMG;AACH,MAAa,qBAAqB;IACjC;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IA0CD;;;;;;;OAOG;IACH,YACkB,UAA4B,EAC5B,MAAoB,EACpB,aAGR,EACQ,IAAgC,EAChC,OAAkC,EACnC,eAAe,IAAI,gCAAiB,EAA2B;QAR9D,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAGrB;QACQ,SAAI,GAAJ,IAAI,CAA4B;QAChC,YAAO,GAAP,OAAO,CAA2B;QACnC,iBAAY,GAAZ,YAAY,CAAmD;QAzDhF;;WAEG;QACc,mBAAc,GAAG;YACjC,OAAO,EAAE,CACR,EAAi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AAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9E,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACjB,CAAC;CACD;AAlTD,sDAkTC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IFluidSerializer } from \"@fluidframework/shared-object-base\";\nimport { ValueType } from \"@fluidframework/shared-object-base/internal\";\n\nimport { IntervalCollectionTypeLocalValue, makeSerializable } from \"./IntervalCollectionValues.js\";\nimport {\n\ttype IntervalCollection,\n\treservedIntervalIdKey,\n\ttoOptionalSequencePlace,\n\ttoSequencePlace,\n} from \"./intervalCollection.js\";\nimport {\n\tIIntervalCollectionType,\n\tIIntervalCollectionTypeOperationValue,\n\tIMapMessageLocalMetadata,\n\tISerializableIntervalCollection,\n\tISharedDefaultMapEvents,\n\tIValueChanged,\n\t// eslint-disable-next-line import/no-deprecated\n\tIValueOpEmitter,\n\tSequenceOptions,\n} from \"./intervalCollectionMapInterfaces.js\";\nimport {\n\ttype ISerializableInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n} from \"./intervals/index.js\";\n\nfunction isMapOperation(op: unknown): op is IMapOperation {\n\treturn typeof op === \"object\" && op !== null && \"type\" in op && op.type === \"act\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport interface IMapOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"act\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value of the operation, specific to the value type.\n\t */\n\tvalue: IIntervalCollectionTypeOperationValue;\n}\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n\t[key: string]: ISerializableIntervalCollection;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class IntervalCollectionMap<T extends ISerializableInterval> {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandler = {\n\t\tprocess: (\n\t\t\top: IMapOperation,\n\t\t\tlocal: boolean,\n\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => {\n\t\t\tconst localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\tconst previousValue = localValue.value;\n\t\t\tconst translatedValue = op.value.value as any;\n\t\t\thandler.process(previousValue, translatedValue, local, message, localOpMetadata);\n\t\t\tconst event: IValueChanged = { key: op.key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n\t\t},\n\t\tsubmit: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t},\n\t\tresubmit: (op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n\t\t\tconst localValue = this.data.get(op.key);\n\n\t\t\tassert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);\n\n\t\t\tconst handler = localValue.getOpHandler(op.value.opName);\n\t\t\tconst rebased = handler.rebase(localValue.value, op.value, localOpMetadata);\n\t\t\tif (rebased !== undefined) {\n\t\t\t\tconst { rebasedOp, rebasedLocalOpMetadata } = rebased;\n\t\t\t\tthis.submitMessage({ ...op, value: rebasedOp }, rebasedLocalOpMetadata);\n\t\t\t}\n\t\t},\n\t};\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, IntervalCollectionTypeLocalValue<T>>();\n\n\t/**\n\t * Create a new default map.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param type - The value type to create at values of this map\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tconstructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (\n\t\t\top: IMapOperation,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t) => void,\n\t\tprivate readonly type: IIntervalCollectionType<T>,\n\t\tprivate readonly options?: Partial<SequenceOptions>,\n\t\tpublic readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n\t) {}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<any> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false }; // Unpack the stored value\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get(key: string): IntervalCollection<T> {\n\t\tconst localValue = this.data.get(key) ?? this.createCore(key, true);\n\n\t\treturn localValue.value;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tthis.data.forEach((localValue, key) => {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t});\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t *\n\t * @param serialized - A JSON string containing serialized map data\n\t */\n\tpublic populate(serialized: string): void {\n\t\tconst parsed = this.serializer.parse(serialized) as IMapDataObjectSerializable;\n\n\t\tfor (const [key, serializable] of Object.entries(parsed)) {\n\t\t\t// Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n\t\t\t// These collections should be empty, and ValueTypes are no longer supported.\n\t\t\tif (\n\t\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n\t\t\t// \"intervalCollections/\". This would burden users trying to iterate the collection and\n\t\t\t// access its value, as well as those trying to match a create message to its underlying\n\t\t\t// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n\t\t\tconst normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n\t\t\tconst localValue = {\n\t\t\t\tkey: normalizedKey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: unknown, localOpMetadata: IMapMessageLocalMetadata): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tthis.messageHandler.resubmit(op, localOpMetadata);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic tryApplyStashedOp(op: unknown): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tconst { value, key } = op;\n\t\t\tconst map = this.get(key);\n\n\t\t\tswitch (value.opName) {\n\t\t\t\tcase \"add\": {\n\t\t\t\t\tmap.add({\n\t\t\t\t\t\t// Todo: we should improve typing so we know add ops always have start and end\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tstart: toSequencePlace(value.value.start!, value.value.startSide),\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tend: toSequencePlace(value.value.end!, value.value.endSide),\n\t\t\t\t\t\tprops: value.value.properties,\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tcase \"change\": {\n\t\t\t\t\tconst { [reservedIntervalIdKey]: id, ...props } = value.value.properties ?? {};\n\t\t\t\t\tmap.change(id, {\n\t\t\t\t\t\tstart: toOptionalSequencePlace(value.value.start, value.value.startSide),\n\t\t\t\t\t\tend: toOptionalSequencePlace(value.value.end, value.value.endSide),\n\t\t\t\t\t\tprops,\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tcase \"delete\": {\n\t\t\t\t\tconst { [reservedIntervalIdKey]: id } = value.value.properties ?? {};\n\t\t\t\t\tmap.removeIntervalById(id);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\"unknown ops should not be stashed\");\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(\n\t\top: unknown,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (isMapOperation(op)) {\n\t\t\tthis.messageHandler.process(\n\t\t\t\top,\n\t\t\t\tlocal,\n\t\t\t\tmessage,\n\t\t\t\tlocalOpMetadata as IMapMessageLocalMetadata,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Initializes a default ValueType at the provided key.\n\t * Should be used when a map operation incurs creation.\n\t * @param key - The key being initialized\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate createCore(key: string, local: boolean): IntervalCollectionTypeLocalValue<T> {\n\t\tconst localValue = new IntervalCollectionTypeLocalValue(\n\t\t\tthis.type.factory.load(this.makeMapValueOpEmitter(key), undefined, this.options),\n\t\t\tthis.type,\n\t\t);\n\t\tconst previousValue = this.data.get(key);\n\t\tthis.data.set(key, localValue);\n\t\tconst event: IValueChanged = { key, previousValue };\n\t\tthis.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n\t\treturn localValue;\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(\n\t\tkey: string,\n\t\tserializable: ISerializableIntervalCollection,\n\t): IntervalCollectionTypeLocalValue<T> {\n\t\tassert(\n\t\t\tserializable.type !== ValueType[ValueType.Plain] &&\n\t\t\t\tserializable.type !== ValueType[ValueType.Shared],\n\t\t\t0x2e1 /* \"Support for plain value types removed.\" */,\n\t\t);\n\n\t\tconst localValue = this.type.factory.load(\n\t\t\tthis.makeMapValueOpEmitter(key),\n\t\t\tserializable.value,\n\t\t\tthis.options,\n\t\t);\n\t\treturn new IntervalCollectionTypeLocalValue(localValue, this.type);\n\t}\n\n\t/**\n\t * Create an emitter for a value type to emit ops from the given key.\n\t * @param key - The key of the map that the value type will be stored on\n\t * @returns A value op emitter for the given key\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate makeMapValueOpEmitter(key: string): IValueOpEmitter {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tconst emit: IValueOpEmitter[\"emit\"] = (\n\t\t\topName: IntervalDeltaOpType,\n\t\t\tpreviousValue: unknown,\n\t\t\tparams: SerializedIntervalDelta,\n\t\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t\t): void => {\n\t\t\tconst op: IMapOperation = {\n\t\t\t\tkey,\n\t\t\t\ttype: \"act\",\n\t\t\t\tvalue: {\n\t\t\t\t\topName,\n\t\t\t\t\tvalue: params,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.submitMessage(op, localOpMetadata);\n\n\t\t\tconst event: IValueChanged = { key, previousValue };\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n\t\t};\n\n\t\treturn { emit };\n\t}\n}\n"]}
@@ -2,10 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
5
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
7
  import { ISharedObjectEvents } from "@fluidframework/shared-object-base";
7
- import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
8
- import { ISerializedInterval, IntervalOpType, SerializedIntervalDelta, IntervalDeltaOpType } from "./intervals/index.js";
8
+ import type { IntervalCollection } from "./intervalCollection.js";
9
+ import { type ISerializableInterval, ISerializedInterval, IntervalDeltaOpType, IntervalOpType, SerializedIntervalDelta } from "./intervals/index.js";
9
10
  /**
10
11
  * Type of "valueChanged" event parameter.
11
12
  */
@@ -75,7 +76,7 @@ export interface SequenceOptions {
75
76
  * A value factory is used to serialize/deserialize value types to a map
76
77
  * @alpha
77
78
  */
78
- export interface IValueFactory<T> {
79
+ export interface IIntervalCollectionFactory<T extends ISerializableInterval> {
79
80
  /**
80
81
  * Create a new value type. Used both in creation of new value types, as well as in loading existing ones
81
82
  * from remote.
@@ -83,20 +84,20 @@ export interface IValueFactory<T> {
83
84
  * @param raw - Initialization parameters as defined by the value type
84
85
  * @returns The new value type
85
86
  */
86
- load(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): T;
87
+ load(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): IntervalCollection<T>;
87
88
  /**
88
89
  * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be
89
90
  * loadable using the load method of its factory.
90
91
  * @param value - The value type to serialize
91
92
  * @returns The JSONable form of the value type
92
93
  */
93
- store(value: T): any;
94
+ store(value: IntervalCollection<T>): any;
94
95
  }
95
96
  /**
96
97
  * Defines an operation that a value type is able to handle.
97
98
  * @alpha
98
99
  */
99
- export interface IValueOperation<T> {
100
+ export interface IIntervalCollectionOperation<T extends ISerializableInterval> {
100
101
  /**
101
102
  * Performs the actual processing on the incoming operation.
102
103
  * @param value - The current value stored at the given key, which should be the value type
@@ -105,7 +106,7 @@ export interface IValueOperation<T> {
105
106
  * @param message - The operation itself
106
107
  * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.
107
108
  */
108
- process(value: T, params: ISerializedInterval, local: boolean, message: ISequencedDocumentMessage | undefined, localOpMetadata: IMapMessageLocalMetadata | undefined): void;
109
+ process(value: IntervalCollection<T>, params: ISerializedInterval, local: boolean, message: ISequencedDocumentMessage | undefined, localOpMetadata: IMapMessageLocalMetadata | undefined): void;
109
110
  /**
110
111
  * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current
111
112
  * perspective. Should be invoked on reconnection.
@@ -114,15 +115,15 @@ export interface IValueOperation<T> {
114
115
  * @param localOpMetadata - Any local metadata that was originally submitted with the op.
115
116
  * @returns A rebased version of the op and any local metadata that should be submitted with it.
116
117
  */
117
- rebase(value: T, op: IValueTypeOperationValue, localOpMetadata: IMapMessageLocalMetadata): {
118
- rebasedOp: IValueTypeOperationValue;
118
+ rebase(value: IntervalCollection<T>, op: IIntervalCollectionTypeOperationValue, localOpMetadata: IMapMessageLocalMetadata): {
119
+ rebasedOp: IIntervalCollectionTypeOperationValue;
119
120
  rebasedLocalOpMetadata: IMapMessageLocalMetadata;
120
121
  } | undefined;
121
122
  }
122
123
  /**
123
124
  * Defines a value type that can be registered on a container type.
124
125
  */
125
- export interface IValueType<T> {
126
+ export interface IIntervalCollectionType<T extends ISerializableInterval> {
126
127
  /**
127
128
  * Name of the value type.
128
129
  */
@@ -130,11 +131,11 @@ export interface IValueType<T> {
130
131
  /**
131
132
  * Factory method used to convert to/from a JSON form of the type.
132
133
  */
133
- factory: IValueFactory<T>;
134
+ factory: IIntervalCollectionFactory<T>;
134
135
  /**
135
136
  * Operations that can be applied to the value type.
136
137
  */
137
- ops: Map<IntervalOpType, IValueOperation<T>>;
138
+ ops: Map<IntervalOpType, IIntervalCollectionOperation<T>>;
138
139
  }
139
140
  export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
140
141
  (event: "valueChanged" | "create", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): void;
@@ -150,7 +151,7 @@ export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
150
151
  * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes
151
152
  * and deserializes via .store() and .load().
152
153
  */
153
- export interface ISerializableValue {
154
+ export interface ISerializableIntervalCollection {
154
155
  /**
155
156
  * A type annotation to help indicate how the value serializes.
156
157
  */
@@ -160,7 +161,7 @@ export interface ISerializableValue {
160
161
  */
161
162
  value: any;
162
163
  }
163
- export interface ISerializedValue {
164
+ export interface ISerializedIntervalCollection {
164
165
  /**
165
166
  * A type annotation to help indicate how the value serializes.
166
167
  */
@@ -179,7 +180,7 @@ export interface ISerializedValue {
179
180
  * it just describes an operation to be applied to an already-in-memory value.
180
181
  * @alpha
181
182
  */
182
- export interface IValueTypeOperationValue {
183
+ export interface IIntervalCollectionTypeOperationValue {
183
184
  /**
184
185
  * The name of the operation.
185
186
  */
@@ -189,4 +190,4 @@ export interface IValueTypeOperationValue {
189
190
  */
190
191
  value: SerializedIntervalDelta;
191
192
  }
192
- //# sourceMappingURL=defaultMapInterfaces.d.ts.map
193
+ //# sourceMappingURL=intervalCollectionMapInterfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACN,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;OAMG;IACH,IAAI,CACH,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE,uBAAuB,EAC/B,eAAe,EAAE,wBAAwB,GACvC,IAAI,CAAC;CACR;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,MAA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OAEG;IACH,GAAG,EAAE,GAAG,CAAC,cAAc,EAAE,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IACnE,CACC,KAAK,EAAE,cAAc,GAAG,QAAQ,EAChC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,GACvF,IAAI,CAAC;CACR;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qCAAqC;IACrD;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC/B"}
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=defaultMapInterfaces.js.map
7
+ //# sourceMappingURL=intervalCollectionMapInterfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\n\nimport type { IntervalCollection } from \"./intervalCollection.js\";\nimport {\n\ttype ISerializableInterval,\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tIntervalOpType,\n\tSerializedIntervalDelta,\n} from \"./intervals/index.js\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\tpreviousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n * @deprecated - will be remove from public api as there is no public used of this type\n */\nexport interface IValueOpEmitter {\n\t/**\n\t * Called by the value type to emit a value type operation through the container type holding it.\n\t * @param opName - Name of the emitted operation\n\t * @param previousValue - JSONable previous value as defined by the value type @deprecated unused\n\t * @param params - JSONable params for the operation as defined by the value type\n\t * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n\t */\n\temit(\n\t\topName: IntervalOpType,\n\t\tpreviousValue: undefined,\n\t\tparams: SerializedIntervalDelta,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\t/**\n\t * Enable the ability for interval endpoints to slide to the special endpoint\n\t * segments that exist before and after the bounds of the string. This is\n\t * primarily useful for workflows involving interval stickiness, and it is\n\t * suggested to enable both this flag and `intervalStickinessEnabled` at the\n\t * same time.\n\t *\n\t * The default value is false.\n\t */\n\tmergeTreeReferencesCanSlideToEndpoint: boolean;\n\t[key: string]: boolean;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IIntervalCollectionFactory<T extends ISerializableInterval> {\n\t/**\n\t * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n\t * from remote.\n\t * @param emitter - Emitter object that the created value type will use to emit operations\n\t * @param raw - Initialization parameters as defined by the value type\n\t * @returns The new value type\n\t */\n\tload(\n\t\temitter: IValueOpEmitter,\n\t\traw: any,\n\t\toptions?: Partial<SequenceOptions>,\n\t): IntervalCollection<T>;\n\n\t/**\n\t * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n\t * loadable using the load method of its factory.\n\t * @param value - The value type to serialize\n\t * @returns The JSONable form of the value type\n\t */\n\tstore(value: IntervalCollection<T>): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IIntervalCollectionOperation<T extends ISerializableInterval> {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection<T>,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t): void;\n\n\t/**\n\t * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current\n\t * perspective. Should be invoked on reconnection.\n\t * @param value - The current value stored at the given key, which should be the value type.\n\t * @param op - The op to be rebased.\n\t * @param localOpMetadata - Any local metadata that was originally submitted with the op.\n\t * @returns A rebased version of the op and any local metadata that should be submitted with it.\n\t */\n\trebase(\n\t\tvalue: IntervalCollection<T>,\n\t\top: IIntervalCollectionTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t):\n\t\t| {\n\t\t\t\trebasedOp: IIntervalCollectionTypeOperationValue;\n\t\t\t\trebasedLocalOpMetadata: IMapMessageLocalMetadata;\n\t\t }\n\t\t| undefined;\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IIntervalCollectionType<T extends ISerializableInterval> {\n\t/**\n\t * Name of the value type.\n\t */\n\tname: string;\n\n\t/**\n\t * Factory method used to convert to/from a JSON form of the type.\n\t */\n\tfactory: IIntervalCollectionFactory<T>;\n\n\t/**\n\t * Operations that can be applied to the value type.\n\t */\n\tops: Map<IntervalOpType, IIntervalCollectionOperation<T>>;\n}\n\nexport interface ISharedDefaultMapEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"valueChanged\" | \"create\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: any;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n * @alpha\n */\nexport interface IIntervalCollectionTypeOperationValue {\n\t/**\n\t * The name of the operation.\n\t */\n\topName: IntervalDeltaOpType;\n\n\t/**\n\t * The payload that is submitted along with the operation.\n\t */\n\tvalue: SerializedIntervalDelta;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Client } from "@fluidframework/merge-tree";
5
+ import { Client } from "@fluidframework/merge-tree/internal";
6
6
  import { IIntervalHelpers, ISerializableInterval, SequenceInterval } from "../intervals/index.js";
7
7
  import { SharedString } from "../sharedString.js";
8
8
  import { IntervalIndex } from "./intervalIndex.js";
@@ -1 +1 @@
1
- {"version":3,"file":"endpointInRangeIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAgC,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EAErB,gBAAgB,EAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CAAC,SAAS,SAAS,qBAAqB,CAC7E,SAAQ,aAAa,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;CAC1E;AAED,qBAAa,oBAAoB,CAAC,SAAS,SAAS,qBAAqB,CACxE,YAAW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O;IAJzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAGZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAyB/C,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAI9B,MAAM,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAIjC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE;CAiChF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,YAAY,EAAE,YAAY,GACxB,qBAAqB,CAAC,gBAAgB,CAAC,CAGzC"}
@@ -3,17 +3,17 @@
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 */
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
7
  exports.createEndpointInRangeIndex = exports.EndpointInRangeIndex = void 0;
9
- const merge_tree_1 = require("@fluidframework/merge-tree");
8
+ /* eslint-disable import/no-deprecated */
9
+ const internal_1 = require("@fluidframework/merge-tree/internal");
10
10
  const index_js_1 = require("../intervals/index.js");
11
11
  const intervalIndexUtils_js_1 = require("./intervalIndexUtils.js");
12
12
  class EndpointInRangeIndex {
13
13
  constructor(client, helpers) {
14
14
  this.client = client;
15
15
  this.helpers = helpers;
16
- this.intervalTree = new merge_tree_1.RedBlackTree((a, b) => {
16
+ this.intervalTree = new internal_1.RedBlackTree((a, b) => {
17
17
  const compareEndsResult = a.compareEnd(b);
18
18
  if (compareEndsResult !== 0) {
19
19
  return compareEndsResult;
@@ -1 +1 @@
1
- {"version":3,"file":"endpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,yCAAyC;;;AAEzC,2DAAkF;AAClF,oDAM+B;AAG/B,mEAAoG;AAgBpG,MAAa,oBAAoB;IAKhC,YACkB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O,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,uBAAY,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,uBAAY,CAAC,SAAS,CACtB,CAAC;QAEF,sDAAsD;QACrD,sBAAyD,CAAC,oCAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7E,oBAAuD,CAAC,oCAAY,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;AAzED,oDAyEC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACzC,YAA0B;IAE1B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,oBAAoB,CAAmB,MAAM,EAAE,kCAAuB,CAAC,CAAC;AACpF,CAAC;AALD,gEAKC","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/index.js\";\nimport { SharedString } from \"../sharedString.js\";\nimport { IntervalIndex } from \"./intervalIndex.js\";\nimport { HasComparisonOverride, compareOverrideables, forceCompare } from \"./intervalIndexUtils.js\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose endpoints fall within a specified range.\n * @internal\n */\nexport interface IEndpointInRangeIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose endpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithEndpointInRange(start: number, end: number): TInterval[];\n}\n\nexport class EndpointInRangeIndex<TInterval extends ISerializableInterval>\n\timplements IEndpointInRangeIndex<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 compareEndsResult = a.compareEnd(b);\n\t\t\tif (compareEndsResult !== 0) {\n\t\t\t\treturn compareEndsResult;\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\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 findIntervalsWithEndpointInRange(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/**\n * @internal\n */\nexport function createEndpointInRangeIndex(\n\tsharedString: SharedString,\n): IEndpointInRangeIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new EndpointInRangeIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
1
+ {"version":3,"file":"endpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA2F;AAE3F,oDAM+B;AAI/B,mEAAoG;AAgBpG,MAAa,oBAAoB;IAKhC,YACkB,MAAc,EACd,OAAoC;QADpC,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAA6B;QAErD,IAAI,CAAC,YAAY,GAAG,IAAI,uBAAY,CAAuB,CAAC,CAAY,EAAE,CAAY,EAAE,EAAE;YACzF,MAAM,iBAAiB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC1C,IAAI,iBAAiB,KAAK,CAAC,EAAE;gBAC5B,OAAO,iBAAiB,CAAC;aACzB;YAED,MAAM,uBAAuB,GAAG,IAAA,4CAAoB,EACnD,CAAmC,EACnC,CAAmC,CACnC,CAAC;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C;QAEF,sDAAsD;QACrD,sBAAyD,CAAC,oCAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7E,oBAAuD,CAAC,oCAAY,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;AAzED,oDAyEC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACzC,YAA0B;IAE1B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,oBAAoB,CAAmB,MAAM,EAAE,kCAAuB,CAAC,CAAC;AACpF,CAAC;AALD,gEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport { Client, PropertyAction, RedBlackTree } from \"@fluidframework/merge-tree/internal\";\n\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tIntervalType,\n\tSequenceInterval,\n\tsequenceIntervalHelpers,\n} from \"../intervals/index.js\";\nimport { SharedString } from \"../sharedString.js\";\n\nimport { IntervalIndex } from \"./intervalIndex.js\";\nimport { HasComparisonOverride, compareOverrideables, forceCompare } from \"./intervalIndexUtils.js\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose endpoints fall within a specified range.\n * @internal\n */\nexport interface IEndpointInRangeIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose endpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithEndpointInRange(start: number, end: number): TInterval[];\n}\n\nexport class EndpointInRangeIndex<TInterval extends ISerializableInterval>\n\timplements IEndpointInRangeIndex<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 compareEndsResult = a.compareEnd(b);\n\t\t\tif (compareEndsResult !== 0) {\n\t\t\t\treturn compareEndsResult;\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\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 findIntervalsWithEndpointInRange(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/**\n * @internal\n */\nexport function createEndpointInRangeIndex(\n\tsharedString: SharedString,\n): IEndpointInRangeIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new EndpointInRangeIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Client } from "@fluidframework/merge-tree";
5
+ import { Client } from "@fluidframework/merge-tree/internal";
6
6
  import { IIntervalHelpers, ISerializableInterval, SequenceInterval } from "../intervals/index.js";
7
7
  import { SharedString } from "../sharedString.js";
8
8
  import { IntervalIndex } from "./intervalIndex.js";
@@ -1 +1 @@
1
- {"version":3,"file":"endpointIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EAErB,gBAAgB,EAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,qBAAqB,CACtE,SAAQ,aAAa,CAAC,SAAS,CAAC;IAChC;;;OAGG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAErD;;;OAGG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACjD;AAED,qBAAa,aAAa,CAAC,SAAS,SAAS,qBAAqB,CACjE,YAAW,cAAc,CAAC,SAAS,CAAC;IA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,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;gBAGnD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAK/C,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAcpD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAchD,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAI9B,MAAM,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;CAGxC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAGhG"}
@@ -3,16 +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 */
7
6
  Object.defineProperty(exports, "__esModule", { value: true });
8
7
  exports.createEndpointIndex = exports.EndpointIndex = void 0;
9
- const merge_tree_1 = require("@fluidframework/merge-tree");
8
+ /* eslint-disable import/no-deprecated */
9
+ const internal_1 = require("@fluidframework/merge-tree/internal");
10
10
  const index_js_1 = require("../intervals/index.js");
11
11
  class EndpointIndex {
12
12
  constructor(client, helpers) {
13
13
  this.client = client;
14
14
  this.helpers = helpers;
15
- this.endIntervalTree = new merge_tree_1.RedBlackTree((a, b) => a.compareEnd(b));
15
+ this.endIntervalTree = new internal_1.RedBlackTree((a, b) => a.compareEnd(b));
16
16
  }
17
17
  previousInterval(pos) {
18
18
  const transientInterval = this.helpers.create("transient", pos, pos, this.client, index_js_1.IntervalType.Transient);
@@ -1 +1 @@
1
- {"version":3,"file":"endpointIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/endpointIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,yCAAyC;;;AAEzC,2DAAkE;AACl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AM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,aAAa,CAAmB,MAAM,EAAE,kCAAuB,CAAC,CAAC;AAC7E,CAAC;AAHD,kDAGC","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, RedBlackTree } from \"@fluidframework/merge-tree\";\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tIntervalType,\n\tSequenceInterval,\n\tsequenceIntervalHelpers,\n} from \"../intervals/index.js\";\nimport { SharedString } from \"../sharedString.js\";\nimport { IntervalIndex } from \"./intervalIndex.js\";\n\n/**\n * @internal\n */\nexport interface IEndpointIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns the previous interval based on the given position number.\n\t * If no such interval exists in this index, returns `undefined`\n\t */\n\tpreviousInterval(pos: number): TInterval | undefined;\n\n\t/**\n\t * @returns the next interval based on the given position number.\n\t * If no such interval exists in this index, returns `undefined`\n\t */\n\tnextInterval(pos: number): TInterval | undefined;\n}\n\nexport class EndpointIndex<TInterval extends ISerializableInterval>\n\timplements IEndpointIndex<TInterval>\n{\n\tprivate readonly endIntervalTree: RedBlackTree<TInterval, TInterval>;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t) {\n\t\tthis.endIntervalTree = new RedBlackTree<TInterval, TInterval>((a, b) => a.compareEnd(b));\n\t}\n\n\tpublic previousInterval(pos: number): TInterval | undefined {\n\t\tconst transientInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tpos,\n\t\t\tpos,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\t\tconst rbNode = this.endIntervalTree.floor(transientInterval);\n\t\tif (rbNode) {\n\t\t\treturn rbNode.data;\n\t\t}\n\t}\n\n\tpublic nextInterval(pos: number): TInterval | undefined {\n\t\tconst transientInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tpos,\n\t\t\tpos,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\t\tconst rbNode = this.endIntervalTree.ceil(transientInterval);\n\t\tif (rbNode) {\n\t\t\treturn rbNode.data;\n\t\t}\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.endIntervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: TInterval): void {\n\t\tthis.endIntervalTree.remove(interval);\n\t}\n}\n\n/**\n * @internal\n */\nexport function createEndpointIndex(sharedString: SharedString): IEndpointIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new EndpointIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
1
+ {"version":3,"file":"endpointIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/endpointIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,kEAA2E;AAE3E,oDAM+B;AAuB/B,MAAa,aAAa;IAKzB,YACkB,MAAc,EACd,OAAoC;QADpC,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAA6B;QAErD,IAAI,CAAC,eAAe,GAAG,IAAI,uBAAY,CAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IAEM,gBAAgB,CAAC,GAAW;QAClC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAC5C,WAAW,EACX,GAAG,EACH,GAAG,EACH,IAAI,CAAC,MAAM,EACX,uBAAY,CAAC,SAAS,CACtB,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC7D,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC,IAAI,CAAC;SACnB;IACF,CAAC;IAEM,YAAY,CAAC,GAAW;QAC9B,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAC5C,WAAW,EACX,GAAG,EACH,GAAG,EACH,IAAI,CAAC,MAAM,EACX,uBAAY,CAAC,SAAS,CACtB,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC5D,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC,IAAI,CAAC;SACnB;IACF,CAAC;IAEM,GAAG,CAAC,QAAmB;QAC7B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAEM,MAAM,CAAC,QAAmB;QAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;CACD;AA/CD,sCA+CC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,YAA0B;IAC7D,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,aAAa,CAAmB,MAAM,EAAE,kCAAuB,CAAC,CAAC;AAC7E,CAAC;AAHD,kDAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport { Client, RedBlackTree } from \"@fluidframework/merge-tree/internal\";\n\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tIntervalType,\n\tSequenceInterval,\n\tsequenceIntervalHelpers,\n} from \"../intervals/index.js\";\nimport { SharedString } from \"../sharedString.js\";\n\nimport { IntervalIndex } from \"./intervalIndex.js\";\n\n/**\n * @internal\n */\nexport interface IEndpointIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns the previous interval based on the given position number.\n\t * If no such interval exists in this index, returns `undefined`\n\t */\n\tpreviousInterval(pos: number): TInterval | undefined;\n\n\t/**\n\t * @returns the next interval based on the given position number.\n\t * If no such interval exists in this index, returns `undefined`\n\t */\n\tnextInterval(pos: number): TInterval | undefined;\n}\n\nexport class EndpointIndex<TInterval extends ISerializableInterval>\n\timplements IEndpointIndex<TInterval>\n{\n\tprivate readonly endIntervalTree: RedBlackTree<TInterval, TInterval>;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t) {\n\t\tthis.endIntervalTree = new RedBlackTree<TInterval, TInterval>((a, b) => a.compareEnd(b));\n\t}\n\n\tpublic previousInterval(pos: number): TInterval | undefined {\n\t\tconst transientInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tpos,\n\t\t\tpos,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\t\tconst rbNode = this.endIntervalTree.floor(transientInterval);\n\t\tif (rbNode) {\n\t\t\treturn rbNode.data;\n\t\t}\n\t}\n\n\tpublic nextInterval(pos: number): TInterval | undefined {\n\t\tconst transientInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tpos,\n\t\t\tpos,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\t\tconst rbNode = this.endIntervalTree.ceil(transientInterval);\n\t\tif (rbNode) {\n\t\t\treturn rbNode.data;\n\t\t}\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.endIntervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: TInterval): void {\n\t\tthis.endIntervalTree.remove(interval);\n\t}\n}\n\n/**\n * @internal\n */\nexport function createEndpointIndex(sharedString: SharedString): IEndpointIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new EndpointIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"idIntervalIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/idIntervalIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,qBAAqB,CACxE,SAAQ,aAAa,CAAC,SAAS,CAAC,EAC/B,QAAQ,CAAC,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;CACzC;AAoCD;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,SAAS,qBAAqB,KACnC,gBAAgB,CAAC,SAAS,CAAC,CAE/B"}
1
+ {"version":3,"file":"idIntervalIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/idIntervalIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,qBAAqB,CACxE,SAAQ,aAAa,CAAC,SAAS,CAAC,EAC/B,QAAQ,CAAC,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;CACzC;AAoCD;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,SAAS,qBAAqB,KACnC,gBAAgB,CAAC,SAAS,CAAC,CAE/B"}