@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 +1 @@
1
- {"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA6D;AAE7D,2DAAoD;AAGpD,iDAAkG;AAClG,2DAA+D;AAE/D,iEAAiE;AACjE,qCAAuF;AACvF,6CAA0D;AAE1D,gDAAgD;AAChD,mDAAyE;AACzE,mEAAmG;AACnG,2EAAqE;AACrE,+EAAsF;AA2FtF;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAwC;IACrE,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EAAE;QAC7E,OAAO,KAAqB,CAAC;KAC7B;IACD,IAAA,mBAAM,EACL,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EACxE,KAAK,CAAC,qEAAqE,CAC3E,CAAC;AACH,CAAC;AARD,sCAQC;AAoED,SAAgB,UAAU,CAAC,KA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AAC,CAAC;IAC5C,IAAI,UAAU,EAAE;QACf,IAAI,IAAI,UAAU,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,IAAI,IAAI,IAAI,CAAC;aACb;YACD,IAAI,IAAI,SAAS,CAAC;SAClB;KACD;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,UAAU,EAAE;QACtB,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,wEAAwE;YACxE,uCAAuC;YACvC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,+DAA+D;YAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;KACH;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAlCD,kDAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport { IAttributionCollection } from \"./attributionCollection.js\";\nimport { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nimport { LocalReferenceCollection } from \"./localReference.js\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { computeHierarchicalOrdinal } from \"./ordinal.js\";\nimport { PartialSequenceLengths } from \"./partialLengths.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { clone, createMap, MapLike, PropertySet } from \"./properties.js\";\nimport { refTypeIncludesFlag, ReferencePosition, refGetTileLabels } from \"./referencePositions.js\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager.js\";\n\n/**\n * Common properties for a node in a merge tree.\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n/**\n * someday we may split tree leaves from segments, but for now they are the same\n * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node\n */\nexport type ISegmentLeaf = ISegment & { parent?: IMergeBlock };\nexport type IMergeNode = IMergeBlock | ISegmentLeaf;\n/**\n * Internal (i.e. non-leaf) node in a merge tree.\n * @internal\n */\nexport interface IMergeBlock extends IMergeNodeCommon {\n\tparent?: IMergeBlock;\n\n\tneedsScour?: boolean;\n\t/**\n\t * Number of direct children of this node\n\t */\n\tchildCount: number;\n\t/**\n\t * Array of child nodes.\n\t *\n\t * @remarks To avoid reallocation, this is always initialized to have maximum length as deemed by\n\t * the merge tree's branching factor. Use `childCount` to determine how many children this node actually has.\n\t */\n\tchildren: IMergeNode[];\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number | undefined;\n\thierBlock(): IHierBlock | undefined;\n\tassignChild(child: IMergeNode, index: number, updateOrdinal?: boolean): void;\n\tsetOrdinal(child: IMergeNode, index: number): void;\n}\n\n/**\n * @internal\n */\nexport interface IHierBlock extends IMergeBlock {\n\trightmostTiles: MapLike<ReferencePosition>;\n\tleftmostTiles: MapLike<ReferencePosition>;\n}\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * @internal\n */\nexport function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t */\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\ttoJSONObject(): any;\n\t/**\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: IMergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: IMergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: IMergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n}\n\n/**\n * @alpha\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock extends MergeNode implements IMergeBlock {\n\tparent?: IMergeBlock;\n\tpublic children: IMergeNode[];\n\tpublic constructor(public childCount: number) {\n\t\tsuper();\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t}\n\n\tpublic hierBlock(): IHierBlock | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number) {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true) {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number) {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @alpha\n */\nexport abstract class BaseSegment extends MergeNode implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(this);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t) {\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment) {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment) {\n\t\tif (this.properties) {\n\t\t\tjseg.props = this.properties;\n\t\t}\n\t}\n\n\tpublic abstract toJSONObject(): any;\n\n\t/***/\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE:\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(\n\t\t\t\t\tremovalInfo !== undefined,\n\t\t\t\t\t0x046 /* \"On remove ack, missing removal info!\" */,\n\t\t\t\t);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE:\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tthis.localMovedSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: ISegmentLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tconst thisAsMergeSegment: ISegmentLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment) {\n\t\tif (this.propertyManager) {\n\t\t\tif (this.properties) {\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @internal\n */\nexport const reservedMarkerIdKey = \"markerId\";\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet) {\n\t\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject() {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: any) {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make(spec.marker.refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone() {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment() {\n\t\treturn this;\n\t}\n\n\tgetOffset() {\n\t\treturn 0;\n\t}\n\n\tgetProperties() {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString() {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend() {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow) {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * @internal\n */\nexport const compareNumbers = (a: number, b: number) => a - b;\n\n/**\n * @internal\n */\nexport const compareStrings = (a: string, b: string) => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
1
+ {"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA6D;AAE7D,kEAA6D;AAI7D,iDAAkG;AAClG,2DAA+D;AAE/D,iEAAiE;AACjE,qCAAuF;AACvF,6CAA0D;AAE1D,gDAAgD;AAChD,mDAA8E;AAC9E,mEAAmG;AACnG,2EAAqE;AACrE,+EAAsF;AA+CtF;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAwC;IACrE,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EAAE;QAC7E,OAAO,KAAqB,CAAC;KAC7B;IACD,IAAA,iBAAM,EACL,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EACxE,KAAK,CAAC,qEAAqE,CAC3E,CAAC;AACH,CAAC;AARD,sCAQC;AAoED,SAAgB,UAAU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I,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;KACH;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAlCD,kDAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { IAttributionCollection } from \"./attributionCollection.js\";\nimport { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nimport { LocalReferenceCollection } from \"./localReference.js\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { computeHierarchicalOrdinal } from \"./ordinal.js\";\nimport type { PartialSequenceLengths } from \"./partialLengths.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { PropertySet, clone, createMap, type MapLike } from \"./properties.js\";\nimport { ReferencePosition, refGetTileLabels, refTypeIncludesFlag } from \"./referencePositions.js\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager.js\";\n\n/**\n * Common properties for a node in a merge tree.\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n/**\n * someday we may split tree leaves from segments, but for now they are the same\n * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node\n */\nexport type ISegmentLeaf = ISegment & { parent?: MergeBlock };\nexport type IMergeNode = MergeBlock | ISegmentLeaf;\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * @internal\n */\nexport function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t */\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\ttoJSONObject(): any;\n\t/**\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: MergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: MergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: MergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n}\n\n/**\n * @alpha\n * @deprecated - unused and will be removed\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock implements IMergeNodeCommon {\n\tpublic children: IMergeNode[];\n\tpublic needsScour?: boolean;\n\tpublic parent?: MergeBlock;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number | undefined = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\n\tpublic constructor(public childCount: number) {\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t}\n\n\tpublic hierBlock(): this is HierMergeBlock {\n\t\treturn false;\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number) {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true) {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport class HierMergeBlock extends MergeBlock {\n\tpublic rightmostTiles: MapLike<ReferencePosition>;\n\tpublic leftmostTiles: MapLike<ReferencePosition>;\n\n\tconstructor(childCount: number) {\n\t\tsuper(childCount);\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.rightmostTiles = createMap<ReferencePosition>();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.leftmostTiles = createMap<ReferencePosition>();\n\t}\n\n\tpublic hierBlock(): this is HierMergeBlock {\n\t\treturn true;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number) {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @alpha\n */\nexport abstract class BaseSegment implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number = 0;\n\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(this);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t) {\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment) {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment) {\n\t\tif (this.properties) {\n\t\t\tjseg.props = this.properties;\n\t\t}\n\t}\n\n\tpublic abstract toJSONObject(): any;\n\n\t/***/\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE:\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(\n\t\t\t\t\tremovalInfo !== undefined,\n\t\t\t\t\t0x046 /* \"On remove ack, missing removal info!\" */,\n\t\t\t\t);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE:\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tthis.localMovedSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: ISegmentLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tconst thisAsMergeSegment: ISegmentLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment) {\n\t\tif (this.propertyManager) {\n\t\t\tif (this.properties) {\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @alpha\n */\nexport const reservedMarkerIdKey = \"markerId\";\n\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet) {\n\t\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject() {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: any) {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make(spec.marker.refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone() {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment() {\n\t\treturn this;\n\t}\n\n\tgetOffset() {\n\t\treturn 0;\n\t}\n\n\tgetProperties() {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString() {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend() {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow) {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * @internal\n */\nexport const compareNumbers = (a: number, b: number) => a - b;\n\n/**\n * @internal\n */\nexport const compareStrings = (a: string, b: string) => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ISegment, Marker } from "./mergeTreeNodes.js";
6
- import { IMergeTreeAnnotateMsg, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeRemoveMsg, IMergeTreeDeltaOp, IMergeTreeObliterateMsg } from "./ops.js";
6
+ import { IMergeTreeAnnotateMsg, IMergeTreeDeltaOp, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeObliterateMsg, IMergeTreeRemoveMsg } from "./ops.js";
7
7
  import { PropertySet } from "./properties.js";
8
8
  /**
9
9
  * Creates the op for annotating the markers with the provided properties
@@ -1 +1 @@
1
- {"version":3,"file":"opBuilder.d.ts","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACN,qBAAqB,EAErB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EAEjB,uBAAuB,EACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,WAAW,GAChB,qBAAqB,GAAG,SAAS,CAYnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,GAChB,qBAAqB,CAOvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAMnF;AAED;;;;;;;GAOG;AAEH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAM3F;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,mBAAmB,CAEzF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE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EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AACpD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAW,EAAE,OAAY;IACvD,OAAO;QACN,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,2BAAkB,CAAC,MAAM;KAC/B,CAAC;AACH,CAAC;AAND,wCAMC;AAED;;;;;;;;;;GAUG;AACH,gDAAgD;AAChD,SAAgB,aAAa,CAAC,GAAG,GAAwB;IACxD,OAAO;QACN,GAAG;QACH,IAAI,EAAE,2BAAkB,CAAC,KAAK;KAC9B,CAAC;AACH,CAAC;AALD,sCAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment, Marker } from \"./mergeTreeNodes.js\";\nimport {\n\tIMergeTreeAnnotateMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\tIMergeTreeInsertMsg,\n\tIMergeTreeRemoveMsg,\n\tMergeTreeDeltaType,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n} from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateMarkerOp(\n\tmarker: Marker,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg | undefined {\n\tconst id = marker.getId();\n\tif (!id) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tprops,\n\t\trelativePos1: { id, before: true },\n\t\trelativePos2: { id },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateRangeOp(\n\tstart: number,\n\tend: number,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\tprops,\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op to remove a range\n *\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n *\n * @internal\n */\nexport function createRemoveRangeOp(start: number, end: number): IMergeTreeRemoveMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.REMOVE,\n\t};\n}\n\n/**\n * Creates the op to obliterate a range\n *\n * @param start - The inclusive start of the range to obliterate\n * @param end - The exclusive end of the range to obliterate\n *\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.OBLITERATE,\n\t};\n}\n\n/**\n *\n * @param pos - The position to insert the segment at\n * @param segment - The segment to insert\n *\n * @internal\n */\nexport function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg {\n\treturn createInsertOp(pos, segment.toJSONObject());\n}\n\n/**\n * @internal\n */\nexport function createInsertOp(pos: number, segSpec: any): IMergeTreeInsertMsg {\n\treturn {\n\t\tpos1: pos,\n\t\tseg: segSpec,\n\t\ttype: MergeTreeDeltaType.INSERT,\n\t};\n}\n\n/**\n *\n * @param ops - The ops to group\n *\n * @deprecated The ability to create group ops will be removed in an upcoming\n * release, as group ops are redundant with he native batching capabilities of\n * the runtime\n *\n * @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\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg {\n\treturn {\n\t\tops,\n\t\ttype: MergeTreeDeltaType.GROUP,\n\t};\n}\n"]}
1
+ {"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qCAUkB;AAGlB;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACrC,MAAc,EACd,KAAkB;IAElB,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,EAAE;QACR,OAAO,SAAS,CAAC;KACjB;IAED,OAAO;QACN,KAAK;QACL,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAClC,YAAY,EAAE,EAAE,EAAE,EAAE;QACpB,IAAI,EAAE,2BAAkB,CAAC,QAAQ;KACjC,CAAC;AACH,CAAC;AAfD,wDAeC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACpC,KAAa,EACb,GAAW,EACX,KAAkB;IAElB,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,KAAK;QACL,IAAI,EAAE,2BAAkB,CAAC,QAAQ;KACjC,CAAC;AACH,CAAC;AAXD,sDAWC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,KAAa,EAAE,GAAW;IAC7D,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,2BAAkB,CAAC,MAAM;KAC/B,CAAC;AACH,CAAC;AAND,kDAMC;AAED;;;;;;;GAOG;AACH,gDAAgD;AAChD,SAAgB,uBAAuB,CAAC,KAAa,EAAE,GAAW;IACjE,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,2BAAkB,CAAC,UAAU;KACnC,CAAC;AACH,CAAC;AAND,0DAMC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,GAAW,EAAE,OAAiB;IACnE,OAAO,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AACpD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAW,EAAE,OAAY;IACvD,OAAO;QACN,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,2BAAkB,CAAC,MAAM;KAC/B,CAAC;AACH,CAAC;AAND,wCAMC;AAED;;;;;;;;;;GAUG;AACH,gDAAgD;AAChD,SAAgB,aAAa,CAAC,GAAG,GAAwB;IACxD,OAAO;QACN,GAAG;QACH,IAAI,EAAE,2BAAkB,CAAC,KAAK;KAC9B,CAAC;AACH,CAAC;AALD,sCAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment, Marker } from \"./mergeTreeNodes.js\";\nimport {\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\tIMergeTreeInsertMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n\tIMergeTreeRemoveMsg,\n\tMergeTreeDeltaType,\n} from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateMarkerOp(\n\tmarker: Marker,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg | undefined {\n\tconst id = marker.getId();\n\tif (!id) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tprops,\n\t\trelativePos1: { id, before: true },\n\t\trelativePos2: { id },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateRangeOp(\n\tstart: number,\n\tend: number,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\tprops,\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op to remove a range\n *\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n *\n * @internal\n */\nexport function createRemoveRangeOp(start: number, end: number): IMergeTreeRemoveMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.REMOVE,\n\t};\n}\n\n/**\n * Creates the op to obliterate a range\n *\n * @param start - The inclusive start of the range to obliterate\n * @param end - The exclusive end of the range to obliterate\n *\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.OBLITERATE,\n\t};\n}\n\n/**\n *\n * @param pos - The position to insert the segment at\n * @param segment - The segment to insert\n *\n * @internal\n */\nexport function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg {\n\treturn createInsertOp(pos, segment.toJSONObject());\n}\n\n/**\n * @internal\n */\nexport function createInsertOp(pos: number, segSpec: any): IMergeTreeInsertMsg {\n\treturn {\n\t\tpos1: pos,\n\t\tseg: segSpec,\n\t\ttype: MergeTreeDeltaType.INSERT,\n\t};\n}\n\n/**\n *\n * @param ops - The ops to group\n *\n * @deprecated The ability to create group ops will be removed in an upcoming\n * release, as group ops are redundant with he native batching capabilities of\n * the runtime\n *\n * @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\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg {\n\treturn {\n\t\tops,\n\t\ttype: MergeTreeDeltaType.GROUP,\n\t};\n}\n"]}
package/dist/ordinal.js CHANGED
@@ -6,9 +6,9 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.computeHierarchicalOrdinal = void 0;
8
8
  /* eslint-disable no-bitwise */
