@fluidframework/merge-tree 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 (461) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/merge-tree.api.md +16 -4
  3. package/dist/MergeTreeTextHelper.d.ts.map +1 -1
  4. package/dist/MergeTreeTextHelper.js.map +1 -1
  5. package/dist/attributionCollection.d.ts +1 -1
  6. package/dist/attributionCollection.d.ts.map +1 -1
  7. package/dist/attributionCollection.js +6 -6
  8. package/dist/attributionCollection.js.map +1 -1
  9. package/dist/attributionPolicy.d.ts +2 -2
  10. package/dist/attributionPolicy.d.ts.map +1 -1
  11. package/dist/attributionPolicy.js +5 -5
  12. package/dist/attributionPolicy.js.map +1 -1
  13. package/dist/client.d.ts +8 -8
  14. package/dist/client.d.ts.map +1 -1
  15. package/dist/client.js +37 -48
  16. package/dist/client.js.map +1 -1
  17. package/dist/collections/list.js +3 -3
  18. package/dist/collections/list.js.map +1 -1
  19. package/dist/endOfTreeSegment.d.ts +5 -5
  20. package/dist/endOfTreeSegment.d.ts.map +1 -1
  21. package/dist/endOfTreeSegment.js +2 -2
  22. package/dist/endOfTreeSegment.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +4 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/legacy.d.ts +76 -0
  28. package/dist/localReference.d.ts.map +1 -1
  29. package/dist/localReference.js +7 -7
  30. package/dist/localReference.js.map +1 -1
  31. package/dist/mergeTree.d.ts +8 -8
  32. package/dist/mergeTree.d.ts.map +1 -1
  33. package/dist/mergeTree.js +44 -57
  34. package/dist/mergeTree.js.map +1 -1
  35. package/dist/mergeTreeDeltaCallback.d.ts +1 -1
  36. package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
  37. package/dist/mergeTreeDeltaCallback.js +4 -0
  38. package/dist/mergeTreeDeltaCallback.js.map +1 -1
  39. package/dist/mergeTreeNodeWalk.d.ts +3 -3
  40. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  41. package/dist/mergeTreeNodeWalk.js.map +1 -1
  42. package/dist/mergeTreeNodes.d.ts +37 -55
  43. package/dist/mergeTreeNodes.d.ts.map +1 -1
  44. package/dist/mergeTreeNodes.js +40 -19
  45. package/dist/mergeTreeNodes.js.map +1 -1
  46. package/dist/opBuilder.d.ts +1 -1
  47. package/dist/opBuilder.d.ts.map +1 -1
  48. package/dist/opBuilder.js.map +1 -1
  49. package/dist/ordinal.js +2 -2
  50. package/dist/ordinal.js.map +1 -1
  51. package/dist/partialLengths.d.ts +6 -6
  52. package/dist/partialLengths.d.ts.map +1 -1
  53. package/dist/partialLengths.js +13 -13
  54. package/dist/partialLengths.js.map +1 -1
  55. package/dist/public.d.ts +12 -0
  56. package/dist/revertibles.d.ts +1 -1
  57. package/dist/revertibles.d.ts.map +1 -1
  58. package/dist/revertibles.js +15 -15
  59. package/dist/revertibles.js.map +1 -1
  60. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  61. package/dist/segmentPropertiesManager.js +2 -2
  62. package/dist/segmentPropertiesManager.js.map +1 -1
  63. package/dist/snapshotChunks.d.ts +2 -2
  64. package/dist/snapshotChunks.d.ts.map +1 -1
  65. package/dist/snapshotChunks.js.map +1 -1
  66. package/dist/snapshotLoader.d.ts +2 -2
  67. package/dist/snapshotLoader.d.ts.map +1 -1
  68. package/dist/snapshotLoader.js +11 -11
  69. package/dist/snapshotLoader.js.map +1 -1
  70. package/dist/snapshotV1.d.ts +3 -3
  71. package/dist/snapshotV1.d.ts.map +1 -1
  72. package/dist/snapshotV1.js +10 -10
  73. package/dist/snapshotV1.js.map +1 -1
  74. package/dist/snapshotlegacy.d.ts +4 -4
  75. package/dist/snapshotlegacy.d.ts.map +1 -1
  76. package/dist/snapshotlegacy.js +9 -10
  77. package/dist/snapshotlegacy.js.map +1 -1
  78. package/dist/test/Insertion.perf.spec.js.map +1 -1
  79. package/dist/test/PartialLengths.perf.spec.js +1 -1
  80. package/dist/test/PartialLengths.perf.spec.js.map +1 -1
  81. package/dist/test/Removal.perf.spec.js +1 -1
  82. package/dist/test/Removal.perf.spec.js.map +1 -1
  83. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  84. package/dist/test/attributionCollection.perf.spec.js +2 -2
  85. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  86. package/dist/test/attributionCollection.spec.js.map +1 -1
  87. package/dist/test/attributionPolicy.spec.js.map +1 -1
  88. package/dist/test/beastTest.spec.d.ts.map +1 -1
  89. package/dist/test/beastTest.spec.js +7 -7
  90. package/dist/test/beastTest.spec.js.map +1 -1
  91. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  92. package/dist/test/client.apis.spec.d.ts.map +1 -1
  93. package/dist/test/client.apis.spec.js.map +1 -1
  94. package/dist/test/client.applyMsg.spec.js +2 -2
  95. package/dist/test/client.applyMsg.spec.js.map +1 -1
  96. package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  97. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  98. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  99. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
  100. package/dist/test/client.attributionFarm.spec.js +1 -1
  101. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  102. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  103. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  104. package/dist/test/client.getPosition.spec.js +1 -1
  105. package/dist/test/client.getPosition.spec.js.map +1 -1
  106. package/dist/test/client.localReference.spec.js +6 -6
  107. package/dist/test/client.localReference.spec.js.map +1 -1
  108. package/dist/test/client.localReferenceFarm.spec.js +2 -2
  109. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  110. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  111. package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
  112. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
  113. package/dist/test/client.reconnectFarm.spec.js +1 -1
  114. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  115. package/dist/test/client.replay.spec.js +4 -4
  116. package/dist/test/client.replay.spec.js.map +1 -1
  117. package/dist/test/client.rollback.spec.js +2 -2
  118. package/dist/test/client.rollback.spec.js.map +1 -1
  119. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  120. package/dist/test/client.searchForMarker.spec.js +1 -1
  121. package/dist/test/client.searchForMarker.spec.js.map +1 -1
  122. package/dist/test/client.walkSegments.spec.js.map +1 -1
  123. package/dist/test/collections.list.spec.js.map +1 -1
  124. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  125. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +3 -3
  126. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  127. package/dist/test/mergeTree.annotate.spec.js +1 -1
  128. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  129. package/dist/test/mergeTree.insert.deltaCallback.spec.js +1 -1
  130. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  131. package/dist/test/mergeTree.insertingWalk.spec.js +3 -3
  132. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  133. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
  134. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  135. package/dist/test/mergeTree.markRangeRemoved.spec.js +1 -1
  136. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  137. package/dist/test/mergeTree.walk.spec.js +2 -2
  138. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  139. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  140. package/dist/test/mergeTreeOperationRunner.d.ts +2 -2
  141. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  142. package/dist/test/mergeTreeOperationRunner.js +3 -3
  143. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  144. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  145. package/dist/test/obliterate.concurrent.spec.js +2 -2
  146. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  147. package/dist/test/obliterate.deltaCallback.spec.js +1 -1
  148. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
  149. package/dist/test/obliterate.partialLength.spec.js.map +1 -1
  150. package/dist/test/obliterate.reconnect.spec.js.map +1 -1
  151. package/dist/test/obliterate.spec.js.map +1 -1
  152. package/dist/test/ordinal.spec.d.ts +4 -0
  153. package/dist/test/ordinal.spec.d.ts.map +1 -1
  154. package/dist/test/ordinal.spec.js +4 -4
  155. package/dist/test/ordinal.spec.js.map +1 -1
  156. package/dist/test/partialLength.spec.js.map +1 -1
  157. package/dist/test/properties.spec.js.map +1 -1
  158. package/dist/test/reconnectHelper.d.ts +1 -1
  159. package/dist/test/reconnectHelper.d.ts.map +1 -1
  160. package/dist/test/reconnectHelper.js.map +1 -1
  161. package/dist/test/resetPendingSegmentsToOp.spec.js +1 -1
  162. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  163. package/dist/test/revertibleFarm.spec.js +1 -1
  164. package/dist/test/revertibleFarm.spec.js.map +1 -1
  165. package/dist/test/revertibles.spec.d.ts.map +1 -1
  166. package/dist/test/revertibles.spec.js +1 -1
  167. package/dist/test/revertibles.spec.js.map +1 -1
  168. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  169. package/dist/test/snapshot.spec.js +1 -1
  170. package/dist/test/snapshot.spec.js.map +1 -1
  171. package/dist/test/snapshot.utils.d.ts +1 -1
  172. package/dist/test/snapshot.utils.d.ts.map +1 -1
  173. package/dist/test/snapshot.utils.js +3 -3
  174. package/dist/test/snapshot.utils.js.map +1 -1
  175. package/dist/test/snapshotlegacy.spec.js +8 -8
  176. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  177. package/dist/test/sortedSegmentSet.spec.js +2 -2
  178. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  179. package/dist/test/testClient.d.ts +5 -5
  180. package/dist/test/testClient.d.ts.map +1 -1
  181. package/dist/test/testClient.js +11 -11
  182. package/dist/test/testClient.js.map +1 -1
  183. package/dist/test/testClientLogger.d.ts +1 -1
  184. package/dist/test/testClientLogger.d.ts.map +1 -1
  185. package/dist/test/testClientLogger.js +10 -8
  186. package/dist/test/testClientLogger.js.map +1 -1
  187. package/dist/test/testSerializer.d.ts.map +1 -1
  188. package/dist/test/testSerializer.js +2 -2
  189. package/dist/test/testSerializer.js.map +1 -1
  190. package/dist/test/testServer.d.ts +1 -1
  191. package/dist/test/testServer.d.ts.map +1 -1
  192. package/dist/test/testServer.js +4 -4
  193. package/dist/test/testServer.js.map +1 -1
  194. package/dist/test/testUtils.d.ts +5 -5
  195. package/dist/test/testUtils.d.ts.map +1 -1
  196. package/dist/test/testUtils.js +3 -3
  197. package/dist/test/testUtils.js.map +1 -1
  198. package/dist/test/text.d.ts +1 -1
  199. package/dist/test/text.d.ts.map +1 -1
  200. package/dist/test/text.js.map +1 -1
  201. package/dist/test/tracking.spec.js.map +1 -1
  202. package/dist/test/wordUnitTests.spec.d.ts.map +1 -1
  203. package/dist/test/wordUnitTests.spec.js +2 -2
  204. package/dist/test/wordUnitTests.spec.js.map +1 -1
  205. package/dist/textSegment.d.ts.map +1 -1
  206. package/dist/textSegment.js +2 -2
  207. package/dist/textSegment.js.map +1 -1
  208. package/dist/zamboni.d.ts +2 -2
  209. package/dist/zamboni.d.ts.map +1 -1
  210. package/dist/zamboni.js.map +1 -1
  211. package/internal.d.ts +11 -0
  212. package/legacy.d.ts +11 -0
  213. package/lib/MergeTreeTextHelper.d.ts.map +1 -1
  214. package/lib/MergeTreeTextHelper.js.map +1 -1
  215. package/lib/attributionCollection.d.ts +1 -1
  216. package/lib/attributionCollection.d.ts.map +1 -1
  217. package/lib/attributionCollection.js +1 -1
  218. package/lib/attributionCollection.js.map +1 -1
  219. package/lib/attributionPolicy.d.ts +2 -2
  220. package/lib/attributionPolicy.d.ts.map +1 -1
  221. package/lib/attributionPolicy.js +4 -4
  222. package/lib/attributionPolicy.js.map +1 -1
  223. package/lib/client.d.ts +8 -8
  224. package/lib/client.d.ts.map +1 -1
  225. package/lib/client.js +14 -25
  226. package/lib/client.js.map +1 -1
  227. package/lib/collections/list.js +1 -1
  228. package/lib/collections/list.js.map +1 -1
  229. package/lib/endOfTreeSegment.d.ts +5 -5
  230. package/lib/endOfTreeSegment.d.ts.map +1 -1
  231. package/lib/endOfTreeSegment.js +2 -2
  232. package/lib/endOfTreeSegment.js.map +1 -1
  233. package/lib/index.d.ts +1 -1
  234. package/lib/index.d.ts.map +1 -1
  235. package/lib/index.js +1 -1
  236. package/lib/index.js.map +1 -1
  237. package/lib/legacy.d.ts +76 -0
  238. package/lib/localReference.d.ts.map +1 -1
  239. package/lib/localReference.js +2 -2
  240. package/lib/localReference.js.map +1 -1
  241. package/lib/mergeTree.d.ts +8 -8
  242. package/lib/mergeTree.d.ts.map +1 -1
  243. package/lib/mergeTree.js +23 -36
  244. package/lib/mergeTree.js.map +1 -1
  245. package/lib/mergeTreeDeltaCallback.d.ts +1 -1
  246. package/lib/mergeTreeDeltaCallback.d.ts.map +1 -1
  247. package/lib/mergeTreeDeltaCallback.js +4 -0
  248. package/lib/mergeTreeDeltaCallback.js.map +1 -1
  249. package/lib/mergeTreeNodeWalk.d.ts +3 -3
  250. package/lib/mergeTreeNodeWalk.d.ts.map +1 -1
  251. package/lib/mergeTreeNodeWalk.js.map +1 -1
  252. package/lib/mergeTreeNodes.d.ts +37 -55
  253. package/lib/mergeTreeNodes.d.ts.map +1 -1
  254. package/lib/mergeTreeNodes.js +28 -8
  255. package/lib/mergeTreeNodes.js.map +1 -1
  256. package/lib/opBuilder.d.ts +1 -1
  257. package/lib/opBuilder.d.ts.map +1 -1
  258. package/lib/opBuilder.js.map +1 -1
  259. package/lib/ordinal.js +1 -1
  260. package/lib/ordinal.js.map +1 -1
  261. package/lib/partialLengths.d.ts +6 -6
  262. package/lib/partialLengths.d.ts.map +1 -1
  263. package/lib/partialLengths.js +3 -3
  264. package/lib/partialLengths.js.map +1 -1
  265. package/lib/public.d.ts +12 -0
  266. package/lib/revertibles.d.ts +1 -1
  267. package/lib/revertibles.d.ts.map +1 -1
  268. package/lib/revertibles.js +4 -4
  269. package/lib/revertibles.js.map +1 -1
  270. package/lib/segmentPropertiesManager.d.ts.map +1 -1
  271. package/lib/segmentPropertiesManager.js +1 -1
  272. package/lib/segmentPropertiesManager.js.map +1 -1
  273. package/lib/snapshotChunks.d.ts +2 -2
  274. package/lib/snapshotChunks.d.ts.map +1 -1
  275. package/lib/snapshotChunks.js.map +1 -1
  276. package/lib/snapshotLoader.d.ts +2 -2
  277. package/lib/snapshotLoader.d.ts.map +1 -1
  278. package/lib/snapshotLoader.js +2 -2
  279. package/lib/snapshotLoader.js.map +1 -1
  280. package/lib/snapshotV1.d.ts +3 -3
  281. package/lib/snapshotV1.d.ts.map +1 -1
  282. package/lib/snapshotV1.js +5 -5
  283. package/lib/snapshotV1.js.map +1 -1
  284. package/lib/snapshotlegacy.d.ts +4 -4
  285. package/lib/snapshotlegacy.d.ts.map +1 -1
  286. package/lib/snapshotlegacy.js +3 -4
  287. package/lib/snapshotlegacy.js.map +1 -1
  288. package/lib/test/Insertion.perf.spec.js +1 -1
  289. package/lib/test/Insertion.perf.spec.js.map +1 -1
  290. package/lib/test/PartialLengths.perf.spec.js +2 -2
  291. package/lib/test/PartialLengths.perf.spec.js.map +1 -1
  292. package/lib/test/Removal.perf.spec.js +2 -2
  293. package/lib/test/Removal.perf.spec.js.map +1 -1
  294. package/lib/test/Snapshot.perf.spec.js +2 -2
  295. package/lib/test/Snapshot.perf.spec.js.map +1 -1
  296. package/lib/test/attributionCollection.perf.spec.js +4 -4
  297. package/lib/test/attributionCollection.perf.spec.js.map +1 -1
  298. package/lib/test/attributionCollection.spec.js.map +1 -1
  299. package/lib/test/attributionPolicy.spec.js.map +1 -1
  300. package/lib/test/beastTest.spec.d.ts.map +1 -1
  301. package/lib/test/beastTest.spec.js +8 -8
  302. package/lib/test/beastTest.spec.js.map +1 -1
  303. package/lib/test/client.annotateMarker.spec.js.map +1 -1
  304. package/lib/test/client.apis.spec.d.ts.map +1 -1
  305. package/lib/test/client.apis.spec.js.map +1 -1
  306. package/lib/test/client.applyMsg.spec.js +3 -3
  307. package/lib/test/client.applyMsg.spec.js.map +1 -1
  308. package/lib/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  309. package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  310. package/lib/test/client.applyStashedOpFarm.spec.js +1 -1
  311. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -1
  312. package/lib/test/client.attributionFarm.spec.d.ts.map +1 -1
  313. package/lib/test/client.attributionFarm.spec.js +2 -2
  314. package/lib/test/client.attributionFarm.spec.js.map +1 -1
  315. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -1
  316. package/lib/test/client.conflictFarm.spec.js +1 -1
  317. package/lib/test/client.conflictFarm.spec.js.map +1 -1
  318. package/lib/test/client.getPosition.spec.js.map +1 -1
  319. package/lib/test/client.localReference.spec.js +5 -5
  320. package/lib/test/client.localReference.spec.js.map +1 -1
  321. package/lib/test/client.localReferenceFarm.spec.js +2 -2
  322. package/lib/test/client.localReferenceFarm.spec.js.map +1 -1
  323. package/lib/test/client.rebasePosition.spec.js.map +1 -1
  324. package/lib/test/client.reconnectFarm.spec.d.ts +1 -1
  325. package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -1
  326. package/lib/test/client.reconnectFarm.spec.js +2 -2
  327. package/lib/test/client.reconnectFarm.spec.js.map +1 -1
  328. package/lib/test/client.replay.spec.js +3 -3
  329. package/lib/test/client.replay.spec.js.map +1 -1
  330. package/lib/test/client.rollback.spec.js +1 -1
  331. package/lib/test/client.rollback.spec.js.map +1 -1
  332. package/lib/test/client.rollbackFarm.spec.js +1 -1
  333. package/lib/test/client.rollbackFarm.spec.js.map +1 -1
  334. package/lib/test/client.searchForMarker.spec.js +2 -2
  335. package/lib/test/client.searchForMarker.spec.js.map +1 -1
  336. package/lib/test/client.walkSegments.spec.js.map +1 -1
  337. package/lib/test/collections.list.spec.js.map +1 -1
  338. package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  339. package/lib/test/mergeTree.annotate.deltaCallback.spec.js +3 -3
  340. package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  341. package/lib/test/mergeTree.annotate.spec.js +1 -1
  342. package/lib/test/mergeTree.annotate.spec.js.map +1 -1
  343. package/lib/test/mergeTree.insert.deltaCallback.spec.js +1 -1
  344. package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  345. package/lib/test/mergeTree.insertingWalk.spec.js +3 -3
  346. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
  347. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
  348. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  349. package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  350. package/lib/test/mergeTree.walk.spec.js +2 -2
  351. package/lib/test/mergeTree.walk.spec.js.map +1 -1
  352. package/lib/test/mergeTree.zamboni.spec.js +1 -1
  353. package/lib/test/mergeTree.zamboni.spec.js.map +1 -1
  354. package/lib/test/mergeTreeOperationRunner.d.ts +2 -2
  355. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
  356. package/lib/test/mergeTreeOperationRunner.js +3 -3
  357. package/lib/test/mergeTreeOperationRunner.js.map +1 -1
  358. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -1
  359. package/lib/test/obliterate.concurrent.spec.js +1 -1
  360. package/lib/test/obliterate.concurrent.spec.js.map +1 -1
  361. package/lib/test/obliterate.deltaCallback.spec.js +1 -1
  362. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
  363. package/lib/test/obliterate.partialLength.spec.js.map +1 -1
  364. package/lib/test/obliterate.reconnect.spec.js.map +1 -1
  365. package/lib/test/obliterate.spec.js.map +1 -1
  366. package/lib/test/ordinal.spec.d.ts +4 -0
  367. package/lib/test/ordinal.spec.d.ts.map +1 -1
  368. package/lib/test/ordinal.spec.js.map +1 -1
  369. package/lib/test/partialLength.spec.js.map +1 -1
  370. package/lib/test/properties.spec.js.map +1 -1
  371. package/lib/test/reconnectHelper.d.ts +1 -1
  372. package/lib/test/reconnectHelper.d.ts.map +1 -1
  373. package/lib/test/reconnectHelper.js +1 -1
  374. package/lib/test/reconnectHelper.js.map +1 -1
  375. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  376. package/lib/test/revertibleFarm.spec.js +3 -3
  377. package/lib/test/revertibleFarm.spec.js.map +1 -1
  378. package/lib/test/revertibles.spec.d.ts.map +1 -1
  379. package/lib/test/revertibles.spec.js +2 -2
  380. package/lib/test/revertibles.spec.js.map +1 -1
  381. package/lib/test/segmentGroupCollection.spec.js.map +1 -1
  382. package/lib/test/snapshot.spec.js +2 -2
  383. package/lib/test/snapshot.spec.js.map +1 -1
  384. package/lib/test/snapshot.utils.d.ts +1 -1
  385. package/lib/test/snapshot.utils.d.ts.map +1 -1
  386. package/lib/test/snapshot.utils.js +2 -2
  387. package/lib/test/snapshot.utils.js.map +1 -1
  388. package/lib/test/snapshotlegacy.spec.js +4 -4
  389. package/lib/test/snapshotlegacy.spec.js.map +1 -1
  390. package/lib/test/sortedSegmentSet.spec.js +2 -2
  391. package/lib/test/sortedSegmentSet.spec.js.map +1 -1
  392. package/lib/test/testClient.d.ts +5 -5
  393. package/lib/test/testClient.d.ts.map +1 -1
  394. package/lib/test/testClient.js +7 -7
  395. package/lib/test/testClient.js.map +1 -1
  396. package/lib/test/testClientLogger.d.ts +1 -1
  397. package/lib/test/testClientLogger.d.ts.map +1 -1
  398. package/lib/test/testClientLogger.js +9 -7
  399. package/lib/test/testClientLogger.js.map +1 -1
  400. package/lib/test/testSerializer.d.ts.map +1 -1
  401. package/lib/test/testSerializer.js +1 -1
  402. package/lib/test/testSerializer.js.map +1 -1
  403. package/lib/test/testServer.d.ts +1 -1
  404. package/lib/test/testServer.d.ts.map +1 -1
  405. package/lib/test/testServer.js +2 -2
  406. package/lib/test/testServer.js.map +1 -1
  407. package/lib/test/testUtils.d.ts +5 -5
  408. package/lib/test/testUtils.d.ts.map +1 -1
  409. package/lib/test/testUtils.js +3 -3
  410. package/lib/test/testUtils.js.map +1 -1
  411. package/lib/test/text.d.ts +1 -1
  412. package/lib/test/text.d.ts.map +1 -1
  413. package/lib/test/text.js.map +1 -1
  414. package/lib/test/tracking.spec.js.map +1 -1
  415. package/lib/test/wordUnitTests.spec.d.ts.map +1 -1
  416. package/lib/test/wordUnitTests.spec.js +2 -2
  417. package/lib/test/wordUnitTests.spec.js.map +1 -1
  418. package/lib/textSegment.d.ts.map +1 -1
  419. package/lib/textSegment.js +1 -1
  420. package/lib/textSegment.js.map +1 -1
  421. package/lib/zamboni.d.ts +2 -2
  422. package/lib/zamboni.d.ts.map +1 -1
  423. package/lib/zamboni.js.map +1 -1
  424. package/package.json +37 -58
  425. package/src/MergeTreeTextHelper.ts +1 -1
  426. package/src/attributionCollection.ts +4 -3
  427. package/src/attributionPolicy.ts +7 -6
  428. package/src/client.ts +32 -45
  429. package/src/collections/list.ts +1 -1
  430. package/src/endOfTreeSegment.ts +5 -4
  431. package/src/index.ts +5 -1
  432. package/src/localReference.ts +4 -3
  433. package/src/mergeTree.ts +66 -84
  434. package/src/mergeTreeDeltaCallback.ts +3 -1
  435. package/src/mergeTreeNodeWalk.ts +6 -6
  436. package/src/mergeTreeNodes.ts +59 -61
  437. package/src/opBuilder.ts +3 -3
  438. package/src/ordinal.ts +1 -1
  439. package/src/partialLengths.ts +11 -10
  440. package/src/revertibles.ts +6 -5
  441. package/src/segmentPropertiesManager.ts +3 -2
  442. package/src/snapshotChunks.ts +3 -2
  443. package/src/snapshotLoader.ts +10 -12
  444. package/src/snapshotV1.ts +15 -12
  445. package/src/snapshotlegacy.ts +8 -6
  446. package/src/textSegment.ts +2 -1
  447. package/src/zamboni.ts +7 -7
  448. package/api-extractor-cjs.json +0 -8
  449. package/dist/merge-tree-alpha.d.ts +0 -1558
  450. package/dist/merge-tree-beta.d.ts +0 -230
  451. package/dist/merge-tree-public.d.ts +0 -230
  452. package/dist/merge-tree-untrimmed.d.ts +0 -1894
  453. package/lib/merge-tree-alpha.d.ts +0 -1558
  454. package/lib/merge-tree-beta.d.ts +0 -230
  455. package/lib/merge-tree-public.d.ts +0 -230
  456. package/lib/merge-tree-untrimmed.d.ts +0 -1894
  457. package/lib/test/types/validateMergeTreePrevious.generated.d.ts +0 -2
  458. package/lib/test/types/validateMergeTreePrevious.generated.d.ts.map +0 -1
  459. package/lib/test/types/validateMergeTreePrevious.generated.js +0 -228
  460. package/lib/test/types/validateMergeTreePrevious.generated.js.map +0 -1
  461. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1,1894 +0,0 @@
