@fluidframework/sequence 2.0.0-rc.2.0.1 → 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
@@ -1,1432 +0,0 @@
1
- /**
2
- * Supports distributed data structures which are list-like.
3
- *
4
- * This library's main export is {@link SharedString}, a DDS for storing and simultaneously editing a sequence of
5
- * text.
6
- *
7
- * See the package's README for a high-level introduction to `SharedString`'s feature set.
8
- * @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for
9
- * working with text.
10
- *
11
- * @packageDocumentation
12
- */
13
-
14
- import { BaseSegment } from '@fluidframework/merge-tree';
15
- import { Client } from '@fluidframework/merge-tree';
16
- import { Deferred } from '@fluidframework/core-utils';
17
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
18
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
19
- import { IChannelServices } from '@fluidframework/datastore-definitions';
20
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
21
- import { IEvent } from '@fluidframework/core-interfaces';
22
- import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
23
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
24
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
25
- import { IJSONSegment } from '@fluidframework/merge-tree';
26
- import { IMergeTreeDeltaCallbackArgs } from '@fluidframework/merge-tree';
27
- import { IMergeTreeDeltaOpArgs } from '@fluidframework/merge-tree';
28
- import { IMergeTreeGroupMsg } from '@fluidframework/merge-tree';
29
- import { IMergeTreeMaintenanceCallbackArgs } from '@fluidframework/merge-tree';
30
- import { IRelativePosition } from '@fluidframework/merge-tree';
31
- import { ISegment } from '@fluidframework/merge-tree';
32
- import { ISegmentAction } from '@fluidframework/merge-tree';
33
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
34
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
35
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
36
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
37
- import { LocalReferencePosition } from '@fluidframework/merge-tree';
38
- import { MapLike } from '@fluidframework/merge-tree';
39
- import { Marker } from '@fluidframework/merge-tree';
40
- import { MergeTreeDeltaOperationType } from '@fluidframework/merge-tree';
41
- import { MergeTreeDeltaOperationTypes } from '@fluidframework/merge-tree';
42
- import { MergeTreeDeltaRevertible } from '@fluidframework/merge-tree';
43
- import { MergeTreeDeltaType } from '@fluidframework/merge-tree';
44
- import { MergeTreeMaintenanceType } from '@fluidframework/merge-tree';
45
- import { MergeTreeRevertibleDriver } from '@fluidframework/merge-tree';
46
- import { PropertiesManager } from '@fluidframework/merge-tree';
47
- import { PropertySet } from '@fluidframework/merge-tree';
48
- import { ReferencePosition } from '@fluidframework/merge-tree';
49
- import { ReferenceType } from '@fluidframework/merge-tree';
50
- import { reservedMarkerIdKey } from '@fluidframework/merge-tree';
51
- import { reservedRangeLabelsKey } from '@fluidframework/merge-tree';
52
- import { reservedTileLabelsKey } from '@fluidframework/merge-tree';
53
- import { Serializable } from '@fluidframework/datastore-definitions';
54
- import { SharedObject } from '@fluidframework/shared-object-base';
55
- import { SlidingPreference } from '@fluidframework/merge-tree';
56
- import { TextSegment } from '@fluidframework/merge-tree';
57
- import { TrackingGroup } from '@fluidframework/merge-tree';
58
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
59
-
60
- /**
61
- * Create revertibles for adding an interval
62
- * @alpha
63
- */
64
- export declare function appendAddIntervalToRevertibles(interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
65
-
66
- /**
67
- * Create revertibles for moving endpoints of an interval
68
- * @alpha
69
- */
70
- export declare function appendChangeIntervalToRevertibles(string: SharedString, newInterval: SequenceInterval, previousInterval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
71
-
72
- /**
73
- * Create revertibles for deleting an interval
74
- * @alpha
75
- */
76
- export declare function appendDeleteIntervalToRevertibles(string: SharedString, interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
77
-
78
- /**
79
- * Create revertibles for changing properties of an interval
80
- * @alpha
81
- */
82
- export declare function appendIntervalPropertyChangedToRevertibles(interval: SequenceInterval, deltas: PropertySet, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
83
-
84
- /**
85
- * Create revertibles for SharedStringDeltas, handling indirectly modified intervals
86
- * (e.g. reverting remove of a range that contains an interval will move the interval back)
87
- * @alpha
88
- */
89
- export declare function appendSharedStringDeltaToRevertibles(string: SharedString, delta: SequenceDeltaEvent, revertibles: SharedStringRevertible[]): void;
90
-
91
- export { BaseSegment }
92
-
93
- /* Excluded from this release type: createEndpointIndex */
94
-
95
- /* Excluded from this release type: createEndpointInRangeIndex */
96
-
97
- /* Excluded from this release type: createIdIntervalIndex */
98
-
99
- /**
100
- * @alpha
101
- */
102
- export declare function createOverlappingIntervalsIndex(sharedString: SharedString): IOverlappingIntervalsIndex<SequenceInterval>;
103
-
104
- /* Excluded from this release type: createOverlappingSequenceIntervalsIndex */
105
-
106
- /* Excluded from this release type: createStartpointInRangeIndex */
107
-
108
- /**
109
- * @alpha
110
- */
111
- export declare type DeserializeCallback = (properties: PropertySet) => void;
112
-
113
- /**
114
- * Clean up resources held by revertibles that are no longer needed.
115
- * @alpha
116
- */
117
- export declare function discardSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
118
-
119
- /* Excluded from this release type: getTextAndMarkers */
120
-
121
- /* Excluded from this release type: IEndpointIndex */
122
-
123
- /* Excluded from this release type: IEndpointInRangeIndex */
124
-
125
- /* Excluded from this release type: IIdIntervalIndex */
126
-
127
- /**
128
- * Basic interval abstraction
129
- * @alpha
130
- */
131
- export declare interface IInterval {
132
- /**
133
- * @returns a new interval object with identical semantics.
134
- */
135
- clone(): IInterval;
136
- /**
137
- * Compares this interval to `b` with standard comparator semantics:
138
- * - returns -1 if this is less than `b`
139
- * - returns 1 if this is greater than `b`
140
- * - returns 0 if this is equivalent to `b`
141
- * @param b - Interval to compare against
142
- */
143
- compare(b: IInterval): number;
144
- /**
145
- * Compares the start endpoint of this interval to `b`'s start endpoint.
146
- * Standard comparator semantics apply.
147
- * @param b - Interval to compare against
148
- */
149
- compareStart(b: IInterval): number;
150
- /**
151
- * Compares the end endpoint of this interval to `b`'s end endpoint.
152
- * Standard comparator semantics apply.
153
- * @param b - Interval to compare against
154
- */
155
- compareEnd(b: IInterval): number;
156
- /**
157
- * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
158
- */
159
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;
160
- /**
161
- * @returns whether this interval overlaps with `b`.
162
- * Intervals are considered to overlap if their intersection is non-empty.
163
- */
164
- overlaps(b: IInterval): boolean;
165
- /**
166
- * Unions this interval with `b`, returning a new interval.
167
- * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes
168
- * intermediate values between the two intervals.
169
- */
170
- union(b: IInterval): IInterval;
171
- }
172
-
173
- /**
174
- * Collection of intervals that supports addition, modification, removal, and efficient spatial querying.
175
- * Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).
176
- * @alpha
177
- */
178
- export declare interface IIntervalCollection<TInterval extends ISerializableInterval> extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {
179
- readonly attached: boolean;
180
- /**
181
- * Attaches an index to this collection.
182
- * All intervals which are part of this collection will be added to the index, and the index will automatically
183
- * be updated when this collection updates due to local or remote changes.
184
- *
185
- * @remarks After attaching an index to an interval collection, applications should typically store this
186
- * index somewhere in their in-memory data model for future reference and querying.
187
- */
188
- attachIndex(index: IntervalIndex<TInterval>): void;
189
- /**
190
- * Detaches an index from this collection.
191
- * All intervals which are part of this collection will be removed from the index, and updates to this collection
192
- * due to local or remote changes will no longer incur updates to the index.
193
- *
194
- * @returns `false` if the target index cannot be found in the indexes, otherwise remove all intervals in the index and return `true`.
195
- */
196
- detachIndex(index: IntervalIndex<TInterval>): boolean;
197
- /**
198
- * @returns the interval in this collection that has the provided `id`.
199
- * If no interval in the collection has this `id`, returns `undefined`.
200
- */
201
- getIntervalById(id: string): TInterval | undefined;
202
- /**
203
- * Creates a new interval and add it to the collection.
204
- * @param start - interval start position (inclusive)
205
- * @param end - interval end position (exclusive)
206
- * @param props - properties of the interval
207
- * @returns - the created interval
208
- * @remarks See documentation on {@link SequenceInterval} for comments on
209
- * interval endpoint semantics: there are subtleties with how the current
210
- * half-open behavior is represented.
211
- *
212
- * Note that intervals may behave unexpectedly if the entire contents
213
- * of the string are deleted. In this case, it is possible for one endpoint
214
- * of the interval to become detached, while the other remains on the string.
215
- *
216
- * By adjusting the `side` and `pos` values of the `start` and `end` parameters,
217
- * it is possible to control whether the interval expands to include content
218
- * inserted at its start or end.
219
- *
220
- * See {@link SequencePlace} for more details on the model.
221
- *
222
- * @example
223
- *
224
- * Given the string "ABCD":
225
- *
226
- *```typescript
227
- * // Refers to "BC". If any content is inserted before B or after C, this
228
- * // interval will include that content
229
- * //
230
- * // Picture:
231
- * // \{start\} - A[- B - C -]D - \{end\}
232
- * // \{start\} - A - B - C - D - \{end\}
233
- * collection.add(\{ pos: 0, side: Side.After \}, \{ pos: 3, side: Side.Before \}, IntervalType.SlideOnRemove);
234
- * // Equivalent to specifying the same positions and Side.Before.
235
- * // Refers to "ABC". Content inserted after C will be included in the
236
- * // interval, but content inserted before A will not.
237
- * // \{start\} -[A - B - C -]D - \{end\}
238
- * // \{start\} - A - B - C - D - \{end\}
239
- * collection.add(0, 3, IntervalType.SlideOnRemove);
240
- *```
241
- *
242
- * In the case of the first example, if text is deleted,
243
- *
244
- * ```typescript
245
- * // Delete the character "B"
246
- * string.removeRange(1, 2);
247
- * ```
248
- *
249
- * The start point of the interval will slide to the position immediately
250
- * before "C", and the same will be true.
251
- *
252
- * ```
253
- * \{start\} - A[- C -]D - \{end\}
254
- * ```
255
- *
256
- * In this case, text inserted immediately before "C" would be included in
257
- * the interval.
258
- *
259
- * ```typescript
260
- * string.insertText(1, "EFG");
261
- * ```
262
- *
263
- * With the string now being,
264
- *
265
- * ```
266
- * \{start\} - A[- E - F - G - C -]D - \{end\}
267
- * ```
268
- *
269
- * @privateRemarks TODO: ADO:5205 the above comment regarding behavior in
270
- * the case that the entire interval has been deleted should be resolved at
271
- * the same time as this ticket
272
- */
273
- add({ start, end, props, }: {
274
- start: SequencePlace;
275
- end: SequencePlace;
276
- props?: PropertySet;
277
- }): TInterval;
278
- /**
279
- * Removes an interval from the collection.
280
- * @param id - Id of the interval to remove
281
- * @returns the removed interval
282
- */
283
- removeIntervalById(id: string): TInterval | undefined;
284
- /**
285
- * Changes the endpoints, properties, or both of an existing interval.
286
- * @param id - Id of the Interval to change
287
- * @returns the interval that was changed, if it existed in the collection.
288
- * Pass the desired new start position, end position, and/or properties in an object. Start and end positions must be changed
289
- * simultaneously - they must either both be specified or both undefined. To only change the properties, leave both endpoints
290
- * undefined. To only change the endpoints, leave the properties undefined.
291
- */
292
- change(id: string, { start, end, props }: {
293
- start?: SequencePlace;
294
- end?: SequencePlace;
295
- props?: PropertySet;
296
- }): TInterval | undefined;
297
- attachDeserializer(onDeserialize: DeserializeCallback): void;
298
- /**
299
- * @returns an iterator over all intervals in this collection.
300
- */
301
- [Symbol.iterator](): Iterator<TInterval>;
302
- /**
303
- * @returns a forward iterator over all intervals in this collection with start point equal to `startPosition`.
304
- */
305
- CreateForwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;
306
- /**
307
- * @returns a backward iterator over all intervals in this collection with start point equal to `startPosition`.
308
- */
309
- CreateBackwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;
310
- /**
311
- * @returns a forward iterator over all intervals in this collection with end point equal to `endPosition`.
312
- */
313
- CreateForwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;
314
- /**
315
- * @returns a backward iterator over all intervals in this collection with end point equal to `endPosition`.
316
- */
317
- CreateBackwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;
318
- /**
319
- * Gathers iteration results that optionally match a start/end criteria into the provided array.
320
- * @param results - Array to gather the results into. In lieu of a return value, this array will be populated with
321
- * intervals matching the query upon edit.
322
- * @param iteratesForward - whether or not iteration should be in the forward direction
323
- * @param start - If provided, only match intervals whose start point is equal to `start`.
324
- * @param end - If provided, only match intervals whose end point is equal to `end`.
325
- */
326
- gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;
327
- /**
328
- * @deprecated - Users must manually attach the corresponding interval index to utilize this functionality, for instance:
329
- *
330
- * ```typescript
331
- * const overlappingIntervalsIndex = createOverlappingIntervalsIndex(sharedString);
332
- * collection.attachIndex(overlappingIntervalsIndex)
333
- * const result = overlappingIntervalsIndex.findOverlappingIntervals(start, end);
334
- * ```
335
- *
336
- * @returns an array of all intervals in this collection that overlap with the interval
337
- * `[startPosition, endPosition]`.
338
- */
339
- findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];
340
- /**
341
- * Applies a function to each interval in this collection.
342
- */
343
- map(fn: (interval: TInterval) => void): void;
344
- /**
345
- * @deprecated - due to the forthcoming change where the endpointIndex will no longer be
346
- * automatically added to the collection. Users are advised to independently attach the
347
- * index to the collection and utilize the API accordingly, for instance:
348
- * ```typescript
349
- * const endpointIndex = createEndpointIndex(sharedString);
350
- * collection.attachIndex(endpointIndex);
351
- * const result1 = endpointIndex.previousInterval(pos);
352
- * ```
353
- * If an index is used repeatedly, applications should generally attach it once and store it in memory.
354
- */
355
- previousInterval(pos: number): TInterval | undefined;
356
- /**
357
- * @deprecated - due to the forthcoming change where the endpointIndex will no longer be
358
- * automatically added to the collection. Users are advised to independently attach the
359
- * index to the collection and utilize the API accordingly, for instance:
360
- * ```typescript
361
- * const endpointIndex = createEndpointIndex(sharedString);
362
- * collection.attachIndex(endpointIndex);
363
- * const result2 = endpointIndex.nextInterval(pos);
364
- * ```
365
- */
366
- nextInterval(pos: number): TInterval | undefined;
367
- }
368
-
369
- /**
370
- * Change events emitted by `IntervalCollection`s
371
- * @alpha
372
- */
373
- export declare interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {
374
- /**
375
- * This event is invoked whenever the endpoints of an interval may have changed.
376
- * This can happen on:
377
- * - local endpoint modification
378
- * - ack of a remote endpoint modification
379
- * - position change due to segment sliding (slides due to mergeTree segment deletion will always appear local)
380
- * The `interval` argument reflects the new values.
381
- * `previousInterval` contains transient `ReferencePosition`s at the same location as the interval's original
382
- * endpoints. These references should be used for position information only.
383
- * `local` reflects whether the change originated locally.
384
- * `op` is defined if and only if the server has acked this change.
385
- * `slide` is true if the change is due to sliding on removal of position
386
- */
387
- (event: "changeInterval", listener: (interval: TInterval, previousInterval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined, slide: boolean) => void): void;
388
- /**
389
- * This event is invoked whenever an interval is added or removed from the collection.
390
- * `local` reflects whether the change originated locally.
391
- * `op` is defined if and only if the server has acked this change.
392
- */
393
- (event: "addInterval" | "deleteInterval", listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined) => void): void;
394
- /**
395
- * This event is invoked whenever an interval's properties have changed.
396
- * `interval` reflects the state of the updated properties.
397
- * `propertyDeltas` is a map-like whose keys contain all values that were changed, and whose
398
- * values contain all previous values of the property set.
399
- * This object can be used directly in a call to `changeProperties` to revert the property change if desired.
400
- * `local` reflects whether the change originated locally.
401
- * `op` is defined if and only if the server has acked this change.
402
- */
403
- (event: "propertyChanged", listener: (interval: TInterval, propertyDeltas: PropertySet, local: boolean, op: ISequencedDocumentMessage | undefined) => void): void;
404
- /**
405
- * This event is invoked whenever an interval's endpoints or properties (or both) have changed.
406
- * `interval` reflects the state of the updated endpoints or properties.
407
- * `propertyDeltas` is a map-like whose keys contain all values that were changed, and whose
408
- * values contain all previous values of the property set.
409
- * This object can be used directly in a call to `changeProperties` to revert the property change if desired.
410
- * 'previousInterval' contains transient `ReferencePosition`s at the same location as the interval's original
411
- * endpoints. These references should be used for position information only. In the case of a property change
412
- * only, this argument should be undefined.
413
- * `local` reflects whether the change originated locally.
414
- * `slide` is true if the change is due to sliding on removal of position.
415
- */
416
- (event: "changed", listener: (interval: TInterval, propertyDeltas: PropertySet, previousInterval: TInterval | undefined, local: boolean, slide: boolean) => void): void;
417
- }
418
-
419
- /* Excluded from this release type: IIntervalHelpers */
420
-
421
- /* Excluded from this release type: IJSONRunSegment */
422
-
423
- /* Excluded from this release type: IMapMessageLocalMetadata */
424
-
425
- /**
426
- * A sequence place that does not refer to the special endpoint segments.
427
- *
428
- * See {@link SequencePlace} for additional context.
429
- * @alpha
430
- */
431
- export declare interface InteriorSequencePlace {
432
- pos: number;
433
- side: Side;
434
- }
435
-
436
- /* Excluded from this release type: Interval */
437
-
438
- /**
439
- * Collection of intervals.
440
- *
441
- * Implementers of this interface will typically implement additional APIs to support efficiently querying a collection
442
- * of intervals in some manner, for example:
443
- * - "find all intervals with start endpoint between these two points"
444
- * - "find all intervals which overlap this range"
445
- * etc.
446
- * @alpha
447
- */
448
- export declare interface IntervalIndex<TInterval extends ISerializableInterval> {
449
- /**
450
- * Adds an interval to the index.
451
- * @remarks Application code should never need to invoke this method on their index for production scenarios:
452
- * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.
453
- */
454
- add(interval: TInterval): void;
455
- /**
456
- * Removes an interval from the index.
457
- * @remarks Application code should never need to invoke this method on their index for production scenarios:
458
- * Fluid handles adding and removing intervals from an index in response to sequence or interval changes.
459
- */
460
- remove(interval: TInterval): void;
461
- }
462
-
463
- /* Excluded from this release type: IntervalLocator */
464
-
465
- /* Excluded from this release type: intervalLocatorFromEndpoint */
466
-
467
- /**
468
- * Values are used in revertibles.
469
- * @alpha
470
- */
471
- export declare const IntervalOpType: {
472
- readonly PROPERTY_CHANGED: "propertyChanged";
473
- readonly POSITION_REMOVE: "positionRemove";
474
- readonly ADD: "add";
475
- readonly DELETE: "delete";
476
- readonly CHANGE: "change";
477
- };
478
-
479
- /**
480
- * @alpha
481
- */
482
- export declare type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];
483
-
484
- /**
485
- * Data for undoing edits affecting Intervals.
486
- * @alpha
487
- */
488
- export declare type IntervalRevertible = {
489
- event: typeof IntervalOpType.CHANGE;
490
- interval: SequenceInterval;
491
- start: LocalReferencePosition;
492
- end: LocalReferencePosition;
493
- } | {
494
- event: typeof IntervalOpType.ADD;
495
- interval: SequenceInterval;
496
- } | {
497
- event: typeof IntervalOpType.DELETE;
498
- interval: SequenceInterval;
499
- start: LocalReferencePosition;
500
- end: LocalReferencePosition;
501
- } | {
502
- event: typeof IntervalOpType.PROPERTY_CHANGED;
503
- interval: SequenceInterval;
504
- propertyDeltas: PropertySet;
505
- } | {
506
- event: typeof IntervalOpType.POSITION_REMOVE;
507
- intervals: {
508
- intervalId: string;
509
- label: string;
510
- startOffset?: number;
511
- endOffset?: number;
512
- }[];
513
- revertibleRefs: {
514
- revertible: IntervalRevertible;
515
- offset: number;
516
- isStart: boolean;
517
- }[];
518
- mergeTreeRevertible: MergeTreeDeltaRevertible;
519
- };
520
-
521
- /**
522
- * Determines how an interval should expand when segments are inserted adjacent
523
- * to the range it spans
524
- *
525
- * Note that interval stickiness is currently an experimental feature and must
526
- * be explicitly enabled with the `intervalStickinessEnabled` flag
527
- *
528
- * @alpha
529
- */
530
- export declare const IntervalStickiness: {
531
- /**
532
- * Interval does not expand to include adjacent segments
533
- */
534
- readonly NONE: 0;
535
- /**
536
- * Interval expands to include segments inserted adjacent to the start
537
- */
538
- readonly START: 1;
539
- /**
540
- * Interval expands to include segments inserted adjacent to the end
541
- *
542
- * This is the default stickiness
543
- */
544
- readonly END: 2;
545
- /**
546
- * Interval expands to include all segments inserted adjacent to it
547
- */
548
- readonly FULL: 3;
549
- };
550
-
551
- /**
552
- * Determines how an interval should expand when segments are inserted adjacent
553
- * to the range it spans
554
- *
555
- * Note that interval stickiness is currently an experimental feature and must
556
- * be explicitly enabled with the `intervalStickinessEnabled` flag
557
- * @alpha
558
- */
559
- export declare type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];
560
-
561
- /**
562
- * @alpha
563
- */
564
- export declare enum IntervalType {
565
- Simple = 0,
566
- /**
567
- * SlideOnRemove indicates that the ends of the interval will slide if the segment
568
- * they reference is removed and acked.
569
- * See `packages\dds\merge-tree\docs\REFERENCEPOSITIONS.md` for details
570
- * SlideOnRemove is the default interval behavior and does not need to be specified.
571
- */
572
- SlideOnRemove = 2,
573
- /* Excluded from this release type: Transient */
574
- }
575
-
576
- /**
577
- * @alpha
578
- */
579
- export declare interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
580
- /**
581
- * @returns an array of all intervals contained in this collection that overlap the range
582
- * `[start end]`.
583
- */
584
- findOverlappingIntervals(start: SequencePlace, end: SequencePlace): TInterval[];
585
- /**
586
- * Gathers the interval results based on specified parameters.
587
- */
588
- gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: SequencePlace, end?: SequencePlace): void;
589
- }
590
-
591
- export { ISegment }
592
-
593
- /**
594
- * A range that has changed corresponding to a segment modification.
595
- * @alpha
596
- */
597
- export declare interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {
598
- /**
599
- * The type of operation that changed this range.
600
- *
601
- * @remarks Consuming code should typically compare this to the enum values defined in
602
- * `MergeTreeDeltaOperationTypes`.
603
- */
604
- operation: TOperation;
605
- /**
606
- * The index of the start of the range.
607
- */
608
- position: number;
609
- /**
610
- * The segment that corresponds to the range.
611
- */
612
- segment: ISegment;
613
- /**
614
- * Deltas object which contains all modified properties with their previous values.
615
- * Since `undefined` doesn't survive a round-trip through JSON serialization, the old value being absent
616
- * is instead encoded with `null`.
617
- *
618
- * @remarks This object is motivated by undo/redo scenarios, and provides a convenient "inverse op" to apply to
619
- * undo a property change.
620
- *
621
- * @example
622
- *
623
- * If a segment initially had properties `{ foo: "1", bar: 2 }` and it was annotated with
624
- * `{ foo: 3, baz: 5 }`, the corresponding event would have a `propertyDeltas` of `{ foo: "1", baz: null }`.
625
- */
626
- propertyDeltas: PropertySet;
627
- }
628
-
629
- /**
630
- * @alpha
631
- */
632
- export declare interface ISerializableInterval extends IInterval {
633
- /** Serializable bag of properties associated with the interval. */
634
- properties: PropertySet;
635
- /***/
636
- propertyManager: PropertiesManager;
637
- /***/
638
- serialize(): ISerializedInterval;
639
- /***/
640
- addProperties(props: PropertySet, collaborating?: boolean, seq?: number): PropertySet | undefined;
641
- /**
642
- * Gets the id associated with this interval.
643
- * When the interval is used as part of an interval collection, this id can be used to modify or remove the
644
- * interval.
645
- * @remarks This signature includes `undefined` strictly for backwards-compatibility reasons, as older versions
646
- * of Fluid didn't always write interval ids.
647
- */
648
- getIntervalId(): string | undefined;
649
- }
650
-
651
- /**
652
- * Serialized object representation of an interval.
653
- * This representation is used for ops that create or change intervals.
654
- * @alpha
655
- */
656
- export declare interface ISerializedInterval {
657
- /**
658
- * Sequence number at which `start` and `end` should be interpreted
659
- *
660
- * @remarks It's unclear that this is necessary to store here.
661
- * This should just be the refSeq on the op that modified the interval, which should be available via other means.
662
- * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.
663
- */
664
- sequenceNumber: number;
665
- /** Start position of the interval */
666
- start: number | "start" | "end";
667
- /** End position of the interval */
668
- end: number | "start" | "end";
669
- /** Interval type to create */
670
- intervalType: IntervalType;
671
- /**
672
- * The stickiness of this interval
673
- */
674
- stickiness?: IntervalStickiness;
675
- startSide?: Side;
676
- endSide?: Side;
677
- /** Any properties the interval has */
678
- properties?: PropertySet;
679
- }
680
-
681
- /**
682
- * @alpha
683
- */
684
- export declare interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {
685
- getIntervalCollection(label: string): IIntervalCollection<TInterval>;
686
- }
687
-
688
- /**
689
- * Events emitted in response to changes to the sequence data.
690
- *
691
- * @remarks
692
- *
693
- * The following is the list of events emitted.
694
- *
695
- * ### "sequenceDelta"
696
- *
697
- * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.
698
- *
699
- * #### Listener signature
700
- *
701
- * ```typescript
702
- * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void
703
- * ```
704
- * - `event` - Various information on the segments that were modified.
705
- *
706
- * - `target` - The sequence itself.
707
- *
708
- * ### "maintenance"
709
- *
710
- * The maintenance event is emitted when segments are modified during merge-tree maintenance.
711
- *
712
- * #### Listener signature
713
- *
714
- * ```typescript
715
- * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void
716
- * ```
717
- * - `event` - Various information on the segments that were modified.
718
- *
719
- * - `target` - The sequence itself.
720
- * @alpha
721
- */
722
- export declare interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {
723
- (event: "createIntervalCollection", listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void): void;
724
- (event: "sequenceDelta", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void): void;
725
- (event: "maintenance", listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void): void;
726
- }
727
-
728
- /**
729
- * Fluid object interface describing access methods on a SharedString
730
- * @alpha
731
- */
732
- export declare interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {
733
- /**
734
- * Inserts the text at the position.
735
- * @param pos - The position to insert the text at
736
- * @param text - The text to insert
737
- * @param props - The properties of the text
738
- */
739
- insertText(pos: number, text: string, props?: PropertySet): void;
740
- /**
741
- * Inserts a marker at the position.
742
- * @param pos - The position to insert the marker at
743
- * @param refType - The reference type of the marker
744
- * @param props - The properties of the marker
745
- */
746
- insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void;
747
- /**
748
- * {@inheritDoc SharedSegmentSequence.posFromRelativePos}
749
- */
750
- posFromRelativePos(relativePos: IRelativePosition): number;
751
- }
752
-
753
- /* Excluded from this release type: IStartpointInRangeIndex */
754
-
755
- /* Excluded from this release type: IValueOpEmitter */
756
- export { LocalReferencePosition }
757
-
758
- export { MapLike }
759
-
760
- export { Marker }
761
-
762
- export { MergeTreeDeltaType }
763
-
764
- export { PropertySet }
765
-
766
- export { ReferencePosition }
767
-
768
- export { ReferenceType }
769
-
770
- /* Excluded from this release type: reservedMarkerIdKey */
771
-
772
- /* Excluded from this release type: reservedRangeLabelsKey */
773
-
774
- /* Excluded from this release type: reservedTileLabelsKey */
775
-
776
- /**
777
- * Invoke revertibles to reverse prior edits
778
- * @alpha
779
- */
780
- export declare function revertSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
781
-
782
- /**
783
- * The event object returned on sequenceDelta events.
784
- *
785
- * The properties of this object and its sub-objects represent the state of the sequence at the
786
- * point in time at which the operation was applied.
787
- * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.
788
- *
789
- * For group ops, each op will get its own event, and the group op property will be set on the op args.
790
- *
791
- * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.
792
- * @alpha
793
- */
794
- export declare class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {
795
- readonly opArgs: IMergeTreeDeltaOpArgs;
796
- /**
797
- * Whether the event was caused by a locally-made change.
798
- */
799
- readonly isLocal: boolean;
800
- constructor(opArgs: IMergeTreeDeltaOpArgs, deltaArgs: IMergeTreeDeltaCallbackArgs, mergeTreeClient: Client);
801
- }
802
-
803
- /**
804
- * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.
805
- *
806
- * The properties of this object and its sub-objects represent the state of the sequence at the
807
- * point in time at which the operation was applied.
808
- * They will not take into any future modifications performed to the underlying sequence and merge tree.
809
- * @alpha
810
- */
811
- export declare abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {
812
- readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>;
813
- private readonly mergeTreeClient;
814
- readonly deltaOperation: TOperation;
815
- private readonly sortedRanges;
816
- private readonly pFirst;
817
- private readonly pLast;
818
- constructor(deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>, mergeTreeClient: Client);
819
- /**
820
- * The in-order ranges affected by this delta.
821
- * These may not be continuous.
822
- */
823
- get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[];
824
- /**
825
- * The client id of the client that made the change which caused the delta event
826
- */
827
- get clientId(): string | undefined;
828
- /**
829
- * The first of the modified ranges.
830
- */
831
- get first(): Readonly<ISequenceDeltaRange<TOperation>>;
832
- /**
833
- * The last of the modified ranges.
834
- */
835
- get last(): Readonly<ISequenceDeltaRange<TOperation>>;
836
- }
837
-
838
- /**
839
- * Interval implementation whose ends are associated with positions in a mutatable sequence.
840
- * As such, when content is inserted into the middle of the interval, the interval expands to
841
- * include that content.
842
- *
843
- * @remarks The endpoints' positions should be treated exclusively to get
844
- * reasonable behavior. E.g., an interval referring to "hello" in "hello world"
845
- * should have a start position of 0 and an end position of 5.
846
- *
847
- * To see why, consider what happens if "llo wor" is removed from the string to make "held".
848
- * The interval's startpoint remains on the "h" (it isn't altered), but the interval's endpoint
849
- * slides forward to the next unremoved position, which is the "l" in "held".
850
- * Users would generally expect the interval to now refer to "he" (as it is the subset of content
851
- * remaining after the removal), hence the "l" should be excluded.
852
- * If the interval endpoint was treated inclusively, the interval would now refer to "hel", which
853
- * is undesirable.
854
- *
855
- * Since the endpoints of an interval are treated exclusively but cannot be greater
856
- * than or equal to the length of the associated sequence, there exist special
857
- * endpoint segments, "start" and "end", which represent the position immediately
858
- * before or immediately after the string respectively.
859
- *
860
- * If a `SequenceInterval` is created on a sequence with the
861
- * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
862
- * of the interval that are exclusive will have the ability to slide to these
863
- * special endpoint segments.
864
- * @alpha
865
- */
866
- export declare class SequenceInterval implements ISerializableInterval {
867
- private readonly client;
868
- /**
869
- * Start endpoint of this interval.
870
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
871
- */
872
- start: LocalReferencePosition;
873
- /**
874
- * End endpoint of this interval.
875
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
876
- */
877
- end: LocalReferencePosition;
878
- intervalType: IntervalType;
879
- readonly startSide: Side;
880
- readonly endSide: Side;
881
- /**
882
- * {@inheritDoc ISerializableInterval.properties}
883
- */
884
- properties: PropertySet;
885
- /**
886
- * {@inheritDoc ISerializableInterval.propertyManager}
887
- */
888
- propertyManager: PropertiesManager;
889
- /***/
890
- get stickiness(): IntervalStickiness;
891
- constructor(client: Client,
892
- /**
893
- * Start endpoint of this interval.
894
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
895
- */
896
- start: LocalReferencePosition,
897
- /**
898
- * End endpoint of this interval.
899
- * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
900
- */
901
- end: LocalReferencePosition, intervalType: IntervalType, props?: PropertySet, startSide?: Side, endSide?: Side);
902
- private callbacks?;
903
- /**
904
- * Subscribes to position change events on this interval if there are no current listeners.
905
- */
906
- addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void;
907
- /**
908
- * Removes the currently subscribed position change listeners.
909
- */
910
- removePositionChangeListeners(): void;
911
- /**
912
- * {@inheritDoc ISerializableInterval.serialize}
913
- */
914
- serialize(): ISerializedInterval;
915
- /**
916
- * {@inheritDoc IInterval.clone}
917
- */
918
- clone(): SequenceInterval;
919
- /**
920
- * {@inheritDoc IInterval.compare}
921
- */
922
- compare(b: SequenceInterval): number;
923
- /**
924
- * {@inheritDoc IInterval.compareStart}
925
- */
926
- compareStart(b: SequenceInterval): number;
927
- /**
928
- * {@inheritDoc IInterval.compareEnd}
929
- */
930
- compareEnd(b: SequenceInterval): number;
931
- /**
932
- * {@inheritDoc IInterval.overlaps}
933
- */
934
- overlaps(b: SequenceInterval): boolean;
935
- /**
936
- * {@inheritDoc ISerializableInterval.getIntervalId}
937
- */
938
- getIntervalId(): string;
939
- /**
940
- * {@inheritDoc IInterval.union}
941
- */
942
- union(b: SequenceInterval): SequenceInterval;
943
- /**
944
- * {@inheritDoc ISerializableInterval.addProperties}
945
- */
946
- addProperties(newProps: PropertySet, collab?: boolean, seq?: number): PropertySet | undefined;
947
- /**
948
- * @returns whether this interval overlaps two numerical positions.
949
- */
950
- overlapsPos(bstart: number, bend: number): boolean;
951
- /**
952
- * {@inheritDoc IInterval.modify}
953
- */
954
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval;
955
- }
956
-
957
- /* Excluded from this release type: sequenceIntervalHelpers */
958
-
959
- /* Excluded from this release type: SequenceIntervalIndexes */
960
-
961
- /**
962
- * The event object returned on maintenance events.
963
- *
964
- * The properties of this object and its sub-objects represent the state of the sequence at the
965
- * point in time at which the operation was applied.
966
- * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.
967
- * @alpha
968
- */
969
- export declare class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {
970
- readonly opArgs: IMergeTreeDeltaOpArgs | undefined;
971
- constructor(opArgs: IMergeTreeDeltaOpArgs | undefined, deltaArgs: IMergeTreeMaintenanceCallbackArgs, mergeTreeClient: Client);
972
- }
973
-
974
- /* Excluded from this release type: SequenceOptions */
975
-
976
- /**
977
- * Defines a position and side relative to a character in a sequence.
978
- *
979
- * For this purpose, sequences look like:
980
- *
981
- * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`
982
- *
983
- * Each `{value}` in the diagram is a character within a sequence.
984
- * Each `-` in the above diagram is a position where text could be inserted.
985
- * Each position between a `{value}` and a `-` is a `SequencePlace`.
986
- *
987
- * The special endpoints `{start}` and `{end}` refer to positions outside the
988
- * contents of the string.
989
- *
990
- * This gives us 2N + 2 possible positions to refer to within a string, where N
991
- * is the number of characters.
992
- *
993
- * If the position is specified with a bare number, the side defaults to
994
- * `Side.Before`.
995
- *
996
- * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),
997
- * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.
998
- * E.g. the start of a range with Side.After is exclusive of the character at the position.
999
- * @alpha
1000
- */
1001
- export declare type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
1002
-
1003
- /* Excluded from this release type: SerializedIntervalDelta */
1004
-
1005
- /* Excluded from this release type: SharedIntervalCollection */
1006
-
1007
- /* Excluded from this release type: SharedIntervalCollectionFactory */
1008
-
1009
- /**
1010
- * @alpha
1011
- */
1012
- export declare abstract class SharedSegmentSequence<T extends ISegment> extends SharedObject<ISharedSegmentSequenceEvents> implements ISharedIntervalCollection<SequenceInterval>, MergeTreeRevertibleDriver {
1013
- private readonly dataStoreRuntime;
1014
- id: string;
1015
- readonly segmentFromSpec: (spec: IJSONSegment) => ISegment;
1016
- get loaded(): Promise<void>;
1017
- /**
1018
- * This is a safeguard to avoid problematic reentrancy of local ops. This type of scenario occurs if the user of SharedString subscribes
1019
- * to the `sequenceDelta` event and uses the callback for a local op to submit further local ops.
1020
- * Historically (before 2.0.0-internal.6.1.0), doing so would result in eventual consistency issues or a corrupted document.
1021
- * These issues were fixed in #16815 which makes such reentrancy no different from applying the ops in order but not from within the change events,
1022
- * but there is still little test coverage for reentrant scenarios.
1023
- * Additionally, applications submitting ops from inside change events need to take extreme care that their data models also support reentrancy.
1024
- * Since this is likely not the case, by default SharedString throws when encountering reentrant ops.
1025
- *
1026
- * An application using SharedString which explicitly wants to opt in to allowing reentrancy anyway can set `sharedStringPreventReentrancy`
1027
- * on the data store options to `false`.
1028
- */
1029
- protected guardReentrancy: <TRet>(callback: () => TRet) => TRet;
1030
- private static createOpsFromDelta;
1031
- /**
1032
- * Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.
1033
- * The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process
1034
- * incoming leave/join ops before putting an op that this DDS submits over the wire.
1035
- *
1036
- * E.g. SharedString submits an op while deltaManager has lastSequenceNumber = 10, but before the runtime
1037
- * puts this op over the wire, it processes a client join/leave op with sequence number 11, so the referenceSequenceNumber
1038
- * on the SharedString op is 11.
1039
- *
1040
- * The reference sequence numbers placed in this queue are also not accurate for stashed ops due to how the applyStashedOp
1041
- * flow works at the runtime level. This is a legitimate bug, and AB#6602 tracks one way to fix it (stop reaching all the way
1042
- * to deltaManager's lastSequenceNumber to obtain refSeq, instead leveraging some analogous notion on the container or datastore
1043
- * runtime).
1044
- */
1045
- private readonly inFlightRefSeqs;
1046
- private ongoingResubmitRefSeq;
1047
- /**
1048
- * Gets the reference sequence number (i.e. sequence number of the runtime's last processed op) for an op submitted
1049
- * in the current context.
1050
- *
1051
- * This value can be optionally overridden using `useResubmitRefSeq`.
1052
- * IntervalCollection's resubmit logic currently relies on preserving merge information from when the op was originally submitted,
1053
- * even if the op is resubmitted more than once. Thus during resubmit, `inFlightRefSeqs` gets populated with the
1054
- * original refSeq rather than the refSeq at the time of reconnection.
1055
- *
1056
- * @remarks - In some not fully understood cases, the runtime may process incoming ops before putting an op that this
1057
- * DDS submits over the wire. See `inFlightRefSeqs` for more details.
1058
- */
1059
- private get currentRefSeq();
1060
- protected client: Client;
1061
- /** `Deferred` that triggers once the object is loaded */
1062
- protected loadedDeferred: Deferred<void>;
1063
- private readonly loadedDeferredOutgoingOps;
1064
- private deferIncomingOps;
1065
- private readonly loadedDeferredIncomingOps;
1066
- private messagesSinceMSNChange;
1067
- private readonly intervalCollections;
1068
- constructor(dataStoreRuntime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, segmentFromSpec: (spec: IJSONSegment) => ISegment);
1069
- /**
1070
- * @param start - The inclusive start of the range to remove
1071
- * @param end - The exclusive end of the range to remove
1072
- */
1073
- removeRange(start: number, end: number): void;
1074
- /**
1075
- * Obliterate is similar to remove, but differs in that segments concurrently
1076
- * inserted into an obliterated range will also be removed
1077
- *
1078
- * @param start - The inclusive start of the range to obliterate
1079
- * @param end - The exclusive end of the range to obliterate
1080
- */
1081
- obliterateRange(start: number, end: number): void;
1082
- /**
1083
- * @deprecated The ability to create group ops will be removed in an upcoming
1084
- * release, as group ops are redundant with the native batching capabilities
1085
- * of the runtime
1086
- */
1087
- groupOperation(groupOp: IMergeTreeGroupMsg): void;
1088
- /**
1089
- * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.
1090
- * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.
1091
- * @param pos - Character position (index) into the current local view of the SharedString.
1092
- */
1093
- getContainingSegment(pos: number): {
1094
- segment: T | undefined;
1095
- offset: number | undefined;
1096
- };
1097
- /**
1098
- * Returns the length of the current sequence for the client
1099
- */
1100
- getLength(): number;
1101
- /**
1102
- * Returns the current position of a segment, and -1 if the segment
1103
- * does not exist in this sequence
1104
- * @param segment - The segment to get the position of
1105
- */
1106
- getPosition(segment: ISegment): number;
1107
- /**
1108
- * Annotates the range with the provided properties
1109
- *
1110
- * @param start - The inclusive start position of the range to annotate
1111
- * @param end - The exclusive end position of the range to annotate
1112
- * @param props - The properties to annotate the range with
1113
- *
1114
- */
1115
- annotateRange(start: number, end: number, props: PropertySet): void;
1116
- getPropertiesAtPosition(pos: number): PropertySet | undefined;
1117
- getRangeExtentsOfPosition(pos: number): {
1118
- posStart: number | undefined;
1119
- posAfterEnd: number | undefined;
1120
- };
1121
- /**
1122
- * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include
1123
- * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.
1124
- * @param segment - Segment to add the local reference on
1125
- * @param offset - Offset on the segment at which to place the local reference
1126
- * @param refType - ReferenceType for the created local reference
1127
- * @param properties - PropertySet to place on the created local reference
1128
- */
1129
- createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
1130
- /**
1131
- * Resolves a `ReferencePosition` into a character position using this client's perspective.
1132
- *
1133
- * Reference positions that point to a character that has been removed will
1134
- * always return the position of the nearest non-removed character, regardless
1135
- * of `ReferenceType`. To handle this case specifically, one may wish
1136
- * to look at the segment returned by `ReferencePosition.getSegment`.
1137
- */
1138
- localReferencePositionToPosition(lref: ReferencePosition): number;
1139
- /**
1140
- * Removes a `LocalReferencePosition` from this SharedString.
1141
- */
1142
- removeLocalReferencePosition(lref: LocalReferencePosition): LocalReferencePosition | undefined;
1143
- /**
1144
- * Resolves a remote client's position against the local sequence
1145
- * and returns the remote client's position relative to the local
1146
- * sequence. The client ref seq must be above the minimum sequence number
1147
- * or the return value will be undefined.
1148
- * Generally this method is used in conjunction with signals which provide
1149
- * point in time values for the below parameters, and is useful for things
1150
- * like displaying user position. It should not be used with persisted values
1151
- * as persisted values will quickly become invalid as the remoteClientRefSeq
1152
- * moves below the minimum sequence number
1153
- * @param remoteClientPosition - The remote client's position to resolve
1154
- * @param remoteClientRefSeq - The reference sequence number of the remote client
1155
- * @param remoteClientId - The client id of the remote client
1156
- */
1157
- resolveRemoteClientPosition(remoteClientPosition: number, remoteClientRefSeq: number, remoteClientId: string): number | undefined;
1158
- private submitSequenceMessage;
1159
- /**
1160
- * Given a position specified relative to a marker id, lookup the marker
1161
- * and convert the position to a character position.
1162
- * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.
1163
- */
1164
- posFromRelativePos(relativePos: IRelativePosition): number;
1165
- /**
1166
- * Walk the underlying segments of the sequence.
1167
- * The walked segments may extend beyond the range if the segments cross the
1168
- * ranges start or end boundaries.
1169
- *
1170
- * Set split range to true to ensure only segments within the range are walked.
1171
- *
1172
- * @param handler - The function to handle each segment. Traversal ends if
1173
- * this function returns true.
1174
- * @param start - Optional. The start of range walk.
1175
- * @param end - Optional. The end of range walk
1176
- * @param accum - Optional. An object that will be passed to the handler for accumulation
1177
- * @param splitRange - Optional. Splits boundary segments on the range boundaries
1178
- */
1179
- walkSegments<TClientData>(handler: ISegmentAction<TClientData>, start?: number, end?: number, accum?: TClientData, splitRange?: boolean): void;
1180
- /**
1181
- * @returns The most recent sequence number which has been acked by the server and processed by this
1182
- * SharedSegmentSequence.
1183
- */
1184
- getCurrentSeq(): number;
1185
- /**
1186
- * Inserts a segment directly before a `ReferencePosition`.
1187
- * @param refPos - The reference position to insert the segment at
1188
- * @param segment - The segment to insert
1189
- */
1190
- insertAtReferencePosition(pos: ReferencePosition, segment: T): void;
1191
- /**
1192
- * Inserts a segment
1193
- * @param start - The position to insert the segment at
1194
- * @param spec - The segment to inserts spec
1195
- */
1196
- insertFromSpec(pos: number, spec: IJSONSegment): void;
1197
- /**
1198
- * Retrieves the interval collection keyed on `label`. If no such interval collection exists,
1199
- * creates one.
1200
- */
1201
- getIntervalCollection(label: string): IIntervalCollection<SequenceInterval>;
1202
- /**
1203
- * @returns An iterable object that enumerates the IntervalCollection labels.
1204
- *
1205
- * @example
1206
- *
1207
- * ```typescript
1208
- * const iter = this.getIntervalCollectionKeys();
1209
- * for (key of iter)
1210
- * const collection = this.getIntervalCollection(key);
1211
- * ...
1212
- * ```
1213
- */
1214
- getIntervalCollectionLabels(): IterableIterator<string>;
1215
- /**
1216
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
1217
- */
1218
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
1219
- /**
1220
- * Runs serializer over the GC data for this SharedMatrix.
1221
- * All the IFluidHandle's represent routes to other objects.
1222
- */
1223
- protected processGCDataCore(serializer: IFluidSerializer): void;
1224
- /**
1225
- * Replace the range specified from start to end with the provided segment
1226
- * This is done by inserting the segment at the end of the range, followed
1227
- * by removing the contents of the range
1228
- * For a zero or reverse range (start \>= end), insert at end do not remove anything
1229
- * @param start - The start of the range to replace
1230
- * @param end - The end of the range to replace
1231
- * @param segment - The segment that will replace the range
1232
- */
1233
- protected replaceRange(start: number, end: number, segment: ISegment): void;
1234
- /**
1235
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}
1236
- */
1237
- protected onConnect(): void;
1238
- /**
1239
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
1240
- */
1241
- protected onDisconnect(): void;
1242
- /**
1243
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
1244
- */
1245
- protected reSubmitCore(content: any, localOpMetadata: unknown): void;
1246
- /**
1247
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
1248
- */
1249
- protected loadCore(storage: IChannelStorageService): Promise<void>;
1250
- /**
1251
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
1252
- */
1253
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
1254
- /**
1255
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}
1256
- */
1257
- protected didAttach(): void;
1258
- /**
1259
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}
1260
- */
1261
- protected initializeLocalCore(): void;
1262
- /**
1263
- * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
1264
- */
1265
- protected applyStashedOp(content: any): void;
1266
- private summarizeMergeTree;
1267
- /**
1268
- *
1269
- * @param message - Message with decoded and hydrated handles
1270
- */
1271
- private processMergeTreeMsg;
1272
- private processMinSequenceNumberChanged;
1273
- private loadFinished;
1274
- private initializeIntervalCollections;
1275
- /**
1276
- * Overrides the "currently applicable reference sequence number" for the duration of the callback.
1277
- * See remarks on `currentRefSeq` for more context.
1278
- */
1279
- private useResubmitRefSeq;
1280
- }
1281
-
1282
- /* Excluded from this release type: SharedSequence */
1283
-
1284
- /**
1285
- * The Shared String is a specialized data structure for handling collaborative
1286
- * text. It is based on a more general Sequence data structure but has
1287
- * additional features that make working with text easier.
1288
- *
1289
- * In addition to text, a Shared String can also contain markers. Markers can be
1290
- * used to store metadata at positions within the text, like the details of an
1291
- * image or Fluid object that should be rendered with the text.
1292
- * @alpha
1293
- */
1294
- export declare class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {
1295
- id: string;
1296
- /**
1297
- * Create a new shared string.
1298
- * @param runtime - data store runtime the new shared string belongs to
1299
- * @param id - optional name of the shared string
1300
- * @returns newly create shared string (but not attached yet)
1301
- */
1302
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedString;
1303
- /**
1304
- * Get a factory for SharedString to register with the data store.
1305
- * @returns a factory that creates and load SharedString
1306
- */
1307
- static getFactory(): SharedStringFactory;
1308
- get ISharedString(): ISharedString;
1309
- private readonly mergeTreeTextHelper;
1310
- constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
1311
- /**
1312
- * Inserts a marker at a relative position.
1313
- * @param relativePos1 - The relative position to insert the marker at
1314
- * @param refType - The reference type of the marker
1315
- * @param props - The properties of the marker
1316
- */
1317
- insertMarkerRelative(relativePos1: IRelativePosition, refType: ReferenceType, props?: PropertySet): void;
1318
- /**
1319
- * {@inheritDoc ISharedString.insertMarker}
1320
- */
1321
- insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void;
1322
- /**
1323
- * Inserts the text at the position.
1324
- * @param relativePos1 - The relative position to insert the text at
1325
- * @param text - The text to insert
1326
- * @param props - The properties of text
1327
- */
1328
- insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet): void;
1329
- /**
1330
- * {@inheritDoc ISharedString.insertText}
1331
- */
1332
- insertText(pos: number, text: string, props?: PropertySet): void;
1333
- /**
1334
- * Replaces a range with the provided text.
1335
- * @param start - The inclusive start of the range to replace
1336
- * @param end - The exclusive end of the range to replace
1337
- * @param text - The text to replace the range with
1338
- * @param props - Optional. The properties of the replacement text
1339
- */
1340
- replaceText(start: number, end: number, text: string, props?: PropertySet): void;
1341
- /**
1342
- * Removes the text in the given range.
1343
- * @param start - The inclusive start of the range to remove
1344
- * @param end - The exclusive end of the range to replace
1345
- * @returns the message sent.
1346
- */
1347
- removeText(start: number, end: number): void;
1348
- /**
1349
- * Annotates the marker with the provided properties.
1350
- * @param marker - The marker to annotate
1351
- * @param props - The properties to annotate the marker with
1352
- */
1353
- annotateMarker(marker: Marker, props: PropertySet): void;
1354
- /**
1355
- * Searches a string for the nearest marker in either direction to a given start position.
1356
- * The search will include the start position, so markers at the start position are valid
1357
- * results of the search.
1358
- * @param startPos - Position at which to start the search
1359
- * @param markerLabel - Label of the marker to search for
1360
- * @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`
1361
- */
1362
- searchForMarker(startPos: number, markerLabel: string, forwards?: boolean): Marker | undefined;
1363
- /**
1364
- * Retrieve text from the SharedString in string format.
1365
- * @param start - The starting index of the text to retrieve, or 0 if omitted.
1366
- * @param end - The ending index of the text to retrieve, or the end of the string if omitted
1367
- * @returns The requested text content as a string.
1368
- */
1369
- getText(start?: number, end?: number): string;
1370
- /**
1371
- * Adds spaces for markers and handles, so that position calculations account for them.
1372
- */
1373
- getTextWithPlaceholders(start?: number, end?: number): string;
1374
- getTextRangeWithMarkers(start: number, end: number): string;
1375
- /**
1376
- * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided
1377
- * id in this `SharedString`.
1378
- */
1379
- getMarkerFromId(id: string): ISegment | undefined;
1380
- /**
1381
- * Revert an op
1382
- */
1383
- protected rollback(content: any, localOpMetadata: unknown): void;
1384
- }
1385
-
1386
- /**
1387
- * @alpha
1388
- */
1389
- export declare class SharedStringFactory implements IChannelFactory {
1390
- static Type: string;
1391
- static readonly Attributes: IChannelAttributes;
1392
- static segmentFromSpec(spec: any): SharedStringSegment;
1393
- get type(): string;
1394
- get attributes(): IChannelAttributes;
1395
- /**
1396
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
1397
- */
1398
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<SharedString>;
1399
- /**
1400
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
1401
- */
1402
- create(document: IFluidDataStoreRuntime, id: string): SharedString;
1403
- }
1404
-
1405
- /**
1406
- * Data for undoing edits on SharedStrings and Intervals.
1407
- * @alpha
1408
- */
1409
- export declare type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;
1410
-
1411
- /**
1412
- * @alpha
1413
- */
1414
- export declare type SharedStringSegment = TextSegment | Marker;
1415
-
1416
- /**
1417
- * Defines a side relative to a character in a sequence.
1418
- *
1419
- * @remarks See {@link SequencePlace} for additional context on usage.
1420
- * @alpha
1421
- */
1422
- export declare enum Side {
1423
- Before = 0,
1424
- After = 1
1425
- }
1426
-
1427
- /* Excluded from this release type: SubSequence */
1428
- export { TextSegment }
1429
-
1430
- export { TrackingGroup }
1431
-
1432
- export { }