@fluidframework/merge-tree 2.0.0-internal.8.0.0 → 2.0.0-rc.1.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 (481) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +0 -6
  3. package/api-extractor-esm.json +17 -0
  4. package/api-extractor-lint.json +1 -10
  5. package/api-extractor.json +0 -4
  6. package/api-report/merge-tree.api.md +4 -9
  7. package/dist/client.d.ts +0 -7
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +0 -7
  10. package/dist/client.js.map +1 -1
  11. package/dist/merge-tree-alpha.d.ts +27 -12
  12. package/dist/merge-tree-beta.d.ts +0 -16
  13. package/dist/merge-tree-public.d.ts +0 -16
  14. package/dist/merge-tree-untrimmed.d.ts +5 -29
  15. package/dist/mergeTree.d.ts +0 -17
  16. package/dist/mergeTree.d.ts.map +1 -1
  17. package/dist/mergeTree.js +0 -130
  18. package/dist/mergeTree.js.map +1 -1
  19. package/dist/ops.d.ts +1 -1
  20. package/dist/ops.js +1 -1
  21. package/dist/ops.js.map +1 -1
  22. package/dist/revertibles.d.ts +4 -4
  23. package/dist/revertibles.js +3 -3
  24. package/dist/revertibles.js.map +1 -1
  25. package/dist/test/Insertion.perf.spec.d.ts +6 -0
  26. package/dist/test/Insertion.perf.spec.d.ts.map +1 -0
  27. package/dist/test/Insertion.perf.spec.js +113 -0
  28. package/dist/test/Insertion.perf.spec.js.map +1 -0
  29. package/dist/test/PartialLengths.perf.spec.d.ts +6 -0
  30. package/dist/test/PartialLengths.perf.spec.d.ts.map +1 -0
  31. package/dist/test/PartialLengths.perf.spec.js +67 -0
  32. package/dist/test/PartialLengths.perf.spec.js.map +1 -0
  33. package/dist/test/Removal.perf.spec.d.ts +6 -0
  34. package/dist/test/Removal.perf.spec.d.ts.map +1 -0
  35. package/dist/test/Removal.perf.spec.js +166 -0
  36. package/dist/test/Removal.perf.spec.js.map +1 -0
  37. package/dist/test/Snapshot.perf.spec.d.ts +6 -0
  38. package/dist/test/Snapshot.perf.spec.d.ts.map +1 -0
  39. package/dist/test/Snapshot.perf.spec.js +33 -0
  40. package/dist/test/Snapshot.perf.spec.js.map +1 -0
  41. package/dist/test/attributionCollection.perf.spec.d.ts +6 -0
  42. package/dist/test/attributionCollection.perf.spec.d.ts.map +1 -0
  43. package/dist/test/attributionCollection.perf.spec.js +231 -0
  44. package/dist/test/attributionCollection.perf.spec.js.map +1 -0
  45. package/dist/test/attributionCollection.spec.d.ts +6 -0
  46. package/dist/test/attributionCollection.spec.d.ts.map +1 -0
  47. package/dist/test/attributionCollection.spec.js +486 -0
  48. package/dist/test/attributionCollection.spec.js.map +1 -0
  49. package/dist/test/attributionPolicy.spec.d.ts +6 -0
  50. package/dist/test/attributionPolicy.spec.d.ts.map +1 -0
  51. package/dist/test/attributionPolicy.spec.js +189 -0
  52. package/dist/test/attributionPolicy.spec.js.map +1 -0
  53. package/dist/test/beastTest.d.ts +54 -0
  54. package/dist/test/beastTest.d.ts.map +1 -0
  55. package/dist/test/beastTest.js +1333 -0
  56. package/dist/test/beastTest.js.map +1 -0
  57. package/dist/test/client.annotateMarker.spec.d.ts +6 -0
  58. package/dist/test/client.annotateMarker.spec.d.ts.map +1 -0
  59. package/dist/test/client.annotateMarker.spec.js +45 -0
  60. package/dist/test/client.annotateMarker.spec.js.map +1 -0
  61. package/dist/test/client.apis.d.ts +7 -0
  62. package/dist/test/client.apis.d.ts.map +1 -0
  63. package/dist/test/client.apis.js +72 -0
  64. package/dist/test/client.apis.js.map +1 -0
  65. package/dist/test/client.applyMsg.spec.d.ts +6 -0
  66. package/dist/test/client.applyMsg.spec.d.ts.map +1 -0
  67. package/dist/test/client.applyMsg.spec.js +500 -0
  68. package/dist/test/client.applyMsg.spec.js.map +1 -0
  69. package/dist/test/client.applyStashedOpFarm.spec.d.ts +12 -0
  70. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
  71. package/dist/test/client.applyStashedOpFarm.spec.js +144 -0
  72. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -0
  73. package/dist/test/client.attributionFarm.spec.d.ts +7 -0
  74. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -0
  75. package/dist/test/client.attributionFarm.spec.js +96 -0
  76. package/dist/test/client.attributionFarm.spec.js.map +1 -0
  77. package/dist/test/client.conflictFarm.spec.d.ts +15 -0
  78. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -0
  79. package/dist/test/client.conflictFarm.spec.js +88 -0
  80. package/dist/test/client.conflictFarm.spec.js.map +1 -0
  81. package/dist/test/client.getPosition.spec.d.ts +6 -0
  82. package/dist/test/client.getPosition.spec.d.ts.map +1 -0
  83. package/dist/test/client.getPosition.spec.js +54 -0
  84. package/dist/test/client.getPosition.spec.js.map +1 -0
  85. package/dist/test/client.localReference.spec.d.ts +6 -0
  86. package/dist/test/client.localReference.spec.d.ts.map +1 -0
  87. package/dist/test/client.localReference.spec.js +439 -0
  88. package/dist/test/client.localReference.spec.js.map +1 -0
  89. package/dist/test/client.localReferenceFarm.spec.d.ts +6 -0
  90. package/dist/test/client.localReferenceFarm.spec.d.ts.map +1 -0
  91. package/dist/test/client.localReferenceFarm.spec.js +88 -0
  92. package/dist/test/client.localReferenceFarm.spec.js.map +1 -0
  93. package/dist/test/client.rebasePosition.spec.d.ts +6 -0
  94. package/dist/test/client.rebasePosition.spec.d.ts.map +1 -0
  95. package/dist/test/client.rebasePosition.spec.js +102 -0
  96. package/dist/test/client.rebasePosition.spec.js.map +1 -0
  97. package/dist/test/client.reconnectFarm.spec.d.ts +12 -0
  98. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -0
  99. package/dist/test/client.reconnectFarm.spec.js +91 -0
  100. package/dist/test/client.reconnectFarm.spec.js.map +1 -0
  101. package/dist/test/client.replay.spec.d.ts +6 -0
  102. package/dist/test/client.replay.spec.d.ts.map +1 -0
  103. package/dist/test/client.replay.spec.js +85 -0
  104. package/dist/test/client.replay.spec.js.map +1 -0
  105. package/dist/test/client.rollback.spec.d.ts +6 -0
  106. package/dist/test/client.rollback.spec.d.ts.map +1 -0
  107. package/dist/test/client.rollback.spec.js +453 -0
  108. package/dist/test/client.rollback.spec.js.map +1 -0
  109. package/dist/test/client.rollbackFarm.spec.d.ts +6 -0
  110. package/dist/test/client.rollbackFarm.spec.d.ts.map +1 -0
  111. package/dist/test/client.rollbackFarm.spec.js +48 -0
  112. package/dist/test/client.rollbackFarm.spec.js.map +1 -0
  113. package/dist/test/client.searchForMarker.spec.d.ts +6 -0
  114. package/dist/test/client.searchForMarker.spec.d.ts.map +1 -0
  115. package/dist/test/client.searchForMarker.spec.js +446 -0
  116. package/dist/test/client.searchForMarker.spec.js.map +1 -0
  117. package/dist/test/client.walkSegments.spec.d.ts +6 -0
  118. package/dist/test/client.walkSegments.spec.d.ts.map +1 -0
  119. package/dist/test/client.walkSegments.spec.js +54 -0
  120. package/dist/test/client.walkSegments.spec.js.map +1 -0
  121. package/dist/test/collections.list.spec.d.ts +6 -0
  122. package/dist/test/collections.list.spec.d.ts.map +1 -0
  123. package/dist/test/collections.list.spec.js +84 -0
  124. package/dist/test/collections.list.spec.js.map +1 -0
  125. package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
  126. package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
  127. package/dist/test/createInsertOnlyAttributionPolicy.spec.js +35 -0
  128. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
  129. package/dist/test/index.d.ts +13 -0
  130. package/dist/test/index.d.ts.map +1 -0
  131. package/dist/test/index.js +88 -0
  132. package/dist/test/index.js.map +1 -0
  133. package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
  134. package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
  135. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +142 -0
  136. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
  137. package/dist/test/mergeTree.annotate.spec.d.ts +6 -0
  138. package/dist/test/mergeTree.annotate.spec.d.ts.map +1 -0
  139. package/dist/test/mergeTree.annotate.spec.js +448 -0
  140. package/dist/test/mergeTree.annotate.spec.js.map +1 -0
  141. package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
  142. package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
  143. package/dist/test/mergeTree.insert.deltaCallback.spec.js +126 -0
  144. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
  145. package/dist/test/mergeTree.insertingWalk.spec.d.ts +6 -0
  146. package/dist/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
  147. package/dist/test/mergeTree.insertingWalk.spec.js +279 -0
  148. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -0
  149. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
  150. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
  151. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +178 -0
  152. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
  153. package/dist/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
  154. package/dist/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
  155. package/dist/test/mergeTree.markRangeRemoved.spec.js +130 -0
  156. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
  157. package/dist/test/mergeTree.walk.spec.d.ts +6 -0
  158. package/dist/test/mergeTree.walk.spec.d.ts.map +1 -0
  159. package/dist/test/mergeTree.walk.spec.js +63 -0
  160. package/dist/test/mergeTree.walk.spec.js.map +1 -0
  161. package/dist/test/mergeTree.zamboni.spec.d.ts +6 -0
  162. package/dist/test/mergeTree.zamboni.spec.d.ts.map +1 -0
  163. package/dist/test/mergeTree.zamboni.spec.js +52 -0
  164. package/dist/test/mergeTree.zamboni.spec.js.map +1 -0
  165. package/dist/test/mergeTreeOperationRunner.d.ts +63 -0
  166. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -0
  167. package/dist/test/mergeTreeOperationRunner.js +245 -0
  168. package/dist/test/mergeTreeOperationRunner.js.map +1 -0
  169. package/dist/test/mergeTreeOperationRunner.spec.d.ts +6 -0
  170. package/dist/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
  171. package/dist/test/mergeTreeOperationRunner.spec.js +156 -0
  172. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -0
  173. package/dist/test/obliterate.concurrent.spec.d.ts +6 -0
  174. package/dist/test/obliterate.concurrent.spec.d.ts.map +1 -0
  175. package/dist/test/obliterate.concurrent.spec.js +1446 -0
  176. package/dist/test/obliterate.concurrent.spec.js.map +1 -0
  177. package/dist/test/obliterate.partialLength.spec.d.ts +6 -0
  178. package/dist/test/obliterate.partialLength.spec.d.ts.map +1 -0
  179. package/dist/test/obliterate.partialLength.spec.js +279 -0
  180. package/dist/test/obliterate.partialLength.spec.js.map +1 -0
  181. package/dist/test/obliterate.reconnect.spec.d.ts +6 -0
  182. package/dist/test/obliterate.reconnect.spec.d.ts.map +1 -0
  183. package/dist/test/obliterate.reconnect.spec.js +164 -0
  184. package/dist/test/obliterate.reconnect.spec.js.map +1 -0
  185. package/dist/test/obliterate.spec.d.ts +6 -0
  186. package/dist/test/obliterate.spec.d.ts.map +1 -0
  187. package/dist/test/obliterate.spec.js +162 -0
  188. package/dist/test/obliterate.spec.js.map +1 -0
  189. package/dist/test/ordinal.spec.d.ts +2 -0
  190. package/dist/test/ordinal.spec.d.ts.map +1 -0
  191. package/dist/test/ordinal.spec.js +43 -0
  192. package/dist/test/ordinal.spec.js.map +1 -0
  193. package/dist/test/partialLength.spec.d.ts +6 -0
  194. package/dist/test/partialLength.spec.d.ts.map +1 -0
  195. package/dist/test/partialLength.spec.js +282 -0
  196. package/dist/test/partialLength.spec.js.map +1 -0
  197. package/dist/test/properties.spec.d.ts +6 -0
  198. package/dist/test/properties.spec.d.ts.map +1 -0
  199. package/dist/test/properties.spec.js +55 -0
  200. package/dist/test/properties.spec.js.map +1 -0
  201. package/dist/test/reconnectHelper.d.ts +48 -0
  202. package/dist/test/reconnectHelper.d.ts.map +1 -0
  203. package/dist/test/reconnectHelper.js +86 -0
  204. package/dist/test/reconnectHelper.js.map +1 -0
  205. package/dist/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
  206. package/dist/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
  207. package/dist/test/resetPendingSegmentsToOp.spec.js +218 -0
  208. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -0
  209. package/dist/test/revertibleFarm.spec.d.ts +6 -0
  210. package/dist/test/revertibleFarm.spec.d.ts.map +1 -0
  211. package/dist/test/revertibleFarm.spec.js +124 -0
  212. package/dist/test/revertibleFarm.spec.js.map +1 -0
  213. package/dist/test/revertibles.spec.d.ts +17 -0
  214. package/dist/test/revertibles.spec.d.ts.map +1 -0
  215. package/dist/test/revertibles.spec.js +385 -0
  216. package/dist/test/revertibles.spec.js.map +1 -0
  217. package/dist/test/segmentGroupCollection.spec.d.ts +6 -0
  218. package/dist/test/segmentGroupCollection.spec.d.ts.map +1 -0
  219. package/dist/test/segmentGroupCollection.spec.js +60 -0
  220. package/dist/test/segmentGroupCollection.spec.js.map +1 -0
  221. package/dist/test/snapshot.spec.d.ts +6 -0
  222. package/dist/test/snapshot.spec.d.ts.map +1 -0
  223. package/dist/test/snapshot.spec.js +178 -0
  224. package/dist/test/snapshot.spec.js.map +1 -0
  225. package/dist/test/snapshot.utils.d.ts +33 -0
  226. package/dist/test/snapshot.utils.d.ts.map +1 -0
  227. package/dist/test/snapshot.utils.js +109 -0
  228. package/dist/test/snapshot.utils.js.map +1 -0
  229. package/dist/test/snapshotlegacy.spec.d.ts +6 -0
  230. package/dist/test/snapshotlegacy.spec.d.ts.map +1 -0
  231. package/dist/test/snapshotlegacy.spec.js +139 -0
  232. package/dist/test/snapshotlegacy.spec.js.map +1 -0
  233. package/dist/test/sortedSegmentSet.spec.d.ts +6 -0
  234. package/dist/test/sortedSegmentSet.spec.d.ts.map +1 -0
  235. package/dist/test/sortedSegmentSet.spec.js +95 -0
  236. package/dist/test/sortedSegmentSet.spec.js.map +1 -0
  237. package/dist/test/testClient.d.ts +119 -0
  238. package/dist/test/testClient.d.ts.map +1 -0
  239. package/dist/test/testClient.js +439 -0
  240. package/dist/test/testClient.js.map +1 -0
  241. package/dist/test/testClientLogger.d.ts +44 -0
  242. package/dist/test/testClientLogger.d.ts.map +1 -0
  243. package/dist/test/testClientLogger.js +287 -0
  244. package/dist/test/testClientLogger.js.map +1 -0
  245. package/dist/test/testSerializer.d.ts +18 -0
  246. package/dist/test/testSerializer.d.ts.map +1 -0
  247. package/dist/test/testSerializer.js +33 -0
  248. package/dist/test/testSerializer.js.map +1 -0
  249. package/dist/test/testServer.d.ts +36 -0
  250. package/dist/test/testServer.d.ts.map +1 -0
  251. package/dist/test/testServer.js +138 -0
  252. package/dist/test/testServer.js.map +1 -0
  253. package/dist/test/testUtils.d.ts +69 -0
  254. package/dist/test/testUtils.d.ts.map +1 -0
  255. package/dist/test/testUtils.js +149 -0
  256. package/dist/test/testUtils.js.map +1 -0
  257. package/dist/test/text.d.ts +9 -0
  258. package/dist/test/text.d.ts.map +1 -0
  259. package/dist/test/text.js +76 -0
  260. package/dist/test/text.js.map +1 -0
  261. package/dist/test/tracking.spec.d.ts +6 -0
  262. package/dist/test/tracking.spec.d.ts.map +1 -0
  263. package/dist/test/tracking.spec.js +120 -0
  264. package/dist/test/tracking.spec.js.map +1 -0
  265. package/dist/test/wordUnitTests.d.ts +6 -0
  266. package/dist/test/wordUnitTests.d.ts.map +1 -0
  267. package/dist/test/wordUnitTests.js +172 -0
  268. package/dist/test/wordUnitTests.js.map +1 -0
  269. package/lib/{MergeTreeTextHelper.d.ts → MergeTreeTextHelper.d.mts} +3 -3
  270. package/lib/MergeTreeTextHelper.d.mts.map +1 -0
  271. package/lib/{MergeTreeTextHelper.js → MergeTreeTextHelper.mjs} +5 -10
  272. package/lib/MergeTreeTextHelper.mjs.map +1 -0
  273. package/lib/{attributionCollection.d.ts → attributionCollection.d.mts} +2 -2
  274. package/lib/attributionCollection.d.mts.map +1 -0
  275. package/lib/{attributionCollection.js → attributionCollection.mjs} +9 -14
  276. package/lib/attributionCollection.mjs.map +1 -0
  277. package/lib/{attributionPolicy.d.ts → attributionPolicy.d.mts} +2 -2
  278. package/lib/attributionPolicy.d.mts.map +1 -0
  279. package/lib/{attributionPolicy.js → attributionPolicy.mjs} +21 -27
  280. package/lib/attributionPolicy.mjs.map +1 -0
  281. package/lib/{client.d.ts → client.d.mts} +9 -16
  282. package/lib/client.d.mts.map +1 -0
  283. package/lib/{client.js → client.mjs} +101 -110
  284. package/lib/client.mjs.map +1 -0
  285. package/lib/collections/{index.d.ts → index.d.mts} +3 -3
  286. package/lib/collections/index.d.mts.map +1 -0
  287. package/lib/collections/index.mjs +7 -0
  288. package/lib/collections/index.mjs.map +1 -0
  289. package/lib/collections/{list.d.ts → list.d.mts} +1 -1
  290. package/lib/collections/list.d.mts.map +1 -0
  291. package/lib/collections/{list.js → list.mjs} +6 -11
  292. package/lib/collections/list.mjs.map +1 -0
  293. package/lib/collections/{rbTree.d.ts → rbTree.d.mts} +1 -1
  294. package/lib/collections/rbTree.d.mts.map +1 -0
  295. package/lib/collections/{rbTree.js → rbTree.mjs} +16 -20
  296. package/lib/collections/rbTree.mjs.map +1 -0
  297. package/lib/{constants.d.ts → constants.d.mts} +1 -1
  298. package/lib/constants.d.mts.map +1 -0
  299. package/lib/constants.mjs +32 -0
  300. package/lib/constants.mjs.map +1 -0
  301. package/lib/{endOfTreeSegment.d.ts → endOfTreeSegment.d.mts} +4 -4
  302. package/lib/endOfTreeSegment.d.mts.map +1 -0
  303. package/lib/{endOfTreeSegment.js → endOfTreeSegment.mjs} +13 -18
  304. package/lib/endOfTreeSegment.mjs.map +1 -0
  305. package/lib/{index.d.ts → index.d.mts} +21 -21
  306. package/lib/index.d.mts.map +1 -0
  307. package/lib/index.mjs +24 -0
  308. package/lib/index.mjs.map +1 -0
  309. package/lib/{localReference.d.ts → localReference.d.mts} +7 -7
  310. package/lib/localReference.d.mts.map +1 -0
  311. package/lib/{localReference.js → localReference.mjs} +38 -47
  312. package/lib/localReference.mjs.map +1 -0
  313. package/lib/{merge-tree-alpha.d.ts → merge-tree-alpha.d.mts} +27 -12
  314. package/lib/{merge-tree-beta.d.ts → merge-tree-beta.d.mts} +0 -16
  315. package/lib/{merge-tree-public.d.ts → merge-tree-public.d.mts} +0 -16
  316. package/lib/{merge-tree-untrimmed.d.ts → merge-tree-untrimmed.d.mts} +5 -29
  317. package/lib/{mergeTree.d.ts → mergeTree.d.mts} +12 -29
  318. package/lib/mergeTree.d.mts.map +1 -0
  319. package/lib/{mergeTree.js → mergeTree.mjs} +203 -340
  320. package/lib/mergeTree.mjs.map +1 -0
  321. package/lib/{mergeTreeDeltaCallback.d.ts → mergeTreeDeltaCallback.d.mts} +4 -8
  322. package/lib/mergeTreeDeltaCallback.d.mts.map +1 -0
  323. package/lib/{mergeTreeDeltaCallback.js → mergeTreeDeltaCallback.mjs} +2 -5
  324. package/lib/mergeTreeDeltaCallback.mjs.map +1 -0
  325. package/lib/{mergeTreeNodeWalk.d.ts → mergeTreeNodeWalk.d.mts} +2 -2
  326. package/lib/mergeTreeNodeWalk.d.mts.map +1 -0
  327. package/lib/{mergeTreeNodeWalk.js → mergeTreeNodeWalk.mjs} +14 -21
  328. package/lib/mergeTreeNodeWalk.mjs.map +1 -0
  329. package/lib/{mergeTreeNodes.d.ts → mergeTreeNodes.d.mts} +12 -12
  330. package/lib/mergeTreeNodes.d.mts.map +1 -0
  331. package/lib/{mergeTreeNodes.js → mergeTreeNodes.mjs} +60 -76
  332. package/lib/mergeTreeNodes.mjs.map +1 -0
  333. package/lib/{mergeTreeTracking.d.ts → mergeTreeTracking.d.mts} +3 -3
  334. package/lib/mergeTreeTracking.d.mts.map +1 -0
  335. package/lib/{mergeTreeTracking.js → mergeTreeTracking.mjs} +6 -13
  336. package/lib/mergeTreeTracking.mjs.map +1 -0
  337. package/lib/{opBuilder.d.ts → opBuilder.d.mts} +4 -4
  338. package/lib/opBuilder.d.mts.map +1 -0
  339. package/lib/{opBuilder.js → opBuilder.mjs} +15 -25
  340. package/lib/opBuilder.mjs.map +1 -0
  341. package/lib/{ops.d.ts → ops.d.mts} +2 -2
  342. package/lib/ops.d.mts.map +1 -0
  343. package/lib/{ops.js → ops.mjs} +5 -8
  344. package/lib/ops.mjs.map +1 -0
  345. package/lib/{ordinal.d.ts → ordinal.d.mts} +1 -1
  346. package/lib/ordinal.d.mts.map +1 -0
  347. package/lib/{ordinal.js → ordinal.mjs} +4 -9
  348. package/lib/ordinal.mjs.map +1 -0
  349. package/lib/{partialLengths.d.ts → partialLengths.d.mts} +4 -4
  350. package/lib/partialLengths.d.mts.map +1 -0
  351. package/lib/{partialLengths.js → partialLengths.mjs} +38 -46
  352. package/lib/partialLengths.mjs.map +1 -0
  353. package/lib/{properties.d.ts → properties.d.mts} +1 -1
  354. package/lib/properties.d.mts.map +1 -0
  355. package/lib/{properties.js → properties.mjs} +7 -16
  356. package/lib/properties.mjs.map +1 -0
  357. package/lib/{referencePositions.d.ts → referencePositions.d.mts} +5 -5
  358. package/lib/referencePositions.d.mts.map +1 -0
  359. package/lib/referencePositions.mjs +70 -0
  360. package/lib/referencePositions.mjs.map +1 -0
  361. package/lib/{revertibles.d.ts → revertibles.d.mts} +12 -12
  362. package/lib/revertibles.d.mts.map +1 -0
  363. package/lib/{revertibles.js → revertibles.mjs} +60 -67
  364. package/lib/revertibles.mjs.map +1 -0
  365. package/lib/{segmentGroupCollection.d.ts → segmentGroupCollection.d.mts} +2 -2
  366. package/lib/segmentGroupCollection.d.mts.map +1 -0
  367. package/lib/{segmentGroupCollection.js → segmentGroupCollection.mjs} +5 -9
  368. package/lib/segmentGroupCollection.mjs.map +1 -0
  369. package/lib/{segmentPropertiesManager.d.ts → segmentPropertiesManager.d.mts} +3 -3
  370. package/lib/segmentPropertiesManager.d.mts.map +1 -0
  371. package/lib/{segmentPropertiesManager.js → segmentPropertiesManager.mjs} +14 -20
  372. package/lib/{segmentPropertiesManager.js.map → segmentPropertiesManager.mjs.map} +1 -1
  373. package/lib/{snapshotChunks.d.ts → snapshotChunks.d.mts} +4 -4
  374. package/lib/snapshotChunks.d.mts.map +1 -0
  375. package/lib/{snapshotChunks.js → snapshotChunks.mjs} +10 -17
  376. package/lib/snapshotChunks.mjs.map +1 -0
  377. package/lib/{snapshotLoader.d.ts → snapshotLoader.d.mts} +3 -3
  378. package/lib/snapshotLoader.d.mts.map +1 -0
  379. package/lib/{snapshotLoader.js → snapshotLoader.mjs} +33 -38
  380. package/lib/snapshotLoader.mjs.map +1 -0
  381. package/lib/{snapshotV1.d.ts → snapshotV1.d.mts} +4 -4
  382. package/lib/snapshotV1.d.mts.map +1 -0
  383. package/lib/{snapshotV1.js → snapshotV1.mjs} +28 -32
  384. package/lib/snapshotV1.mjs.map +1 -0
  385. package/lib/{snapshotlegacy.d.ts → snapshotlegacy.d.mts} +3 -3
  386. package/lib/snapshotlegacy.d.mts.map +1 -0
  387. package/lib/{snapshotlegacy.js → snapshotlegacy.mjs} +21 -26
  388. package/lib/snapshotlegacy.mjs.map +1 -0
  389. package/lib/{sortedSegmentSet.d.ts → sortedSegmentSet.d.mts} +4 -4
  390. package/lib/sortedSegmentSet.d.mts.map +1 -0
  391. package/lib/{sortedSegmentSet.js → sortedSegmentSet.mjs} +3 -8
  392. package/lib/sortedSegmentSet.mjs.map +1 -0
  393. package/lib/{sortedSet.d.ts → sortedSet.d.mts} +1 -1
  394. package/lib/sortedSet.d.mts.map +1 -0
  395. package/lib/{sortedSet.js → sortedSet.mjs} +2 -6
  396. package/lib/sortedSet.mjs.map +1 -0
  397. package/lib/{textSegment.d.ts → textSegment.d.mts} +4 -4
  398. package/lib/textSegment.d.mts.map +1 -0
  399. package/lib/{textSegment.js → textSegment.mjs} +8 -12
  400. package/lib/textSegment.mjs.map +1 -0
  401. package/lib/{zamboni.d.ts → zamboni.d.mts} +3 -3
  402. package/lib/zamboni.d.mts.map +1 -0
  403. package/lib/{zamboni.js → zamboni.mjs} +22 -28
  404. package/lib/zamboni.mjs.map +1 -0
  405. package/package.json +95 -164
  406. package/src/client.ts +0 -8
  407. package/src/mergeTree.ts +0 -226
  408. package/src/ops.ts +1 -1
  409. package/src/revertibles.ts +4 -4
  410. package/lib/MergeTreeTextHelper.d.ts.map +0 -1
  411. package/lib/MergeTreeTextHelper.js.map +0 -1
  412. package/lib/attributionCollection.d.ts.map +0 -1
  413. package/lib/attributionCollection.js.map +0 -1
  414. package/lib/attributionPolicy.d.ts.map +0 -1
  415. package/lib/attributionPolicy.js.map +0 -1
  416. package/lib/client.d.ts.map +0 -1
  417. package/lib/client.js.map +0 -1
  418. package/lib/collections/index.d.ts.map +0 -1
  419. package/lib/collections/index.js +0 -14
  420. package/lib/collections/index.js.map +0 -1
  421. package/lib/collections/list.d.ts.map +0 -1
  422. package/lib/collections/list.js.map +0 -1
  423. package/lib/collections/rbTree.d.ts.map +0 -1
  424. package/lib/collections/rbTree.js.map +0 -1
  425. package/lib/constants.d.ts.map +0 -1
  426. package/lib/constants.js +0 -35
  427. package/lib/constants.js.map +0 -1
  428. package/lib/endOfTreeSegment.d.ts.map +0 -1
  429. package/lib/endOfTreeSegment.js.map +0 -1
  430. package/lib/index.d.ts.map +0 -1
  431. package/lib/index.js +0 -80
  432. package/lib/index.js.map +0 -1
  433. package/lib/localReference.d.ts.map +0 -1
  434. package/lib/localReference.js.map +0 -1
  435. package/lib/mergeTree.d.ts.map +0 -1
  436. package/lib/mergeTree.js.map +0 -1
  437. package/lib/mergeTreeDeltaCallback.d.ts.map +0 -1
  438. package/lib/mergeTreeDeltaCallback.js.map +0 -1
  439. package/lib/mergeTreeNodeWalk.d.ts.map +0 -1
  440. package/lib/mergeTreeNodeWalk.js.map +0 -1
  441. package/lib/mergeTreeNodes.d.ts.map +0 -1
  442. package/lib/mergeTreeNodes.js.map +0 -1
  443. package/lib/mergeTreeTracking.d.ts.map +0 -1
  444. package/lib/mergeTreeTracking.js.map +0 -1
  445. package/lib/opBuilder.d.ts.map +0 -1
  446. package/lib/opBuilder.js.map +0 -1
  447. package/lib/ops.d.ts.map +0 -1
  448. package/lib/ops.js.map +0 -1
  449. package/lib/ordinal.d.ts.map +0 -1
  450. package/lib/ordinal.js.map +0 -1
  451. package/lib/partialLengths.d.ts.map +0 -1
  452. package/lib/partialLengths.js.map +0 -1
  453. package/lib/properties.d.ts.map +0 -1
  454. package/lib/properties.js.map +0 -1
  455. package/lib/referencePositions.d.ts.map +0 -1
  456. package/lib/referencePositions.js +0 -80
  457. package/lib/referencePositions.js.map +0 -1
  458. package/lib/revertibles.d.ts.map +0 -1
  459. package/lib/revertibles.js.map +0 -1
  460. package/lib/segmentGroupCollection.d.ts.map +0 -1
  461. package/lib/segmentGroupCollection.js.map +0 -1
  462. package/lib/segmentPropertiesManager.d.ts.map +0 -1
  463. package/lib/snapshotChunks.d.ts.map +0 -1
  464. package/lib/snapshotChunks.js.map +0 -1
  465. package/lib/snapshotLoader.d.ts.map +0 -1
  466. package/lib/snapshotLoader.js.map +0 -1
  467. package/lib/snapshotV1.d.ts.map +0 -1
  468. package/lib/snapshotV1.js.map +0 -1
  469. package/lib/snapshotlegacy.d.ts.map +0 -1
  470. package/lib/snapshotlegacy.js.map +0 -1
  471. package/lib/sortedSegmentSet.d.ts.map +0 -1
  472. package/lib/sortedSegmentSet.js.map +0 -1
  473. package/lib/sortedSet.d.ts.map +0 -1
  474. package/lib/sortedSet.js.map +0 -1
  475. package/lib/textSegment.d.ts.map +0 -1
  476. package/lib/textSegment.js.map +0 -1
  477. package/lib/zamboni.d.ts.map +0 -1
  478. package/lib/zamboni.js.map +0 -1
  479. package/merge-tree.test-files.tar +0 -0
  480. package/src/mergeTreeExample1.pdf +0 -0
  481. package/tsconfig.esnext.json +0 -6