1
- import { AttributionKey } from '@fluidframework/runtime-definitions';
2
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
3
- import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
4
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
5
- import { IFluidHandle } from '@fluidframework/core-interfaces';
6
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
9
- import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
10
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
11
-
12
- /**
13
- * @deprecated This functionality was not intended for public export and will
14
- * be removed in a future release.
15
- * @internal
16
- */
17
- export declare function addProperties(oldProps: PropertySet | undefined, newProps: PropertySet): PropertySet;
18
-
19
- /**
20
- * @alpha
21
- */
22
- export declare function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;
23
-
24
- /**
25
- * Implements policy dictating which kinds of operations should be attributed and how.
26
- * @sealed
27
- * @alpha
28
- */
29
- export declare interface AttributionPolicy {
30
- /**
31
- * Enables tracking attribution information for operations on this merge-tree.
32
- * This function is expected to subscribe to appropriate change events in order
33
- * to manage any attribution data it stores on segments.
34
- *
35
- * This must be done in an eventually consistent fashion.
36
- */
37
- attach: (client: Client) => void;
38
- /**
39
- * Disables tracking attribution information on segments.
40
- */
41
- detach: () => void;
42
- /***/
43
- isAttached: boolean;
44
- /**
45
- * Serializer capable of serializing any attribution data this policy stores on segments.
46
- */
47
- serializer: IAttributionCollectionSerializer;
48
- }
49
-
50
- /**
51
- * @alpha
52
- */
53
- export declare abstract class BaseSegment extends MergeNode implements ISegment {
54
- clientId: number;
55
- seq: number;
56
- removedSeq?: number;
57
- removedClientIds?: number[];
58
- movedSeq?: number;
59
- movedSeqs?: number[];
60
- movedClientIds?: number[];
61
- wasMovedOnInsert?: boolean | undefined;
62
- readonly segmentGroups: SegmentGroupCollection;
63
- readonly trackingCollection: TrackingGroupCollection;
64
- /***/
65
- attribution?: IAttributionCollection<AttributionKey>;
66
- propertyManager?: PropertiesManager;
67
- properties?: PropertySet;
68
- localRefs?: LocalReferenceCollection;
69
- abstract readonly type: string;
70
- localSeq?: number;
71
- localRemovedSeq?: number;
72
- localMovedSeq?: number;
73
- addProperties(newProps: PropertySet, seq?: number, collaborating?: boolean, rollback?: PropertiesRollback): PropertySet;
74
- hasProperty(key: string): boolean;
75
- isLeaf(): this is ISegment;
76
- protected cloneInto(b: ISegment): void;
77
- canAppend(segment: ISegment): boolean;
78
- protected addSerializedProps(jseg: IJSONSegment): void;
79
- abstract toJSONObject(): any;
80
- /***/
81
- ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;
82
- splitAt(pos: number): ISegment | undefined;
83
- private copyPropertiesTo;
84
- abstract clone(): ISegment;
85
- append(other: ISegment): void;
86
- protected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;
87
- }
88
-
89
- /**
90
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
91
- * @alpha
92
- */
93
- export declare class Client extends TypedEventEmitter<IClientEvents> {
94
- readonly specToSegment: (spec: IJSONSegment) => ISegment;
95
- readonly logger: ITelemetryLoggerExt;
96
- private readonly getMinInFlightRefSeq;
97
- longClientId: string | undefined;
98
- private readonly _mergeTree;
99
- private readonly clientNameToIds;
100
- private readonly shortClientIdMap;
101
- /**
102
- * @param specToSegment - Rehydrates a segment from its JSON representation
103
- * @param logger - Telemetry logger for diagnostics
104
- * @param options - Options for this client. See {@link IMergeTreeOptions} for details.
105
- * @param getMinInFlightRefSeq - Upon applying a message (see {@link Client.applyMsg}), client purges collab-window information which
106
- * is no longer necessary based on that message's minimum sequence number.
107
- * However, if the user of this client has in-flight messages which refer to positions in this Client,
108
- * they may wish to preserve additional merge information.
109
- * The effective minimum sequence number will be the minimum of the message's minimumSequenceNumber and the result of this function.
110
- * If this function returns undefined, the message's minimumSequenceNumber will be used.
111
- *
112
- * @privateRemarks
113
- * - Passing specToSegment would be unnecessary if Client were merged with SharedSegmentSequence
114
- * - AB#6866 tracks a more unified approach to collab window min seq handling.
115
- */
116
- constructor(specToSegment: (spec: IJSONSegment) => ISegment, logger: ITelemetryLoggerExt, options?: IMergeTreeOptions & PropertySet, getMinInFlightRefSeq?: () => number | undefined);
117
- /**
118
- * The merge tree maintains a queue of segment groups for each local operation.
119
- * These segment groups track segments modified by an operation.
120
- * This method peeks the tail of that queue, and returns the segments groups there.
121
- * It is used to get the segment group(s) for the previous operations.
122
- * @param count - The number segment groups to get peek from the tail of the queue. Default 1.
123
- */
124
- peekPendingSegmentGroups(): SegmentGroup | undefined;
125
- peekPendingSegmentGroups(count: number): SegmentGroup | SegmentGroup[] | undefined;
126
- /**
127
- * Annotates the markers with the provided properties
128
- * @param marker - The marker to annotate
129
- * @param props - The properties to annotate the marker with
130
- * @returns The annotate op if valid, otherwise undefined
131
- */
132
- annotateMarker(marker: Marker, props: PropertySet): IMergeTreeAnnotateMsg | undefined;
133
- /**
134
- * Annotates the range with the provided properties
135
- * @param start - The inclusive start position of the range to annotate
136
- * @param end - The exclusive end position of the range to annotate
137
- * @param props - The properties to annotate the range with
138
- * @returns The annotate op if valid, otherwise undefined
139
- */
140
- annotateRangeLocal(start: number, end: number, props: PropertySet): IMergeTreeAnnotateMsg | undefined;
141
- /**
142
- * Removes the range
143
- *
144
- * @param start - The inclusive start of the range to remove
145
- * @param end - The exclusive end of the range to remove
146
- */
147
- removeRangeLocal(start: number, end: number): IMergeTreeRemoveMsg;
148
- /**
149
- * Obliterates the range. This is similar to removing the range, but also
150
- * includes any concurrently inserted content.
151
- *
152
- * @param start - The inclusive start of the range to obliterate
153
- * @param end - The exclusive end of the range to obliterate
154
- */
155
- obliterateRangeLocal(start: number, end: number): IMergeTreeObliterateMsg;
156
- /**
157
- * @param pos - The position to insert the segment at
158
- * @param segment - The segment to insert
159
- */
160
- insertSegmentLocal(pos: number, segment: ISegment): IMergeTreeInsertMsg | undefined;
161
- /**
162
- * @param refPos - The reference position to insert the segment at
163
- * @param segment - The segment to insert
164
- */
165
- insertAtReferencePositionLocal(refPos: ReferencePosition, segment: ISegment): IMergeTreeInsertMsg | undefined;
166
- walkSegments<TClientData>(handler: ISegmentAction<TClientData>, start: number | undefined, end: number | undefined, accum: TClientData, splitRange?: boolean): void;
167
- walkSegments<undefined>(handler: ISegmentAction<undefined>, start?: number, end?: number, accum?: undefined, splitRange?: boolean): void;
168
- protected walkAllSegments<TClientData>(action: (segment: ISegment, accum?: TClientData) => boolean, accum?: TClientData): boolean;
169
- /**
170
- * Serializes the data required for garbage collection. The IFluidHandles stored in all segments that haven't
171
- * been removed represent routes to other objects. We serialize the data in these segments using the passed in
172
- * serializer which keeps track of all serialized handles.
173
- */
174
- serializeGCData(handle: IFluidHandle, handleCollectingSerializer: IFluidSerializer): void;
175
- getCollabWindow(): CollaborationWindow;
176
- /**
177
- * Returns the current position of a segment, and -1 if the segment
178
- * does not exist in this merge tree
179
- * @param segment - The segment to get the position of
180
- */
181
- getPosition(segment: ISegment | undefined, localSeq?: number): number;
182
- /**
183
- * Creates a `LocalReferencePosition` on this client. If the refType does not include ReferenceType.Transient,
184
- * the returned reference will be added to the localRefs on the provided segment.
185
- * @param segment - Segment to add the local reference on
186
- * @param offset - Offset on the segment at which to place the local reference
187
- * @param refType - ReferenceType for the created local reference
188
- * @param properties - PropertySet to place on the created local reference
189
- * @param canSlideToEndpoint - Whether or not the created local reference can
190
- * slide onto one of the special endpoint segments denoting the position
191
- * before the start of or after the end of the tree
192
- */
193
- createLocalReferencePosition(segment: ISegment | "start" | "end", offset: number | undefined, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
194
- /**
195
- * Removes a `LocalReferencePosition` from this client.
196
- */
197
- removeLocalReferencePosition(lref: LocalReferencePosition): LocalReferencePosition | undefined;
198
- /**
199
- * Resolves a `ReferencePosition` into a character position using this client's perspective.
200
- *
201
- * Reference positions that point to a character that has been removed will
202
- * always return the position of the nearest non-removed character, regardless
203
- * of {@link ReferenceType}. To handle this case specifically, one may wish
204
- * to look at the segment returned by {@link ReferencePosition.getSegment}.
205
- */
206
- localReferencePositionToPosition(lref: ReferencePosition): number;
207
- /**
208
- * Given a position specified relative to a marker id, lookup the marker
209
- * and convert the position to a character position.
210
- * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.
211
- */
212
- posFromRelativePos(relativePos: IRelativePosition): number;
213
- getMarkerFromId(id: string): ISegment | undefined;
214
- /**
215
- * Revert an op
216
- */
217
- rollback?(op: any, localOpMetadata: unknown): void;
218
- private applyObliterateRangeOp;
219
- /**
220
- * Performs the remove based on the provided op
221
- * @param opArgs - The ops args for the op
222
- */
223
- private applyRemoveRangeOp;
224
- /**
225
- * Performs the annotate based on the provided op
226
- * @param opArgs - The ops args for the op
227
- */
228
- private applyAnnotateRangeOp;
229
- /**
230
- * Performs the insert based on the provided op
231
- * @param opArgs - The ops args for the op
232
- * @returns True if the insert was applied. False if it could not be.
233
- */
234
- private applyInsertOp;
235
- /**
236
- * Returns a valid range for the op, or undefined
237
- * @param op - The op to generate the range for
238
- * @param clientArgs - The client args for the op
239
- */
240
- private getValidOpRange;
241
- /**
242
- * Gets the client args from the op if remote, otherwise uses the local clients info
243
- * @param sequencedMessage - The sequencedMessage to get the client sequence args for
244
- */
245
- private getClientSequenceArgsForMessage;
246
- /**
247
- * Gets the client args from the op if remote, otherwise uses the local clients info
248
- * @param opArgs - The op arg to get the client sequence args for
249
- */
250
- private getClientSequenceArgs;
251
- private ackPendingSegment;
252
- getOrAddShortClientId(longClientId: string): number;
253
- protected getShortClientId(longClientId: string): number;
254
- getLongClientId(shortClientId: number): string;
255
- addLongClientId(longClientId: string): void;
256
- private getOrAddShortClientIdFromMessage;
257
- /**
258
- * During reconnect, we must find the positions to pending segments
259
- * relative to other pending segments. This methods computes that
260
- * position relative to a localSeq. Pending segments above the localSeq
261
- * will be ignored.
262
- *
263
- * @param segment - The segment to find the position for
264
- * @param localSeq - The localSeq to find the position of the segment at
265
- */
266
- findReconnectionPosition(segment: ISegment, localSeq: number): number;
267
- private resetPendingDeltaToOps;
268
- private applyRemoteOp;
269
- applyStashedOp(op: IMergeTreeOp): void;
270
- applyMsg(msg: ISequencedDocumentMessage, local?: boolean): void;
271
- private updateSeqNumbers;
272
- /**
273
- * Resolves a remote client's position against the local sequence
274
- * and returns the remote client's position relative to the local
275
- * sequence
276
- * @param remoteClientPosition - The remote client's position to resolve
277
- * @param remoteClientRefSeq - The reference sequence number of the remote client
278
- * @param remoteClientId - The client id of the remote client
279
- */
280
- resolveRemoteClientPosition(remoteClientPosition: number, remoteClientRefSeq: number, remoteClientId: string): number | undefined;
281
- private lastNormalizationRefSeq;
282
- private pendingRebase;
283
- /**
284
- * Given a pending operation and segment group, regenerate the op, so it
285
- * can be resubmitted
286
- * @param resetOp - The op to reset
287
- * @param segmentGroup - The segment group associated with the op
288
- */
289
- regeneratePendingOp(resetOp: IMergeTreeOp, segmentGroup: SegmentGroup | SegmentGroup[]): IMergeTreeOp;
290
- createTextHelper(): IMergeTreeTextHelper;
291
- summarize(runtime: IFluidDataStoreRuntime, handle: IFluidHandle, serializer: IFluidSerializer, catchUpMsgs: ISequencedDocumentMessage[]): ISummaryTreeWithStats;
292
- load(runtime: IFluidDataStoreRuntime, storage: IChannelStorageService, serializer: IFluidSerializer): Promise<{
293
- catchupOpsP: Promise<ISequencedDocumentMessage[]>;
294
- }>;
295
- private getLocalSequenceNumber;
296
- localTransaction(groupOp: IMergeTreeGroupMsg): void;
297
- updateMinSeq(minSeq: number): void;
298
- getContainingSegment<T extends ISegment>(pos: number, sequenceArgs?: Pick<ISequencedDocumentMessage, "referenceSequenceNumber" | "clientId">, localSeq?: number): {
299
- segment: T | undefined;
300
- offset: number | undefined;
301
- };
302
- getPropertiesAtPosition(pos: number): PropertySet | undefined;
303
- getRangeExtentsOfPosition(pos: number): {
304
- posStart: number | undefined;
305
- posAfterEnd: number | undefined;
306
- };
307
- getCurrentSeq(): number;
308
- getClientId(): number;
309
- getLength(): number;
310
- startOrUpdateCollaboration(longClientId: string | undefined, minSeq?: number, currentSeq?: number): void;
311
- /**
312
- * Searches a string for the nearest marker in either direction to a given start position.
313
- * The search will include the start position, so markers at the start position are valid
314
- * results of the search. Makes use of block-accelerated search functions for log(n) complexity.
315
- *
316
- * @param startPos - Position at which to start the search
317
- * @param markerLabel - Label of the marker to search for
318
- * @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`
319
- */
320
- searchForMarker(startPos: number, markerLabel: string, forwards?: boolean): Marker | undefined;
321
- }
322
-
323
- /**
324
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
325
- * @alpha
326
- */
327
- export declare class CollaborationWindow {
328
- clientId: number;
329
- collaborating: boolean;
330
- /**
331
- * Lowest-numbered segment in window; no client can reference a state before this one
332
- */
333
- minSeq: number;
334
- /**
335
- * Highest-numbered segment in window and current reference sequence number for this client.
336
- */
337
- currentSeq: number;
338
- /**
339
- * Highest-numbered localSeq used for a pending segment.
340
- * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:
341
- * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.
342
- *
343
- * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree
344
- * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.
345
- *
346
- * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from
347
- * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.
348
- *
349
- * For example, imagine a client with initial state "123456" submits some ops to create the text "123456ABC".
350
- * If they insert the "C" first, then "B", then "A", their local segment state might look like this:
351
- * ```js
352
- * [
353
- * { seq: 0, text: "1234" },
354
- * { seq: 5, text: "56" },
355
- * { localSeq: 3, seq: UnassignedSequenceNumber, text: "A" },
356
- * { localSeq: 2, seq: UnassignedSequenceNumber, text: "B" },
357
- * { localSeq: 1, seq: UnassignedSequenceNumber, text: "C" },
358
- * ]
359
- * ```
360
- * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)
361
- *
362
- * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate
363
- * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.
364
- *
365
- * It will generate the ops
366
- * 1. \{ pos: 6, text: "C" \}
367
- * 2. \{ pos: 6, text: "B" \}
368
- * 3. \{ pos: 6, text: "A" \}
369
- *
370
- * since when submitting the first op, remote clients don't know that this client is about to submit the "A" and "B".
371
- *
372
- * On the other hand, imagine if the client had originally submitted the ops in the order "A", "B", "C"
373
- * such that the segments' local state was instead:
374
- *
375
- * ```js
376
- * [
377
- * { seq: 0, text: "1234" },
378
- * { seq: 5, text: "56" },
379
- * { localSeq: 1, seq: UnassignedSequenceNumber, text: "A" },
380
- * { localSeq: 2, seq: UnassignedSequenceNumber, text: "B" },
381
- * { localSeq: 3, seq: UnassignedSequenceNumber, text: "C" },
382
- * ]
383
- * ```
384
- *
385
- * The resubmitted ops should instead be:
386
- * 1. \{ pos: 6, text: "A" \}
387
- * 2. \{ pos: 7, text: "B" \}
388
- * 3. \{ pos: 8, text: "C" \}
389
- *
390
- * since remote clients will have seen the "A" when processing the "B" as well as both the "A" and "B" when processing the "C".
391
- * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing
392
- * in `localSeq`.
393
- *
394
- * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client
395
- * was disconnected, the resubmitted ops end up matching the original ops exactly.
396
- * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked
397
- * and local information as appropriate.
398
- * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible
399
- * from a given (seq, localSeq) perspective.
400
- */
401
- localSeq: number;
402
- loadFrom(a: CollaborationWindow): void;
403
- }
404
-
405
- /**
406
- * @internal
407
- */
408
- export declare function compareReferencePositions(a: ReferencePosition, b: ReferencePosition): number;
409
-
410
- /**
411
- * @internal
412
- */
413
- export declare type ConflictAction<TKey, TData> = (key: TKey, currentKey: TKey, data: TData, currentData: TData) => QProperty<TKey, TData>;
414
-
415
- /**
416
- * Creates the op for annotating the range with the provided properties
417
- * @param start - The inclusive start position of the range to annotate
418
- * @param end - The exclusive end position of the range to annotate
419
- * @param props - The properties to annotate the range with
420
- * @returns The annotate op
421
- *
422
- * @internal
423
- */
424
- export declare function createAnnotateRangeOp(start: number, end: number, props: PropertySet): IMergeTreeAnnotateMsg;
425
-
426
- /**
427
- * @internal
428
- */
429
- export declare function createDetachedLocalReferencePosition(refType?: ReferenceType): LocalReferencePosition;
430
-
431
- /**
432
- *
433
- * @param ops - The ops to group
434
- *
435
- * @deprecated The ability to create group ops will be removed in an upcoming
436
- * release, as group ops are redundant with he native batching capabilities of
437
- * the runtime
438
- *
439
- * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with he native batching capabilities of the runtime
440
- * @internal
441
- */
442
- export declare function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg;
443
-
444
- /**
445
- * @returns An {@link AttributionPolicy} which tracks only insertion of content.
446
- * @internal
447
- */
448
- export declare function createInsertOnlyAttributionPolicy(): AttributionPolicy;
449
-
450
- /**
451
- * @internal
452
- */
453
- export declare function createInsertOp(pos: number, segSpec: any): IMergeTreeInsertMsg;
454
-
455
- /**
456
- *
457
- * @param pos - The position to insert the segment at
458
- * @param segment - The segment to insert
459
- *
460
- * @internal
461
- */
462
- export declare function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg;
463
-
464
- /**
465
- * @deprecated This functionality was not intended for public export and will
466
- * be removed in a future release.
467
- * @internal
468
- */
469
- export declare function createMap<T>(): MapLike<T>;
470
-
471
- /**
472
- * Creates the op to obliterate a range
473
- *
474
- * @param start - The inclusive start of the range to obliterate
475
- * @param end - The exclusive end of the range to obliterate
476
- *
477
- * @internal
478
- */
479
- export declare function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg;
480
-
481
- /**
482
- * Creates the op to remove a range
483
- *
484
- * @param start - The inclusive start of the range to remove
485
- * @param end - The exclusive end of the range to remove
486
- *
487
- * @internal
488
- */
489
- export declare function createRemoveRangeOp(start: number, end: number): IMergeTreeRemoveMsg;
490
-
491
- /**
492
- * Get a human-readable string for a given {@link Marker}.
493
- *
494
- * @remarks This function is intended for debugging only. The exact format of
495
- * this string should not be relied upon between versions.
496
- * @internal
497
- */
498
- export declare function debugMarkerToString(marker: Marker): string;
499
-
500
- /**
501
- * @internal
502
- */
503
- export declare const DetachedReferencePosition = -1;
504
-
505
- /**
506
- * @internal
507
- */
508
- export declare interface Dictionary<TKey, TData> {
509
- get(key: TKey): Property<TKey, TData> | undefined;
510
- put(key: TKey, data: TData, conflict?: ConflictAction<TKey, TData>): void;
511
- remove(key: TKey): void;
512
- map<TAccum>(action: PropertyAction<TKey, TData>, accum?: TAccum): void;
513
- }
514
-
515
- /**
516
- * @alpha
517
- */
518
- export declare function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;
519
-
520
- /**
521
- * Returns the position to slide a reference to if a slide is required.
522
- * @param segoff - The segment and offset to slide from
523
- * @returns segment and offset to slide the reference to
524
- * @internal
525
- */
526
- export declare function getSlideToSegoff(segoff: {
527
- segment: ISegment | undefined;
528
- offset: number | undefined;
529
- }, slidingPreference?: SlidingPreference, useNewSlidingBehavior?: boolean): {
530
- segment: ISegment | undefined;
531
- offset: number | undefined;
532
- };
533
-
534
- /**
535
- * @alpha
536
- */
537
- export declare interface IAttributionCollection<T> {
538
- /**
539
- * Retrieves the attribution key associated with the provided offset.
540
- * @param channel - When specified, gets an attribution key associated with a particular channel.
541
- */
542
- getAtOffset(offset: number, channel?: string): AttributionKey | undefined;
543
- /**
544
- * Total length of all attribution keys in this collection.
545
- */
546
- readonly length: number;
547
- readonly channelNames: Iterable<string>;
548
- /**
549
- * Retrieve all key/offset pairs stored on this segment. Entries should be ordered by offset, such that
550
- * the `i`th result's attribution key applies to offsets in the open range between the `i`th offset and the
551
- * `i+1`th offset.
552
- * The last entry's key applies to the open interval from the last entry's offset to this collection's length.
553
- */
554
- getAll(): IAttributionCollectionSpec<T>;
555
- /***/
556
- splitAt(pos: number): IAttributionCollection<T>;
557
- /***/
558
- append(other: IAttributionCollection<T>): void;
559
- /***/
560
- clone(): IAttributionCollection<T>;
561
- /**
562
- * Updates this collection with new attribution data.
563
- * @param name - Name of the channel that requires an update. Undefined signifies the root channel.
564
- * Updates apply only to the individual channel (i.e. if an attribution policy needs to update the root
565
- * channel and 4 other channels, it should call `.update` 5 times).
566
- * @param channel - Updated collection for that channel.
567
- */
568
- update(name: string | undefined, channel: IAttributionCollection<T>): void;
569
- }
570
-
571
- /**
572
- * @alpha
573
- * @sealed
574
- */
575
- export declare interface IAttributionCollectionSerializer {
576
- /***/
577
- serializeAttributionCollections(segments: Iterable<{
578
- attribution?: IAttributionCollection<AttributionKey>;
579
- cachedLength: number;
580
- }>): SerializedAttributionCollection;
581
- /**
582
- * Populates attribution information on segments using the provided summary.
583
- */
584
- populateAttributionCollections(segments: Iterable<ISegment>, summary: SerializedAttributionCollection): void;
585
- }
586
-
587
- /**
588
- * @alpha
589
- */
590
- export declare interface IAttributionCollectionSpec<T> {
591
- root: Iterable<{
592
- offset: number;
593
- key: T | null;
594
- }>;
595
- channels?: {
596
- [name: string]: Iterable<{
597
- offset: number;
598
- key: T | null;
599
- }>;
600
- };
601
- length: number;
602
- }
603
-
604
- /**
605
- * Emitted before this client's merge-tree normalizes its segments on reconnect, potentially
606
- * ordering them. Useful for DDS-like consumers built atop the merge-tree to compute any information
607
- * they need for rebasing their ops on reconnection.
608
- * @alpha
609
- */
610
- export declare interface IClientEvents {
611
- (event: "normalize", listener: (target: IEventThisPlaceHolder) => void): void;
612
- (event: "delta", listener: (opArgs: IMergeTreeDeltaOpArgs, deltaArgs: IMergeTreeDeltaCallbackArgs, target: IEventThisPlaceHolder) => void): void;
613
- (event: "maintenance", listener: (args: IMergeTreeMaintenanceCallbackArgs, deltaArgs: IMergeTreeDeltaOpArgs | undefined, target: IEventThisPlaceHolder) => void): void;
614
- }
615
-
616
- /**
617
- * @alpha
618
- */
619
- export declare interface IJSONMarkerSegment extends IJSONSegment {
620
- marker: IMarkerDef;
621
- }
622
-
623
- /**
624
- * @alpha
625
- */
626
- export declare interface IJSONSegment {
627
- props?: Record<string, any>;
628
- }
629
-
630
- /**
631
- * @alpha
632
- */
633
- export declare interface IJSONTextSegment extends IJSONSegment {
634
- text: string;
635
- }
636
-
637
- /**
638
- * @alpha
639
- */
640
- export declare interface IMarkerDef {
641
- refType?: ReferenceType;
642
- }
643
-
644
- /**
645
- * Common properties for a node in a merge tree.
646
- * @alpha
647
- */
648
- export declare interface IMergeNodeCommon {
649
- /**
650
- * The index of this node in its parent's list of children.
651
- */
652
- index: number;
653
- /**
654
- * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.
655
- * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.
656
- */
657
- ordinal: string;
658
- isLeaf(): this is ISegment;
659
- }
660
-
661
- /**
662
- * @alpha
663
- */
664
- export declare interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {
665
- type: typeof MergeTreeDeltaType.ANNOTATE;
666
- pos1?: number;
667
- relativePos1?: IRelativePosition;
668
- pos2?: number;
669
- relativePos2?: IRelativePosition;
670
- props: Record<string, any>;
671
- }
672
-
673
- /**
674
- * @alpha
675
- */
676
- export declare interface IMergeTreeAttributionOptions {
677
- /**
678
- * If enabled, segments will store attribution keys which can be used with the runtime to determine
679
- * attribution information (i.e. who created the content and when it was created).
680
- *
681
- * This flag only applied to new documents: if a snapshot is loaded, whether or not attribution keys
682
- * are tracked is determined by the presence of existing attribution keys in the snapshot.
683
- *
684
- * default: false
685
- */
686
- track?: boolean;
687
- /**
688
- * Provides a policy for how to track attribution data on segments.
689
- * This option must be provided if either:
690
- * - `track` is set to true
691
- * - a document containing existing attribution information is loaded
692
- */
693
- policyFactory?: () => AttributionPolicy;
694
- }
695
-
696
- /**
697
- * @internal
698
- */
699
- export declare interface IMergeTreeClientSequenceArgs {
700
- readonly clientId: number;
701
- readonly referenceSequenceNumber: number;
702
- readonly sequenceNumber: number;
703
- }
704
-
705
- /**
706
- * @alpha
707
- */
708
- export declare interface IMergeTreeDelta {
709
- /**
710
- * Type of this change.
711
- */
712
- type: MergeTreeDeltaType;
713
- }
714
-
715
- /**
716
- * @alpha
717
- */
718
- export declare interface IMergeTreeDeltaCallbackArgs<TOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType> {
719
- readonly operation: TOperationType;
720
- readonly deltaSegments: IMergeTreeSegmentDelta[];
721
- }
722
-
723
- /**
724
- * @alpha
725
- */
726
- export declare type IMergeTreeDeltaOp = IMergeTreeInsertMsg | IMergeTreeRemoveMsg | IMergeTreeAnnotateMsg | IMergeTreeObliterateMsg;
727
-
728
- /**
729
- * @alpha
730
- */
731
- export declare interface IMergeTreeDeltaOpArgs {
732
- /**
733
- * The group op which contains the operation
734
- * if there operation is part of a group op.
735
- */
736
- readonly groupOp?: IMergeTreeGroupMsg;
737
- /**
738
- * The merge tree operation
739
- */
740
- readonly op: IMergeTreeOp;
741
- /**
742
- * Get the sequence message, should only be null if the
743
- * Delta op args are for an unacked local change
744
- */
745
- readonly sequencedMessage?: ISequencedDocumentMessage;
746
- }
747
-
748
- /**
749
- * @deprecated The ability to create group ops will be removed in an upcoming
750
- * release, as group ops are redundant with the native batching capabilities
751
- * of the runtime
752
- *
753
- * @alpha
754
- */
755
- export declare interface IMergeTreeGroupMsg extends IMergeTreeDelta {
756
- type: typeof MergeTreeDeltaType.GROUP;
757
- ops: IMergeTreeDeltaOp[];
758
- }
759
-
760
- /**
761
- * @alpha
762
- */
763
- export declare interface IMergeTreeInsertMsg extends IMergeTreeDelta {
764
- type: typeof MergeTreeDeltaType.INSERT;
765
- pos1?: number;
766
- relativePos1?: IRelativePosition;
767
- pos2?: number;
768
- relativePos2?: IRelativePosition;
769
- seg?: any;
770
- }
771
-
772
- /**
773
- * @alpha
774
- */
775
- export declare interface IMergeTreeMaintenanceCallbackArgs extends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> {
776
- }
777
-
778
- /**
779
- * @deprecated We no longer intend to support this functionality and it will
780
- * be removed in a future release. There is no replacement for this
781
- * functionality.
782
- * @alpha
783
- */
784
- export declare interface IMergeTreeObliterateMsg extends IMergeTreeDelta {
785
- type: typeof MergeTreeDeltaType.OBLITERATE;
786
- pos1?: number;
787
- /**
788
- * This field is currently unused, but we keep it around to make the union
789
- * type of all merge-tree messages have the same fields
790
- */
791
- relativePos1?: never;
792
- pos2?: number;
793
- /**
794
- * This field is currently unused, but we keep it around to make the union
795
- * type of all merge-tree messages have the same fields
796
- */
797
- relativePos2?: never;
798
- }
799
-
800
- /**
801
- * @alpha
802
- */
803
- export declare type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;
804
-
805
- /**
806
- * @alpha
807
- */
808
- export declare interface IMergeTreeOptions {
809
- catchUpBlobName?: string;
810
- /**
811
- * Whether or not reference positions can slide to special endpoint segments
812
- * denoting the positions immediately before the start and immediately after
813
- * the end of the string.
814
- *
815
- * This is primarily useful in the case of interval stickiness.
816
- */
817
- mergeTreeReferencesCanSlideToEndpoint?: boolean;
818
- mergeTreeSnapshotChunkSize?: number;
819
- /**
820
- * Whether to use the SnapshotV1 format over SnapshotLegacy.
821
- *
822
- * SnapshotV1 stores a view of the merge-tree at the current sequence number, preserving merge metadata
823
- * (e.g. clientId, seq, etc.) only for segment changes within the collab window.
824
- *
825
- * SnapshotLegacy stores a view of the merge-tree at the minimum sequence number along with the ops between
826
- * the minimum sequence number and the current sequence number.
827
- *
828
- * Both formats merge segments where possible (see {@link ISegment.canAppend})
829
- *
830
- * default: false
831
- *
832
- * @remarks
833
- * Despite the "legacy"/"V1" naming, both formats are actively used at the time of writing. SharedString
834
- * uses legacy and Matrix uses V1.
835
- */
836
- newMergeTreeSnapshotFormat?: boolean;
837
- /**
838
- * Options related to attribution
839
- */
840
- attribution?: IMergeTreeAttributionOptions;
841
- /**
842
- * Enables support for the obliterate operation -- a stronger form of remove
843
- * which deletes concurrently inserted segments
844
- *
845
- * Obliterate is currently experimental and may not work in all scenarios.
846
- *
847
- * Default value: false
848
- */
849
- mergeTreeEnableObliterate?: boolean;
850
- }
851
-
852
- /**
853
- * @alpha
854
- */
855
- export declare interface IMergeTreeRemoveMsg extends IMergeTreeDelta {
856
- type: typeof MergeTreeDeltaType.REMOVE;
857
- pos1?: number;
858
- relativePos1?: IRelativePosition;
859
- pos2?: number;
860
- relativePos2?: IRelativePosition;
861
- }
862
-
863
- /**
864
- * @alpha
865
- */
866
- export declare interface IMergeTreeSegmentDelta {
867
- segment: ISegment;
868
- propertyDeltas?: PropertySet;
869
- }
870
-
871
- /**
872
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
873
- * @alpha
874
- */
875
- export declare interface IMergeTreeTextHelper {
876
- getText(refSeq: number, clientId: number, placeholder: string, start?: number, end?: number): string;
877
- }
878
-
879
- /**
880
- * Tracks information about when and where this segment was moved to.
881
- *
882
- * Note that merge-tree does not currently support moving and only supports
883
- * obliterate. The fields below include "move" in their names to avoid renaming
884
- * in the future, when moves _are_ supported.
885
- * @alpha
886
- */
887
- export declare interface IMoveInfo {
888
- /**
889
- * Local seq at which this segment was moved if the move is yet-to-be
890
- * acked.
891
- */
892
- localMovedSeq?: number;
893
- /**
894
- * The first seq at which this segment was moved.
895
- */
896
- movedSeq: number;
897
- /**
898
- * All seqs at which this segment was moved. In the case of overlapping,
899
- * concurrent moves this array will contain multiple seqs.
900
- *
901
- * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.
902
- *
903
- * The first element corresponds to the seq of the first move
904
- */
905
- movedSeqs: number[];
906
- /**
907
- * A reference to the inserted destination segment corresponding to this
908
- * segment's move.
909
- *
910
- * If undefined, the move was an obliterate.
911
- *
912
- * Currently this field is unused, as we only support obliterate operations
913
- */
914
- moveDst?: ReferencePosition;
915
- /**
916
- * List of client IDs that have moved this segment.
917
- *
918
- * The client that actually moved the segment (i.e. whose move op was sequenced
919
- * first) is stored as the first client in this list. Other clients in the
920
- * list have all issued concurrent ops to move the segment.
921
- */
922
- movedClientIds: number[];
923
- /**
924
- * If this segment was inserted into a concurrently moved range and
925
- * the move op was sequenced before the insertion op. In this case,
926
- * the segment is visible only to the inserting client
927
- *
928
- * `wasMovedOnInsert` only applies for acked obliterates. That is, if
929
- * a segment inserted by a remote client is moved on insertion by a local
930
- * and unacked obliterate, we do not consider it as having been moved
931
- * on insert
932
- *
933
- * If a segment is moved on insertion, its length is only ever visible to
934
- * the client that inserted the segment. This is relevant in partial length
935
- * calculations
936
- */
937
- wasMovedOnInsert: boolean;
938
- }
939
-
940
- /**
941
- * @internal
942
- */
943
- export declare interface IRBAugmentation<TKey, TData> {
944
- update(node: RBNode<TKey, TData>): void;
945
- }
946
-
947
- /**
948
- * @internal
949
- */
950
- export declare interface IRBMatcher<TKey, TData> {
951
- continueSubtree(node: RBNode<TKey, TData> | undefined, key: TKey): boolean;
952
- matchNode(node: RBNode<TKey, TData> | undefined, key: TKey): boolean;
953
- }
954
-
955
- /**
956
- * A position specified relative to a segment.
957
- * @alpha
958
- */
959
- export declare interface IRelativePosition {
960
- /**
961
- * String identifier specifying a segment.
962
- */
963
- id?: string;
964
- /**
965
- * If true, insert before the specified segment. If false or not defined,
966
- * insert after the specified segment.
967
- */
968
- before?: boolean;
969
- /**
970
- * A positive number \>= 1. If before is false, offset is added to the position.
971
- * If before is true, offset is subtracted from the position.
972
- */
973
- offset?: number;
974
- }
975
-
976
- /**
977
- * Contains removal information associated to an {@link ISegment}.
978
- * @alpha
979
- */
980
- export declare interface IRemovalInfo {
981
- /**
982
- * Local seq at which this segment was removed, if the removal is yet-to-be acked.
983
- */
984
- localRemovedSeq?: number;
985
- /**
986
- * Seq at which this segment was removed.
987
- */
988
- removedSeq: number;
989
- /**
990
- * List of client IDs that have removed this segment.
991
- * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first
992
- * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.
993
- * @remarks When this list has length \> 1, this is referred to as the "overlapping remove" case.
994
- */
995
- removedClientIds: number[];
996
- }
997
-
998
- /**
999
- * A segment representing a portion of the merge tree.
1000
- * Segments are leaf nodes of the merge tree and contain data.
1001
- * @alpha
1002
- */
1003
- export declare interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {
1004
- readonly type: string;
1005
- readonly segmentGroups: SegmentGroupCollection;
1006
- readonly trackingCollection: TrackingGroupCollection;
1007
- /**
1008
- * Whether or not this segment is a special segment denoting the start or
1009
- * end of the tree
1010
- *
1011
- * Endpoint segments are imaginary segments positioned immediately before or
1012
- * after the tree. These segments cannot be referenced by regular operations
1013
- * and exist primarily as a bucket for local references to slide onto during
1014
- * deletion of regular segments.
1015
- */
1016
- readonly endpointType?: "start" | "end";
1017
- /**
1018
- * The length of the contents of the node.
1019
- */
1020
- cachedLength: number;
1021
- /**
1022
- * Stores attribution keys associated with offsets of this segment.
1023
- * This data is only persisted if MergeTree's `attributions.track` flag is set to true.
1024
- * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have
1025
- * `attribution === undefined` until ack.
1026
- *
1027
- * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.
1028
- * @remarks There are plans to make the shape of the data stored extensible in a couple ways:
1029
- *
1030
- * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of
1031
- * content but keeping the old attribution information).
1032
- *
1033
- * 2. Storage of multiple "channels" of information (ex: track property changes separately from insertion,
1034
- * or only attribute certain property modifications, etc.)
1035
- */
1036
- attribution?: IAttributionCollection<AttributionKey>;
1037
- /**
1038
- * Manages pending local state for properties on this segment.
1039
- */
1040
- propertyManager?: PropertiesManager;
1041
- /**
1042
- * Local seq at which this segment was inserted.
1043
- * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.
1044
- * Once the segment is acked, this field is cleared.
1045
- *
1046
- * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.
1047
- */
1048
- localSeq?: number;
1049
- /**
1050
- * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to
1051
- * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`
1052
- * will be updated to the seq at which that client removed this segment.
1053
- *
1054
- * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.
1055
- * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.
1056
- */
1057
- localRemovedSeq?: number;
1058
- /**
1059
- * Seq at which this segment was inserted.
1060
- * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.
1061
- */
1062
- seq?: number;
1063
- /**
1064
- * Short clientId for the client that inserted this segment.
1065
- */
1066
- clientId: number;
1067
- /**
1068
- * Local references added to this segment.
1069
- */
1070
- localRefs?: LocalReferenceCollection;
1071
- /**
1072
- * Properties that have been added to this segment via annotation.
1073
- */
1074
- properties?: PropertySet;
1075
- /**
1076
- * Add properties to this segment via annotation.
1077
- *
1078
- * @remarks This function should not be called directly. Properties should
1079
- * be added through the `annotateRange` functions.
1080
- */
1081
- addProperties(newProps: PropertySet, seq?: number, collaborating?: boolean, rollback?: PropertiesRollback): PropertySet;
1082
- clone(): ISegment;
1083
- canAppend(segment: ISegment): boolean;
1084
- append(segment: ISegment): void;
1085
- splitAt(pos: number): ISegment | undefined;
1086
- toJSONObject(): any;
1087
- /**
1088
- * Acks the current segment against the segment group, op, and merge tree.
1089
- *
1090
- * @param segmentGroup - Pending segment group associated with this op.
1091
- * @param opArgs - Information about the op that was acked
1092
- * @returns `true` if the op modifies the segment, otherwise `false`.
1093
- * The only current false case is overlapping remove, where a segment is removed
1094
- * by a previously sequenced operation before the current operation is acked.
1095
- * @throws - error if the segment state doesn't match segment group or op.
1096
- * E.g. if the segment group is not first in the pending queue, or
1097
- * an inserted segment does not have unassigned sequence number.
1098
- */
1099
- ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;
1100
- }
1101
-
1102
- /**
1103
- * @alpha
1104
- */
1105
- export declare interface ISegmentAction<TClientData> {
1106
- (segment: ISegment, pos: number, refSeq: number, clientId: number, start: number, end: number, accum: TClientData): boolean;
1107
- }
1108
-
1109
- /**
1110
- * Tests whether x is a MergeTreeDeltaRevertible
1111
- * @internal
1112
- */
1113
- export declare function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible;
1114
-
1115
- /**
1116
- * @alpha
1117
- */
1118
- export declare interface ITrackingGroup {
1119
- tracked: readonly Trackable[];
1120
- size: number;
1121
- has(trackable: Trackable): boolean;
1122
- link(trackable: Trackable): void;
1123
- unlink(trackable: Trackable): boolean;
1124
- }
1125
-
1126
- /**
1127
- * @internal
1128
- */
1129
- export declare interface KeyComparer<TKey> {
1130
- (a: TKey, b: TKey): number;
1131
- }
1132
-
1133
- /**
1134
- * Represents a collection of {@link LocalReferencePosition}s associated with
1135
- * one segment in a merge-tree.
1136
- * Represents a collection of {@link LocalReferencePosition}s associated with one segment in a merge-tree.
1137
- * @sealed
1138
- *
1139
- * @alpha
1140
- */
1141
- export declare class LocalReferenceCollection {
1142
- /** Segment this `LocalReferenceCollection` is associated to. */
1143
- private readonly segment;
1144
- static append(seg1: ISegment, seg2: ISegment): void;
1145
- static setOrGet(segment: ISegment): LocalReferenceCollection;
1146
- private readonly refsByOffset;
1147
- private refCount;
1148
- /***/
1149
- private constructor();
1150
- /**
1151
- * @remarks This method should only be called by mergeTree.
1152
- */
1153
- [Symbol.iterator](): {
1154
- next(): IteratorResult<LocalReferencePosition>;
1155
- [Symbol.iterator](): any;
1156
- };
1157
- /**
1158
- * @remarks This method should only be called by mergeTree.
1159
- */
1160
- get empty(): boolean;
1161
- /**
1162
- * @remarks This method should only be called by mergeTree.
1163
- */
1164
- createLocalRef(offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference, canSlideToEndpoint?: boolean): LocalReferencePosition;
1165
- /**
1166
- * @remarks This method should only be called by mergeTree.
1167
- */
1168
- addLocalRef(lref: LocalReferencePosition, offset: number): void;
1169
- /**
1170
- * @remarks This method should only be called by mergeTree.
1171
- */
1172
- removeLocalRef(lref: LocalReferencePosition): LocalReferencePosition | undefined;
1173
- /**
1174
- *
1175
- * Called by 'append()' implementations to append local refs from the given 'other' segment to the
1176
- * end of 'this' segment.
1177
- *
1178
- * Note: This method should be invoked after the caller has ensured that segments can be merged,
1179
- * but before 'this' segment's cachedLength has changed, or the adjustment to the local refs
1180
- * will be incorrect.
1181
- *
1182
- * @remarks This method should only be called by mergeTree.
1183
- */
1184
- append(other: LocalReferenceCollection): void;
1185
- /**
1186
- * Returns true of the local reference is in the collection, otherwise false.
1187
- *
1188
- * @remarks This method should only be called by mergeTree.
1189
- */
1190
- has(lref: ReferencePosition): boolean;
1191
- /**
1192
- * Splits this `LocalReferenceCollection` into the intervals [0, offset) and [offset, originalLength).
1193
- * Local references in the former half of this split will remain associated with the segment used on construction.
1194
- * Local references in the latter half of this split will be transferred to `splitSeg`,
1195
- * and its `localRefs` field will be set.
1196
- * @param offset - Offset into the original segment at which the collection should be split
1197
- * @param splitSeg - Split segment which originally corresponded to the indices [offset, originalLength)
1198
- * before splitting.
1199
- *
1200
- * @remarks This method should only be called by mergeTree.
1201
- */
1202
- split(offset: number, splitSeg: ISegment): void;
1203
- /**
1204
- * @remarks This method should only be called by mergeTree.
1205
- */
1206
- addBeforeTombstones(...refs: Iterable<LocalReferencePosition>[]): void;
1207
- /**
1208
- * @remarks This method should only be called by mergeTree.
1209
- */
1210
- addAfterTombstones(...refs: Iterable<LocalReferencePosition>[]): void;
1211
- /**
1212
- * @remarks This method should only be called by mergeTree.
1213
- */
1214
- isAfterTombstone(lref: LocalReferencePosition): boolean;
1215
- /**
1216
- * @remarks This method should only be called by mergeTree.
1217
- */
1218
- walkReferences(visitor: (lref: LocalReferencePosition) => boolean | void | undefined, start?: LocalReferencePosition, forward?: boolean): boolean;
1219
- }
1220
-
1221
- /**
1222
- * @sealed
1223
- * @alpha
1224
- */
1225
- export declare interface LocalReferencePosition extends ReferencePosition {
1226
- callbacks?: Partial<Record<"beforeSlide" | "afterSlide", (ref: LocalReferencePosition) => void>>;
1227
- readonly trackingCollection: TrackingGroupCollection;
1228
- /**
1229
- * Whether or not this reference position can slide onto one of the two
1230
- * special segments representing the position before or after the tree
1231
- */
1232
- readonly canSlideToEndpoint?: boolean;
1233
- }
1234
-
1235
- /**
1236
- * Any mapping from a string to values of type `T`
1237
- * @alpha
1238
- */
1239
- export declare interface MapLike<T> {
1240
- [index: string]: T;
1241
- }
1242
-
1243
- /**
1244
- * Markers are a special kind of segment that do not hold any content.
1245
- *
1246
- * Markers with a reference type of {@link ReferenceType.Tile} support spatially
1247
- * accelerated queries for finding the next marker to the left or right of it in
1248
- * sub-linear time. This is useful, for example, in the case of jumping from the
1249
- * start of a paragraph to the end, assuming a paragraph is bound by markers at
1250
- * the start and end.
1251
- *
1252
- * @alpha
1253
- */
1254
- export declare class Marker extends BaseSegment implements ReferencePosition, ISegment {
1255
- refType: ReferenceType;
1256
- static readonly type = "Marker";
1257
- static is(segment: ISegment): segment is Marker;
1258
- readonly type = "Marker";
1259
- static make(refType: ReferenceType, props?: PropertySet): Marker;
1260
- constructor(refType: ReferenceType);
1261
- toJSONObject(): IJSONMarkerSegment;
1262
- static fromJSONObject(spec: any): Marker | undefined;
1263
- clone(): Marker;
1264
- getSegment(): this;
1265
- getOffset(): number;
1266
- getProperties(): PropertySet | undefined;
1267
- getId(): string | undefined;
1268
- toString(): string;
1269
- protected createSplitSegmentAt(pos: number): undefined;
1270
- canAppend(segment: ISegment): boolean;
1271
- append(): void;
1272
- }
1273
-
1274
- /**
1275
- * @internal
1276
- */
1277
- export declare function matchProperties(a: PropertySet | undefined, b: PropertySet | undefined): boolean;
1278
-
1279
- /**
1280
- * @internal
1281
- */
1282
- export declare function maxReferencePosition<T extends ReferencePosition>(a: T, b: T): T;
1283
-
1284
- /**
1285
- * @alpha
1286
- */
1287
- export declare class MergeNode implements IMergeNodeCommon {
1288
- index: number;
1289
- ordinal: string;
1290
- cachedLength: number;
1291
- isLeaf(): this is ISegment;
1292
- }
1293
-
1294
- /**
1295
- * @alpha
1296
- */
1297
- export declare type MergeTreeDeltaOperationType = typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE | typeof MergeTreeDeltaType.OBLITERATE;
1298
-
1299
- /**
1300
- * @alpha
1301
- */
1302
- export declare type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;
1303
-
1304
- /**
1305
- * @alpha
1306
- */
1307
- export declare type MergeTreeDeltaRevertible = {
1308
- operation: typeof MergeTreeDeltaType.INSERT;
1309
- trackingGroup: ITrackingGroup;
1310
- } | {
1311
- operation: typeof MergeTreeDeltaType.REMOVE;
1312
- trackingGroup: ITrackingGroup;
1313
- } | {
1314
- operation: typeof MergeTreeDeltaType.ANNOTATE;
1315
- trackingGroup: ITrackingGroup;
1316
- propertyDeltas: PropertySet;
1317
- };
1318
-
1319
- /**
1320
- * @alpha
1321
- */
1322
- export declare const MergeTreeDeltaType: {
1323
- readonly INSERT: 0;
1324
- readonly REMOVE: 1;
1325
- readonly ANNOTATE: 2;
1326
- /**
1327
- * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with he native batching capabilities of the runtime
1328
- */
1329
- readonly GROUP: 3;
1330
- readonly OBLITERATE: 4;
1331
- };
1332
-
1333
- /**
1334
- * @alpha
1335
- */
1336
- export declare type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];
1337
-
1338
- /**
1339
- * Enum-like constant defining the types of "maintenance" events on a merge tree.
1340
- * Maintenance events correspond to structural segment changes or acks of pending segments.
1341
- *
1342
- * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.
1343
- * @alpha
1344
- */
1345
- export declare const MergeTreeMaintenanceType: {
1346
- /**
1347
- * Notification that a segment "append" has occurred, i.e. two adjacent segments have been merged.
1348
- * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter
1349
- * segment, pre-merge.
1350
- * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get
1351
- * segment [AB], `deltaSegments` would contain [AB] and [B].
1352
- */
1353
- readonly APPEND: -1;
1354
- /**
1355
- * Notification that a segment has been split in two.
1356
- * `deltaSegments` on the corresponding event will contain the resulting two segments.
1357
- */
1358
- readonly SPLIT: -2;
1359
- /**
1360
- * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.
1361
- * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty
1362
- * (e.g., not being tracked for undo/redo).
1363
- * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.
1364
- */
1365
- readonly UNLINK: -3;
1366
- /**
1367
- * Notification that a local change has been acknowledged by the server.
1368
- * This means that it has made the round trip to the server and has had a sequence number assigned.
1369
- */
1370
- readonly ACKNOWLEDGED: -4;
1371
- };
1372
-
1373
- /**
1374
- * @alpha
1375
- */
1376
- export declare type MergeTreeMaintenanceType = (typeof MergeTreeMaintenanceType)[keyof typeof MergeTreeMaintenanceType];
1377
-
1378
- /**
1379
- * @alpha
1380
- */
1381
- export declare interface MergeTreeRevertibleDriver {
1382
- insertFromSpec(pos: number, spec: IJSONSegment): void;
1383
- removeRange(start: number, end: number): void;
1384
- annotateRange(start: number, end: number, props: PropertySet): void;
1385
- }
1386
-
1387
- /**
1388
- * @internal
1389
- */
1390
- export declare function minReferencePosition<T extends ReferencePosition>(a: T, b: T): T;
1391
-
1392
- /**
1393
- * @alpha
1394
- */
1395
- export declare class PropertiesManager {
1396
- private pendingKeyUpdateCount;
1397
- ackPendingProperties(annotateOp: IMergeTreeAnnotateMsg): void;
1398
- private decrementPendingCounts;
1399
- addProperties(oldProps: PropertySet, newProps: PropertySet, seq?: number, collaborating?: boolean, rollback?: PropertiesRollback): PropertySet;
1400
- copyTo(oldProps: PropertySet, newProps: PropertySet | undefined, newManager: PropertiesManager): PropertySet | undefined;
1401
- hasPendingProperties(): boolean;
1402
- hasPendingProperty(key: string): boolean;
1403
- }
1404
-
1405
- /**
1406
- * @alpha
1407
- */
1408
- export declare enum PropertiesRollback {
1409
- /** Not in a rollback */
1410
- None = 0,
1411
- /** Rollback */
1412
- Rollback = 1
1413
- }
1414
-
1415
- /**
1416
- * @internal
1417
- */
1418
- export declare interface Property<TKey, TData> {
1419
- key: TKey;
1420
- data: TData;
1421
- }
1422
-
1423
- /**
1424
- * @internal
1425
- */
1426
- export declare interface PropertyAction<TKey, TData> {
1427
- <TAccum>(p: Property<TKey, TData>, accum?: TAccum): boolean;
1428
- }
1429
-
1430
- /**
1431
- * A loosely-typed mapping from strings to any value.
1432
- *
1433
- * @remarks Property sets are expected to be JSON-stringify-able.
1434
- *
1435
- * @privateRemarks PropertySet is typed using `any` because when you include
1436
- * custom methods such as toJSON(), JSON.stringify accepts most types other than
1437
- * functions
1438
- * @alpha
1439
- */
1440
- export declare type PropertySet = MapLike<any>;
1441
-
1442
- /**
1443
- * @internal
1444
- */
1445
- export declare interface QProperty<TKey, TData> {
1446
- key?: TKey;
1447
- data?: TData;
1448
- }
1449
-
1450
- /**
1451
- * @internal
1452
- */
1453
- export declare const RBColor: {
1454
- readonly RED: 0;
1455
- readonly BLACK: 1;
1456
- };
1457
-
1458
- /**
1459
- * @internal
1460
- */
1461
- export declare type RBColor = (typeof RBColor)[keyof typeof RBColor];
1462
-
1463
- /**
1464
- * @internal
1465
- */
1466
- export declare interface RBNode<TKey, TData> {
1467
- key: TKey;
1468
- data: TData;
1469
- left: RBNode<TKey, TData> | undefined;
1470
- right: RBNode<TKey, TData> | undefined;
1471
- color: RBColor;
1472
- size: number;
1473
- }
1474
-
1475
- /**
1476
- * @internal
1477
- */
1478
- export declare interface RBNodeActions<TKey, TData> {
1479
- infix?(node: RBNode<TKey, TData>): boolean;
1480
- pre?(node: RBNode<TKey, TData>): boolean;
1481
- post?(node: RBNode<TKey, TData>): boolean;
1482
- showStructure?: boolean;
1483
- }
1484
-
1485
- /**
1486
- * @internal
1487
- */
1488
- export declare class RedBlackTree<TKey, TData> implements SortedDictionary<TKey, TData> {
1489
- private readonly compareKeys;
1490
- private readonly aug?;
1491
- private root;
1492
- constructor(compareKeys: KeyComparer<TKey>, aug?: IRBAugmentation<TKey, TData> | undefined);
1493
- private makeNode;
1494
- private isRed;
1495
- private nodeSize;
1496
- size(): number;
1497
- isEmpty(): boolean;
1498
- get(key: TKey): RBNode<TKey, TData> | undefined;
1499
- private nodeGet;
1500
- private contains;
1501
- gather(key: TKey, matcher: IRBMatcher<TKey, TData>): RBNode<TKey, TData>[];
1502
- private nodeGather;
1503
- walkExactMatchesForward(compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (number: number) => boolean, continueRightFn: (number: number) => boolean): void;
1504
- private nodeWalkExactMatchesForward;
1505
- walkExactMatchesBackward(compareFn: (node: RBNode<TKey, TData>) => number, actionFn: (node: RBNode<TKey, TData>) => void, continueLeftFn: (number: number) => boolean, continueRightFn: (number: number) => boolean): void;
1506
- private nodeWalkExactMatchesBackward;
1507
- put(key: TKey, data: TData, conflict?: ConflictAction<TKey, TData>): void;
1508
- private nodePut;
1509
- private updateLocal;
1510
- private nodeRemoveMin;
1511
- remove(key: TKey): void;
1512
- removeExisting(key: TKey): void;
1513
- private nodeRemove;
1514
- /**
1515
- * @returns The largest node in this tree which compares less than or equal to `key`
1516
- */
1517
- floor(key: TKey): RBNode<TKey, TData> | undefined;
1518
- private nodeFloor;
1519
- /**
1520
- * @returns The smallest node in this tree which compares greater than or equal to `key`
1521
- */
1522
- ceil(key: TKey): RBNode<TKey, TData> | undefined;
1523
- private nodeCeil;
1524
- min(): RBNode<TKey, TData> | undefined;
1525
- private nodeMin;
1526
- max(): RBNode<TKey, TData> | undefined;
1527
- private nodeMax;
1528
- private rotateRight;
1529
- private rotateLeft;
1530
- private oppositeColor;
1531
- private flipColors;
1532
- private moveRedLeft;
1533
- private moveRedRight;
1534
- private balance;
1535
- mapRange<TAccum>(action: PropertyAction<TKey, TData>, accum?: TAccum, start?: TKey, end?: TKey): void;
1536
- map<TAccum>(action: PropertyAction<TKey, TData>, accum?: TAccum): void;
1537
- keys(): TKey[];
1538
- /**
1539
- * Depth-first traversal with custom action; if action returns
1540
- * false, traversal is halted.
1541
- * @param action - action to apply to each node
1542
- */
1543
- walk(actions: RBNodeActions<TKey, TData>): void;
1544
- walkBackward(actions: RBNodeActions<TKey, TData>): void;
1545
- private nodeWalk;
1546
- private nodeWalkBackward;
1547
- private nodeMap;
1548
- }
1549
-
1550
- /**
1551
- * Represents a reference to a place within a merge tree. This place conceptually remains stable over time
1552
- * by referring to a particular segment and offset within that segment.
1553
- * Thus, this reference's character position changes as the tree is edited.
1554
- * @alpha
1555
- */
1556
- export declare interface ReferencePosition {
1557
- /**
1558
- * Properties associated with this reference
1559
- */
1560
- properties?: PropertySet;
1561
- /**
1562
- * The direction for this reference position to slide when the segment it
1563
- * points to is removed. See {@link (SlidingPreference:type)} for additional context.
1564
- *
1565
- * Defaults to SlidingPreference.Forward
1566
- */
1567
- slidingPreference?: SlidingPreference;
1568
- refType: ReferenceType;
1569
- /**
1570
- * Gets the segment that this reference position is semantically associated with. Returns undefined iff the
1571
- * reference became detached from the string.
1572
- */
1573
- getSegment(): ISegment | undefined;
1574
- /**
1575
- * Gets the offset for this reference position within its associated segment.
1576
- *
1577
- * @example
1578
- *
1579
- * If a merge-tree has 3 leaf segments ["hello", " ", "world"] and a ReferencePosition refers to the "l"
1580
- * in "world", that reference's offset would be 3 as "l" is the character at index 3 within "world".
1581
- */
1582
- getOffset(): number;
1583
- /**
1584
- * @param newProps - Properties to add to this reference.
1585
- * @remarks Note that merge-tree does not broadcast changes to other clients. It is up to the consumer
1586
- * to ensure broadcast happens if that is desired.
1587
- */
1588
- addProperties(newProps: PropertySet): void;
1589
- isLeaf(): this is ISegment;
1590
- }
1591
-
1592
- /**
1593
- * Flags enum that dictates behavior of a {@link ReferencePosition}
1594
- * @alpha
1595
- */
1596
- export declare enum ReferenceType {
1597
- Simple = 0,
1598
- /**
1599
- * Allows this reference to be located using the `searchForMarker` API on merge-tree.
1600
- */
1601
- Tile = 1,
1602
- /**
1603
- * Denotes that this reference begins the start of an interval. This is
1604
- * generally not meaningful outside the context of interval collections
1605
- * on SharedString.
1606
- */
1607
- RangeBegin = 16,
1608
- /**
1609
- * Denotes that this reference is the end of an interval. This is
1610
- * generally not meaningful outside the context of interval collections
1611
- * on SharedString.
1612
- */
1613
- RangeEnd = 32,
1614
- /**
1615
- * When a segment is marked removed (locally or with ack), this reference will slide to the first
1616
- * valid option of:
1617
- * 1. the start of the next furthest segment
1618
- * 2. the end of the next nearest segment
1619
- * 3. DetachedReferencePosition
1620
- */
1621
- SlideOnRemove = 64,
1622
- /**
1623
- * When a segment is marked removed (locally or with ack), this reference will remain on that segment.
1624
- */
1625
- StayOnRemove = 128,
1626
- /**
1627
- * Specifies that the reference position should never be added to the segment it refers to.
1628
- * This is useful for comparison/iteration purposes
1629
- */
1630
- Transient = 256
1631
- }
1632
-
1633
- /**
1634
- * @internal
1635
- */
1636
- export declare const refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined;
1637
-
1638
- /**
1639
- * @internal
1640
- */
1641
- export declare function refHasTileLabel(refPos: ReferencePosition, label: string): boolean;
1642
-
1643
- /**
1644
- * @internal
1645
- */
1646
- export declare function refHasTileLabels(refPos: ReferencePosition): boolean;
1647
-
1648
- /**
1649
- * @internal
1650
- */
1651
- export declare function refTypeIncludesFlag(refPosOrType: ReferencePosition | ReferenceType, flags: ReferenceType): boolean;
1652
-
1653
- /**
1654
- * The special-cased property key that tracks the id of a {@link Marker}.
1655
- *
1656
- * @remarks In general, marker ids should be accessed using the inherent method
1657
- * {@link Marker.getId}. Marker ids should not be updated after creation.
1658
- * @internal
1659
- */
1660
- export declare const reservedMarkerIdKey = "markerId";
1661
-
1662
- /**
1663
- * @internal
1664
- */
1665
- export declare const reservedMarkerSimpleTypeKey = "markerSimpleType";
1666
-
1667
- /**
1668
- * @internal
1669
- */
1670
- export declare const reservedRangeLabelsKey = "referenceRangeLabels";
1671
-
1672
- /**
1673
- * @internal
1674
- */
1675
- export declare const reservedTileLabelsKey = "referenceTileLabels";
1676
-
1677
- /**
1678
- * @alpha
1679
- */
1680
- export declare function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;
1681
-
1682
- /**
1683
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
1684
- * @alpha
1685
- */
1686
- export declare interface SegmentGroup {
1687
- segments: ISegment[];
1688
- previousProps?: PropertySet[];
1689
- localSeq?: number;
1690
- refSeq: number;
1691
- }
1692
-
1693
- /**
1694
- * @alpha
1695
- */
1696
- export declare class SegmentGroupCollection {
1697
- private readonly segment;
1698
- private readonly segmentGroups;
1699
- constructor(segment: ISegment);
1700
- get size(): number;
1701
- get empty(): boolean;
1702
- enqueue(segmentGroup: SegmentGroup): void;
1703
- dequeue(): SegmentGroup | undefined;
1704
- remove?(segmentGroup: SegmentGroup): boolean;
1705
- pop?(): SegmentGroup | undefined;
1706
- copyTo(segment: ISegment): void;
1707
- private enqueueOnCopy;
1708
- }
1709
-
1710
- /**
1711
- * @alpha
1712
- */
1713
- export declare interface SequenceOffsets {
1714
- /**
1715
- * Parallel array with posBreakpoints which tracks the seq of insertion.
1716
- *
1717
- * @example
1718
- *
1719
- * If seqs is [45, 46] and posBreakpoints is [0, 3], the section of the string
1720
- * between offsets 0 and 3 was inserted at seq 45 and the section of the string between
1721
- * 3 and the length of the string was inserted at seq 46.
1722
- *
1723
- * @remarks We use null here rather than undefined as round-tripping through JSON converts
1724
- * undefineds to null anyway
1725
- */
1726
- seqs: (number | AttributionKey | null)[];
1727
- posBreakpoints: number[];
1728
- }
1729
-
1730
- /**
1731
- * @alpha
1732
- */
1733
- export declare interface SerializedAttributionCollection extends SequenceOffsets {
1734
- channels?: {
1735
- [name: string]: SequenceOffsets;
1736
- };
1737
- length: number;
1738
- }
1739
-
1740
- /**
1741
- * Dictates the preferential direction for a {@link ReferencePosition} to slide
1742
- * in a merge-tree
1743
- * @alpha
1744
- */
1745
- export declare const SlidingPreference: {
1746
- /**
1747
- * Prefer sliding towards the start of the tree
1748
- */
1749
- readonly BACKWARD: 0;
1750
- /**
1751
- * Prefer sliding towards the end of the tree
1752
- */
1753
- readonly FORWARD: 1;
1754
- };
1755
-
1756
- /**
1757
- * Dictates the preferential direction for a {@link ReferencePosition} to slide
1758
- * in a merge-tree
1759
- * @alpha
1760
- */
1761
- export declare type SlidingPreference = (typeof SlidingPreference)[keyof typeof SlidingPreference];
1762
-
1763
- /**
1764
- * @internal
1765
- */
1766
- export declare interface SortedDictionary<TKey, TData> extends Dictionary<TKey, TData> {
1767
- max(): Property<TKey, TData> | undefined;
1768
- min(): Property<TKey, TData> | undefined;
1769
- mapRange<TAccum>(action: PropertyAction<TKey, TData>, accum?: TAccum, start?: TKey, end?: TKey): void;
1770
- }
1771
-
1772
- /**
1773
- * Stores a unique and sorted set of segments, or objects with segments
1774
- *
1775
- * This differs from a normal sorted set in that the keys are not fixed.
1776
- * The segments are sorted via their ordinals which can change as the merge tree is modified.
1777
- * Even though the values of the ordinals can change their ordering and uniqueness cannot, so the order of a set of
1778
- * segments ordered by their ordinals will always have the same order even if the ordinal values on
1779
- * the segments changes. This invariant allows us to ensure the segments stay
1780
- * ordered and unique, and that new segments can be inserted into that order.
1781
- *
1782
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
1783
- * @internal
1784
- */
1785
- export declare class SortedSegmentSet<T extends SortedSegmentSetItem = ISegment> extends SortedSet<T, string> {
1786
- protected getKey(item: T): string;
1787
- protected findItemPosition(item: T): {
1788
- exists: boolean;
1789
- index: number;
1790
- };
1791
- }
1792
-
1793
- /**
1794
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
1795
- * @internal
1796
- */
1797
- export declare type SortedSegmentSetItem = ISegment | LocalReferencePosition | {
1798
- readonly segment: ISegment;
1799
- };
1800
-
1801
- /**
1802
- * @deprecated This functionality was not meant to be exported and will be removed in a future release
1803
- * @internal
1804
- */
1805
- export declare abstract class SortedSet<T, U extends string | number> {
1806
- protected abstract getKey(t: T): U;
1807
- protected readonly keySortedItems: T[];
1808
- get size(): number;
1809
- get items(): readonly T[];
1810
- addOrUpdate(newItem: T, update?: (existingItem: T, newItem: T) => void): void;
1811
- remove(item: T): boolean;
1812
- has(item: T): boolean;
1813
- protected findItemPosition(item: T): {
1814
- exists: boolean;
1815
- index: number;
1816
- };
1817
- }
1818
-
1819
- /**
1820
- * @alpha
1821
- */
1822
- export declare class TextSegment extends BaseSegment {
1823
- text: string;
1824
- static readonly type = "TextSegment";
1825
- readonly type = "TextSegment";
1826
- static is(segment: ISegment): segment is TextSegment;
1827
- static make(text: string, props?: PropertySet): TextSegment;
1828
- static fromJSONObject(spec: any): TextSegment | undefined;
1829
- constructor(text: string);
1830
- toJSONObject(): IJSONTextSegment | string;
1831
- clone(start?: number, end?: number): TextSegment;
1832
- canAppend(segment: ISegment): boolean;
1833
- toString(): string;
1834
- append(segment: ISegment): void;
1835
- protected createSplitSegmentAt(pos: number): TextSegment | undefined;
1836
- }
1837
-
1838
- /**
1839
- * @internal
1840
- */
1841
- export declare function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined;
1842
-
1843
- /**
1844
- * @alpha
1845
- */
1846
- export declare type Trackable = ISegment | LocalReferencePosition;
1847
-
1848
- /**
1849
- * @alpha
1850
- */
1851
- export declare class TrackingGroup implements ITrackingGroup {
1852
- private readonly trackedSet;
1853
- constructor();
1854
- get tracked(): readonly Trackable[];
1855
- get size(): number;
1856
- has(trackable: Trackable): boolean;
1857
- link(trackable: Trackable): void;
1858
- unlink(trackable: Trackable): boolean;
1859
- }
1860
-
1861
- /**
1862
- * A collection of {@link ITrackingGroup}.
1863
- * @alpha
1864
- */
1865
- export declare class TrackingGroupCollection {
1866
- private readonly trackable;
1867
- private readonly _trackingGroups;
1868
- get trackingGroups(): Set<TrackingGroup>;
1869
- constructor(trackable: Trackable);
1870
- link(trackingGroup: ITrackingGroup): void;
1871
- unlink(trackingGroup: ITrackingGroup): boolean;
1872
- copyTo(trackable: Trackable): void;
1873
- get empty(): boolean;
1874
- matches(trackingCollection: TrackingGroupCollection): boolean;
1875
- }
1876
-
1877
- /**
1878
- * The sequence number of an op before it is acked.
1879
- *
1880
- * @internal
1881
- */
1882
- export declare const UnassignedSequenceNumber = -1;
1883
-
1884
- /**
1885
- * The sequence number which can be seen by all ops.
1886
- *
1887
- * This is useful in the context of snapshot loading, rollback, among other
1888
- * scenarios.
1889
- *
1890
- * @internal
1891
- */
1892
- export declare const UniversalSequenceNumber = 0;
1893
-
1894
- export { }