@fluidframework/merge-tree 2.53.0 → 2.60.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 (378) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/{merge-tree.legacy.alpha.api.md → merge-tree.legacy.beta.api.md} +62 -62
  3. package/dist/attributionCollection.d.ts +7 -12
  4. package/dist/attributionCollection.d.ts.map +1 -1
  5. package/dist/attributionCollection.js.map +1 -1
  6. package/dist/attributionPolicy.d.ts +1 -1
  7. package/dist/attributionPolicy.d.ts.map +1 -1
  8. package/dist/attributionPolicy.js.map +1 -1
  9. package/dist/client.d.ts +11 -11
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js.map +1 -1
  12. package/dist/collections/index.d.ts +1 -1
  13. package/dist/collections/index.d.ts.map +1 -1
  14. package/dist/collections/index.js.map +1 -1
  15. package/dist/endOfTreeSegment.d.ts +4 -4
  16. package/dist/endOfTreeSegment.d.ts.map +1 -1
  17. package/dist/endOfTreeSegment.js.map +1 -1
  18. package/dist/index.d.ts +16 -16
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/localReference.d.ts +6 -9
  22. package/dist/localReference.d.ts.map +1 -1
  23. package/dist/localReference.js +1 -2
  24. package/dist/localReference.js.map +1 -1
  25. package/dist/mergeTree.d.ts +9 -10
  26. package/dist/mergeTree.d.ts.map +1 -1
  27. package/dist/mergeTree.js.map +1 -1
  28. package/dist/mergeTreeDeltaCallback.d.ts +12 -20
  29. package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
  30. package/dist/mergeTreeDeltaCallback.js +1 -2
  31. package/dist/mergeTreeDeltaCallback.js.map +1 -1
  32. package/dist/mergeTreeNodeWalk.d.ts +1 -1
  33. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  34. package/dist/mergeTreeNodeWalk.js.map +1 -1
  35. package/dist/mergeTreeNodes.d.ts +14 -21
  36. package/dist/mergeTreeNodes.d.ts.map +1 -1
  37. package/dist/mergeTreeNodes.js +4 -8
  38. package/dist/mergeTreeNodes.js.map +1 -1
  39. package/dist/mergeTreeTracking.d.ts +6 -10
  40. package/dist/mergeTreeTracking.d.ts.map +1 -1
  41. package/dist/mergeTreeTracking.js +2 -4
  42. package/dist/mergeTreeTracking.js.map +1 -1
  43. package/dist/opBuilder.d.ts +3 -3
  44. package/dist/opBuilder.d.ts.map +1 -1
  45. package/dist/opBuilder.js.map +1 -1
  46. package/dist/ops.d.ts +17 -34
  47. package/dist/ops.d.ts.map +1 -1
  48. package/dist/ops.js +2 -4
  49. package/dist/ops.js.map +1 -1
  50. package/dist/partialLengths.d.ts +2 -2
  51. package/dist/partialLengths.d.ts.map +1 -1
  52. package/dist/partialLengths.js.map +1 -1
  53. package/dist/properties.d.ts +2 -4
  54. package/dist/properties.d.ts.map +1 -1
  55. package/dist/properties.js.map +1 -1
  56. package/dist/referencePositions.d.ts +6 -9
  57. package/dist/referencePositions.d.ts.map +1 -1
  58. package/dist/referencePositions.js +2 -4
  59. package/dist/referencePositions.js.map +1 -1
  60. package/dist/revertibles.d.ts +11 -16
  61. package/dist/revertibles.d.ts.map +1 -1
  62. package/dist/revertibles.js +3 -6
  63. package/dist/revertibles.js.map +1 -1
  64. package/dist/segmentGroupCollection.d.ts +1 -1
  65. package/dist/segmentGroupCollection.d.ts.map +1 -1
  66. package/dist/segmentGroupCollection.js.map +1 -1
  67. package/dist/segmentInfos.d.ts +1 -1
  68. package/dist/segmentInfos.d.ts.map +1 -1
  69. package/dist/segmentInfos.js.map +1 -1
  70. package/dist/segmentPropertiesManager.d.ts +1 -1
  71. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  72. package/dist/segmentPropertiesManager.js.map +1 -1
  73. package/dist/sequencePlace.d.ts +4 -8
  74. package/dist/sequencePlace.d.ts.map +1 -1
  75. package/dist/sequencePlace.js +2 -4
  76. package/dist/sequencePlace.js.map +1 -1
  77. package/dist/snapshotChunks.d.ts +6 -6
  78. package/dist/snapshotChunks.d.ts.map +1 -1
  79. package/dist/snapshotChunks.js.map +1 -1
  80. package/dist/snapshotLoader.d.ts +6 -6
  81. package/dist/snapshotLoader.d.ts.map +1 -1
  82. package/dist/snapshotLoader.js.map +1 -1
  83. package/dist/snapshotV1.d.ts +8 -8
  84. package/dist/snapshotV1.d.ts.map +1 -1
  85. package/dist/snapshotV1.js.map +1 -1
  86. package/dist/snapshotlegacy.d.ts +6 -6
  87. package/dist/snapshotlegacy.d.ts.map +1 -1
  88. package/dist/snapshotlegacy.js.map +1 -1
  89. package/dist/sortedSegmentSet.d.ts +2 -2
  90. package/dist/sortedSegmentSet.d.ts.map +1 -1
  91. package/dist/sortedSegmentSet.js.map +1 -1
  92. package/dist/test/Removal.perf.spec.js.map +1 -1
  93. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  94. package/dist/test/attributionCollection.spec.js.map +1 -1
  95. package/dist/test/attributionPolicy.spec.js.map +1 -1
  96. package/dist/test/beastTest.spec.d.ts +1 -1
  97. package/dist/test/beastTest.spec.d.ts.map +1 -1
  98. package/dist/test/beastTest.spec.js.map +1 -1
  99. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  100. package/dist/test/client.apis.spec.js.map +1 -1
  101. package/dist/test/client.applyMsg.spec.js.map +1 -1
  102. package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  103. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  104. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  105. package/dist/test/client.attributionFarm.spec.d.ts +1 -1
  106. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
  107. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  108. package/dist/test/client.conflictFarm.spec.d.ts +1 -1
  109. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  110. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  111. package/dist/test/client.localReference.spec.js.map +1 -1
  112. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  113. package/dist/test/client.obliterateFarm.spec.d.ts +1 -1
  114. package/dist/test/client.obliterateFarm.spec.d.ts.map +1 -1
  115. package/dist/test/client.obliterateFarm.spec.js.map +1 -1
  116. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  117. package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
  118. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
  119. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  120. package/dist/test/client.replay.spec.js.map +1 -1
  121. package/dist/test/client.rollback.spec.js.map +1 -1
  122. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  123. package/dist/test/clientTestHelper.d.ts +1 -1
  124. package/dist/test/clientTestHelper.d.ts.map +1 -1
  125. package/dist/test/clientTestHelper.js.map +1 -1
  126. package/dist/test/index.d.ts +4 -4
  127. package/dist/test/index.d.ts.map +1 -1
  128. package/dist/test/index.js.map +1 -1
  129. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  130. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  131. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  132. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  133. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  134. package/dist/test/mergeTreeOperationRunner.d.ts +5 -5
  135. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  136. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  137. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  138. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
  139. package/dist/test/obliterateOperations.js.map +1 -1
  140. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  141. package/dist/test/revertibleFarm.spec.js.map +1 -1
  142. package/dist/test/revertibles.spec.js.map +1 -1
  143. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  144. package/dist/test/snapshot.spec.js.map +1 -1
  145. package/dist/test/snapshot.utils.d.ts +4 -4
  146. package/dist/test/snapshot.utils.d.ts.map +1 -1
  147. package/dist/test/snapshot.utils.js.map +1 -1
  148. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  149. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  150. package/dist/test/testClient.d.ts +9 -9
  151. package/dist/test/testClient.d.ts.map +1 -1
  152. package/dist/test/testClient.js.map +1 -1
  153. package/dist/test/testClientLogger.d.ts +2 -2
  154. package/dist/test/testClientLogger.d.ts.map +1 -1
  155. package/dist/test/testClientLogger.js.map +1 -1
  156. package/dist/test/testSerializer.d.ts +2 -2
  157. package/dist/test/testSerializer.d.ts.map +1 -1
  158. package/dist/test/testSerializer.js.map +1 -1
  159. package/dist/test/testServer.d.ts +2 -2
  160. package/dist/test/testServer.d.ts.map +1 -1
  161. package/dist/test/testServer.js.map +1 -1
  162. package/dist/test/testUtils.d.ts +3 -3
  163. package/dist/test/testUtils.d.ts.map +1 -1
  164. package/dist/test/testUtils.js.map +1 -1
  165. package/dist/test/text.d.ts +1 -1
  166. package/dist/test/text.d.ts.map +1 -1
  167. package/dist/test/text.js.map +1 -1
  168. package/dist/test/wordUnitTests.spec.js.map +1 -1
  169. package/dist/textSegment.d.ts +4 -6
  170. package/dist/textSegment.d.ts.map +1 -1
  171. package/dist/textSegment.js +1 -2
  172. package/dist/textSegment.js.map +1 -1
  173. package/dist/zamboni.d.ts +1 -1
  174. package/dist/zamboni.d.ts.map +1 -1
  175. package/dist/zamboni.js.map +1 -1
  176. package/lib/attributionCollection.d.ts +7 -12
  177. package/lib/attributionCollection.d.ts.map +1 -1
  178. package/lib/attributionCollection.js.map +1 -1
  179. package/lib/attributionPolicy.d.ts +1 -1
  180. package/lib/attributionPolicy.d.ts.map +1 -1
  181. package/lib/attributionPolicy.js.map +1 -1
  182. package/lib/client.d.ts +11 -11
  183. package/lib/client.d.ts.map +1 -1
  184. package/lib/client.js.map +1 -1
  185. package/lib/collections/index.d.ts +1 -1
  186. package/lib/collections/index.d.ts.map +1 -1
  187. package/lib/collections/index.js.map +1 -1
  188. package/lib/endOfTreeSegment.d.ts +4 -4
  189. package/lib/endOfTreeSegment.d.ts.map +1 -1
  190. package/lib/endOfTreeSegment.js.map +1 -1
  191. package/lib/index.d.ts +16 -16
  192. package/lib/index.d.ts.map +1 -1
  193. package/lib/index.js.map +1 -1
  194. package/lib/localReference.d.ts +6 -9
  195. package/lib/localReference.d.ts.map +1 -1
  196. package/lib/localReference.js +1 -2
  197. package/lib/localReference.js.map +1 -1
  198. package/lib/mergeTree.d.ts +9 -10
  199. package/lib/mergeTree.d.ts.map +1 -1
  200. package/lib/mergeTree.js.map +1 -1
  201. package/lib/mergeTreeDeltaCallback.d.ts +12 -20
  202. package/lib/mergeTreeDeltaCallback.d.ts.map +1 -1
  203. package/lib/mergeTreeDeltaCallback.js +1 -2
  204. package/lib/mergeTreeDeltaCallback.js.map +1 -1
  205. package/lib/mergeTreeNodeWalk.d.ts +1 -1
  206. package/lib/mergeTreeNodeWalk.d.ts.map +1 -1
  207. package/lib/mergeTreeNodeWalk.js.map +1 -1
  208. package/lib/mergeTreeNodes.d.ts +14 -21
  209. package/lib/mergeTreeNodes.d.ts.map +1 -1
  210. package/lib/mergeTreeNodes.js +4 -8
  211. package/lib/mergeTreeNodes.js.map +1 -1
  212. package/lib/mergeTreeTracking.d.ts +6 -10
  213. package/lib/mergeTreeTracking.d.ts.map +1 -1
  214. package/lib/mergeTreeTracking.js +2 -4
  215. package/lib/mergeTreeTracking.js.map +1 -1
  216. package/lib/opBuilder.d.ts +3 -3
  217. package/lib/opBuilder.d.ts.map +1 -1
  218. package/lib/opBuilder.js.map +1 -1
  219. package/lib/ops.d.ts +17 -34
  220. package/lib/ops.d.ts.map +1 -1
  221. package/lib/ops.js +2 -4
  222. package/lib/ops.js.map +1 -1
  223. package/lib/partialLengths.d.ts +2 -2
  224. package/lib/partialLengths.d.ts.map +1 -1
  225. package/lib/partialLengths.js.map +1 -1
  226. package/lib/properties.d.ts +2 -4
  227. package/lib/properties.d.ts.map +1 -1
  228. package/lib/properties.js.map +1 -1
  229. package/lib/referencePositions.d.ts +6 -9
  230. package/lib/referencePositions.d.ts.map +1 -1
  231. package/lib/referencePositions.js +2 -4
  232. package/lib/referencePositions.js.map +1 -1
  233. package/lib/revertibles.d.ts +11 -16
  234. package/lib/revertibles.d.ts.map +1 -1
  235. package/lib/revertibles.js +4 -7
  236. package/lib/revertibles.js.map +1 -1
  237. package/lib/segmentGroupCollection.d.ts +1 -1
  238. package/lib/segmentGroupCollection.d.ts.map +1 -1
  239. package/lib/segmentGroupCollection.js.map +1 -1
  240. package/lib/segmentInfos.d.ts +1 -1
  241. package/lib/segmentInfos.d.ts.map +1 -1
  242. package/lib/segmentInfos.js.map +1 -1
  243. package/lib/segmentPropertiesManager.d.ts +1 -1
  244. package/lib/segmentPropertiesManager.d.ts.map +1 -1
  245. package/lib/segmentPropertiesManager.js.map +1 -1
  246. package/lib/sequencePlace.d.ts +4 -8
  247. package/lib/sequencePlace.d.ts.map +1 -1
  248. package/lib/sequencePlace.js +2 -4
  249. package/lib/sequencePlace.js.map +1 -1
  250. package/lib/snapshotChunks.d.ts +6 -6
  251. package/lib/snapshotChunks.d.ts.map +1 -1
  252. package/lib/snapshotChunks.js.map +1 -1
  253. package/lib/snapshotLoader.d.ts +6 -6
  254. package/lib/snapshotLoader.d.ts.map +1 -1
  255. package/lib/snapshotLoader.js.map +1 -1
  256. package/lib/snapshotV1.d.ts +8 -8
  257. package/lib/snapshotV1.d.ts.map +1 -1
  258. package/lib/snapshotV1.js.map +1 -1
  259. package/lib/snapshotlegacy.d.ts +6 -6
  260. package/lib/snapshotlegacy.d.ts.map +1 -1
  261. package/lib/snapshotlegacy.js.map +1 -1
  262. package/lib/sortedSegmentSet.d.ts +2 -2
  263. package/lib/sortedSegmentSet.d.ts.map +1 -1
  264. package/lib/sortedSegmentSet.js.map +1 -1
  265. package/lib/test/Removal.perf.spec.js.map +1 -1
  266. package/lib/test/attributionCollection.perf.spec.js.map +1 -1
  267. package/lib/test/attributionCollection.spec.js.map +1 -1
  268. package/lib/test/attributionPolicy.spec.js.map +1 -1
  269. package/lib/test/beastTest.spec.d.ts +1 -1
  270. package/lib/test/beastTest.spec.d.ts.map +1 -1
  271. package/lib/test/beastTest.spec.js.map +1 -1
  272. package/lib/test/client.annotateMarker.spec.js.map +1 -1
  273. package/lib/test/client.apis.spec.js.map +1 -1
  274. package/lib/test/client.applyMsg.spec.js.map +1 -1
  275. package/lib/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  276. package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  277. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -1
  278. package/lib/test/client.attributionFarm.spec.d.ts +1 -1
  279. package/lib/test/client.attributionFarm.spec.d.ts.map +1 -1
  280. package/lib/test/client.attributionFarm.spec.js.map +1 -1
  281. package/lib/test/client.conflictFarm.spec.d.ts +1 -1
  282. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -1
  283. package/lib/test/client.conflictFarm.spec.js.map +1 -1
  284. package/lib/test/client.localReference.spec.js.map +1 -1
  285. package/lib/test/client.localReferenceFarm.spec.js.map +1 -1
  286. package/lib/test/client.obliterateFarm.spec.d.ts +1 -1
  287. package/lib/test/client.obliterateFarm.spec.d.ts.map +1 -1
  288. package/lib/test/client.obliterateFarm.spec.js.map +1 -1
  289. package/lib/test/client.rebasePosition.spec.js.map +1 -1
  290. package/lib/test/client.reconnectFarm.spec.d.ts +1 -1
  291. package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -1
  292. package/lib/test/client.reconnectFarm.spec.js.map +1 -1
  293. package/lib/test/client.replay.spec.js.map +1 -1
  294. package/lib/test/client.rollback.spec.js.map +1 -1
  295. package/lib/test/client.rollbackFarm.spec.js.map +1 -1
  296. package/lib/test/clientTestHelper.d.ts +1 -1
  297. package/lib/test/clientTestHelper.d.ts.map +1 -1
  298. package/lib/test/clientTestHelper.js.map +1 -1
  299. package/lib/test/index.d.ts +4 -4
  300. package/lib/test/index.d.ts.map +1 -1
  301. package/lib/test/index.js.map +1 -1
  302. package/lib/test/mergeTree.annotate.spec.js.map +1 -1
  303. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
  304. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  305. package/lib/test/mergeTree.walk.spec.js.map +1 -1
  306. package/lib/test/mergeTree.zamboni.spec.js.map +1 -1
  307. package/lib/test/mergeTreeOperationRunner.d.ts +5 -5
  308. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
  309. package/lib/test/mergeTreeOperationRunner.js.map +1 -1
  310. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -1
  311. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
  312. package/lib/test/obliterateOperations.js.map +1 -1
  313. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  314. package/lib/test/revertibleFarm.spec.js.map +1 -1
  315. package/lib/test/revertibles.spec.js.map +1 -1
  316. package/lib/test/segmentGroupCollection.spec.js.map +1 -1
  317. package/lib/test/snapshot.spec.js.map +1 -1
  318. package/lib/test/snapshot.utils.d.ts +4 -4
  319. package/lib/test/snapshot.utils.d.ts.map +1 -1
  320. package/lib/test/snapshot.utils.js.map +1 -1
  321. package/lib/test/snapshotlegacy.spec.js.map +1 -1
  322. package/lib/test/sortedSegmentSet.spec.js.map +1 -1
  323. package/lib/test/testClient.d.ts +9 -9
  324. package/lib/test/testClient.d.ts.map +1 -1
  325. package/lib/test/testClient.js.map +1 -1
  326. package/lib/test/testClientLogger.d.ts +2 -2
  327. package/lib/test/testClientLogger.d.ts.map +1 -1
  328. package/lib/test/testClientLogger.js.map +1 -1
  329. package/lib/test/testSerializer.d.ts +2 -2
  330. package/lib/test/testSerializer.d.ts.map +1 -1
  331. package/lib/test/testSerializer.js.map +1 -1
  332. package/lib/test/testServer.d.ts +2 -2
  333. package/lib/test/testServer.d.ts.map +1 -1
  334. package/lib/test/testServer.js.map +1 -1
  335. package/lib/test/testUtils.d.ts +3 -3
  336. package/lib/test/testUtils.d.ts.map +1 -1
  337. package/lib/test/testUtils.js.map +1 -1
  338. package/lib/test/text.d.ts +1 -1
  339. package/lib/test/text.d.ts.map +1 -1
  340. package/lib/test/text.js.map +1 -1
  341. package/lib/test/wordUnitTests.spec.js.map +1 -1
  342. package/lib/textSegment.d.ts +4 -6
  343. package/lib/textSegment.d.ts.map +1 -1
  344. package/lib/textSegment.js +1 -2
  345. package/lib/textSegment.js.map +1 -1
  346. package/lib/zamboni.d.ts +1 -1
  347. package/lib/zamboni.d.ts.map +1 -1
  348. package/lib/zamboni.js.map +1 -1
  349. package/package.json +17 -17
  350. package/src/attributionCollection.ts +7 -12
  351. package/src/attributionPolicy.ts +8 -8
  352. package/src/client.ts +24 -24
  353. package/src/collections/index.ts +11 -11
  354. package/src/endOfTreeSegment.ts +4 -8
  355. package/src/index.ts +54 -54
  356. package/src/localReference.ts +8 -11
  357. package/src/mergeTree.ts +19 -20
  358. package/src/mergeTreeDeltaCallback.ts +12 -20
  359. package/src/mergeTreeNodeWalk.ts +1 -1
  360. package/src/mergeTreeNodes.ts +15 -22
  361. package/src/mergeTreeTracking.ts +6 -10
  362. package/src/opBuilder.ts +8 -8
  363. package/src/ops.ts +17 -34
  364. package/src/partialLengths.ts +4 -4
  365. package/src/properties.ts +2 -4
  366. package/src/referencePositions.ts +6 -9
  367. package/src/revertibles.ts +15 -16
  368. package/src/segmentGroupCollection.ts +1 -1
  369. package/src/segmentInfos.ts +2 -2
  370. package/src/segmentPropertiesManager.ts +1 -1
  371. package/src/sequencePlace.ts +4 -8
  372. package/src/snapshotChunks.ts +6 -6
  373. package/src/snapshotLoader.ts +11 -11
  374. package/src/snapshotV1.ts +13 -13
  375. package/src/snapshotlegacy.ts +8 -8
  376. package/src/sortedSegmentSet.ts +2 -2
  377. package/src/textSegment.ts +4 -6
  378. package/src/zamboni.ts +3 -3