@@ -3,17 +3,17 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { AttributionKey } from "@fluidframework/runtime-definitions";
6
- import { IAttributionCollection } from "./attributionCollection";
7
- import { LocalReferenceCollection } from "./localReference";
8
- import { ISegmentLeaf } from "./mergeTree";
9
- import { IMergeTreeDeltaOpArgs } from "./mergeTreeDeltaCallback";
10
- import { TrackingGroupCollection } from "./mergeTreeTracking";
11
- import { IJSONSegment, IMarkerDef, ReferenceType } from "./ops";
12
- import { PartialSequenceLengths } from "./partialLengths";
13
- import { MapLike, PropertySet } from "./properties";
14
- import { ReferencePosition } from "./referencePositions";
15
- import { SegmentGroupCollection } from "./segmentGroupCollection";
16
- import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager";
6
+ import { IAttributionCollection } from "./attributionCollection.mjs";
7
+ import { LocalReferenceCollection } from "./localReference.mjs";
8
+ import { ISegmentLeaf } from "./mergeTree.mjs";
9
+ import { IMergeTreeDeltaOpArgs } from "./mergeTreeDeltaCallback.mjs";
10
+ import { TrackingGroupCollection } from "./mergeTreeTracking.mjs";
11
+ import { IJSONSegment, IMarkerDef, ReferenceType } from "./ops.mjs";
12
+ import { PartialSequenceLengths } from "./partialLengths.mjs";
13
+ import { MapLike, PropertySet } from "./properties.mjs";
14
+ import { ReferencePosition } from "./referencePositions.mjs";
15
+ import { SegmentGroupCollection } from "./segmentGroupCollection.mjs";
16
+ import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager.mjs";
17
17
  /**
18
18
  * Common properties for a node in a merge tree.
19
19
  * @alpha
@@ -537,4 +537,4 @@ export declare const compareStrings: (a: string, b: string) => number;
537
537
  * @internal
538
538
  */