9
- const core_utils_1 = require("@fluidframework/core-utils");
9
+ const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  function computeHierarchicalOrdinal(maxCount, actualCount, parentOrdinal, previousOrdinal) {
11
- (0, core_utils_1.assert)(maxCount <= 16 && actualCount <= maxCount, 0x3f0 /* count must be less than max, and max must be 16 or less */);
11
+ (0, internal_1.assert)(maxCount <= 16 && actualCount <= maxCount, 0x3f0 /* count must be less than max, and max must be 16 or less */);
12
12
  const ordinalWidth = 1 << (maxCount - actualCount);
13
13
  let ordinal;
14
14
  if (previousOrdinal === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"ordinal.js","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,2DAAoD;AAEpD,SAAgB,0BAA0B,CACzC,QAAgB,EAChB,WAAmB,EACnB,aAAqB,EACrB,eAAmC;IAEnC,IAAA,mBAAM,EACL,QAAQ,IAAI,EAAE,IAAI,WAAW,IAAI,QAAQ,EACzC,KAAK,CAAC,6DAA6D,CACnE,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IACnD,IAAI,OAAe,CAAC;IACpB,IAAI,eAAe,KAAK,SAAS,EAAE;QAClC,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;KAChE;SAAM;QACN,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;QAChD,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;KAC5D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAtBD,gEAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils\";\n\nexport function computeHierarchicalOrdinal(\n\tmaxCount: number,\n\tactualCount: number,\n\tparentOrdinal: string,\n\tpreviousOrdinal: string | undefined,\n) {\n\tassert(\n\t\tmaxCount <= 16 && actualCount <= maxCount,\n\t\t0x3f0 /* count must be less than max, and max must be 16 or less */,\n\t);\n\n\tconst ordinalWidth = 1 << (maxCount - actualCount);\n\tlet ordinal: string;\n\tif (previousOrdinal === undefined) {\n\t\tordinal = parentOrdinal + String.fromCharCode(ordinalWidth - 1);\n\t} else {\n\t\tconst prevOrdCode = previousOrdinal.charCodeAt(previousOrdinal.length - 1);\n\t\tconst localOrdinal = prevOrdCode + ordinalWidth;\n\t\tordinal = parentOrdinal + String.fromCharCode(localOrdinal);\n\t}\n\n\treturn ordinal;\n}\n"]}