@@ -3,15 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { EndOfTreeSegment } from "./endOfTreeSegment.js";
6
- import { LocalReferencePosition } from "./localReference.js";
7
- import { MergeTree } from "./mergeTree.js";
8
- import { IMergeTreeDeltaCallbackArgs } from "./mergeTreeDeltaCallback.js";
9
- import { ITrackingGroup } from "./mergeTreeTracking.js";
10
- import { IJSONSegment, MergeTreeDeltaType } from "./ops.js";
11
- import { PropertySet } from "./properties.js";
6
+ import { type LocalReferencePosition } from "./localReference.js";
7
+ import { type MergeTree } from "./mergeTree.js";
8
+ import type { IMergeTreeDeltaCallbackArgs } from "./mergeTreeDeltaCallback.js";
9
+ import { type ITrackingGroup } from "./mergeTreeTracking.js";
10
+ import { type IJSONSegment, MergeTreeDeltaType } from "./ops.js";
11
+ import { type PropertySet } from "./properties.js";
12
12
  /**
13
- * @legacy
14
- * @alpha
13
+ * @legacy @beta
15
14
  */
16
15
  export type MergeTreeDeltaRevertible = {
17
16
  operation: typeof MergeTreeDeltaType.INSERT;
@@ -30,8 +29,7 @@ export type MergeTreeDeltaRevertible = {
30
29
  */
31
30
  export declare function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible;
32
31
  /**
33
- * @legacy
34
- * @alpha
32
+ * @legacy @beta
35
33
  */
36
34
  export interface MergeTreeRevertibleDriver {
37
35
  insertFromSpec(pos: number, spec: IJSONSegment): void;
@@ -52,22 +50,19 @@ export type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
52
50
  /**
53
51
  * Appends a merge tree delta to the list of revertibles.
54
52
  *
55
- * @legacy
56
- * @alpha
53
+ * @legacy @beta
57
54
  */
58
55
  export declare function appendToMergeTreeDeltaRevertibles(deltaArgs: IMergeTreeDeltaCallbackArgs, revertibles: MergeTreeDeltaRevertible[]): void;
59
56
  /**
60
57
  * Removes all revertibles from the list of revertibles.
61
58
  *
62
- * @legacy
63
- * @alpha
59
+ * @legacy @beta
64
60
  */
65
61
  export declare function discardMergeTreeDeltaRevertible(revertibles: MergeTreeDeltaRevertible[]): void;
66
62
  /**
67
63
  * Reverts all operations in the list of revertibles.
68
64
  *
69
- * @legacy
70
- * @alpha
65
+ * @legacy @beta
71
66
  */
72
67
  export declare function revertMergeTreeDeltaRevertibles(driver: MergeTreeRevertibleDriver, revertibles: MergeTreeDeltaRevertible[]): void;
73
68
  //# sourceMappingURL=revertibles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAA4B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAS1E,OAAO,EAAE,cAAc,EAAqC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAI/D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GACjC;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,cAAc,CAAC;CAC7B,GACD;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,cAAc,CAAC;CAC7B,GACD;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,QAAQ,CAAC;IAC9C,aAAa,EAAE,cAAc,CAAC;IAC9B,cAAc,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEL;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,wBAAwB,CAEpF;AAkBD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,cAA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AC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AA4GjF;;;;GAIG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,2BAA2B,EACtC,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CA0BN;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CAWN;AAgJD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,yBAAyB,EACjC,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CA4BN"}
@@ -9,7 +9,7 @@ import { LocalReferenceCollection } from "./localReference.js";
9
9
  import { findRootMergeBlock } from "./mergeTree.js";
10
10
  import { depthFirstNodeWalk } from "./mergeTreeNodeWalk.js";
11
11
  import { assertSegmentLeaf, isSegmentLeaf, toSegmentLeaf, } from "./mergeTreeNodes.js";
12
- import { UnorderedTrackingGroup } from "./mergeTreeTracking.js";
12
+ import { UnorderedTrackingGroup, } from "./mergeTreeTracking.js";
13
13
  import { MergeTreeDeltaType, ReferenceType } from "./ops.js";
14
14
  import { matchProperties } from "./properties.js";
15
15
  import { DetachedReferencePosition } from "./referencePositions.js";
@@ -104,8 +104,7 @@ function appendLocalAnnotateToRevertibles(deltaArgs, revertibles) {
104
104
  /**
105
105
  * Appends a merge tree delta to the list of revertibles.
106
106
  *
107
- * @legacy
108
- * @alpha
107
+ * @legacy @beta
109
108
  */
110
109
  export function appendToMergeTreeDeltaRevertibles(deltaArgs, revertibles) {
111
110
  if (deltaArgs.deltaSegments.length === 0) {
@@ -134,8 +133,7 @@ export function appendToMergeTreeDeltaRevertibles(deltaArgs, revertibles) {
134
133
  /**
135
134
  * Removes all revertibles from the list of revertibles.
136
135
  *
137
- * @legacy
138
- * @alpha
136
+ * @legacy @beta
139
137
  */
140
138
  export function discardMergeTreeDeltaRevertible(revertibles) {
141
139
  for (const r of revertibles) {
@@ -246,8 +244,7 @@ function getPosition(mergeTreeWithRevert, segment) {
246
244
  /**
247
245
  * Reverts all operations in the list of revertibles.
248
246
  *
249
- * @legacy
250
- * @alpha
247
+ * @legacy @beta
251
248
  */
252
249
  export function revertMergeTreeDeltaRevertibles(driver, revertibles) {
253
250
  let mergeTreeWithRevert;
@@ -1 +1 @@
1
- {"version":3,"file":"revertibles.js","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,eAAe,EACf,gBAAgB,GAChB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAA0B,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAa,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,aAAa,GAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA6B,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAgB,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAe,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAqBlD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,CAAU;IACpD,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC,IAAI,eAAe,IAAI,CAAC,CAAC;AACjF,CAAC;AAwCD,SAAS,uBAAuB,CAAC,SAAoB;IACpD,MAAM,aAAa,GAAG,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AE,CAAC;YAC9B,mBAAmB,KAAK,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,QAAQ,SAAS,EAAE,CAAC;gBACnB,KAAK,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAClC,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBACpD,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,eAAe,CAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tunreachableCase,\n\tDoublyLinkedList,\n} from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EndOfTreeSegment } from \"./endOfTreeSegment.js\";\nimport { LocalReferenceCollection, LocalReferencePosition } from \"./localReference.js\";\nimport { MergeTree, findRootMergeBlock } from \"./mergeTree.js\";\nimport { IMergeTreeDeltaCallbackArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { depthFirstNodeWalk } from \"./mergeTreeNodeWalk.js\";\nimport {\n\tassertSegmentLeaf,\n\tisSegmentLeaf,\n\ttoSegmentLeaf,\n\ttype ISegmentLeaf,\n\ttype ISegmentPrivate,\n} from \"./mergeTreeNodes.js\";\nimport { ITrackingGroup, Trackable, UnorderedTrackingGroup } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { PropertySet, matchProperties } from \"./properties.js\";\nimport { DetachedReferencePosition } from \"./referencePositions.js\";\nimport { toRemovalInfo } from \"./segmentInfos.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport type MergeTreeDeltaRevertible =\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.INSERT;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.REMOVE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.ANNOTATE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t\t\tpropertyDeltas: PropertySet;\n\t };\n\n/**\n * Tests whether x is a MergeTreeDeltaRevertible\n * @internal\n */\nexport function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible {\n\treturn !!x && typeof x === \"object\" && \"operation\" in x && \"trackingGroup\" in x;\n}\n\ntype TypedRevertible<T extends MergeTreeDeltaRevertible[\"operation\"]> =\n\tMergeTreeDeltaRevertible & {\n\t\toperation: T;\n\t};\n\ninterface RemoveSegmentRefProperties {\n\t/**\n\t * the serialized form of the segment, so it can be re-inserted\n\t */\n\tsegSpec: IJSONSegment;\n\t/**\n\t * a tag so the reference can be identified as being created for revert\n\t */\n\treferenceSpace: \"mergeTreeDeltaRevertible\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface MergeTreeRevertibleDriver {\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\tremoveRange(start: number, end: number): void;\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n}\n\n/**\n * exported for test only. should not be exported out the the package\n * @internal\n */\nexport interface MergeTreeWithRevert extends MergeTree {\n\t__mergeTreeRevertible: {\n\t\tdetachedReferences: EndOfTreeSegment;\n\t\trefCallbacks: LocalReferencePosition[\"callbacks\"];\n\t};\n}\n\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nfunction findMergeTreeWithRevert(trackable: Trackable): MergeTreeWithRevert {\n\tconst segmentOrNode = trackable.isLeaf() ? trackable : trackable.getSegment();\n\tconst maybeRoot = findRootMergeBlock(toSegmentLeaf(segmentOrNode));\n\tassert(\n\t\tmaybeRoot?.mergeTree !== undefined,\n\t\t0x5c2 /* trackable is invalid as it is not in a rooted merge tree. */,\n\t);\n\tconst mergeTree: PickPartial<MergeTreeWithRevert, \"__mergeTreeRevertible\"> =\n\t\tmaybeRoot.mergeTree;\n\n\tif (mergeTree.__mergeTreeRevertible === undefined) {\n\t\tconst detachedReferences = new EndOfTreeSegment(maybeRoot.mergeTree);\n\t\tconst refCallbacks: MergeTreeWithRevert[\"__mergeTreeRevertible\"][\"refCallbacks\"] = {\n\t\t\tafterSlide: (r: LocalReferencePosition) => {\n\t\t\t\tif (mergeTree.referencePositionToLocalPosition(r) === DetachedReferencePosition) {\n\t\t\t\t\tconst refs = LocalReferenceCollection.setOrGet(detachedReferences);\n\t\t\t\t\trefs.addAfterTombstones([r]);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tmergeTree.__mergeTreeRevertible = {\n\t\t\trefCallbacks,\n\t\t\tdetachedReferences,\n\t\t};\n\t}\n\treturn mergeTree as MergeTreeWithRevert;\n}\n\nfunction appendLocalInsertToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.INSERT) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.INSERT,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\tfor (const t of deltaArgs.deltaSegments) last.trackingGroup.link(t.segment);\n\n\treturn revertibles;\n}\n\nfunction appendLocalRemoveToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.REMOVE) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.REMOVE,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\n\tconst mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0].segment);\n\n\tfor (const t of deltaArgs.deltaSegments) {\n\t\tconst props: RemoveSegmentRefProperties = {\n\t\t\tsegSpec: t.segment.toJSONObject() as IJSONSegment,\n\t\t\treferenceSpace: \"mergeTreeDeltaRevertible\",\n\t\t};\n\t\tconst ref = mergeTreeWithRevert.createLocalReferencePosition(\n\t\t\tt.segment,\n\t\t\t0,\n\t\t\tReferenceType.SlideOnRemove,\n\t\t\tprops,\n\t\t);\n\t\tref.callbacks = mergeTreeWithRevert.__mergeTreeRevertible.refCallbacks;\n\t\tfor (const tg of t.segment.trackingCollection.trackingGroups) {\n\t\t\ttg.link(ref);\n\t\t\ttg.unlink(t.segment);\n\t\t}\n\n\t\tlast.trackingGroup.link(ref);\n\t}\n\treturn revertibles;\n}\n\nfunction appendLocalAnnotateToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tlet last = revertibles[revertibles.length - 1];\n\tfor (const ds of deltaArgs.deltaSegments) {\n\t\tconst propertyDeltas = ds.propertyDeltas;\n\t\tif (propertyDeltas) {\n\t\t\tif (\n\t\t\t\tlast?.operation === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\tmatchProperties(last?.propertyDeltas, propertyDeltas)\n\t\t\t) {\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t} else {\n\t\t\t\tlast = {\n\t\t\t\t\toperation: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\t\tpropertyDeltas,\n\t\t\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t\t\t};\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t\trevertibles.push(last);\n\t\t\t}\n\t\t}\n\t}\n\treturn revertibles;\n}\n\n/**\n * Appends a merge tree delta to the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function appendToMergeTreeDeltaRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tif (deltaArgs.deltaSegments.length === 0) {\n\t\treturn;\n\t}\n\tswitch (deltaArgs.operation) {\n\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\tappendLocalInsertToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\tappendLocalRemoveToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\tappendLocalAnnotateToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tthrow new UsageError(\"Unsupported event delta type\", {\n\t\t\t\toperation: deltaArgs.operation,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Removes all revertibles from the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function discardMergeTreeDeltaRevertible(\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tfor (const r of revertibles) {\n\t\tfor (const t of r.trackingGroup.tracked) {\n\t\t\tt.trackingCollection.unlink(r.trackingGroup);\n\t\t\t// remove untracked local references\n\t\t\tif (t.trackingCollection.empty && !t.isLeaf()) {\n\t\t\t\tconst segment: ISegmentPrivate | undefined = t.getSegment();\n\t\t\t\tsegment?.localRefs?.removeLocalRef(t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction revertLocalInsert(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.INSERT>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f1 /* tracking group removed */,\n\t\t);\n\t\tassert(isSegmentLeaf(tracked), 0x3f2 /* inserts must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.removeRange(start, start + tracked.cachedLength);\n\t\t}\n\t}\n}\n\nfunction revertLocalRemove(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.REMOVE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f3 /* tracking group removed */,\n\t\t);\n\n\t\tassert(!tracked.isLeaf(), 0x3f4 /* removes must track local refs */);\n\n\t\tconst refSeg = tracked.getSegment();\n\t\tlet realPos = mergeTreeWithRevert.referencePositionToLocalPosition(tracked);\n\n\t\t// References which are on EndOfStringSegment don't return detached for pos,\n\t\t// they will return the length of the merge-tree. this case just catches\n\t\t// random references, likely not created in the revertible flow,\n\t\t// that are tying to be reverted for some reason.\n\t\tif (realPos === DetachedReferencePosition || !isSegmentLeaf(refSeg)) {\n\t\t\tthrow new UsageError(\"Cannot insert at detached references position\");\n\t\t}\n\n\t\tif (toRemovalInfo(refSeg) === undefined && refSeg.localRefs?.isAfterTombstone(tracked)) {\n\t\t\trealPos++;\n\t\t}\n\n\t\tconst props = tracked.properties as RemoveSegmentRefProperties;\n\t\tdriver.insertFromSpec(realPos, props.segSpec);\n\t\tconst insertSegment = mergeTreeWithRevert.getContainingSegment(\n\t\t\trealPos,\n\t\t\tmergeTreeWithRevert.localPerspective,\n\t\t)?.segment;\n\t\tassertSegmentLeaf(insertSegment);\n\n\t\tconst localSlideFilter = (lref: LocalReferencePosition): boolean =>\n\t\t\t(lref.properties as Partial<RemoveSegmentRefProperties>)?.referenceSpace ===\n\t\t\t\"mergeTreeDeltaRevertible\";\n\n\t\tconst insertRef: Partial<\n\t\t\tRecord<\"before\" | \"after\", DoublyLinkedList<LocalReferencePosition>>\n\t\t> = {};\n\t\tconst forward = insertSegment.ordinal < refSeg.ordinal;\n\t\tconst refHandler = (lref: LocalReferencePosition): false | undefined => {\n\t\t\t// once we reach it keep the original reference where it is\n\t\t\t// we'll move tracking groups, and remove it as a last step.\n\t\t\tif (tracked === lref) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (localSlideFilter(lref)) {\n\t\t\t\tif (forward) {\n\t\t\t\t\tconst before = (insertRef.before ??= new DoublyLinkedList());\n\t\t\t\t\tbefore.push(lref);\n\t\t\t\t} else {\n\t\t\t\t\tconst after = (insertRef.after ??= new DoublyLinkedList());\n\t\t\t\t\tafter.unshift(lref);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tdepthFirstNodeWalk(\n\t\t\tinsertSegment.parent,\n\t\t\tinsertSegment,\n\t\t\tundefined,\n\t\t\t(seg: ISegmentPrivate) => {\n\t\t\t\tif (seg.localRefs?.empty === false) {\n\t\t\t\t\treturn seg.localRefs.walkReferences(refHandler, undefined, forward);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tundefined,\n\t\t\tforward,\n\t\t);\n\t\tif (\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible?.detachedReferences?.localRefs?.has(tracked)\n\t\t) {\n\t\t\tassert(forward, 0x3f6 /* forward should always be true when detached */);\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible.detachedReferences.localRefs.walkReferences(\n\t\t\t\trefHandler,\n\t\t\t);\n\t\t}\n\n\t\tif (insertRef !== undefined) {\n\t\t\tconst localRefs = LocalReferenceCollection.setOrGet(insertSegment);\n\t\t\tif (insertRef.before?.empty === false) {\n\t\t\t\tlocalRefs.addBeforeTombstones(insertRef.before.map((n) => n.data));\n\t\t\t}\n\t\t\tif (insertRef.after?.empty === false) {\n\t\t\t\tlocalRefs.addAfterTombstones(insertRef.after.map((n) => n.data));\n\t\t\t}\n\t\t}\n\n\t\tfor (const tg of tracked.trackingCollection.trackingGroups) {\n\t\t\ttg.link(insertSegment);\n\t\t\ttg.unlink(tracked);\n\t\t}\n\t\tconst segment: ISegmentPrivate | undefined = tracked.getSegment();\n\t\tsegment?.localRefs?.removeLocalRef(tracked);\n\t}\n}\n\nfunction revertLocalAnnotate(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.ANNOTATE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tconst unlinked = tracked.trackingCollection.unlink(revertible.trackingGroup);\n\t\tassert(unlinked && isSegmentLeaf(tracked), 0x3f7 /* annotates must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.annotateRange(start, start + tracked.cachedLength, revertible.propertyDeltas);\n\t\t}\n\t}\n}\n\nfunction getPosition(mergeTreeWithRevert: MergeTreeWithRevert, segment: ISegmentLeaf): number {\n\treturn mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.localPerspective);\n}\n\n/**\n * Reverts all operations in the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function revertMergeTreeDeltaRevertibles(\n\tdriver: MergeTreeRevertibleDriver,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tlet mergeTreeWithRevert: MergeTreeWithRevert | undefined;\n\n\twhile (revertibles.length > 0) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst r = revertibles.pop()!;\n\t\tconst operation = r.operation;\n\t\tif (r.trackingGroup.size > 0) {\n\t\t\tmergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]);\n\t\t\tswitch (operation) {\n\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\trevertLocalInsert(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\trevertLocalRemove(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\trevertLocalAnnotate(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(operation);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"revertibles.js","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,eAAe,EACf,gBAAgB,GAChB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAA+B,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAkB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,aAAa,GAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGN,sBAAsB,GACtB,M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CAAC;AAED,SAAS,WAAW,CAAC,mBAAwC,EAAE,OAAqB;IACnF,OAAO,mBAAmB,CAAC,WAAW,CAAC,OAAO,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AACvF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC9C,MAAiC,EACjC,WAAuC;IAEvC,IAAI,mBAAoD,CAAC;IAEzD,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,oEAAoE;QACpE,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,EAAG,CAAC;QAC7B,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;QAC9B,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC9B,mBAAmB,KAAK,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5E,QAAQ,SAAS,EAAE,CAAC;gBACnB,KAAK,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAClC,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBACpD,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,eAAe,CAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tunreachableCase,\n\tDoublyLinkedList,\n} from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EndOfTreeSegment } from \"./endOfTreeSegment.js\";\nimport { LocalReferenceCollection, type LocalReferencePosition } from \"./localReference.js\";\nimport { type MergeTree, findRootMergeBlock } from \"./mergeTree.js\";\nimport type { IMergeTreeDeltaCallbackArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { depthFirstNodeWalk } from \"./mergeTreeNodeWalk.js\";\nimport {\n\tassertSegmentLeaf,\n\tisSegmentLeaf,\n\ttoSegmentLeaf,\n\ttype ISegmentLeaf,\n\ttype ISegmentPrivate,\n} from \"./mergeTreeNodes.js\";\nimport {\n\ttype ITrackingGroup,\n\ttype Trackable,\n\tUnorderedTrackingGroup,\n} from \"./mergeTreeTracking.js\";\nimport { type IJSONSegment, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { type PropertySet, matchProperties } from \"./properties.js\";\nimport { DetachedReferencePosition } from \"./referencePositions.js\";\nimport { toRemovalInfo } from \"./segmentInfos.js\";\n\n/**\n * @legacy @beta\n */\nexport type MergeTreeDeltaRevertible =\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.INSERT;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.REMOVE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.ANNOTATE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t\t\tpropertyDeltas: PropertySet;\n\t };\n\n/**\n * Tests whether x is a MergeTreeDeltaRevertible\n * @internal\n */\nexport function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible {\n\treturn !!x && typeof x === \"object\" && \"operation\" in x && \"trackingGroup\" in x;\n}\n\ntype TypedRevertible<T extends MergeTreeDeltaRevertible[\"operation\"]> =\n\tMergeTreeDeltaRevertible & {\n\t\toperation: T;\n\t};\n\ninterface RemoveSegmentRefProperties {\n\t/**\n\t * the serialized form of the segment, so it can be re-inserted\n\t */\n\tsegSpec: IJSONSegment;\n\t/**\n\t * a tag so the reference can be identified as being created for revert\n\t */\n\treferenceSpace: \"mergeTreeDeltaRevertible\";\n}\n\n/**\n * @legacy @beta\n */\nexport interface MergeTreeRevertibleDriver {\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\tremoveRange(start: number, end: number): void;\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n}\n\n/**\n * exported for test only. should not be exported out the the package\n * @internal\n */\nexport interface MergeTreeWithRevert extends MergeTree {\n\t__mergeTreeRevertible: {\n\t\tdetachedReferences: EndOfTreeSegment;\n\t\trefCallbacks: LocalReferencePosition[\"callbacks\"];\n\t};\n}\n\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nfunction findMergeTreeWithRevert(trackable: Trackable): MergeTreeWithRevert {\n\tconst segmentOrNode = trackable.isLeaf() ? trackable : trackable.getSegment();\n\tconst maybeRoot = findRootMergeBlock(toSegmentLeaf(segmentOrNode));\n\tassert(\n\t\tmaybeRoot?.mergeTree !== undefined,\n\t\t0x5c2 /* trackable is invalid as it is not in a rooted merge tree. */,\n\t);\n\tconst mergeTree: PickPartial<MergeTreeWithRevert, \"__mergeTreeRevertible\"> =\n\t\tmaybeRoot.mergeTree;\n\n\tif (mergeTree.__mergeTreeRevertible === undefined) {\n\t\tconst detachedReferences = new EndOfTreeSegment(maybeRoot.mergeTree);\n\t\tconst refCallbacks: MergeTreeWithRevert[\"__mergeTreeRevertible\"][\"refCallbacks\"] = {\n\t\t\tafterSlide: (r: LocalReferencePosition) => {\n\t\t\t\tif (mergeTree.referencePositionToLocalPosition(r) === DetachedReferencePosition) {\n\t\t\t\t\tconst refs = LocalReferenceCollection.setOrGet(detachedReferences);\n\t\t\t\t\trefs.addAfterTombstones([r]);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tmergeTree.__mergeTreeRevertible = {\n\t\t\trefCallbacks,\n\t\t\tdetachedReferences,\n\t\t};\n\t}\n\treturn mergeTree as MergeTreeWithRevert;\n}\n\nfunction appendLocalInsertToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.INSERT) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.INSERT,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\tfor (const t of deltaArgs.deltaSegments) last.trackingGroup.link(t.segment);\n\n\treturn revertibles;\n}\n\nfunction appendLocalRemoveToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.REMOVE) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.REMOVE,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\n\tconst mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0].segment);\n\n\tfor (const t of deltaArgs.deltaSegments) {\n\t\tconst props: RemoveSegmentRefProperties = {\n\t\t\tsegSpec: t.segment.toJSONObject() as IJSONSegment,\n\t\t\treferenceSpace: \"mergeTreeDeltaRevertible\",\n\t\t};\n\t\tconst ref = mergeTreeWithRevert.createLocalReferencePosition(\n\t\t\tt.segment,\n\t\t\t0,\n\t\t\tReferenceType.SlideOnRemove,\n\t\t\tprops,\n\t\t);\n\t\tref.callbacks = mergeTreeWithRevert.__mergeTreeRevertible.refCallbacks;\n\t\tfor (const tg of t.segment.trackingCollection.trackingGroups) {\n\t\t\ttg.link(ref);\n\t\t\ttg.unlink(t.segment);\n\t\t}\n\n\t\tlast.trackingGroup.link(ref);\n\t}\n\treturn revertibles;\n}\n\nfunction appendLocalAnnotateToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tlet last = revertibles[revertibles.length - 1];\n\tfor (const ds of deltaArgs.deltaSegments) {\n\t\tconst propertyDeltas = ds.propertyDeltas;\n\t\tif (propertyDeltas) {\n\t\t\tif (\n\t\t\t\tlast?.operation === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\tmatchProperties(last?.propertyDeltas, propertyDeltas)\n\t\t\t) {\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t} else {\n\t\t\t\tlast = {\n\t\t\t\t\toperation: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\t\tpropertyDeltas,\n\t\t\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t\t\t};\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t\trevertibles.push(last);\n\t\t\t}\n\t\t}\n\t}\n\treturn revertibles;\n}\n\n/**\n * Appends a merge tree delta to the list of revertibles.\n *\n * @legacy @beta\n */\nexport function appendToMergeTreeDeltaRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tif (deltaArgs.deltaSegments.length === 0) {\n\t\treturn;\n\t}\n\tswitch (deltaArgs.operation) {\n\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\tappendLocalInsertToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\tappendLocalRemoveToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\tappendLocalAnnotateToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tthrow new UsageError(\"Unsupported event delta type\", {\n\t\t\t\toperation: deltaArgs.operation,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Removes all revertibles from the list of revertibles.\n *\n * @legacy @beta\n */\nexport function discardMergeTreeDeltaRevertible(\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tfor (const r of revertibles) {\n\t\tfor (const t of r.trackingGroup.tracked) {\n\t\t\tt.trackingCollection.unlink(r.trackingGroup);\n\t\t\t// remove untracked local references\n\t\t\tif (t.trackingCollection.empty && !t.isLeaf()) {\n\t\t\t\tconst segment: ISegmentPrivate | undefined = t.getSegment();\n\t\t\t\tsegment?.localRefs?.removeLocalRef(t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction revertLocalInsert(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.INSERT>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f1 /* tracking group removed */,\n\t\t);\n\t\tassert(isSegmentLeaf(tracked), 0x3f2 /* inserts must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.removeRange(start, start + tracked.cachedLength);\n\t\t}\n\t}\n}\n\nfunction revertLocalRemove(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.REMOVE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f3 /* tracking group removed */,\n\t\t);\n\n\t\tassert(!tracked.isLeaf(), 0x3f4 /* removes must track local refs */);\n\n\t\tconst refSeg = tracked.getSegment();\n\t\tlet realPos = mergeTreeWithRevert.referencePositionToLocalPosition(tracked);\n\n\t\t// References which are on EndOfStringSegment don't return detached for pos,\n\t\t// they will return the length of the merge-tree. this case just catches\n\t\t// random references, likely not created in the revertible flow,\n\t\t// that are tying to be reverted for some reason.\n\t\tif (realPos === DetachedReferencePosition || !isSegmentLeaf(refSeg)) {\n\t\t\tthrow new UsageError(\"Cannot insert at detached references position\");\n\t\t}\n\n\t\tif (toRemovalInfo(refSeg) === undefined && refSeg.localRefs?.isAfterTombstone(tracked)) {\n\t\t\trealPos++;\n\t\t}\n\n\t\tconst props = tracked.properties as RemoveSegmentRefProperties;\n\t\tdriver.insertFromSpec(realPos, props.segSpec);\n\t\tconst insertSegment = mergeTreeWithRevert.getContainingSegment(\n\t\t\trealPos,\n\t\t\tmergeTreeWithRevert.localPerspective,\n\t\t)?.segment;\n\t\tassertSegmentLeaf(insertSegment);\n\n\t\tconst localSlideFilter = (lref: LocalReferencePosition): boolean =>\n\t\t\t(lref.properties as Partial<RemoveSegmentRefProperties>)?.referenceSpace ===\n\t\t\t\"mergeTreeDeltaRevertible\";\n\n\t\tconst insertRef: Partial<\n\t\t\tRecord<\"before\" | \"after\", DoublyLinkedList<LocalReferencePosition>>\n\t\t> = {};\n\t\tconst forward = insertSegment.ordinal < refSeg.ordinal;\n\t\tconst refHandler = (lref: LocalReferencePosition): false | undefined => {\n\t\t\t// once we reach it keep the original reference where it is\n\t\t\t// we'll move tracking groups, and remove it as a last step.\n\t\t\tif (tracked === lref) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (localSlideFilter(lref)) {\n\t\t\t\tif (forward) {\n\t\t\t\t\tconst before = (insertRef.before ??= new DoublyLinkedList());\n\t\t\t\t\tbefore.push(lref);\n\t\t\t\t} else {\n\t\t\t\t\tconst after = (insertRef.after ??= new DoublyLinkedList());\n\t\t\t\t\tafter.unshift(lref);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tdepthFirstNodeWalk(\n\t\t\tinsertSegment.parent,\n\t\t\tinsertSegment,\n\t\t\tundefined,\n\t\t\t(seg: ISegmentPrivate) => {\n\t\t\t\tif (seg.localRefs?.empty === false) {\n\t\t\t\t\treturn seg.localRefs.walkReferences(refHandler, undefined, forward);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tundefined,\n\t\t\tforward,\n\t\t);\n\t\tif (\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible?.detachedReferences?.localRefs?.has(tracked)\n\t\t) {\n\t\t\tassert(forward, 0x3f6 /* forward should always be true when detached */);\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible.detachedReferences.localRefs.walkReferences(\n\t\t\t\trefHandler,\n\t\t\t);\n\t\t}\n\n\t\tif (insertRef !== undefined) {\n\t\t\tconst localRefs = LocalReferenceCollection.setOrGet(insertSegment);\n\t\t\tif (insertRef.before?.empty === false) {\n\t\t\t\tlocalRefs.addBeforeTombstones(insertRef.before.map((n) => n.data));\n\t\t\t}\n\t\t\tif (insertRef.after?.empty === false) {\n\t\t\t\tlocalRefs.addAfterTombstones(insertRef.after.map((n) => n.data));\n\t\t\t}\n\t\t}\n\n\t\tfor (const tg of tracked.trackingCollection.trackingGroups) {\n\t\t\ttg.link(insertSegment);\n\t\t\ttg.unlink(tracked);\n\t\t}\n\t\tconst segment: ISegmentPrivate | undefined = tracked.getSegment();\n\t\tsegment?.localRefs?.removeLocalRef(tracked);\n\t}\n}\n\nfunction revertLocalAnnotate(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.ANNOTATE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tconst unlinked = tracked.trackingCollection.unlink(revertible.trackingGroup);\n\t\tassert(unlinked && isSegmentLeaf(tracked), 0x3f7 /* annotates must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.annotateRange(start, start + tracked.cachedLength, revertible.propertyDeltas);\n\t\t}\n\t}\n}\n\nfunction getPosition(mergeTreeWithRevert: MergeTreeWithRevert, segment: ISegmentLeaf): number {\n\treturn mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.localPerspective);\n}\n\n/**\n * Reverts all operations in the list of revertibles.\n *\n * @legacy @beta\n */\nexport function revertMergeTreeDeltaRevertibles(\n\tdriver: MergeTreeRevertibleDriver,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tlet mergeTreeWithRevert: MergeTreeWithRevert | undefined;\n\n\twhile (revertibles.length > 0) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst r = revertibles.pop()!;\n\t\tconst operation = r.operation;\n\t\tif (r.trackingGroup.size > 0) {\n\t\t\tmergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]);\n\t\t\tswitch (operation) {\n\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\trevertLocalInsert(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\trevertLocalRemove(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\trevertLocalAnnotate(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(operation);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { SegmentGroup, type ISegmentLeaf } from "./mergeTreeNodes.js";
5
+ import type { SegmentGroup, ISegmentLeaf } from "./mergeTreeNodes.js";
6
6
  export declare class SegmentGroupCollection {
7
7
  private readonly segment;
8
8
  private readonly segmentGroups;
@@ -1 +1 @@
1
- {"version":3,"file":"segmentGroupCollection.d.ts","sourceRoot":"","sources":["../src/segmentGroupCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,qBAAa,sBAAsB;IAGtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;gBAElC,OAAO,EAAE,YAAY;IAIlD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,KAAK,IAAI,OAAO,CAE1B;IAEM,OAAO,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAKzC,OAAO,IAAI,YAAY,GAAG,SAAS;IAInC,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO;IAS3C,GAAG,IAAI,YAAY,GAAG,SAAS;IAI/B,MAAM,CAAC,aAAa,EAAE,sBAAsB,GAAG,IAAI;IAI1D,OAAO,CAAC,aAAa;CAUrB"}
1
+ {"version":3,"file":"segmentGroupCollection.d.ts","sourceRoot":"","sources":["../src/segmentGroupCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,qBAAa,sBAAsB;IAGtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;gBAElC,OAAO,EAAE,YAAY;IAIlD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,KAAK,IAAI,OAAO,CAE1B;IAEM,OAAO,CAAC,YAA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AAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,GAAG;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;IAEM,MAAM,CAAC,aAAqC;QAClD,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1F,CAAC;IAEO,aAAa,CAAC,YAA0B,EAAE,aAA2B;QAC5E,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,YAAY,CAAC,aAAa,EAAE,CAAC;YAChC,+CAA+C;YAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClB,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DoublyLinkedList, walkList } from \"@fluidframework/core-utils/internal\";\n\nimport { SegmentGroup, type ISegmentLeaf } from \"./mergeTreeNodes.js\";\n\nexport class SegmentGroupCollection {\n\tprivate readonly segmentGroups: DoublyLinkedList<SegmentGroup>;\n\n\tconstructor(private readonly segment: ISegmentLeaf) {\n\t\tthis.segmentGroups = new DoublyLinkedList<SegmentGroup>();\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.segmentGroups.length;\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this.segmentGroups.empty;\n\t}\n\n\tpublic enqueue(segmentGroup: SegmentGroup): void {\n\t\tthis.segmentGroups.push(segmentGroup);\n\t\tsegmentGroup.segments.push(this.segment);\n\t}\n\n\tpublic dequeue(): SegmentGroup | undefined {\n\t\treturn this.segmentGroups.shift()?.data;\n\t}\n\n\tpublic remove(segmentGroup: SegmentGroup): boolean {\n\t\tconst found = this.segmentGroups.find((v) => v.data === segmentGroup);\n\t\tif (found === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.segmentGroups.remove(found);\n\t\treturn true;\n\t}\n\n\tpublic pop(): SegmentGroup | undefined {\n\t\treturn this.segmentGroups.pop ? this.segmentGroups.pop()?.data : undefined;\n\t}\n\n\tpublic copyTo(segmentGroups: SegmentGroupCollection): void {\n\t\twalkList(this.segmentGroups, (sg) => segmentGroups.enqueueOnCopy(sg.data, this.segment));\n\t}\n\n\tprivate enqueueOnCopy(segmentGroup: SegmentGroup, sourceSegment: ISegmentLeaf): void {\n\t\tthis.enqueue(segmentGroup);\n\t\tif (segmentGroup.previousProps) {\n\t\t\t// duplicate the previousProps for this segment\n\t\t\tconst index = segmentGroup.segments.indexOf(sourceSegment);\n\t\t\tif (index !== -1) {\n\t\t\t\tsegmentGroup.previousProps.push(segmentGroup.previousProps[index]);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"segmentGroupCollection.js","sourceRoot":"","sources":["../src/segmentGroupCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAIjF,MAAM,OAAO,sBAAsB;IAGlC,YAA6B,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QACjD,IAAI,CAAC,aAAa,GAAG,IAAI,gBAAgB,EAAgB,CAAC;IAC3D,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClC,CAAC;IAED,IAAW,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,CAAC;YAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClB,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DoublyLinkedList, walkList } from \"@fluidframework/core-utils/internal\";\n\nimport type { SegmentGroup, ISegmentLeaf } from \"./mergeTreeNodes.js\";\n\nexport class SegmentGroupCollection {\n\tprivate readonly segmentGroups: DoublyLinkedList<SegmentGroup>;\n\n\tconstructor(private readonly segment: ISegmentLeaf) {\n\t\tthis.segmentGroups = new DoublyLinkedList<SegmentGroup>();\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.segmentGroups.length;\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this.segmentGroups.empty;\n\t}\n\n\tpublic enqueue(segmentGroup: SegmentGroup): void {\n\t\tthis.segmentGroups.push(segmentGroup);\n\t\tsegmentGroup.segments.push(this.segment);\n\t}\n\n\tpublic dequeue(): SegmentGroup | undefined {\n\t\treturn this.segmentGroups.shift()?.data;\n\t}\n\n\tpublic remove(segmentGroup: SegmentGroup): boolean {\n\t\tconst found = this.segmentGroups.find((v) => v.data === segmentGroup);\n\t\tif (found === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.segmentGroups.remove(found);\n\t\treturn true;\n\t}\n\n\tpublic pop(): SegmentGroup | undefined {\n\t\treturn this.segmentGroups.pop ? this.segmentGroups.pop()?.data : undefined;\n\t}\n\n\tpublic copyTo(segmentGroups: SegmentGroupCollection): void {\n\t\twalkList(this.segmentGroups, (sg) => segmentGroups.enqueueOnCopy(sg.data, this.segment));\n\t}\n\n\tprivate enqueueOnCopy(segmentGroup: SegmentGroup, sourceSegment: ISegmentLeaf): void {\n\t\tthis.enqueue(segmentGroup);\n\t\tif (segmentGroup.previousProps) {\n\t\t\t// duplicate the previousProps for this segment\n\t\t\tconst index = segmentGroup.segments.indexOf(sourceSegment);\n\t\t\tif (index !== -1) {\n\t\t\t\tsegmentGroup.previousProps.push(segmentGroup.previousProps[index]);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISegmentInternal, ISegmentPrivate, MergeBlock, type ObliterateInfo } from "./mergeTreeNodes.js";
5
+ import { type ISegmentInternal, type ISegmentPrivate, MergeBlock, type ObliterateInfo } from "./mergeTreeNodes.js";
6
6
  import type { InsertOperationStamp, OperationStamp, RemoveOperationStamp } from "./stamps.js";
7
7
  export interface StringToType {
8
8
  "string": string;
@@ -1 +1 @@
1
- {"version":3,"file":"segmentInfos.d.ts","sourceRoot":"","sources":["../src/segmentInfos.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9F,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACL,KAAK,IAAI,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAE7B;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,YAAY,EACrE,KAAK,EAAE,OAAO,EACd,I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C,yBAAyB,CAAC,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAEkC,CAAC,QAAQ,EAAE,EAAE,CAC5E,MAAM,CAAC,MAAM,CAA4D,QAAQ,EAAE;IAClF,OAAO,EAAE,SAAS;CAClB,CAAC,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA4C;IAC9E,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9C,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,wBAAwB,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;IACrC,OAAO,SAAS,KAAK,wBAAwB,IAAI,SAAS,GAAG,UAAU,CAAC;AACzE,CAAC;AAmBD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAI5B,WAAc,EACd,IAAO,EACiB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, isObject } from \"@fluidframework/core-utils/internal\";\n\nimport { UnassignedSequenceNumber } from \"./constants.js\";\nimport {\n\tISegmentInternal,\n\tISegmentPrivate,\n\tMergeBlock,\n\ttype ObliterateInfo,\n} from \"./mergeTreeNodes.js\";\nimport type { InsertOperationStamp, OperationStamp, RemoveOperationStamp } from \"./stamps.js\";\n\nexport interface StringToType {\n\t\"string\": string;\n\t\"number\": number;\n\t\"object\": object;\n\t\"array\": unknown[];\n\t\"boolean\": boolean;\n}\n\nexport function propExists<P extends string>(\n\tthing: unknown,\n\tprop: P,\n): thing is Record<P, unknown> {\n\treturn isObject(thing) && prop in thing;\n}\n\nexport function hasProp<P extends string, T extends keyof StringToType>(\n\tthing: unknown,\n\tprop: P,\n\ttype: T,\n): thing is Record<P, StringToType[typeof type]> {\n\treturn (\n\t\tpropExists(thing, prop) &&\n\t\t(type === \"array\" ? Array.isArray(thing[prop]) : typeof thing[prop] === type)\n\t);\n}\n\nexport function propInstanceOf<P extends string, T>(\n\tthing: unknown,\n\tprop: P,\n\ttype: new (...args: any[]) => T,\n): thing is Record<P, T> {\n\treturn propExists(thing, prop) && thing[prop] instanceof type;\n}\n\n/**\n * Contains insertion information associated to an {@link ISegment}.\n */\nexport interface IHasInsertionInfo {\n\tinsert: InsertOperationStamp;\n}\n\nexport interface ISegmentInsideObliterateInfo {\n\t/**\n\t * Populated iff this segment was inserted into a range affected by concurrent obliterates at the time of its insertion.\n\t * Contains information about the 'most recent' (i.e. 'winning' in the sense below) obliterate.\n\t *\n\t * BEWARE: We have opted for a certain form of last-write wins (LWW) semantics for obliterates:\n\t * the client which last obliterated a range is considered to have \"won ownership\" of that range and may insert into it\n\t * without that insertion being obliterated by other clients' concurrent obliterates.\n\t *\n\t * Therefore, this field can be populated even if the segment has not been obliterated (i.e. is still visible).\n\t * This happens precisely when the segment was inserted by the same client that 'won' the obliterate (in a scenario where\n\t * a client first issues a sided obliterate impacting a range, then inserts into that range before the server has acked the obliterate).\n\t *\n\t * See the test case \"obliterate with mismatched final states\" for an example of such a scenario.\n\t *\n\t * TODO:AB#29553: This property is not persisted in the V1 summary, but it should be.\n\t */\n\tobliteratePrecedingInsertion?: ObliterateInfo;\n\t/**\n\t * Populated iff this segment was inserted into a range concurrently removed by a local obliterate operation.\n\t * This field is unset once the newest such overlapping obliterate is acked, and allows recomputing {@link obliteratePrecedingInsertion}\n\t * if that local obliterate is resubmitted.\n\t *\n\t * TODO:AB#29553: This property is not persisted in the V1 summary, but it should be.\n\t */\n\tinsertionRefSeqStamp?: OperationStamp;\n}\n\n/**\n * Converts a segment-like object to an insertion info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The insertion info object if the conversion is possible, otherwise undefined.\n */\nexport const toInsertionInfo = (segmentLike: unknown): IHasInsertionInfo | undefined => {\n\treturn segmentLike !== undefined &&\n\t\thasProp(segmentLike, \"insert\", \"object\") &&\n\t\thasProp(segmentLike.insert, \"clientId\", \"number\") &&\n\t\thasProp(segmentLike.insert, \"seq\", \"number\")\n\t\t? (segmentLike as IHasInsertionInfo)\n\t\t: undefined;\n};\n\n/**\n * A type-guard which determines if the segment has insertion info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param segmentLike - The segment-like object to check.\n * @returns True if the segment has insertion info, otherwise false.\n */\nexport const isInserted = (segmentLike: unknown): segmentLike is IHasInsertionInfo =>\n\ttoInsertionInfo(segmentLike) !== undefined;\n\nexport const isInsideObliterate = (\n\tsegmentLike: unknown,\n): segmentLike is ISegmentInsideObliterateInfo =>\n\tsegmentLike !== undefined && hasProp(segmentLike, \"obliteratePrecedingInsertion\", \"object\");\n\n/**\n * Asserts that the segment has insertion info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have insertion info.\n */\nexport const assertInserted: <T extends Partial<IHasInsertionInfo> | undefined>(\n\tsegmentLike: ISegmentInternal | Partial<IHasInsertionInfo> | T,\n) => asserts segmentLike is IHasInsertionInfo | Exclude<T, Partial<IHasInsertionInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(\n\t\tsegmentLike === undefined || isInserted(segmentLike),\n\t\t0xaa0 /* must be insertionInfo */,\n\t);\n\n/**\n * Common properties for a node in a merge tree.\n */\nexport interface IMergeNodeInfo {\n\t/**\n\t * The parent merge block if the node is parented\n\t */\n\tparent: MergeBlock;\n\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\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}\n\n/**\n * Converts a segment-like object to a merge node info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The merge node info object if the conversion is possible, otherwise undefined.\n */\nexport const toMergeNodeInfo = (nodeLike: unknown): IMergeNodeInfo | undefined =>\n\tpropInstanceOf(nodeLike, \"parent\", MergeBlock) &&\n\thasProp(nodeLike, \"ordinal\", \"string\") &&\n\thasProp(nodeLike, \"index\", \"number\")\n\t\t? nodeLike\n\t\t: undefined;\n\n/**\n * A type-guard which determines if the segment has merge node info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param nodeLike - The segment-like object to check.\n * @returns True if the segment has merge node info, otherwise false.\n */\nexport const isMergeNodeInfo = (nodeLike: unknown): nodeLike is IMergeNodeInfo =>\n\ttoMergeNodeInfo(nodeLike) !== undefined;\n\n/**\n * Asserts that the segment has merge node info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have merge node info.\n */\nexport const assertMergeNode: <T extends Partial<IMergeNodeInfo> | undefined>(\n\tnodeLike: ISegmentInternal | ISegmentPrivate | Partial<IMergeNodeInfo> | T,\n) => asserts nodeLike is IMergeNodeInfo | Exclude<T, Partial<IMergeNodeInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(\n\t\tsegmentLike === undefined || isMergeNodeInfo(segmentLike),\n\t\t0xaa1 /* must be MergeNodeInfo */,\n\t);\n\n/**\n * Removes the merge node info. This is used to remove nodes from the merge-tree.\n * @param segmentLike - The segment-like object to check.\n * @returns This function will change the type of the provided node like to never via an assertion. This\n * ensures no further usage of the removed merge node info is allowed. if continued use is required other\n * type coercion methods should be used to correctly re-type the variable.\n */\nexport const removeMergeNodeInfo: (nodeLike: IMergeNodeInfo) => asserts nodeLike is never = (\n\tnodeLike,\n) =>\n\tObject.assign<IMergeNodeInfo, Record<keyof IMergeNodeInfo, undefined>>(nodeLike, {\n\t\tparent: undefined,\n\t\tindex: undefined,\n\t\tordinal: undefined,\n\t});\n\n/**\n * Contains removal information associated with an {@link ISegment}.\n *\n * Segments can be removed concurrently by multiple clients.\n */\nexport interface IHasRemovalInfo {\n\t/**\n\t * Operation stamps which have removed this segment. This list is sorted by stamp order, where removes[0] is the earliest removal.\n\t */\n\tremoves: RemoveOperationStamp[];\n}\n\n/**\n * Converts a segment-like object to a removal info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The removal info object if the conversion is possible, otherwise undefined.\n */\nexport const toRemovalInfo = (segmentLike: unknown): IHasRemovalInfo | undefined => {\n\treturn hasProp(segmentLike, \"removes\", \"array\") &&\n\t\tsegmentLike.removes.length > 0 &&\n\t\thasProp(segmentLike.removes[0], \"clientId\", \"number\") &&\n\t\thasProp(segmentLike.removes[0], \"seq\", \"number\")\n\t\t? (segmentLike as IHasRemovalInfo)\n\t\t: undefined;\n};\n\n/**\n * A type-guard which determines if the segment has removal info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param segmentLike - The segment-like object to check.\n * @returns True if the segment has removal info, otherwise false.\n */\n// export const isRemoved = (segmentLike: unknown): segmentLike is IHasRemovalInfo =>\n// \ttoRemovalInfo(segmentLike) !== undefined;\n\nexport const isRemoved = (segmentLike: unknown): segmentLike is IHasRemovalInfo =>\n\ttoRemovalInfo(segmentLike) !== undefined;\n\n/**\n * Asserts that the segment has removal info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have removal info.\n */\nexport const assertRemoved: <T extends Partial<IHasRemovalInfo> | undefined>(\n\tsegmentLike: ISegmentInternal | Partial<IHasRemovalInfo> | T,\n) => asserts segmentLike is IHasRemovalInfo | Exclude<T, Partial<IHasRemovalInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(segmentLike === undefined || isRemoved(segmentLike), 0xaa2 /* must be removalInfo */);\n\n/**\n * Removes the removal info. This is used in rollback.\n * @param segmentLike - The segment-like object to check.\n * @returns This function will change the type of the provided node like to never via an assertion. This\n * ensures no further usage of the removed removal info is allowed. if continued use is required other\n * type coercion methods should be use to correctly re-type the variable.\n */\nexport const removeRemovalInfo: (\n\tnodeLike: IHasRemovalInfo,\n) => asserts nodeLike is Record<keyof IHasRemovalInfo, never> = (nodeLike) =>\n\tObject.assign<IHasRemovalInfo, Record<keyof IHasRemovalInfo, undefined>>(nodeLike, {\n\t\tremoves: undefined,\n\t});\n\n/**\n * Returns whether this segment was marked removed as soon as its insertion was acked.\n *\n * This can happen when an an insert occurs concurrent to an obliterate over the range the segment was inserted into,\n * and the obliterate was sequenced first.\n *\n * When this happens, the segment is only ever visible to the client that inserted the segment\n * (and only until that client has seen the obliterate which removed their segment).\n */\nexport function wasRemovedOnInsert(segment: IHasInsertionInfo & ISegmentPrivate): boolean {\n\tconst removeInfo = toRemovalInfo(segment);\n\tconst removedSeq = removeInfo?.removes[0].seq;\n\tif (removedSeq === undefined || removedSeq === UnassignedSequenceNumber) {\n\t\treturn false;\n\t}\n\n\tconst insertSeq = segment.insert.seq;\n\treturn insertSeq === UnassignedSequenceNumber || insertSeq > removedSeq;\n}\n\n/**\n * A union type representing any segment info.\n */\nexport type SegmentInfo =\n\t| IMergeNodeInfo\n\t| IHasInsertionInfo\n\t| IHasRemovalInfo\n\t| ISegmentInsideObliterateInfo;\n\n/**\n * A type representing a segment with additional info.\n */\nexport type SegmentWithInfo<\n\tT extends SegmentInfo,\n\tS extends ISegmentPrivate = ISegmentPrivate,\n> = S & T;\n\n/**\n * Overwrites the segment info on a segment-like object.\n *\n * @param segmentLike - The segment-like object to set the info on.\n * @param info - The segment info to overwrite.\n * @returns The segment-like object with the info set.\n */\nexport const overwriteInfo = <\n\tT extends SegmentInfo,\n\tS extends ISegmentPrivate = ISegmentPrivate,\n>(\n\tsegmentLike: S,\n\tinfo: T,\n): SegmentWithInfo<T, S> => Object.assign(segmentLike, info);\n"]}
1
+ {"version":3,"file":"segmentInfos.js","sourceRoot":"","sources":["../src/segmentInfos.ts"],"names":[],"mappings":"AAAA;;;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S,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;IACrC,OAAO,SAAS,KAAK,wBAAwB,IAAI,SAAS,GAAG,UAAU,CAAC;AACzE,CAAC;AAmBD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAI5B,WAAc,EACd,IAAO,EACiB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, isObject } from \"@fluidframework/core-utils/internal\";\n\nimport { UnassignedSequenceNumber } from \"./constants.js\";\nimport {\n\ttype ISegmentInternal,\n\ttype ISegmentPrivate,\n\tMergeBlock,\n\ttype ObliterateInfo,\n} from \"./mergeTreeNodes.js\";\nimport type { InsertOperationStamp, OperationStamp, RemoveOperationStamp } from \"./stamps.js\";\n\nexport interface StringToType {\n\t\"string\": string;\n\t\"number\": number;\n\t\"object\": object;\n\t\"array\": unknown[];\n\t\"boolean\": boolean;\n}\n\nexport function propExists<P extends string>(\n\tthing: unknown,\n\tprop: P,\n): thing is Record<P, unknown> {\n\treturn isObject(thing) && prop in thing;\n}\n\nexport function hasProp<P extends string, T extends keyof StringToType>(\n\tthing: unknown,\n\tprop: P,\n\ttype: T,\n): thing is Record<P, StringToType[typeof type]> {\n\treturn (\n\t\tpropExists(thing, prop) &&\n\t\t(type === \"array\" ? Array.isArray(thing[prop]) : typeof thing[prop] === type)\n\t);\n}\n\nexport function propInstanceOf<P extends string, T>(\n\tthing: unknown,\n\tprop: P,\n\ttype: new (...args: any[]) => T,\n): thing is Record<P, T> {\n\treturn propExists(thing, prop) && thing[prop] instanceof type;\n}\n\n/**\n * Contains insertion information associated to an {@link ISegment}.\n */\nexport interface IHasInsertionInfo {\n\tinsert: InsertOperationStamp;\n}\n\nexport interface ISegmentInsideObliterateInfo {\n\t/**\n\t * Populated iff this segment was inserted into a range affected by concurrent obliterates at the time of its insertion.\n\t * Contains information about the 'most recent' (i.e. 'winning' in the sense below) obliterate.\n\t *\n\t * BEWARE: We have opted for a certain form of last-write wins (LWW) semantics for obliterates:\n\t * the client which last obliterated a range is considered to have \"won ownership\" of that range and may insert into it\n\t * without that insertion being obliterated by other clients' concurrent obliterates.\n\t *\n\t * Therefore, this field can be populated even if the segment has not been obliterated (i.e. is still visible).\n\t * This happens precisely when the segment was inserted by the same client that 'won' the obliterate (in a scenario where\n\t * a client first issues a sided obliterate impacting a range, then inserts into that range before the server has acked the obliterate).\n\t *\n\t * See the test case \"obliterate with mismatched final states\" for an example of such a scenario.\n\t *\n\t * TODO:AB#29553: This property is not persisted in the V1 summary, but it should be.\n\t */\n\tobliteratePrecedingInsertion?: ObliterateInfo;\n\t/**\n\t * Populated iff this segment was inserted into a range concurrently removed by a local obliterate operation.\n\t * This field is unset once the newest such overlapping obliterate is acked, and allows recomputing {@link obliteratePrecedingInsertion}\n\t * if that local obliterate is resubmitted.\n\t *\n\t * TODO:AB#29553: This property is not persisted in the V1 summary, but it should be.\n\t */\n\tinsertionRefSeqStamp?: OperationStamp;\n}\n\n/**\n * Converts a segment-like object to an insertion info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The insertion info object if the conversion is possible, otherwise undefined.\n */\nexport const toInsertionInfo = (segmentLike: unknown): IHasInsertionInfo | undefined => {\n\treturn segmentLike !== undefined &&\n\t\thasProp(segmentLike, \"insert\", \"object\") &&\n\t\thasProp(segmentLike.insert, \"clientId\", \"number\") &&\n\t\thasProp(segmentLike.insert, \"seq\", \"number\")\n\t\t? (segmentLike as IHasInsertionInfo)\n\t\t: undefined;\n};\n\n/**\n * A type-guard which determines if the segment has insertion info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param segmentLike - The segment-like object to check.\n * @returns True if the segment has insertion info, otherwise false.\n */\nexport const isInserted = (segmentLike: unknown): segmentLike is IHasInsertionInfo =>\n\ttoInsertionInfo(segmentLike) !== undefined;\n\nexport const isInsideObliterate = (\n\tsegmentLike: unknown,\n): segmentLike is ISegmentInsideObliterateInfo =>\n\tsegmentLike !== undefined && hasProp(segmentLike, \"obliteratePrecedingInsertion\", \"object\");\n\n/**\n * Asserts that the segment has insertion info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have insertion info.\n */\nexport const assertInserted: <T extends Partial<IHasInsertionInfo> | undefined>(\n\tsegmentLike: ISegmentInternal | Partial<IHasInsertionInfo> | T,\n) => asserts segmentLike is IHasInsertionInfo | Exclude<T, Partial<IHasInsertionInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(\n\t\tsegmentLike === undefined || isInserted(segmentLike),\n\t\t0xaa0 /* must be insertionInfo */,\n\t);\n\n/**\n * Common properties for a node in a merge tree.\n */\nexport interface IMergeNodeInfo {\n\t/**\n\t * The parent merge block if the node is parented\n\t */\n\tparent: MergeBlock;\n\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\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}\n\n/**\n * Converts a segment-like object to a merge node info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The merge node info object if the conversion is possible, otherwise undefined.\n */\nexport const toMergeNodeInfo = (nodeLike: unknown): IMergeNodeInfo | undefined =>\n\tpropInstanceOf(nodeLike, \"parent\", MergeBlock) &&\n\thasProp(nodeLike, \"ordinal\", \"string\") &&\n\thasProp(nodeLike, \"index\", \"number\")\n\t\t? nodeLike\n\t\t: undefined;\n\n/**\n * A type-guard which determines if the segment has merge node info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param nodeLike - The segment-like object to check.\n * @returns True if the segment has merge node info, otherwise false.\n */\nexport const isMergeNodeInfo = (nodeLike: unknown): nodeLike is IMergeNodeInfo =>\n\ttoMergeNodeInfo(nodeLike) !== undefined;\n\n/**\n * Asserts that the segment has merge node info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have merge node info.\n */\nexport const assertMergeNode: <T extends Partial<IMergeNodeInfo> | undefined>(\n\tnodeLike: ISegmentInternal | ISegmentPrivate | Partial<IMergeNodeInfo> | T,\n) => asserts nodeLike is IMergeNodeInfo | Exclude<T, Partial<IMergeNodeInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(\n\t\tsegmentLike === undefined || isMergeNodeInfo(segmentLike),\n\t\t0xaa1 /* must be MergeNodeInfo */,\n\t);\n\n/**\n * Removes the merge node info. This is used to remove nodes from the merge-tree.\n * @param segmentLike - The segment-like object to check.\n * @returns This function will change the type of the provided node like to never via an assertion. This\n * ensures no further usage of the removed merge node info is allowed. if continued use is required other\n * type coercion methods should be used to correctly re-type the variable.\n */\nexport const removeMergeNodeInfo: (nodeLike: IMergeNodeInfo) => asserts nodeLike is never = (\n\tnodeLike,\n) =>\n\tObject.assign<IMergeNodeInfo, Record<keyof IMergeNodeInfo, undefined>>(nodeLike, {\n\t\tparent: undefined,\n\t\tindex: undefined,\n\t\tordinal: undefined,\n\t});\n\n/**\n * Contains removal information associated with an {@link ISegment}.\n *\n * Segments can be removed concurrently by multiple clients.\n */\nexport interface IHasRemovalInfo {\n\t/**\n\t * Operation stamps which have removed this segment. This list is sorted by stamp order, where removes[0] is the earliest removal.\n\t */\n\tremoves: RemoveOperationStamp[];\n}\n\n/**\n * Converts a segment-like object to a removal info object if possible.\n *\n * @param segmentLike - The segment-like object to convert.\n * @returns The removal info object if the conversion is possible, otherwise undefined.\n */\nexport const toRemovalInfo = (segmentLike: unknown): IHasRemovalInfo | undefined => {\n\treturn hasProp(segmentLike, \"removes\", \"array\") &&\n\t\tsegmentLike.removes.length > 0 &&\n\t\thasProp(segmentLike.removes[0], \"clientId\", \"number\") &&\n\t\thasProp(segmentLike.removes[0], \"seq\", \"number\")\n\t\t? (segmentLike as IHasRemovalInfo)\n\t\t: undefined;\n};\n\n/**\n * A type-guard which determines if the segment has removal info, and\n * returns true if it does, along with applying strong typing.\n *\n * @param segmentLike - The segment-like object to check.\n * @returns True if the segment has removal info, otherwise false.\n */\n// export const isRemoved = (segmentLike: unknown): segmentLike is IHasRemovalInfo =>\n// \ttoRemovalInfo(segmentLike) !== undefined;\n\nexport const isRemoved = (segmentLike: unknown): segmentLike is IHasRemovalInfo =>\n\ttoRemovalInfo(segmentLike) !== undefined;\n\n/**\n * Asserts that the segment has removal info. Usage of this function should not produce a user facing error.\n *\n * @param segmentLike - The segment-like object to check.\n * @throws Will throw an error if the segment does not have removal info.\n */\nexport const assertRemoved: <T extends Partial<IHasRemovalInfo> | undefined>(\n\tsegmentLike: ISegmentInternal | Partial<IHasRemovalInfo> | T,\n) => asserts segmentLike is IHasRemovalInfo | Exclude<T, Partial<IHasRemovalInfo>> = (\n\tsegmentLike,\n) =>\n\tassert(segmentLike === undefined || isRemoved(segmentLike), 0xaa2 /* must be removalInfo */);\n\n/**\n * Removes the removal info. This is used in rollback.\n * @param segmentLike - The segment-like object to check.\n * @returns This function will change the type of the provided node like to never via an assertion. This\n * ensures no further usage of the removed removal info is allowed. if continued use is required other\n * type coercion methods should be use to correctly re-type the variable.\n */\nexport const removeRemovalInfo: (\n\tnodeLike: IHasRemovalInfo,\n) => asserts nodeLike is Record<keyof IHasRemovalInfo, never> = (nodeLike) =>\n\tObject.assign<IHasRemovalInfo, Record<keyof IHasRemovalInfo, undefined>>(nodeLike, {\n\t\tremoves: undefined,\n\t});\n\n/**\n * Returns whether this segment was marked removed as soon as its insertion was acked.\n *\n * This can happen when an an insert occurs concurrent to an obliterate over the range the segment was inserted into,\n * and the obliterate was sequenced first.\n *\n * When this happens, the segment is only ever visible to the client that inserted the segment\n * (and only until that client has seen the obliterate which removed their segment).\n */\nexport function wasRemovedOnInsert(segment: IHasInsertionInfo & ISegmentPrivate): boolean {\n\tconst removeInfo = toRemovalInfo(segment);\n\tconst removedSeq = removeInfo?.removes[0].seq;\n\tif (removedSeq === undefined || removedSeq === UnassignedSequenceNumber) {\n\t\treturn false;\n\t}\n\n\tconst insertSeq = segment.insert.seq;\n\treturn insertSeq === UnassignedSequenceNumber || insertSeq > removedSeq;\n}\n\n/**\n * A union type representing any segment info.\n */\nexport type SegmentInfo =\n\t| IMergeNodeInfo\n\t| IHasInsertionInfo\n\t| IHasRemovalInfo\n\t| ISegmentInsideObliterateInfo;\n\n/**\n * A type representing a segment with additional info.\n */\nexport type SegmentWithInfo<\n\tT extends SegmentInfo,\n\tS extends ISegmentPrivate = ISegmentPrivate,\n> = S & T;\n\n/**\n * Overwrites the segment info on a segment-like object.\n *\n * @param segmentLike - The segment-like object to set the info on.\n * @param info - The segment info to overwrite.\n * @returns The segment-like object with the info set.\n */\nexport const overwriteInfo = <\n\tT extends SegmentInfo,\n\tS extends ISegmentPrivate = ISegmentPrivate,\n>(\n\tsegmentLike: S,\n\tinfo: T,\n): SegmentWithInfo<T, S> => Object.assign(segmentLike, info);\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IMergeTreeAnnotateAdjustMsg, IMergeTreeAnnotateMsg } from "./ops.js";
6
- import { MapLike, PropertySet } from "./properties.js";
6
+ import { type MapLike, type PropertySet } from "./properties.js";
7
7
  /**
8
8
  * Minimally copies properties and the property manager from source to destination.
9
9
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"segmentPropertiesManager.d.ts","sourceRoot":"","sources":["../src/segmentPropertiesManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAEX,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAoB,MAAM,iBAAiB,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE;IACP,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,eAAe,C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nB,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAAC,KAAkB;QAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBACzE,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tDoublyLinkedList,\n\titerateListValuesWhile,\n} from \"@fluidframework/core-utils/internal\";\n\nimport { UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nimport type {\n\tAdjustParams,\n\tIMergeTreeAnnotateAdjustMsg,\n\tIMergeTreeAnnotateMsg,\n} from \"./ops.js\";\nimport { MapLike, PropertySet, clone, createMap } from \"./properties.js\";\n\n/**\n * Minimally copies properties and the property manager from source to destination.\n * @internal\n */\nexport function copyPropertiesAndManager(\n\tsource: {\n\t\tproperties?: PropertySet;\n\t\tpropertyManager?: PropertiesManager;\n\t},\n\tdestination: {\n\t\tproperties?: PropertySet;\n\t\tpropertyManager?: PropertiesManager;\n\t},\n): void {\n\tif (source.properties) {\n\t\tif (source.propertyManager === undefined) {\n\t\t\tdestination.properties = clone(source.properties);\n\t\t} else {\n\t\t\tdestination.propertyManager ??= new PropertiesManager();\n\t\t\tsource.propertyManager.copyTo(source.properties, destination);\n\t\t}\n\t}\n}\n\ntype PropertyChange = {\n\tseq: number;\n} & ({ adjust: AdjustParams; raw?: undefined } | { raw: unknown; adjust?: undefined });\n\ninterface PropertyChanges {\n\tmsnConsensus: unknown;\n\tremote: DoublyLinkedList<PropertyChange>;\n\tlocal: DoublyLinkedList<PropertyChange>;\n}\n\nfunction computePropertyValue(\n\tconsensus: unknown,\n\t...changes: Iterable<PropertyChange>[]\n): unknown {\n\tlet computedValue: unknown = consensus;\n\tfor (const change of changes) {\n\t\tfor (const op of change) {\n\t\t\tconst { raw, adjust } = op;\n\t\t\tif (adjust === undefined) {\n\t\t\t\tcomputedValue = raw;\n\t\t\t} else {\n\t\t\t\tconst adjusted =\n\t\t\t\t\t(typeof computedValue === \"number\" ? computedValue : 0) + adjust.delta;\n\t\t\t\tif (adjust.max !== undefined && adjusted > adjust.max) {\n\t\t\t\t\tcomputedValue = adjust.max;\n\t\t\t\t} else if (adjust.min !== undefined && adjusted < adjust.min) {\n\t\t\t\t\tcomputedValue = adjust.min;\n\t\t\t\t} else {\n\t\t\t\t\tcomputedValue = adjusted;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn computedValue;\n}\n\n/**\n * @internal\n */\nexport type PropsOrAdjust =\n\t| Pick<IMergeTreeAnnotateAdjustMsg, \"props\" | \"adjust\">\n\t| Pick<IMergeTreeAnnotateMsg, \"props\" | \"adjust\">;\n\nconst opToChanges = (op: PropsOrAdjust, seq: number): [string, PropertyChange][] => [\n\t...Object.entries(op.props ?? {})\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t.map<[string, PropertyChange]>(([k, raw]) => [k, { raw, seq }])\n\t\t.filter(([_, v]) => v.raw !== undefined),\n\t...Object.entries(op.adjust ?? {}).map<[string, PropertyChange]>(([k, adjust]) => [\n\t\tk,\n\t\t{ adjust, seq },\n\t]),\n];\n\nfunction applyChanges(\n\top: PropsOrAdjust,\n\tseg: { properties?: MapLike<unknown> },\n\tseq: number,\n\trun: (\n\t\tproperties: MapLike<unknown>,\n\t\tdeltas: MapLike<unknown>,\n\t\tkey: string,\n\t\tvalue: PropertyChange,\n\t) => void,\n): MapLike<unknown> {\n\tconst properties = (seg.properties ??= createMap<unknown>());\n\tconst deltas: MapLike<unknown> = {};\n\tfor (const [key, value] of opToChanges(op, seq)) {\n\t\trun(properties, deltas, key, value);\n\t\tif (properties[key] === null) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\tdelete properties[key];\n\t\t}\n\t}\n\treturn deltas;\n}\n\n/**\n * The PropertiesManager class handles changes to properties, both remote and local.\n * It manages the lifecycle for local property changes, ensures all property changes are eventually consistent,\n * and provides methods to acknowledge changes, update the minimum sequence number (msn), and copy properties to another manager.\n * This class is essential for maintaining the integrity and consistency of property changes in collaborative environments.\n * @internal\n */\nexport class PropertiesManager {\n\tprivate readonly changes = new Map<string, PropertyChanges>();\n\n\t/**\n\t * Rolls back local property changes.\n\t * This method reverts property changes based on the provided operation and segment.\n\t * If the operation is part of a collaborative session, it ensures that the changes are consistent with the remote state.\n\t *\n\t * @param op - The operation containing property changes. This can be an adjustment or a set of properties.\n\t * @param seg - The segment containing properties. This object may have a properties map that will be modified.\n\t * @param collaborating - Indicates if the operation is part of a collaborative session. Defaults to false.\n\t * @returns The deltas of the rolled-back properties. This is a map-like object representing the changes that were reverted.\n\t */\n\tpublic rollbackProperties(\n\t\top: PropsOrAdjust,\n\t\tseg: { properties?: MapLike<unknown> },\n\t\tcollaborating: boolean = false,\n\t): MapLike<unknown> {\n\t\treturn applyChanges(op, seg, UniversalSequenceNumber, (properties, deltas, key, value) => {\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst previousValue = properties[key] ?? null;\n\n\t\t\tconst pending = this.changes.get(key);\n\t\t\tif (collaborating) {\n\t\t\t\tassert(\n\t\t\t\t\tpending !== undefined,\n\t\t\t\t\t0xa6f /* Pending changes must exist for rollback when collaborating */,\n\t\t\t\t);\n\t\t\t\tpending.local.pop();\n\t\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\t\tpending.msnConsensus,\n\t\t\t\t\tpending.remote.map((n) => n.data),\n\t\t\t\t\tpending.local.map((n) => n.data),\n\t\t\t\t);\n\t\t\t\tif (pending.local.empty && pending.remote.empty) {\n\t\t\t\t\tthis.changes.delete(key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tassert(\n\t\t\t\t\tpending === undefined,\n\t\t\t\t\t0xa70 /* Pending changes must not exist when not collaborating */,\n\t\t\t\t);\n\t\t\t\tproperties[key] = computePropertyValue(previousValue, [value]);\n\t\t\t}\n\t\t\tdeltas[key] = previousValue;\n\t\t});\n\t}\n\n\t/**\n\t * Handles property changes.\n\t * This method applies property changes based on the provided operation, segment, sequence number, and collaboration state.\n\t * It also handles rolling back changes if specified.\n\t *\n\t * @param op - The operation containing property changes.\n\t * @param seg - The segment containing properties.\n\t * @param seq - The sequence number for the operation.\n\t * @param msn - The minimum sequence number for the operation.\n\t * @param collaborating - Indicates if the operation is part of a collaborative session. Defaults to false.\n\t * @param rollback - Specifies if the changes should be rolled back. Defaults to PropertiesRollback.None.\n\t * @returns The deltas of the applied or rolled-back properties. This is a map-like object representing the changes.\n\t */\n\tpublic handleProperties(\n\t\top: PropsOrAdjust,\n\t\tseg: { properties?: MapLike<unknown> },\n\t\tseq: number,\n\t\tmsn: number,\n\t\tcollaborating: boolean = false,\n\t\trollback: boolean = false,\n\t): MapLike<unknown> {\n\t\tif (rollback) {\n\t\t\treturn this.rollbackProperties(op, seg, collaborating);\n\t\t}\n\t\tconst rtn = applyChanges(op, seg, seq, (properties, deltas, key, value) => {\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst previousValue = properties[key] ?? null;\n\t\t\tif (collaborating) {\n\t\t\t\tconst pending: PropertyChanges | undefined = this.changes.get(key) ?? {\n\t\t\t\t\tmsnConsensus: previousValue,\n\t\t\t\t\tremote: new DoublyLinkedList(),\n\t\t\t\t\tlocal: new DoublyLinkedList(),\n\t\t\t\t};\n\t\t\t\tthis.changes.set(key, pending);\n\t\t\t\tconst local = seq === UnassignedSequenceNumber;\n\t\t\t\tif (local) {\n\t\t\t\t\tpending.local.push(value);\n\t\t\t\t} else {\n\t\t\t\t\t// we only track remotes if there are adjusts, as only adjusts make application anti-commutative\n\t\t\t\t\t// this will limit the impact of this change to only those using adjusts. Additionally, we only\n\t\t\t\t\t// need to track remotes at all to support emitting the legacy snapshot format, which only sharedstring\n\t\t\t\t\t// uses. when we remove the ability to emit that format, we can remove all remote op tracking\n\t\t\t\t\tif (value.raw !== undefined && pending.remote.empty) {\n\t\t\t\t\t\tpending.msnConsensus = computePropertyValue(pending.msnConsensus, [value]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpending.remote.push(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\t\tpending.msnConsensus,\n\t\t\t\t\tpending.remote.map((n) => n.data),\n\t\t\t\t\tpending.local.map((n) => n.data),\n\t\t\t\t);\n\t\t\t\tif (local || pending.local.empty || properties[key] !== previousValue) {\n\t\t\t\t\tdeltas[key] = previousValue;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tproperties[key] = computePropertyValue(previousValue, [value]);\n\t\t\t\tdeltas[key] = previousValue;\n\t\t\t}\n\t\t});\n\t\tthis.updateMsn(msn);\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Acknowledges property changes.\n\t * This method acknowledges the property changes based on the provided sequence number and operation.\n\t *\n\t * @param seq - The sequence number for the operation.\n\t * @param msn - The minimum sequence number for the operation.\n\t * @param op - The operation containing property changes.\n\t */\n\tpublic ack(seq: number, msn: number, op: PropsOrAdjust): void {\n\t\tfor (const [key, value] of opToChanges(op, seq)) {\n\t\t\tconst change = this.changes.get(key);\n\t\t\tconst acked = change?.local?.shift();\n\t\t\tassert(\n\t\t\t\tchange !== undefined && acked !== undefined,\n\t\t\t\t0xa71 /* must have local change to ack */,\n\t\t\t);\n\t\t\t// we only track remotes if there are adjusts, as only adjusts make application anti-commutative\n\t\t\t// this will limit the impact of this change to only those using adjusts. Additionally, we only\n\t\t\t// need to track remotes at all to support emitting the legacy snapshot format, which only sharedstring\n\t\t\t// uses. when we remove the ability to emit that format, we can remove all remote op tracking\n\t\t\tif (value.raw !== undefined && change.remote.empty) {\n\t\t\t\tchange.msnConsensus = computePropertyValue(change.msnConsensus, [value]);\n\t\t\t} else {\n\t\t\t\tchange.remote.push(value);\n\t\t\t}\n\t\t}\n\t\tthis.updateMsn(msn);\n\t}\n\n\t/**\n\t * Updates the minimum sequence number (msn).\n\t * This method updates the minimum sequence number and removes any changes that have been acknowledged.\n\t *\n\t * @param msn - The minimum sequence number to update.\n\t */\n\tpublic updateMsn(msn: number): void {\n\t\tfor (const [key, pending] of this.changes) {\n\t\t\tpending.msnConsensus = computePropertyValue(\n\t\t\t\tpending.msnConsensus,\n\t\t\t\titerateListValuesWhile(pending.remote.first, (n) => {\n\t\t\t\t\tif (n.data.seq <= msn) {\n\t\t\t\t\t\tn.list?.remove(n);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (pending.local.empty && pending.remote.empty) {\n\t\t\t\tthis.changes.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Copies properties to another manager.\n\t * This method copies the properties and their changes from the current manager to the destination manager.\n\t *\n\t * @param oldProps - The old properties to be copied.\n\t * @param dest - The destination object containing properties and property manager.\n\t */\n\tpublic copyTo(\n\t\toldProps: PropertySet | undefined,\n\t\tdest: {\n\t\t\tproperties?: PropertySet;\n\t\t\tpropertyManager?: PropertiesManager;\n\t\t},\n\t): void {\n\t\tconst newManager = (dest.propertyManager ??= new PropertiesManager());\n\t\tdest.properties = clone(oldProps);\n\t\tfor (const [key, { local, remote, msnConsensus }] of this.changes.entries()) {\n\t\t\tnewManager.changes.set(key, {\n\t\t\t\tmsnConsensus,\n\t\t\t\tremote: new DoublyLinkedList(remote.empty ? undefined : remote.map((c) => c.data)),\n\t\t\t\tlocal: new DoublyLinkedList(local.empty ? undefined : local.map((c) => c.data)),\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Gets properties at a specific sequence number.\n\t * This method retrieves the properties at the given sequence number.\n\t * This is only needed to support emitting snapshots in the legacy format.\n\t * If we remove the ability to emit the legacy format, we can remove this method, along with the need to track remote changes at all.\n\t *\n\t * @param oldProps - The old properties to be retrieved.\n\t * @param sequenceNumber - The sequence number to get properties at.\n\t * @returns The properties at the given sequence number.\n\t */\n\tpublic getAtSeq(\n\t\toldProps: MapLike<unknown> | undefined,\n\t\tsequenceNumber: number,\n\t): MapLike<unknown> {\n\t\tconst properties: MapLike<unknown> = { ...oldProps };\n\t\tfor (const [key, changes] of this.changes) {\n\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\tchanges.msnConsensus,\n\t\t\t\titerateListValuesWhile(changes.remote.first, (c) => c.data.seq <= sequenceNumber),\n\t\t\t);\n\t\t\tif (properties[key] === null) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete properties[key];\n\t\t\t}\n\t\t}\n\t\treturn properties;\n\t}\n\n\t/**\n\t * Determines if all of the defined properties in a given property set are pending.\n\t *\n\t * @param props - The properties to check.\n\t * @returns True if all the properties are pending, false otherwise.\n\t */\n\tpublic hasPendingProperties(props: PropertySet): boolean {\n\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\tif (value !== undefined && this.changes.get(key)?.local.empty !== false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"segmentPropertiesManager.js","sourceRoot":"","sources":["../src/segmentPropertiesManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAMnF,OAAO,EAAkC,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnF;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAGC,EACD,W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gBAC9B,gEAAgE;gBAChE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAAC,KAAkB;QAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBACzE,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tDoublyLinkedList,\n\titerateListValuesWhile,\n} from \"@fluidframework/core-utils/internal\";\n\nimport { UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nimport type {\n\tAdjustParams,\n\tIMergeTreeAnnotateAdjustMsg,\n\tIMergeTreeAnnotateMsg,\n} from \"./ops.js\";\nimport { type MapLike, type PropertySet, clone, createMap } from \"./properties.js\";\n\n/**\n * Minimally copies properties and the property manager from source to destination.\n * @internal\n */\nexport function copyPropertiesAndManager(\n\tsource: {\n\t\tproperties?: PropertySet;\n\t\tpropertyManager?: PropertiesManager;\n\t},\n\tdestination: {\n\t\tproperties?: PropertySet;\n\t\tpropertyManager?: PropertiesManager;\n\t},\n): void {\n\tif (source.properties) {\n\t\tif (source.propertyManager === undefined) {\n\t\t\tdestination.properties = clone(source.properties);\n\t\t} else {\n\t\t\tdestination.propertyManager ??= new PropertiesManager();\n\t\t\tsource.propertyManager.copyTo(source.properties, destination);\n\t\t}\n\t}\n}\n\ntype PropertyChange = {\n\tseq: number;\n} & ({ adjust: AdjustParams; raw?: undefined } | { raw: unknown; adjust?: undefined });\n\ninterface PropertyChanges {\n\tmsnConsensus: unknown;\n\tremote: DoublyLinkedList<PropertyChange>;\n\tlocal: DoublyLinkedList<PropertyChange>;\n}\n\nfunction computePropertyValue(\n\tconsensus: unknown,\n\t...changes: Iterable<PropertyChange>[]\n): unknown {\n\tlet computedValue: unknown = consensus;\n\tfor (const change of changes) {\n\t\tfor (const op of change) {\n\t\t\tconst { raw, adjust } = op;\n\t\t\tif (adjust === undefined) {\n\t\t\t\tcomputedValue = raw;\n\t\t\t} else {\n\t\t\t\tconst adjusted =\n\t\t\t\t\t(typeof computedValue === \"number\" ? computedValue : 0) + adjust.delta;\n\t\t\t\tif (adjust.max !== undefined && adjusted > adjust.max) {\n\t\t\t\t\tcomputedValue = adjust.max;\n\t\t\t\t} else if (adjust.min !== undefined && adjusted < adjust.min) {\n\t\t\t\t\tcomputedValue = adjust.min;\n\t\t\t\t} else {\n\t\t\t\t\tcomputedValue = adjusted;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn computedValue;\n}\n\n/**\n * @internal\n */\nexport type PropsOrAdjust =\n\t| Pick<IMergeTreeAnnotateAdjustMsg, \"props\" | \"adjust\">\n\t| Pick<IMergeTreeAnnotateMsg, \"props\" | \"adjust\">;\n\nconst opToChanges = (op: PropsOrAdjust, seq: number): [string, PropertyChange][] => [\n\t...Object.entries(op.props ?? {})\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t.map<[string, PropertyChange]>(([k, raw]) => [k, { raw, seq }])\n\t\t.filter(([_, v]) => v.raw !== undefined),\n\t...Object.entries(op.adjust ?? {}).map<[string, PropertyChange]>(([k, adjust]) => [\n\t\tk,\n\t\t{ adjust, seq },\n\t]),\n];\n\nfunction applyChanges(\n\top: PropsOrAdjust,\n\tseg: { properties?: MapLike<unknown> },\n\tseq: number,\n\trun: (\n\t\tproperties: MapLike<unknown>,\n\t\tdeltas: MapLike<unknown>,\n\t\tkey: string,\n\t\tvalue: PropertyChange,\n\t) => void,\n): MapLike<unknown> {\n\tconst properties = (seg.properties ??= createMap<unknown>());\n\tconst deltas: MapLike<unknown> = {};\n\tfor (const [key, value] of opToChanges(op, seq)) {\n\t\trun(properties, deltas, key, value);\n\t\tif (properties[key] === null) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\tdelete properties[key];\n\t\t}\n\t}\n\treturn deltas;\n}\n\n/**\n * The PropertiesManager class handles changes to properties, both remote and local.\n * It manages the lifecycle for local property changes, ensures all property changes are eventually consistent,\n * and provides methods to acknowledge changes, update the minimum sequence number (msn), and copy properties to another manager.\n * This class is essential for maintaining the integrity and consistency of property changes in collaborative environments.\n * @internal\n */\nexport class PropertiesManager {\n\tprivate readonly changes = new Map<string, PropertyChanges>();\n\n\t/**\n\t * Rolls back local property changes.\n\t * This method reverts property changes based on the provided operation and segment.\n\t * If the operation is part of a collaborative session, it ensures that the changes are consistent with the remote state.\n\t *\n\t * @param op - The operation containing property changes. This can be an adjustment or a set of properties.\n\t * @param seg - The segment containing properties. This object may have a properties map that will be modified.\n\t * @param collaborating - Indicates if the operation is part of a collaborative session. Defaults to false.\n\t * @returns The deltas of the rolled-back properties. This is a map-like object representing the changes that were reverted.\n\t */\n\tpublic rollbackProperties(\n\t\top: PropsOrAdjust,\n\t\tseg: { properties?: MapLike<unknown> },\n\t\tcollaborating: boolean = false,\n\t): MapLike<unknown> {\n\t\treturn applyChanges(op, seg, UniversalSequenceNumber, (properties, deltas, key, value) => {\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst previousValue = properties[key] ?? null;\n\n\t\t\tconst pending = this.changes.get(key);\n\t\t\tif (collaborating) {\n\t\t\t\tassert(\n\t\t\t\t\tpending !== undefined,\n\t\t\t\t\t0xa6f /* Pending changes must exist for rollback when collaborating */,\n\t\t\t\t);\n\t\t\t\tpending.local.pop();\n\t\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\t\tpending.msnConsensus,\n\t\t\t\t\tpending.remote.map((n) => n.data),\n\t\t\t\t\tpending.local.map((n) => n.data),\n\t\t\t\t);\n\t\t\t\tif (pending.local.empty && pending.remote.empty) {\n\t\t\t\t\tthis.changes.delete(key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tassert(\n\t\t\t\t\tpending === undefined,\n\t\t\t\t\t0xa70 /* Pending changes must not exist when not collaborating */,\n\t\t\t\t);\n\t\t\t\tproperties[key] = computePropertyValue(previousValue, [value]);\n\t\t\t}\n\t\t\tdeltas[key] = previousValue;\n\t\t});\n\t}\n\n\t/**\n\t * Handles property changes.\n\t * This method applies property changes based on the provided operation, segment, sequence number, and collaboration state.\n\t * It also handles rolling back changes if specified.\n\t *\n\t * @param op - The operation containing property changes.\n\t * @param seg - The segment containing properties.\n\t * @param seq - The sequence number for the operation.\n\t * @param msn - The minimum sequence number for the operation.\n\t * @param collaborating - Indicates if the operation is part of a collaborative session. Defaults to false.\n\t * @param rollback - Specifies if the changes should be rolled back. Defaults to PropertiesRollback.None.\n\t * @returns The deltas of the applied or rolled-back properties. This is a map-like object representing the changes.\n\t */\n\tpublic handleProperties(\n\t\top: PropsOrAdjust,\n\t\tseg: { properties?: MapLike<unknown> },\n\t\tseq: number,\n\t\tmsn: number,\n\t\tcollaborating: boolean = false,\n\t\trollback: boolean = false,\n\t): MapLike<unknown> {\n\t\tif (rollback) {\n\t\t\treturn this.rollbackProperties(op, seg, collaborating);\n\t\t}\n\t\tconst rtn = applyChanges(op, seg, seq, (properties, deltas, key, value) => {\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst previousValue = properties[key] ?? null;\n\t\t\tif (collaborating) {\n\t\t\t\tconst pending: PropertyChanges | undefined = this.changes.get(key) ?? {\n\t\t\t\t\tmsnConsensus: previousValue,\n\t\t\t\t\tremote: new DoublyLinkedList(),\n\t\t\t\t\tlocal: new DoublyLinkedList(),\n\t\t\t\t};\n\t\t\t\tthis.changes.set(key, pending);\n\t\t\t\tconst local = seq === UnassignedSequenceNumber;\n\t\t\t\tif (local) {\n\t\t\t\t\tpending.local.push(value);\n\t\t\t\t} else {\n\t\t\t\t\t// we only track remotes if there are adjusts, as only adjusts make application anti-commutative\n\t\t\t\t\t// this will limit the impact of this change to only those using adjusts. Additionally, we only\n\t\t\t\t\t// need to track remotes at all to support emitting the legacy snapshot format, which only sharedstring\n\t\t\t\t\t// uses. when we remove the ability to emit that format, we can remove all remote op tracking\n\t\t\t\t\tif (value.raw !== undefined && pending.remote.empty) {\n\t\t\t\t\t\tpending.msnConsensus = computePropertyValue(pending.msnConsensus, [value]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpending.remote.push(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\t\tpending.msnConsensus,\n\t\t\t\t\tpending.remote.map((n) => n.data),\n\t\t\t\t\tpending.local.map((n) => n.data),\n\t\t\t\t);\n\t\t\t\tif (local || pending.local.empty || properties[key] !== previousValue) {\n\t\t\t\t\tdeltas[key] = previousValue;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tproperties[key] = computePropertyValue(previousValue, [value]);\n\t\t\t\tdeltas[key] = previousValue;\n\t\t\t}\n\t\t});\n\t\tthis.updateMsn(msn);\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Acknowledges property changes.\n\t * This method acknowledges the property changes based on the provided sequence number and operation.\n\t *\n\t * @param seq - The sequence number for the operation.\n\t * @param msn - The minimum sequence number for the operation.\n\t * @param op - The operation containing property changes.\n\t */\n\tpublic ack(seq: number, msn: number, op: PropsOrAdjust): void {\n\t\tfor (const [key, value] of opToChanges(op, seq)) {\n\t\t\tconst change = this.changes.get(key);\n\t\t\tconst acked = change?.local?.shift();\n\t\t\tassert(\n\t\t\t\tchange !== undefined && acked !== undefined,\n\t\t\t\t0xa71 /* must have local change to ack */,\n\t\t\t);\n\t\t\t// we only track remotes if there are adjusts, as only adjusts make application anti-commutative\n\t\t\t// this will limit the impact of this change to only those using adjusts. Additionally, we only\n\t\t\t// need to track remotes at all to support emitting the legacy snapshot format, which only sharedstring\n\t\t\t// uses. when we remove the ability to emit that format, we can remove all remote op tracking\n\t\t\tif (value.raw !== undefined && change.remote.empty) {\n\t\t\t\tchange.msnConsensus = computePropertyValue(change.msnConsensus, [value]);\n\t\t\t} else {\n\t\t\t\tchange.remote.push(value);\n\t\t\t}\n\t\t}\n\t\tthis.updateMsn(msn);\n\t}\n\n\t/**\n\t * Updates the minimum sequence number (msn).\n\t * This method updates the minimum sequence number and removes any changes that have been acknowledged.\n\t *\n\t * @param msn - The minimum sequence number to update.\n\t */\n\tpublic updateMsn(msn: number): void {\n\t\tfor (const [key, pending] of this.changes) {\n\t\t\tpending.msnConsensus = computePropertyValue(\n\t\t\t\tpending.msnConsensus,\n\t\t\t\titerateListValuesWhile(pending.remote.first, (n) => {\n\t\t\t\t\tif (n.data.seq <= msn) {\n\t\t\t\t\t\tn.list?.remove(n);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (pending.local.empty && pending.remote.empty) {\n\t\t\t\tthis.changes.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Copies properties to another manager.\n\t * This method copies the properties and their changes from the current manager to the destination manager.\n\t *\n\t * @param oldProps - The old properties to be copied.\n\t * @param dest - The destination object containing properties and property manager.\n\t */\n\tpublic copyTo(\n\t\toldProps: PropertySet | undefined,\n\t\tdest: {\n\t\t\tproperties?: PropertySet;\n\t\t\tpropertyManager?: PropertiesManager;\n\t\t},\n\t): void {\n\t\tconst newManager = (dest.propertyManager ??= new PropertiesManager());\n\t\tdest.properties = clone(oldProps);\n\t\tfor (const [key, { local, remote, msnConsensus }] of this.changes.entries()) {\n\t\t\tnewManager.changes.set(key, {\n\t\t\t\tmsnConsensus,\n\t\t\t\tremote: new DoublyLinkedList(remote.empty ? undefined : remote.map((c) => c.data)),\n\t\t\t\tlocal: new DoublyLinkedList(local.empty ? undefined : local.map((c) => c.data)),\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Gets properties at a specific sequence number.\n\t * This method retrieves the properties at the given sequence number.\n\t * This is only needed to support emitting snapshots in the legacy format.\n\t * If we remove the ability to emit the legacy format, we can remove this method, along with the need to track remote changes at all.\n\t *\n\t * @param oldProps - The old properties to be retrieved.\n\t * @param sequenceNumber - The sequence number to get properties at.\n\t * @returns The properties at the given sequence number.\n\t */\n\tpublic getAtSeq(\n\t\toldProps: MapLike<unknown> | undefined,\n\t\tsequenceNumber: number,\n\t): MapLike<unknown> {\n\t\tconst properties: MapLike<unknown> = { ...oldProps };\n\t\tfor (const [key, changes] of this.changes) {\n\t\t\tproperties[key] = computePropertyValue(\n\t\t\t\tchanges.msnConsensus,\n\t\t\t\titerateListValuesWhile(changes.remote.first, (c) => c.data.seq <= sequenceNumber),\n\t\t\t);\n\t\t\tif (properties[key] === null) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete properties[key];\n\t\t\t}\n\t\t}\n\t\treturn properties;\n\t}\n\n\t/**\n\t * Determines if all of the defined properties in a given property set are pending.\n\t *\n\t * @param props - The properties to check.\n\t * @returns True if all the properties are pending, false otherwise.\n\t */\n\tpublic hasPendingProperties(props: PropertySet): boolean {\n\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\tif (value !== undefined && this.changes.get(key)?.local.empty !== false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
@@ -25,16 +25,14 @@
25
25
  * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),
26
26
  * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.
27
27
  * E.g. the start of a range with Side.After is exclusive of the character at the position.
28
- * @legacy
29
- * @alpha
28
+ * @legacy @beta
30
29
  */
31
30
  export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
32
31
  /**
33
32
  * A sequence place that does not refer to the special endpoint segments.
34
33
  *
35
34
  * See {@link SequencePlace} for additional context.
36
- * @legacy
37
- * @alpha
35
+ * @legacy @beta
38
36
  */
39
37
  export interface InteriorSequencePlace {
40
38
  pos: number;
@@ -44,8 +42,7 @@ export interface InteriorSequencePlace {
44
42
  * Defines a side relative to a character in a sequence.
45
43
  *
46
44
  * @remarks See {@link SequencePlace} for additional context on usage.
47
- * @legacy
48
- * @alpha
45
+ * @legacy @beta
49
46
  */
50
47
  export declare enum Side {
51
48
  Before = 0,
@@ -54,8 +51,7 @@ export declare enum Side {
54
51
  /**
55
52
  * Returns the position and side of the start and end of a sequence.
56
53
  *
57
- * @legacy
58
- * @alpha
54
+ * @legacy @beta
59
55
  */
60
56
  export declare function endpointPosAndSide(start: SequencePlace | undefined, end: SequencePlace | undefined): {
61
57
  startSide: Side | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePlace.d.ts","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,qBAAqB,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACX;AAED;;;;;;GAMG;AACH,oBAAY,IAAI;IACf,MAAM,IAAI;IACV,KAAK,IAAI;CACT;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,GAC5B;IACF,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;CAC7C,CAiBA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,qBAAqB,CAW1E"}
1
+ {"version":3,"file":"sequencePlace.d.ts","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,qBAAqB,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACX;AAED;;;;;GAKG;AACH,oBAAY,IAAI;IACf,MAAM,IAAI;IACV,KAAK,IAAI;CACT;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,GAC5B;IACF,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;CAC7C,CAiBA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,qBAAqB,CAW1E"}
@@ -6,8 +6,7 @@
6
6
  * Defines a side relative to a character in a sequence.
7
7
  *
8
8
  * @remarks See {@link SequencePlace} for additional context on usage.
9
- * @legacy
10
- * @alpha
9
+ * @legacy @beta
11
10
  */
12
11
  export var Side;
13
12
  (function (Side) {
@@ -17,8 +16,7 @@ export var Side;
17
16
  /**
18
17
  * Returns the position and side of the start and end of a sequence.
19
18
  *
20
- * @legacy
21
- * @alpha
19
+ * @legacy @beta
22
20
  */
23
21
  export function endpointPosAndSide(start, end) {
24
22
  const startIsPlainEndpoint = typeof start === "number" || start === "start" || start === "end";
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePlace.js","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0CH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,KAAgC,EAChC,GAA8B;IAO9B,MAAM,oBAAoB,GACzB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,KAAK,CAAC;IACnE,MAAM,kBAAkB,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,CAAC;IAEvF,MAAM,SAAS,GAAG,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC;IACnE,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC;IAE7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC;IAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnD,OAAO;QACN,SAAS;QACT,OAAO;QACP,QAAQ;QACR,MAAM;KACN,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Defines a position and side relative to a character in a sequence.\n *\n * For this purpose, sequences look like:\n *\n * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`\n *\n * Each `{value}` in the diagram is a character within a sequence.\n * Each `-` in the above diagram is a position where text could be inserted.\n * Each position between a `{value}` and a `-` is a `SequencePlace`.\n *\n * The special endpoints `{start}` and `{end}` refer to positions outside the\n * contents of the string.\n *\n * This gives us 2N + 2 possible positions to refer to within a string, where N\n * is the number of characters.\n *\n * If the position is specified with a bare number, the side defaults to\n * `Side.Before`.\n *\n * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),\n * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.\n * E.g. the start of a range with Side.After is exclusive of the character at the position.\n * @legacy\n * @alpha\n */\nexport type SequencePlace = number | \"start\" | \"end\" | InteriorSequencePlace;\n\n/**\n * A sequence place that does not refer to the special endpoint segments.\n *\n * See {@link SequencePlace} for additional context.\n * @legacy\n * @alpha\n */\nexport interface InteriorSequencePlace {\n\tpos: number;\n\tside: Side;\n}\n\n/**\n * Defines a side relative to a character in a sequence.\n *\n * @remarks See {@link SequencePlace} for additional context on usage.\n * @legacy\n * @alpha\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * Returns the position and side of the start and end of a sequence.\n *\n * @legacy\n * @alpha\n */\nexport function endpointPosAndSide(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n): {\n\tstartSide: Side | undefined;\n\tendSide: Side | undefined;\n\tstartPos: number | \"start\" | \"end\" | undefined;\n\tendPos: number | \"start\" | \"end\" | undefined;\n} {\n\tconst startIsPlainEndpoint =\n\t\ttypeof start === \"number\" || start === \"start\" || start === \"end\";\n\tconst endIsPlainEndpoint = typeof end === \"number\" || end === \"start\" || end === \"end\";\n\n\tconst startSide = startIsPlainEndpoint ? Side.Before : start?.side;\n\tconst endSide = endIsPlainEndpoint ? Side.Before : end?.side;\n\n\tconst startPos = startIsPlainEndpoint ? start : start?.pos;\n\tconst endPos = endIsPlainEndpoint ? end : end?.pos;\n\n\treturn {\n\t\tstartSide,\n\t\tendSide,\n\t\tstartPos,\n\t\tendPos,\n\t};\n}\n\n/**\n * Returns the given place in InteriorSequencePlace form.\n */\nexport function normalizePlace(place: SequencePlace): InteriorSequencePlace {\n\tif (typeof place === \"number\") {\n\t\treturn { pos: place, side: Side.Before };\n\t}\n\tif (place === \"start\") {\n\t\treturn { pos: -1, side: Side.After };\n\t}\n\tif (place === \"end\") {\n\t\treturn { pos: -1, side: Side.Before };\n\t}\n\treturn place;\n}\n"]}
1
+ {"version":3,"file":"sequencePlace.js","sourceRoot":"","sources":["../src/sequencePlace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwCH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,mCAAU,CAAA;IACV,iCAAS,CAAA;AACV,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,KAAgC,EAChC,GAA8B;IAO9B,MAAM,oBAAoB,GACzB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,KAAK,CAAC;IACnE,MAAM,kBAAkB,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,CAAC;IAEvF,MAAM,SAAS,GAAG,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC;IACnE,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC;IAE7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC;IAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnD,OAAO;QACN,SAAS;QACT,OAAO;QACP,QAAQ;QACR,MAAM;KACN,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAoB;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Defines a position and side relative to a character in a sequence.\n *\n * For this purpose, sequences look like:\n *\n * `{start} - {character 0} - {character 1} - ... - {character N} - {end}`\n *\n * Each `{value}` in the diagram is a character within a sequence.\n * Each `-` in the above diagram is a position where text could be inserted.\n * Each position between a `{value}` and a `-` is a `SequencePlace`.\n *\n * The special endpoints `{start}` and `{end}` refer to positions outside the\n * contents of the string.\n *\n * This gives us 2N + 2 possible positions to refer to within a string, where N\n * is the number of characters.\n *\n * If the position is specified with a bare number, the side defaults to\n * `Side.Before`.\n *\n * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),\n * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.\n * E.g. the start of a range with Side.After is exclusive of the character at the position.\n * @legacy @beta\n */\nexport type SequencePlace = number | \"start\" | \"end\" | InteriorSequencePlace;\n\n/**\n * A sequence place that does not refer to the special endpoint segments.\n *\n * See {@link SequencePlace} for additional context.\n * @legacy @beta\n */\nexport interface InteriorSequencePlace {\n\tpos: number;\n\tside: Side;\n}\n\n/**\n * Defines a side relative to a character in a sequence.\n *\n * @remarks See {@link SequencePlace} for additional context on usage.\n * @legacy @beta\n */\nexport enum Side {\n\tBefore = 0,\n\tAfter = 1,\n}\n\n/**\n * Returns the position and side of the start and end of a sequence.\n *\n * @legacy @beta\n */\nexport function endpointPosAndSide(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n): {\n\tstartSide: Side | undefined;\n\tendSide: Side | undefined;\n\tstartPos: number | \"start\" | \"end\" | undefined;\n\tendPos: number | \"start\" | \"end\" | undefined;\n} {\n\tconst startIsPlainEndpoint =\n\t\ttypeof start === \"number\" || start === \"start\" || start === \"end\";\n\tconst endIsPlainEndpoint = typeof end === \"number\" || end === \"start\" || end === \"end\";\n\n\tconst startSide = startIsPlainEndpoint ? Side.Before : start?.side;\n\tconst endSide = endIsPlainEndpoint ? Side.Before : end?.side;\n\n\tconst startPos = startIsPlainEndpoint ? start : start?.pos;\n\tconst endPos = endIsPlainEndpoint ? end : end?.pos;\n\n\treturn {\n\t\tstartSide,\n\t\tendSide,\n\t\tstartPos,\n\t\tendPos,\n\t};\n}\n\n/**\n * Returns the given place in InteriorSequencePlace form.\n */\nexport function normalizePlace(place: SequencePlace): InteriorSequencePlace {\n\tif (typeof place === \"number\") {\n\t\treturn { pos: place, side: Side.Before };\n\t}\n\tif (place === \"start\") {\n\t\treturn { pos: -1, side: Side.After };\n\t}\n\tif (place === \"end\") {\n\t\treturn { pos: -1, side: Side.Before };\n\t}\n\treturn place;\n}\n"]}