539
539
  export declare function debugMarkerToString(marker: Marker): string;
540
- //# sourceMappingURL=mergeTreeNodes.d.ts.map
540
+ //# sourceMappingURL=mergeTreeNodes.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTreeNodes.d.mts","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"m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AAED;;GAEG;AACH,eAAO,MAAM,cAAc,MAAO,MAAM,KAAK,MAAM,WAAU,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,cAAc,MAAO,MAAM,KAAK,MAAM,WAAuB,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAkC1D"}
@@ -1,46 +1,39 @@
1
- "use strict";
2
1
  /*!
3
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
3
  * Licensed under the MIT License.
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.debugMarkerToString = exports.compareStrings = exports.compareNumbers = exports.CollaborationWindow = exports.Marker = exports.reservedMarkerSimpleTypeKey = exports.reservedMarkerIdKey = exports.BaseSegment = exports.seqLTE = exports.MergeBlock = exports.MaxNodesInBlock = exports.MergeNode = exports.toMoveInfo = exports.toRemovalInfo = void 0;
8
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
9
- const core_utils_1 = require("@fluidframework/core-utils");
10
- const constants_1 = require("./constants");
11
- const localReference_1 = require("./localReference");
12
- const mergeTreeTracking_1 = require("./mergeTreeTracking");
13
- const ops_1 = require("./ops");
14
- const ordinal_1 = require("./ordinal");
15
- // eslint-disable-next-line import/no-deprecated
16
- const properties_1 = require("./properties");
17
- const referencePositions_1 = require("./referencePositions");
18
- const segmentGroupCollection_1 = require("./segmentGroupCollection");
19
- const segmentPropertiesManager_1 = require("./segmentPropertiesManager");
5
+ import { assert } from "@fluidframework/core-utils";
6
+ import { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from "./constants.mjs";
7
+ import { LocalReferenceCollection } from "./localReference.mjs";
8
+ import { TrackingGroupCollection } from "./mergeTreeTracking.mjs";
9
+ import { MergeTreeDeltaType, ReferenceType } from "./ops.mjs";
10
+ import { computeHierarchicalOrdinal } from "./ordinal.mjs";
11
+ import { clone, createMap } from "./properties.mjs";
12
+ import { refTypeIncludesFlag, refGetTileLabels } from "./referencePositions.mjs";
13
+ import { SegmentGroupCollection } from "./segmentGroupCollection.mjs";
14
+ import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager.mjs";
20
15
  /**
21
16
  * @internal
22
17
  */