1
+ {"version":3,"file":"ordinal.js","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,kEAA6D;AAE7D,SAAgB,0BAA0B,CACzC,QAAgB,EAChB,WAAmB,EACnB,aAAqB,EACrB,eAAmC;IAEnC,IAAA,iBAAM,EACL,QAAQ,IAAI,EAAE,IAAI,WAAW,IAAI,QAAQ,EACzC,KAAK,CAAC,6DAA6D,CACnE,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IACnD,IAAI,OAAe,CAAC;IACpB,IAAI,eAAe,KAAK,SAAS,EAAE;QAClC,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;KAChE;SAAM;QACN,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;QAChD,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;KAC5D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAtBD,gEAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nexport function computeHierarchicalOrdinal(\n\tmaxCount: number,\n\tactualCount: number,\n\tparentOrdinal: string,\n\tpreviousOrdinal: string | undefined,\n) {\n\tassert(\n\t\tmaxCount <= 16 && actualCount <= maxCount,\n\t\t0x3f0 /* count must be less than max, and max must be 16 or less */,\n\t);\n\n\tconst ordinalWidth = 1 << (maxCount - actualCount);\n\tlet ordinal: string;\n\tif (previousOrdinal === undefined) {\n\t\tordinal = parentOrdinal + String.fromCharCode(ordinalWidth - 1);\n\t} else {\n\t\tconst prevOrdCode = previousOrdinal.charCodeAt(previousOrdinal.length - 1);\n\t\tconst localOrdinal = prevOrdCode + ordinalWidth;\n\t\tordinal = parentOrdinal + String.fromCharCode(localOrdinal);\n\t}\n\n\treturn ordinal;\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { RedBlackTree } from "./collections/index.js";
6
6
  import { MergeTree } from "./mergeTree.js";
7
- import { CollaborationWindow, IMergeBlock, ISegment } from "./mergeTreeNodes.js";
7
+ import { CollaborationWindow, ISegment, type MergeBlock } from "./mergeTreeNodes.js";
8
8
  interface IOverlapClient {
9
9
  clientId: number;
10
10
  seglen: number;
@@ -70,7 +70,7 @@ export interface PartialSequenceLength {
70
70
  }
71
71
  export interface PartialSequenceLengthsOptions {
72
72
  verifier?: (partialLengths: PartialSequenceLengths) => void;
73
- verifyExpected?: (mergeTree: MergeTree, node: IMergeBlock, refSeq: number, clientId: number, localSeq?: number) => void;
73
+ verifyExpected?: (mergeTree: MergeTree, node: MergeBlock, refSeq: number, clientId: number, localSeq?: number) => void;
74
74
  zamboni: boolean;
75
75
  }
76
76
  /**
@@ -137,10 +137,10 @@ export declare class PartialSequenceLengths {
137
137
  * This enables querying for the length of the block at a given localSeq, but incurs extra work.
138
138
  * Local partial information doesn't support `update`.
139
139
  */
140
- static combine(block: IMergeBlock, collabWindow: CollaborationWindow, recur?: boolean, computeLocalPartials?: boolean): PartialSequenceLengths;
140
+ static combine(block: MergeBlock, collabWindow: CollaborationWindow, recur?: boolean, computeLocalPartials?: boolean): PartialSequenceLengths;
141
141
  /**
142
142
  * @returns a PartialSequenceLengths structure which tracks only lengths of leaf children of the provided
143
- * IMergeBlock.
143
+ * MergeBlock.
144
144
  */
145
145
  private static fromLeaves;
146
146
  private static getOverlapClients;
@@ -217,7 +217,7 @@ export declare class PartialSequenceLengths {
217
217
  * or if no such calls have been made, the one used on construction.
218
218
  */
219
219
  minSeq: number, computeLocalPartials: boolean);
220
- update(node: IMergeBlock, seq: number, clientId: number, collabWindow: CollaborationWindow): void;
220
+ update(node: MergeBlock, seq: number, clientId: number, collabWindow: CollaborationWindow): void;
221
221
  /**
222
222
  * Returns the length of this block as viewed from the perspective of `clientId` at `refSeq`.
223
223
  * This is the total length of all segments sequenced at or before refSeq OR submitted by `clientId`.
@@ -262,7 +262,7 @@ export declare class PartialSequenceLengths {
262
262
  private cliLatestLEQ;
263
263
  private cliLatest;
264
264
  }
265
- export declare function verifyExpectedPartialLengths(mergeTree: MergeTree, node: IMergeBlock, refSeq: number, clientId: number, localSeq?: number): void;
265
+ export declare function verifyExpectedPartialLengths(mergeTree: MergeTree, node: MergeBlock, refSeq: number, clientId: number, localSeq?: number): void;
266
266
  export declare function verifyPartialLengths(partialSeqLengths: PartialSequenceLengths): void;
267
267
  /**
268
268
  * Combines the `overlapRemoveClients` and `overlapOb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QAgCjB;AAED,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,sBAAsB,QAsB7E;AAoBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,QAkCvF"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.combineOverlapClients = exports.verifyPartialLengths = exports.verifyExpectedPartialLengths = exports.PartialSequenceLengths = void 0;
8
- const core_utils_1 = require("@fluidframework/core-utils");
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("./collections/index.js");
10
10
  const constants_js_1 = require("./constants.js");
11
11
  const mergeTreeNodes_js_1 = require("./mergeTreeNodes.js");
@@ -201,7 +201,7 @@ class PartialSequenceLengths {
201
201
  }
202
202
  /**
203
203
  * @returns a PartialSequenceLengths structure which tracks only lengths of leaf children of the provided
204
- * IMergeBlock.
204
+ * MergeBlock.
205
205
  */
206
206
  static fromLeaves(block,
207
207
  // eslint-disable-next-line import/no-deprecated
@@ -393,7 +393,7 @@ class PartialSequenceLengths {
393
393
  let moveClientOverlap;
394
394
  let remoteObliteratedLen;
395
395
  // it's not possible to have an overlapping obliterate and remove that are both local
396
- (0, core_utils_1.assert)((!moveIsLocal && !removalIsLocal) || moveIsLocal !== removalIsLocal, 0x870 /* overlapping local obliterate and remove */);
396
+ (0, internal_1.assert)((!moveIsLocal && !removalIsLocal) || moveIsLocal !== removalIsLocal, 0x870 /* overlapping local obliterate and remove */);
397
397
  const removeHappenedFirst = removalInfo &&
398
398
  (!moveInfo ||
399
399
  moveIsLocal ||
@@ -415,7 +415,7 @@ class PartialSequenceLengths {
415
415
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
416
416
  seqOrLocalSeq = moveIsLocal ? moveInfo.localMovedSeq : moveInfo.movedSeq;
417
417
  if (segment.wasMovedOnInsert) {
418
- (0, core_utils_1.assert)(moveInfo.movedSeq !== -1, 0x871 /* wasMovedOnInsert should only be set on acked obliterates */);
418
+ (0, internal_1.assert)(moveInfo.movedSeq !== -1, 0x871 /* wasMovedOnInsert should only be set on acked obliterates */);
419
419
  segmentLen = 0;
420
420
  }
421
421
  else {
@@ -676,7 +676,7 @@ class PartialSequenceLengths {
676
676
  }
677
677
  }
678
678
  else {
679
- (0, core_utils_1.assert)(this.unsequencedRecords !== undefined, 0x39f /* Local getPartialLength invoked without computing local partials. */);
679
+ (0, internal_1.assert)(this.unsequencedRecords !== undefined, 0x39f /* Local getPartialLength invoked without computing local partials. */);
680
680
  const unsequencedPartialLengths = this.unsequencedRecords.partialLengths;
681
681
  // Local segments at or before localSeq should also be included
682
682
  const local = unsequencedPartialLengths.latestLeq(localSeq);
@@ -821,14 +821,14 @@ function verifyPartialLengthsInner(partialSeqLengths, partialLengths, clientPart
821
821
  // Count total number of partial length entries
822
822
  count++;
823
823
  // Sequence number should be larger or equal to minseq
824
- (0, core_utils_1.assert)(partialSeqLengths.minSeq <= partialLength.seq, 0x054 /* "Sequence number less than minSeq!" */);
824
+ (0, internal_1.assert)(partialSeqLengths.minSeq <= partialLength.seq, 0x054 /* "Sequence number less than minSeq!" */);
825
825
  // Sequence number should be sorted
826
- (0, core_utils_1.assert)(lastSeqNum < partialLength.seq, 0x055 /* "Sequence number is not sorted!" */);
826
+ (0, internal_1.assert)(lastSeqNum < partialLength.seq, 0x055 /* "Sequence number is not sorted!" */);
827
827
  lastSeqNum = partialLength.seq;
828
828
  // Len is a accumulation of all the seglen adjustments
829
829
  accumSegLen += partialLength.seglen;
830
830
  if (accumSegLen !== partialLength.len) {
831
- (0, core_utils_1.assert)(false, 0x056 /* "Unexpected total for accumulation of all seglen adjustments!" */);
831
+ (0, internal_1.assert)(false, 0x056 /* "Unexpected total for accumulation of all seglen adjustments!" */);
832
832
  }
833
833
  if (clientPartials) {
834
834
  // Client partials used to track local edits so we can account for them some refSeq.
@@ -845,19 +845,19 @@ function verifyPartialLengthsInner(partialSeqLengths, partialLengths, clientPart
845
845
  else {
846
846
  // Len adjustment should not make length negative
847
847
  if (partialSeqLengths["minLength"] + partialLength.len < 0) {
848
- (0, core_utils_1.assert)(false, 0x057 /* "Negative length after length adjustment!" */);
848
+ (0, internal_1.assert)(false, 0x057 /* "Negative length after length adjustment!" */);
849
849
  }
850
850
  }
851
851
  if (partialLength.overlapRemoveClients) {
852
852
  // Only the flat partialLengths can have overlapRemoveClients, the per client view shouldn't
853
- (0, core_utils_1.assert)(!clientPartials, 0x058 /* "Both overlapRemoveClients and clientPartials are set!" */);
853
+ (0, internal_1.assert)(!clientPartials, 0x058 /* "Both overlapRemoveClients and clientPartials are set!" */);
854
854
  // Each overlap client counts as one, but the first remove to sequence was already counted.
855
855
  // (this aligns with the logic to omit the removing client in `addClientSeqNumberFromPartial`)
856
856
  count += partialLength.overlapRemoveClients.size() - 1;
857
857
  }
858
858
  if (partialLength.overlapObliterateClients) {
859
859
  // Only the flat partialLengths can have overlapObliterateClients, the per client view shouldn't
860
- (0, core_utils_1.assert)(!clientPartials, 0x872 /* Both overlapObliterateClients and clientPartials are set! */);
860
+ (0, internal_1.assert)(!clientPartials, 0x872 /* Both overlapObliterateClients and clientPartials are set! */);
861
861
  // Each overlap client counts as one, but the first move to sequence was already counted.
862
862
  // (this aligns with the logic to omit the moving client in `addClientSeqNumberFromPartial`)
863
863
  count += partialLength.overlapObliterateClients.size() - 1;
@@ -899,12 +899,12 @@ function verifyPartialLengths(partialSeqLengths) {
899
899
  }
900
900
  }
901
901
  // If we have client view, we should have the flat view
902
- (0, core_utils_1.assert)(!!partialSeqLengths["partialLengths"], 0x059 /* "Client view exists but flat view does not!" */);
902
+ (0, internal_1.assert)(!!partialSeqLengths["partialLengths"], 0x059 /* "Client view exists but flat view does not!" */);
903
903
  verifyPartialLengthsInner(partialSeqLengths, partialSeqLengths["partialLengths"], false);
904
904
  }
905
905
  else {
906
906
  // If we don't have a client view, we shouldn't have the flat view either
907
- (0, core_utils_1.assert)(!partialSeqLengths["partialLengths"], 0x05b /* "Flat view exists but client view does not!" */);
907
+ (0, internal_1.assert)(!partialSeqLengths["partialLengths"], 0x05b /* "Flat view exists but client view does not!" */);
908
908
  }
909
909
  }
910
910
  exports.verifyPartialLengths = verifyPartialLengths;