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