23
- function toRemovalInfo(maybe) {
18
+ export function toRemovalInfo(maybe) {
24
19
  if (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {
25
20
  return maybe;
26
21
  }
27
- (0, core_utils_1.assert)(maybe?.removedClientIds === undefined && maybe?.removedSeq === undefined, 0x2bf /* "both removedClientIds and removedSeq should be set or not set" */);
22
+ assert(maybe?.removedClientIds === undefined && maybe?.removedSeq === undefined, 0x2bf /* "both removedClientIds and removedSeq should be set or not set" */);
28
23
  }
29
- exports.toRemovalInfo = toRemovalInfo;
30
- function toMoveInfo(maybe) {
24
+ export function toMoveInfo(maybe) {
31
25
  if (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {
32
26
  return maybe;
33
27
  }
34
- (0, core_utils_1.assert)(maybe?.movedClientIds === undefined &&
28
+ assert(maybe?.movedClientIds === undefined &&
35
29
  maybe?.movedSeq === undefined &&
36
30
  maybe?.movedSeqs === undefined &&
37
31
  maybe?.wasMovedOnInsert === undefined, 0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */);
38
32
  }
39
- exports.toMoveInfo = toMoveInfo;
40
33
  /**
41
34
  * @alpha
42
35
  */
43
- class MergeNode {
36
+ export class MergeNode {
44
37
  constructor() {
45
38
  this.index = 0;
46
39
  this.ordinal = "";
@@ -50,7 +43,6 @@ class MergeNode {
50
43
  return false;
51
44
  }
52
45
  }
53
- exports.MergeNode = MergeNode;
54
46
  /**
55
47
  * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because
56
48
  * the MergeTree always inserts first, then checks for overflow and splits if the child count equals
@@ -58,23 +50,23 @@ exports.MergeNode = MergeNode;
58
50
  * facilitate splits.)
59
51
  * @internal
60
52
  */
61
- exports.MaxNodesInBlock = 8;
53
+ export const MaxNodesInBlock = 8;
62
54
  /**
63
55
  * @internal
64
56
  */
65
- class MergeBlock extends MergeNode {
57
+ export class MergeBlock extends MergeNode {
66
58
  constructor(childCount) {
67
59
  super();
68
60
  this.childCount = childCount;
69
- this.children = new Array(exports.MaxNodesInBlock);
61
+ this.children = new Array(MaxNodesInBlock);
70
62
  }
71
63
  hierBlock() {
72
64
  return undefined;
73
65
  }
74
66
  setOrdinal(child, index) {
75
67
  const childCount = this.childCount;
76
- (0, core_utils_1.assert)(childCount >= 1 && childCount <= exports.MaxNodesInBlock, 0x040 /* "Child count is not within [1,8] range!" */);
77
- child.ordinal = (0, ordinal_1.computeHierarchicalOrdinal)(exports.MaxNodesInBlock, childCount, this.ordinal, index === 0 ? undefined : this.children[index - 1]?.ordinal);
68
+ assert(childCount >= 1 && childCount <= MaxNodesInBlock, 0x040 /* "Child count is not within [1,8] range!" */);
69
+ child.ordinal = computeHierarchicalOrdinal(MaxNodesInBlock, childCount, this.ordinal, index === 0 ? undefined : this.children[index - 1]?.ordinal);
78
70
  }
79
71
  assignChild(child, index, updateOrdinal = true) {
80
72
  child.parent = this;
@@ -85,26 +77,24 @@ class MergeBlock extends MergeNode {
85
77
  this.children[index] = child;
86
78
  }
87
79
  }
88
- exports.MergeBlock = MergeBlock;
89
- function seqLTE(seq, minOrRefSeq) {
90
- return seq !== constants_1.UnassignedSequenceNumber && seq <= minOrRefSeq;
80
+ export function seqLTE(seq, minOrRefSeq) {
81
+ return seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;
91
82
  }
92
- exports.seqLTE = seqLTE;
93
83
  /**
94
84
  * @alpha
95
85
  */
96
- class BaseSegment extends MergeNode {
86
+ export class BaseSegment extends MergeNode {
97
87
  constructor() {
98
88
  super(...arguments);
99
- this.clientId = constants_1.LocalClientId;
100
- this.seq = constants_1.UniversalSequenceNumber;
101
- this.segmentGroups = new segmentGroupCollection_1.SegmentGroupCollection(this);
102
- this.trackingCollection = new mergeTreeTracking_1.TrackingGroupCollection(this);
89
+ this.clientId = LocalClientId;
90
+ this.seq = UniversalSequenceNumber;
91
+ this.segmentGroups = new SegmentGroupCollection(this);
92
+ this.trackingCollection = new TrackingGroupCollection(this);
103
93
  }
104
- addProperties(newProps, seq, collaborating, rollback = segmentPropertiesManager_1.PropertiesRollback.None) {
105
- this.propertyManager ?? (this.propertyManager = new segmentPropertiesManager_1.PropertiesManager());
94
+ addProperties(newProps, seq, collaborating, rollback = PropertiesRollback.None) {
95
+ this.propertyManager ?? (this.propertyManager = new PropertiesManager());
106
96
  // eslint-disable-next-line import/no-deprecated
107
- this.properties ?? (this.properties = (0, properties_1.createMap)());
97
+ this.properties ?? (this.properties = createMap());
108
98
  return this.propertyManager.addProperties(this.properties, newProps, seq, collaborating, rollback);
109
99
  }
110
100
  hasProperty(key) {
@@ -117,7 +107,7 @@ class BaseSegment extends MergeNode {
117
107
  b.clientId = this.clientId;
118
108
  // TODO: deep clone properties
119
109
  // eslint-disable-next-line import/no-deprecated
120
- b.properties = (0, properties_1.clone)(this.properties);
110
+ b.properties = clone(this.properties);
121
111
  b.removedClientIds = this.removedClientIds?.slice();
122
112
  // TODO: copy removed client overlap and branch removal info
123
113
  b.removedSeq = this.removedSeq;
@@ -139,34 +129,34 @@ class BaseSegment extends MergeNode {
139
129
  /***/
140
130
  ack(segmentGroup, opArgs) {
141
131
  const currentSegmentGroup = this.segmentGroups.dequeue();
142
- (0, core_utils_1.assert)(currentSegmentGroup === segmentGroup, 0x043 /* "On ack, unexpected segmentGroup!" */);
132
+ assert(currentSegmentGroup === segmentGroup, 0x043 /* "On ack, unexpected segmentGroup!" */);
143
133
  switch (opArgs.op.type) {
144
- case ops_1.MergeTreeDeltaType.ANNOTATE:
145
- (0, core_utils_1.assert)(!!this.propertyManager, 0x044 /* "On annotate ack, missing segment property manager!" */);
134
+ case MergeTreeDeltaType.ANNOTATE:
135
+ assert(!!this.propertyManager, 0x044 /* "On annotate ack, missing segment property manager!" */);
146
136
  this.propertyManager.ackPendingProperties(opArgs.op);
147
137
  return true;
148
- case ops_1.MergeTreeDeltaType.INSERT:
149
- (0, core_utils_1.assert)(this.seq === constants_1.UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */);
138
+ case MergeTreeDeltaType.INSERT:
139
+ assert(this.seq === UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */);
150
140
  this.seq = opArgs.sequencedMessage.sequenceNumber;
151
141
  this.localSeq = undefined;
152
142
  return true;
153
- case ops_1.MergeTreeDeltaType.REMOVE:
143
+ case MergeTreeDeltaType.REMOVE:
154
144
  const removalInfo = toRemovalInfo(this);
155
- (0, core_utils_1.assert)(removalInfo !== undefined, 0x046 /* "On remove ack, missing removal info!" */);
145
+ assert(removalInfo !== undefined, 0x046 /* "On remove ack, missing removal info!" */);
156
146
  this.localRemovedSeq = undefined;
157
- if (removalInfo.removedSeq === constants_1.UnassignedSequenceNumber) {
147
+ if (removalInfo.removedSeq === UnassignedSequenceNumber) {
158
148
  removalInfo.removedSeq = opArgs.sequencedMessage.sequenceNumber;
159
149
  return true;
160
150
  }
161
151
  return false;
162
- case ops_1.MergeTreeDeltaType.OBLITERATE:
152
+ case MergeTreeDeltaType.OBLITERATE:
163
153
  const moveInfo = toMoveInfo(this);
164
- (0, core_utils_1.assert)(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);
154
+ assert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);
165
155
  this.localMovedSeq = undefined;
166
- const seqIdx = moveInfo.movedSeqs.indexOf(constants_1.UnassignedSequenceNumber);
167
- (0, core_utils_1.assert)(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);
156
+ const seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);
157
+ assert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);
168
158
  moveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage.sequenceNumber;
169
- if (moveInfo.movedSeq === constants_1.UnassignedSequenceNumber) {
159
+ if (moveInfo.movedSeq === UnassignedSequenceNumber) {
170
160
  moveInfo.movedSeq = opArgs.sequencedMessage.sequenceNumber;
171
161
  return true;
172
162
  }
@@ -215,7 +205,7 @@ class BaseSegment extends MergeNode {
215
205
  copyPropertiesTo(other) {
216
206
  if (this.propertyManager) {
217
207
  if (this.properties) {
218
- other.propertyManager = new segmentPropertiesManager_1.PropertiesManager();
208
+ other.propertyManager = new PropertiesManager();
219
209
  other.properties = this.propertyManager.copyTo(this.properties, other.properties, other.propertyManager);
220
210
  }
221
211
  }
@@ -223,19 +213,18 @@ class BaseSegment extends MergeNode {
223
213
  append(other) {
224
214
  // Note: Must call 'appendLocalRefs' before modifying this segment's length as
225
215
  // 'this.cachedLength' is used to adjust the offsets of the local refs.
226
- localReference_1.LocalReferenceCollection.append(this, other);
216
+ LocalReferenceCollection.append(this, other);
227
217
  if (this.attribution) {
228
- (0, core_utils_1.assert)(other.attribution !== undefined, 0x4bd /* attribution should be set on appendee */);
218
+ assert(other.attribution !== undefined, 0x4bd /* attribution should be set on appendee */);
229
219
  this.attribution.append(other.attribution);
230
220
  }
231
221
  else {
232
- (0, core_utils_1.assert)(other.attribution === undefined, 0x4be /* attribution should not be set on appendee */);
222
+ assert(other.attribution === undefined, 0x4be /* attribution should not be set on appendee */);
233
223
  }
234
224
  this.cachedLength ?? (this.cachedLength = 0);
235
225
  this.cachedLength += other.cachedLength;
236
226
  }
237
227
  }
238
- exports.BaseSegment = BaseSegment;
239
228
  /**
240
229
  * The special-cased property key that tracks the id of a {@link Marker}.
241
230
  *
@@ -243,11 +232,11 @@ exports.BaseSegment = BaseSegment;
243
232
  * {@link Marker.getId}. Marker ids should not be updated after creation.
244
233
  * @internal
245
234
  */
246
- exports.reservedMarkerIdKey = "markerId";
235
+ export const reservedMarkerIdKey = "markerId";
247
236
  /**
248
237
  * @internal
249
238
  */
250
- exports.reservedMarkerSimpleTypeKey = "markerSimpleType";
239
+ export const reservedMarkerSimpleTypeKey = "markerSimpleType";
251
240
  /**
252
241
  * Markers are a special kind of segment that do not hold any content.
253
242
  *
@@ -259,7 +248,7 @@ exports.reservedMarkerSimpleTypeKey = "markerSimpleType";
259
248
  *
260
249
  * @alpha
261
250
  */
262
- class Marker extends BaseSegment {
251
+ export class Marker extends BaseSegment {
263
252
  static is(segment) {
264
253
  return segment.type === Marker.type;
265
254
  }
@@ -302,7 +291,7 @@ class Marker extends BaseSegment {
302
291
  return this.properties;
303
292
  }
304
293
  getId() {
305
- return this.properties?.[exports.reservedMarkerIdKey];
294
+ return this.properties?.[reservedMarkerIdKey];
306
295
  }
307
296
  toString() {
308
297
  return `M${this.getId()}`;
@@ -317,15 +306,14 @@ class Marker extends BaseSegment {
317
306
  throw new Error("Can not append to marker");
318
307
  }
319
308
  }
320
- exports.Marker = Marker;
321
309
  Marker.type = "Marker";
322
310
  /**
323
311
  * @deprecated This functionality was not meant to be exported and will be removed in a future release
324
312
  * @alpha
325
313
  */
326
- class CollaborationWindow {
314
+ export class CollaborationWindow {
327
315
  constructor() {
328
- this.clientId = constants_1.LocalClientId;
316
+ this.clientId = LocalClientId;
329
317
  this.collaborating = false;
330
318
  /**
331
319
  * Lowest-numbered segment in window; no client can reference a state before this one
@@ -407,17 +395,14 @@ class CollaborationWindow {
407
395
  this.currentSeq = a.currentSeq;
408
396
  }
409
397
  }
410
- exports.CollaborationWindow = CollaborationWindow;
411
398
  /**
412
399
  * @internal
413
400
  */
414
- const compareNumbers = (a, b) => a - b;
415
- exports.compareNumbers = compareNumbers;
401
+ export const compareNumbers = (a, b) => a - b;
416
402
  /**
417
403
  * @internal
418
404
  */
419
- const compareStrings = (a, b) => a.localeCompare(b);
420
- exports.compareStrings = compareStrings;
405
+ export const compareStrings = (a, b) => a.localeCompare(b);
421
406
  /**
422
407
  * Get a human-readable string for a given {@link Marker}.
423
408
  *
@@ -425,9 +410,9 @@ exports.compareStrings = compareStrings;
425
410
  * this string should not be relied upon between versions.
426
411
  * @internal
427
412
  */
428
- function debugMarkerToString(marker) {
413
+ export function debugMarkerToString(marker) {
429
414
  let bbuf = "";
430
- if ((0, referencePositions_1.refTypeIncludesFlag)(marker, ops_1.ReferenceType.Tile)) {
415
+ if (refTypeIncludesFlag(marker, ReferenceType.Tile)) {
431
416
  bbuf += "Tile";
432
417
  }
433
418
  let lbuf = "";
@@ -435,7 +420,7 @@ function debugMarkerToString(marker) {
435
420
  if (id) {
436
421
  bbuf += ` (${id}) `;
437
422
  }
438
- const tileLabels = (0, referencePositions_1.refGetTileLabels)(marker);
423
+ const tileLabels = refGetTileLabels(marker);
439
424
  if (tileLabels) {
440
425
  lbuf += "tile -- ";
441
426
  for (let i = 0, len = tileLabels.length; i < len; i++) {
@@ -458,5 +443,4 @@ function debugMarkerToString(marker) {
458
443
  }
459
444
  return `M ${bbuf}: ${lbuf} ${pbuf}`;
460
445
  }
461
- exports.debugMarkerToString = debugMarkerToString;
462
- //# sourceMappingURL=mergeTreeNodes.js.map
446
+ //# sourceMappingURL=mergeTreeNodes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTreeNodes.mjs","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAG5C,EAAE,aAAa,EAAE,wBAAwB,EAAE,uBAAuB,EAAE;OACpE,EAAE,wBAAwB,EAAE;OAG5B,EAAE,uBAAuB,EAAE;OAC3B,EAA4B,kBAAkB,EAAE,aAAa,EAAE;OAC/D,EAAE,0BAA0B,EAAE;OAG9B,EAAE,KAAK,EAAE,SAAS,EAAwB;OAC1C,EAAE,mBAAmB,EAAqB,gBAAgB,EAAE;OAC5D,EAAE,sBAAsB,EAAE;OAC1B,EAAE,iBAAiB,EAAE,kBAAkB,EAAE;AAwFhD;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwC;IACrE,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KA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EAAE,IAAI,CAAC;KACpB;IACD,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM,CAAC,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","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\";\nimport { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants\";\nimport { LocalReferenceCollection } from \"./localReference\";\nimport { ISegmentLeaf } from \"./mergeTree\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops\";\nimport { computeHierarchicalOrdinal } from \"./ordinal\";\nimport { PartialSequenceLengths } from \"./partialLengths\";\n// eslint-disable-next-line import/no-deprecated\nimport { clone, createMap, MapLike, PropertySet } from \"./properties\";\nimport { refTypeIncludesFlag, ReferencePosition, refGetTileLabels } from \"./referencePositions\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection\";\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager\";\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\nexport type IMergeLeaf = ISegment & { parent?: IMergeBlock };\nexport type IMergeNode = IMergeBlock | IMergeLeaf;\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: ISegmentLeaf[];\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: IMergeLeaf | 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: IMergeLeaf = 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"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { LocalReferencePosition } from "./localReference";
6
- import { ISegment } from "./mergeTreeNodes";
5
+ import { LocalReferencePosition } from "./localReference.mjs";
6
+ import { ISegment } from "./mergeTreeNodes.mjs";
7
7
  /**
8
8
  * @alpha
9
9
  */
@@ -57,4 +57,4 @@ export declare class TrackingGroupCollection {
57
57
  get empty(): boolean;
58
58
  matches(trackingCollection: TrackingGroupCollection): boolean;
59
59
  }
60
- //# sourceMappingURL=mergeTreeTracking.d.ts.map
60
+ //# sourceMappingURL=mergeTreeTracking.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTreeTracking.d.mts","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,sBAAsB,EAAE;OAC1B,EAAE,QAAQ,EAAE;AAInB;;GAEG;AACH,MAAM,MAAM,SAAS,GAA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AAC,aAAa,EAAE,cAAc,GAAG,OAAO;IAY9C,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAMzC,IAAW,KAAK,IAAI,OAAO,CAE1B;IAEM,OAAO,CAAC,kBAAkB,EAAE,uBAAuB,GAAG,OAAO;CAcpE"}
@@ -1,19 +1,15 @@
1
- "use strict";
2
1
  /*!
3
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
3
  * Licensed under the MIT License.
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.TrackingGroupCollection = exports.UnorderedTrackingGroup = exports.TrackingGroup = void 0;
8
- // eslint-disable-next-line import/no-deprecated
9
- const sortedSegmentSet_1 = require("./sortedSegmentSet");
5
+ import { SortedSegmentSet } from "./sortedSegmentSet.mjs";
10
6
  /**
11
7
  * @alpha
12
8
  */
13
- class TrackingGroup {
9
+ export class TrackingGroup {
14
10
  constructor() {
15
11
  // eslint-disable-next-line import/no-deprecated
16
- this.trackedSet = new sortedSegmentSet_1.SortedSegmentSet();
12
+ this.trackedSet = new SortedSegmentSet();
17
13
  }
18
14
  get tracked() {
19
15
  return this.trackedSet.items;
@@ -38,11 +34,10 @@ class TrackingGroup {
38
34
  return false;
39
35
  }
40
36
  }
41
- exports.TrackingGroup = TrackingGroup;
42
37
  /**
43
38
  * Tracking group backed by an unordered set. Lookup, insertion, and deletion are O(1)
44
39
  */
45
- class UnorderedTrackingGroup {
40
+ export class UnorderedTrackingGroup {
46
41
  constructor() {
47
42
  this.trackedSet = new Set();
48
43
  }
@@ -69,12 +64,11 @@ class UnorderedTrackingGroup {
69
64
  return false;
70
65
  }
71
66
  }
72
- exports.UnorderedTrackingGroup = UnorderedTrackingGroup;
73
67
  /**
74
68
  * A collection of {@link ITrackingGroup}.
75
69
  * @alpha
76
70
  */
77
- class TrackingGroupCollection {
71
+ export class TrackingGroupCollection {
78
72
  get trackingGroups() {
79
73
  // Cast here is necessary to avoid a breaking change to
80
74
  // `TrackingGroupCollection`. Ideally we could just return
@@ -126,5 +120,4 @@ class TrackingGroupCollection {
126
120
  return true;
127
121
  }
128
122
  }
129
- exports.TrackingGroupCollection = TrackingGroupCollection;
130
- //# sourceMappingURL=mergeTreeTracking.js.map
123
+ //# sourceMappingURL=mergeTreeTracking.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTreeTracking.mjs","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAKI,EAAE,gBAAgB,EAAE;AAkB3B;;GAEG;AACH,MAAM,OAAO,aAAa;IAIzB;QACC,gDAAgD;QAChD,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,EAAa,CAAC;IACrD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,SAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAEM,IAAI,CAAC,SAAoB;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YACpC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACvC,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACxC;IACF,CAAC;IAEM,MAAM,CAAC,SAAoB;QACjC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YACtC,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAGlC;QACC,IAAI,CAA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n * Licensed under the MIT License.\n */\n\nimport { LocalReferencePosition } from \"./localReference\";\nimport { ISegment } from \"./mergeTreeNodes\";\n// eslint-disable-next-line import/no-deprecated\nimport { SortedSegmentSet } from \"./sortedSegmentSet\";\n\n/**\n * @alpha\n */\nexport type Trackable = ISegment | LocalReferencePosition;\n\n/**\n * @alpha\n */\nexport interface ITrackingGroup {\n\ttracked: readonly Trackable[];\n\tsize: number;\n\thas(trackable: Trackable): boolean;\n\tlink(trackable: Trackable): void;\n\tunlink(trackable: Trackable): boolean;\n}\n\n/**\n * @alpha\n */\nexport class TrackingGroup implements ITrackingGroup {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly trackedSet: SortedSegmentSet<Trackable>;\n\n\tconstructor() {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.trackedSet = new SortedSegmentSet<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn this.trackedSet.items;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.addOrUpdate(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.remove(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * Tracking group backed by an unordered set. Lookup, insertion, and deletion are O(1)\n */\nexport class UnorderedTrackingGroup implements ITrackingGroup {\n\tprivate readonly trackedSet: Set<Trackable>;\n\n\tconstructor() {\n\t\tthis.trackedSet = new Set<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn Array.from(this.trackedSet);\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.add(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.delete(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * A collection of {@link ITrackingGroup}.\n * @alpha\n */\nexport class TrackingGroupCollection {\n\tprivate readonly _trackingGroups: Set<ITrackingGroup>;\n\n\tpublic get trackingGroups(): Set<TrackingGroup> {\n\t\t// Cast here is necessary to avoid a breaking change to\n\t\t// `TrackingGroupCollection`. Ideally we could just return\n\t\t// `Set<ITrackingGroup>`\n\t\treturn this._trackingGroups as Set<TrackingGroup>;\n\t}\n\n\tconstructor(private readonly trackable: Trackable) {\n\t\tthis._trackingGroups = new Set<ITrackingGroup>();\n\t}\n\n\tpublic link(trackingGroup: ITrackingGroup): void {\n\t\tif (trackingGroup) {\n\t\t\tif (!this._trackingGroups.has(trackingGroup)) {\n\t\t\t\tthis._trackingGroups.add(trackingGroup);\n\t\t\t}\n\n\t\t\tif (!trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.link(this.trackable);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic unlink(trackingGroup: ITrackingGroup): boolean {\n\t\tif (this._trackingGroups.has(trackingGroup)) {\n\t\t\tif (trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.unlink(this.trackable);\n\t\t\t}\n\t\t\tthis._trackingGroups.delete(trackingGroup);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic copyTo(trackable: Trackable): void {\n\t\tthis._trackingGroups.forEach((sg) => {\n\t\t\ttrackable.trackingCollection.link(sg);\n\t\t});\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this._trackingGroups.size === 0;\n\t}\n\n\tpublic matches(trackingCollection: TrackingGroupCollection): boolean {\n\t\tif (\n\t\t\t!trackingCollection ||\n\t\t\tthis._trackingGroups.size !== trackingCollection._trackingGroups.size\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const tg of this._trackingGroups.values()) {\n\t\t\tif (!trackingCollection._trackingGroups.has(tg)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISegment, Marker } from "./mergeTreeNodes";
6
- import { IMergeTreeAnnotateMsg, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeRemoveMsg, IMergeTreeDeltaOp, IMergeTreeObliterateMsg } from "./ops";
7
- import { PropertySet } from "./properties";
5
+ import { ISegment, Marker } from "./mergeTreeNodes.mjs";
6
+ import { IMergeTreeAnnotateMsg, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeRemoveMsg, IMergeTreeDeltaOp, IMergeTreeObliterateMsg } from "./ops.mjs";
7
+ import { PropertySet } from "./properties.mjs";
8
8
  /**
9
9
  * Creates the op for annotating the markers with the provided properties
10
10
  * @param marker - The marker to annotate
@@ -66,4 +66,4 @@ export declare function createInsertOp(pos: number, segSpec: any): IMergeTreeIns
66
66
  * @internal
67
67
  */
68
68
  export declare function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg;
69
- //# sourceMappingURL=opBuilder.d.ts.map
69
+ //# sourceMappingURL=opBuilder.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opBuilder.d.mts","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,MAAM,EAAE;OACpB,EACN,qBAAqB,EAErB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EAEjB,uBAAuB,EACvB;OACM,EAAE,WAAW,EAAE;AAEtB;;;;;;;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,OAAO,EAAE,GAAG,GAAG,mBAAmB,CAM7E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,aAAa,CAAC,GAAG,GAAG,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAK7E"}