@fluidframework/merge-tree 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/merge-tree.api.md +16 -4
  3. package/dist/MergeTreeTextHelper.d.ts.map +1 -1
  4. package/dist/MergeTreeTextHelper.js.map +1 -1
  5. package/dist/attributionCollection.d.ts +1 -1
  6. package/dist/attributionCollection.d.ts.map +1 -1
  7. package/dist/attributionCollection.js +6 -6
  8. package/dist/attributionCollection.js.map +1 -1
  9. package/dist/attributionPolicy.d.ts +2 -2
  10. package/dist/attributionPolicy.d.ts.map +1 -1
  11. package/dist/attributionPolicy.js +5 -5
  12. package/dist/attributionPolicy.js.map +1 -1
  13. package/dist/client.d.ts +8 -8
  14. package/dist/client.d.ts.map +1 -1
  15. package/dist/client.js +37 -48
  16. package/dist/client.js.map +1 -1
  17. package/dist/collections/list.js +3 -3
  18. package/dist/collections/list.js.map +1 -1
  19. package/dist/endOfTreeSegment.d.ts +5 -5
  20. package/dist/endOfTreeSegment.d.ts.map +1 -1
  21. package/dist/endOfTreeSegment.js +2 -2
  22. package/dist/endOfTreeSegment.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +4 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/legacy.d.ts +76 -0
  28. package/dist/localReference.d.ts.map +1 -1
  29. package/dist/localReference.js +7 -7
  30. package/dist/localReference.js.map +1 -1
  31. package/dist/mergeTree.d.ts +8 -8
  32. package/dist/mergeTree.d.ts.map +1 -1
  33. package/dist/mergeTree.js +44 -57
  34. package/dist/mergeTree.js.map +1 -1
  35. package/dist/mergeTreeDeltaCallback.d.ts +1 -1
  36. package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
  37. package/dist/mergeTreeDeltaCallback.js +4 -0
  38. package/dist/mergeTreeDeltaCallback.js.map +1 -1
  39. package/dist/mergeTreeNodeWalk.d.ts +3 -3
  40. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  41. package/dist/mergeTreeNodeWalk.js.map +1 -1
  42. package/dist/mergeTreeNodes.d.ts +37 -55
  43. package/dist/mergeTreeNodes.d.ts.map +1 -1
  44. package/dist/mergeTreeNodes.js +40 -19
  45. package/dist/mergeTreeNodes.js.map +1 -1
  46. package/dist/opBuilder.d.ts +1 -1
  47. package/dist/opBuilder.d.ts.map +1 -1
  48. package/dist/opBuilder.js.map +1 -1
  49. package/dist/ordinal.js +2 -2
  50. package/dist/ordinal.js.map +1 -1
  51. package/dist/partialLengths.d.ts +6 -6
  52. package/dist/partialLengths.d.ts.map +1 -1
  53. package/dist/partialLengths.js +13 -13
  54. package/dist/partialLengths.js.map +1 -1
  55. package/dist/public.d.ts +12 -0
  56. package/dist/revertibles.d.ts +1 -1
  57. package/dist/revertibles.d.ts.map +1 -1
  58. package/dist/revertibles.js +15 -15
  59. package/dist/revertibles.js.map +1 -1
  60. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  61. package/dist/segmentPropertiesManager.js +2 -2
  62. package/dist/segmentPropertiesManager.js.map +1 -1
  63. package/dist/snapshotChunks.d.ts +2 -2
  64. package/dist/snapshotChunks.d.ts.map +1 -1
  65. package/dist/snapshotChunks.js.map +1 -1
  66. package/dist/snapshotLoader.d.ts +2 -2
  67. package/dist/snapshotLoader.d.ts.map +1 -1
  68. package/dist/snapshotLoader.js +11 -11
  69. package/dist/snapshotLoader.js.map +1 -1
  70. package/dist/snapshotV1.d.ts +3 -3
  71. package/dist/snapshotV1.d.ts.map +1 -1
  72. package/dist/snapshotV1.js +10 -10
  73. package/dist/snapshotV1.js.map +1 -1
  74. package/dist/snapshotlegacy.d.ts +4 -4
  75. package/dist/snapshotlegacy.d.ts.map +1 -1
  76. package/dist/snapshotlegacy.js +9 -10
  77. package/dist/snapshotlegacy.js.map +1 -1
  78. package/dist/test/Insertion.perf.spec.js.map +1 -1
  79. package/dist/test/PartialLengths.perf.spec.js +1 -1
  80. package/dist/test/PartialLengths.perf.spec.js.map +1 -1
  81. package/dist/test/Removal.perf.spec.js +1 -1
  82. package/dist/test/Removal.perf.spec.js.map +1 -1
  83. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  84. package/dist/test/attributionCollection.perf.spec.js +2 -2
  85. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  86. package/dist/test/attributionCollection.spec.js.map +1 -1
  87. package/dist/test/attributionPolicy.spec.js.map +1 -1
  88. package/dist/test/beastTest.spec.d.ts.map +1 -1
  89. package/dist/test/beastTest.spec.js +7 -7
  90. package/dist/test/beastTest.spec.js.map +1 -1
  91. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  92. package/dist/test/client.apis.spec.d.ts.map +1 -1
  93. package/dist/test/client.apis.spec.js.map +1 -1
  94. package/dist/test/client.applyMsg.spec.js +2 -2
  95. package/dist/test/client.applyMsg.spec.js.map +1 -1
  96. package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  97. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  98. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  99. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
  100. package/dist/test/client.attributionFarm.spec.js +1 -1
  101. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  102. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  103. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  104. package/dist/test/client.getPosition.spec.js +1 -1
  105. package/dist/test/client.getPosition.spec.js.map +1 -1
  106. package/dist/test/client.localReference.spec.js +6 -6
  107. package/dist/test/client.localReference.spec.js.map +1 -1
  108. package/dist/test/client.localReferenceFarm.spec.js +2 -2
  109. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  110. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  111. package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
  112. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
  113. package/dist/test/client.reconnectFarm.spec.js +1 -1
  114. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  115. package/dist/test/client.replay.spec.js +4 -4
  116. package/dist/test/client.replay.spec.js.map +1 -1
  117. package/dist/test/client.rollback.spec.js +2 -2
  118. package/dist/test/client.rollback.spec.js.map +1 -1
  119. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  120. package/dist/test/client.searchForMarker.spec.js +1 -1
  121. package/dist/test/client.searchForMarker.spec.js.map +1 -1
  122. package/dist/test/client.walkSegments.spec.js.map +1 -1
  123. package/dist/test/collections.list.spec.js.map +1 -1
  124. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  125. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +3 -3
  126. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  127. package/dist/test/mergeTree.annotate.spec.js +1 -1
  128. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  129. package/dist/test/mergeTree.insert.deltaCallback.spec.js +1 -1
  130. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  131. package/dist/test/mergeTree.insertingWalk.spec.js +3 -3
  132. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  133. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
  134. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  135. package/dist/test/mergeTree.markRangeRemoved.spec.js +1 -1
  136. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  137. package/dist/test/mergeTree.walk.spec.js +2 -2
  138. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  139. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  140. package/dist/test/mergeTreeOperationRunner.d.ts +2 -2
  141. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  142. package/dist/test/mergeTreeOperationRunner.js +3 -3
  143. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  144. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  145. package/dist/test/obliterate.concurrent.spec.js +2 -2
  146. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  147. package/dist/test/obliterate.deltaCallback.spec.js +1 -1
  148. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
  149. package/dist/test/obliterate.partialLength.spec.js.map +1 -1
  150. package/dist/test/obliterate.reconnect.spec.js.map +1 -1
  151. package/dist/test/obliterate.spec.js.map +1 -1
  152. package/dist/test/ordinal.spec.d.ts +4 -0
  153. package/dist/test/ordinal.spec.d.ts.map +1 -1
  154. package/dist/test/ordinal.spec.js +4 -4
  155. package/dist/test/ordinal.spec.js.map +1 -1
  156. package/dist/test/partialLength.spec.js.map +1 -1
  157. package/dist/test/properties.spec.js.map +1 -1
  158. package/dist/test/reconnectHelper.d.ts +1 -1
  159. package/dist/test/reconnectHelper.d.ts.map +1 -1
  160. package/dist/test/reconnectHelper.js.map +1 -1
  161. package/dist/test/resetPendingSegmentsToOp.spec.js +1 -1
  162. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  163. package/dist/test/revertibleFarm.spec.js +1 -1
  164. package/dist/test/revertibleFarm.spec.js.map +1 -1
  165. package/dist/test/revertibles.spec.d.ts.map +1 -1
  166. package/dist/test/revertibles.spec.js +1 -1
  167. package/dist/test/revertibles.spec.js.map +1 -1
  168. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  169. package/dist/test/snapshot.spec.js +1 -1
  170. package/dist/test/snapshot.spec.js.map +1 -1
  171. package/dist/test/snapshot.utils.d.ts +1 -1
  172. package/dist/test/snapshot.utils.d.ts.map +1 -1
  173. package/dist/test/snapshot.utils.js +3 -3
  174. package/dist/test/snapshot.utils.js.map +1 -1
  175. package/dist/test/snapshotlegacy.spec.js +8 -8
  176. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  177. package/dist/test/sortedSegmentSet.spec.js +2 -2
  178. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  179. package/dist/test/testClient.d.ts +5 -5
  180. package/dist/test/testClient.d.ts.map +1 -1
  181. package/dist/test/testClient.js +11 -11
  182. package/dist/test/testClient.js.map +1 -1
  183. package/dist/test/testClientLogger.d.ts +1 -1
  184. package/dist/test/testClientLogger.d.ts.map +1 -1
  185. package/dist/test/testClientLogger.js +10 -8
  186. package/dist/test/testClientLogger.js.map +1 -1
  187. package/dist/test/testSerializer.d.ts.map +1 -1
  188. package/dist/test/testSerializer.js +2 -2
  189. package/dist/test/testSerializer.js.map +1 -1
  190. package/dist/test/testServer.d.ts +1 -1
  191. package/dist/test/testServer.d.ts.map +1 -1
  192. package/dist/test/testServer.js +4 -4
  193. package/dist/test/testServer.js.map +1 -1
  194. package/dist/test/testUtils.d.ts +5 -5
  195. package/dist/test/testUtils.d.ts.map +1 -1
  196. package/dist/test/testUtils.js +3 -3
  197. package/dist/test/testUtils.js.map +1 -1
  198. package/dist/test/text.d.ts +1 -1
  199. package/dist/test/text.d.ts.map +1 -1
  200. package/dist/test/text.js.map +1 -1
  201. package/dist/test/tracking.spec.js.map +1 -1
  202. package/dist/test/wordUnitTests.spec.d.ts.map +1 -1
  203. package/dist/test/wordUnitTests.spec.js +2 -2
  204. package/dist/test/wordUnitTests.spec.js.map +1 -1
  205. package/dist/textSegment.d.ts.map +1 -1
  206. package/dist/textSegment.js +2 -2
  207. package/dist/textSegment.js.map +1 -1
  208. package/dist/zamboni.d.ts +2 -2
  209. package/dist/zamboni.d.ts.map +1 -1
  210. package/dist/zamboni.js.map +1 -1
  211. package/internal.d.ts +11 -0
  212. package/legacy.d.ts +11 -0
  213. package/lib/MergeTreeTextHelper.d.ts.map +1 -1
  214. package/lib/MergeTreeTextHelper.js.map +1 -1
  215. package/lib/attributionCollection.d.ts +1 -1
  216. package/lib/attributionCollection.d.ts.map +1 -1
  217. package/lib/attributionCollection.js +1 -1
  218. package/lib/attributionCollection.js.map +1 -1
  219. package/lib/attributionPolicy.d.ts +2 -2
  220. package/lib/attributionPolicy.d.ts.map +1 -1
  221. package/lib/attributionPolicy.js +4 -4
  222. package/lib/attributionPolicy.js.map +1 -1
  223. package/lib/client.d.ts +8 -8
  224. package/lib/client.d.ts.map +1 -1
  225. package/lib/client.js +14 -25
  226. package/lib/client.js.map +1 -1
  227. package/lib/collections/list.js +1 -1
  228. package/lib/collections/list.js.map +1 -1
  229. package/lib/endOfTreeSegment.d.ts +5 -5
  230. package/lib/endOfTreeSegment.d.ts.map +1 -1
  231. package/lib/endOfTreeSegment.js +2 -2
  232. package/lib/endOfTreeSegment.js.map +1 -1
  233. package/lib/index.d.ts +1 -1
  234. package/lib/index.d.ts.map +1 -1
  235. package/lib/index.js +1 -1
  236. package/lib/index.js.map +1 -1
  237. package/lib/legacy.d.ts +76 -0
  238. package/lib/localReference.d.ts.map +1 -1
  239. package/lib/localReference.js +2 -2
  240. package/lib/localReference.js.map +1 -1
  241. package/lib/mergeTree.d.ts +8 -8
  242. package/lib/mergeTree.d.ts.map +1 -1
  243. package/lib/mergeTree.js +23 -36
  244. package/lib/mergeTree.js.map +1 -1
  245. package/lib/mergeTreeDeltaCallback.d.ts +1 -1
  246. package/lib/mergeTreeDeltaCallback.d.ts.map +1 -1
  247. package/lib/mergeTreeDeltaCallback.js +4 -0
  248. package/lib/mergeTreeDeltaCallback.js.map +1 -1
  249. package/lib/mergeTreeNodeWalk.d.ts +3 -3
  250. package/lib/mergeTreeNodeWalk.d.ts.map +1 -1
  251. package/lib/mergeTreeNodeWalk.js.map +1 -1
  252. package/lib/mergeTreeNodes.d.ts +37 -55
  253. package/lib/mergeTreeNodes.d.ts.map +1 -1
  254. package/lib/mergeTreeNodes.js +28 -8
  255. package/lib/mergeTreeNodes.js.map +1 -1
  256. package/lib/opBuilder.d.ts +1 -1
  257. package/lib/opBuilder.d.ts.map +1 -1
  258. package/lib/opBuilder.js.map +1 -1
  259. package/lib/ordinal.js +1 -1
  260. package/lib/ordinal.js.map +1 -1
  261. package/lib/partialLengths.d.ts +6 -6
  262. package/lib/partialLengths.d.ts.map +1 -1
  263. package/lib/partialLengths.js +3 -3
  264. package/lib/partialLengths.js.map +1 -1
  265. package/lib/public.d.ts +12 -0
  266. package/lib/revertibles.d.ts +1 -1
  267. package/lib/revertibles.d.ts.map +1 -1
  268. package/lib/revertibles.js +4 -4
  269. package/lib/revertibles.js.map +1 -1
  270. package/lib/segmentPropertiesManager.d.ts.map +1 -1
  271. package/lib/segmentPropertiesManager.js +1 -1
  272. package/lib/segmentPropertiesManager.js.map +1 -1
  273. package/lib/snapshotChunks.d.ts +2 -2
  274. package/lib/snapshotChunks.d.ts.map +1 -1
  275. package/lib/snapshotChunks.js.map +1 -1
  276. package/lib/snapshotLoader.d.ts +2 -2
  277. package/lib/snapshotLoader.d.ts.map +1 -1
  278. package/lib/snapshotLoader.js +2 -2
  279. package/lib/snapshotLoader.js.map +1 -1
  280. package/lib/snapshotV1.d.ts +3 -3
  281. package/lib/snapshotV1.d.ts.map +1 -1
  282. package/lib/snapshotV1.js +5 -5
  283. package/lib/snapshotV1.js.map +1 -1
  284. package/lib/snapshotlegacy.d.ts +4 -4
  285. package/lib/snapshotlegacy.d.ts.map +1 -1
  286. package/lib/snapshotlegacy.js +3 -4
  287. package/lib/snapshotlegacy.js.map +1 -1
  288. package/lib/test/Insertion.perf.spec.js +1 -1
  289. package/lib/test/Insertion.perf.spec.js.map +1 -1
  290. package/lib/test/PartialLengths.perf.spec.js +2 -2
  291. package/lib/test/PartialLengths.perf.spec.js.map +1 -1
  292. package/lib/test/Removal.perf.spec.js +2 -2
  293. package/lib/test/Removal.perf.spec.js.map +1 -1
  294. package/lib/test/Snapshot.perf.spec.js +2 -2
  295. package/lib/test/Snapshot.perf.spec.js.map +1 -1
  296. package/lib/test/attributionCollection.perf.spec.js +4 -4
  297. package/lib/test/attributionCollection.perf.spec.js.map +1 -1
  298. package/lib/test/attributionCollection.spec.js.map +1 -1
  299. package/lib/test/attributionPolicy.spec.js.map +1 -1
  300. package/lib/test/beastTest.spec.d.ts.map +1 -1
  301. package/lib/test/beastTest.spec.js +8 -8
  302. package/lib/test/beastTest.spec.js.map +1 -1
  303. package/lib/test/client.annotateMarker.spec.js.map +1 -1
  304. package/lib/test/client.apis.spec.d.ts.map +1 -1
  305. package/lib/test/client.apis.spec.js.map +1 -1
  306. package/lib/test/client.applyMsg.spec.js +3 -3
  307. package/lib/test/client.applyMsg.spec.js.map +1 -1
  308. package/lib/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  309. package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  310. package/lib/test/client.applyStashedOpFarm.spec.js +1 -1
  311. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -1
  312. package/lib/test/client.attributionFarm.spec.d.ts.map +1 -1
  313. package/lib/test/client.attributionFarm.spec.js +2 -2
  314. package/lib/test/client.attributionFarm.spec.js.map +1 -1
  315. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -1
  316. package/lib/test/client.conflictFarm.spec.js +1 -1
  317. package/lib/test/client.conflictFarm.spec.js.map +1 -1
  318. package/lib/test/client.getPosition.spec.js.map +1 -1
  319. package/lib/test/client.localReference.spec.js +5 -5
  320. package/lib/test/client.localReference.spec.js.map +1 -1
  321. package/lib/test/client.localReferenceFarm.spec.js +2 -2
  322. package/lib/test/client.localReferenceFarm.spec.js.map +1 -1
  323. package/lib/test/client.rebasePosition.spec.js.map +1 -1
  324. package/lib/test/client.reconnectFarm.spec.d.ts +1 -1
  325. package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -1
  326. package/lib/test/client.reconnectFarm.spec.js +2 -2
  327. package/lib/test/client.reconnectFarm.spec.js.map +1 -1
  328. package/lib/test/client.replay.spec.js +3 -3
  329. package/lib/test/client.replay.spec.js.map +1 -1
  330. package/lib/test/client.rollback.spec.js +1 -1
  331. package/lib/test/client.rollback.spec.js.map +1 -1
  332. package/lib/test/client.rollbackFarm.spec.js +1 -1
  333. package/lib/test/client.rollbackFarm.spec.js.map +1 -1
  334. package/lib/test/client.searchForMarker.spec.js +2 -2
  335. package/lib/test/client.searchForMarker.spec.js.map +1 -1
  336. package/lib/test/client.walkSegments.spec.js.map +1 -1
  337. package/lib/test/collections.list.spec.js.map +1 -1
  338. package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  339. package/lib/test/mergeTree.annotate.deltaCallback.spec.js +3 -3
  340. package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  341. package/lib/test/mergeTree.annotate.spec.js +1 -1
  342. package/lib/test/mergeTree.annotate.spec.js.map +1 -1
  343. package/lib/test/mergeTree.insert.deltaCallback.spec.js +1 -1
  344. package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  345. package/lib/test/mergeTree.insertingWalk.spec.js +3 -3
  346. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
  347. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
  348. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  349. package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  350. package/lib/test/mergeTree.walk.spec.js +2 -2
  351. package/lib/test/mergeTree.walk.spec.js.map +1 -1
  352. package/lib/test/mergeTree.zamboni.spec.js +1 -1
  353. package/lib/test/mergeTree.zamboni.spec.js.map +1 -1
  354. package/lib/test/mergeTreeOperationRunner.d.ts +2 -2
  355. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
  356. package/lib/test/mergeTreeOperationRunner.js +3 -3
  357. package/lib/test/mergeTreeOperationRunner.js.map +1 -1
  358. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -1
  359. package/lib/test/obliterate.concurrent.spec.js +1 -1
  360. package/lib/test/obliterate.concurrent.spec.js.map +1 -1
  361. package/lib/test/obliterate.deltaCallback.spec.js +1 -1
  362. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
  363. package/lib/test/obliterate.partialLength.spec.js.map +1 -1
  364. package/lib/test/obliterate.reconnect.spec.js.map +1 -1
  365. package/lib/test/obliterate.spec.js.map +1 -1
  366. package/lib/test/ordinal.spec.d.ts +4 -0
  367. package/lib/test/ordinal.spec.d.ts.map +1 -1
  368. package/lib/test/ordinal.spec.js.map +1 -1
  369. package/lib/test/partialLength.spec.js.map +1 -1
  370. package/lib/test/properties.spec.js.map +1 -1
  371. package/lib/test/reconnectHelper.d.ts +1 -1
  372. package/lib/test/reconnectHelper.d.ts.map +1 -1
  373. package/lib/test/reconnectHelper.js +1 -1
  374. package/lib/test/reconnectHelper.js.map +1 -1
  375. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  376. package/lib/test/revertibleFarm.spec.js +3 -3
  377. package/lib/test/revertibleFarm.spec.js.map +1 -1
  378. package/lib/test/revertibles.spec.d.ts.map +1 -1
  379. package/lib/test/revertibles.spec.js +2 -2
  380. package/lib/test/revertibles.spec.js.map +1 -1
  381. package/lib/test/segmentGroupCollection.spec.js.map +1 -1
  382. package/lib/test/snapshot.spec.js +2 -2
  383. package/lib/test/snapshot.spec.js.map +1 -1
  384. package/lib/test/snapshot.utils.d.ts +1 -1
  385. package/lib/test/snapshot.utils.d.ts.map +1 -1
  386. package/lib/test/snapshot.utils.js +2 -2
  387. package/lib/test/snapshot.utils.js.map +1 -1
  388. package/lib/test/snapshotlegacy.spec.js +4 -4
  389. package/lib/test/snapshotlegacy.spec.js.map +1 -1
  390. package/lib/test/sortedSegmentSet.spec.js +2 -2
  391. package/lib/test/sortedSegmentSet.spec.js.map +1 -1
  392. package/lib/test/testClient.d.ts +5 -5
  393. package/lib/test/testClient.d.ts.map +1 -1
  394. package/lib/test/testClient.js +7 -7
  395. package/lib/test/testClient.js.map +1 -1
  396. package/lib/test/testClientLogger.d.ts +1 -1
  397. package/lib/test/testClientLogger.d.ts.map +1 -1
  398. package/lib/test/testClientLogger.js +9 -7
  399. package/lib/test/testClientLogger.js.map +1 -1
  400. package/lib/test/testSerializer.d.ts.map +1 -1
  401. package/lib/test/testSerializer.js +1 -1
  402. package/lib/test/testSerializer.js.map +1 -1
  403. package/lib/test/testServer.d.ts +1 -1
  404. package/lib/test/testServer.d.ts.map +1 -1
  405. package/lib/test/testServer.js +2 -2
  406. package/lib/test/testServer.js.map +1 -1
  407. package/lib/test/testUtils.d.ts +5 -5
  408. package/lib/test/testUtils.d.ts.map +1 -1
  409. package/lib/test/testUtils.js +3 -3
  410. package/lib/test/testUtils.js.map +1 -1
  411. package/lib/test/text.d.ts +1 -1
  412. package/lib/test/text.d.ts.map +1 -1
  413. package/lib/test/text.js.map +1 -1
  414. package/lib/test/tracking.spec.js.map +1 -1
  415. package/lib/test/wordUnitTests.spec.d.ts.map +1 -1
  416. package/lib/test/wordUnitTests.spec.js +2 -2
  417. package/lib/test/wordUnitTests.spec.js.map +1 -1
  418. package/lib/textSegment.d.ts.map +1 -1
  419. package/lib/textSegment.js +1 -1
  420. package/lib/textSegment.js.map +1 -1
  421. package/lib/zamboni.d.ts +2 -2
  422. package/lib/zamboni.d.ts.map +1 -1
  423. package/lib/zamboni.js.map +1 -1
  424. package/package.json +37 -58
  425. package/src/MergeTreeTextHelper.ts +1 -1
  426. package/src/attributionCollection.ts +4 -3
  427. package/src/attributionPolicy.ts +7 -6
  428. package/src/client.ts +32 -45
  429. package/src/collections/list.ts +1 -1
  430. package/src/endOfTreeSegment.ts +5 -4
  431. package/src/index.ts +5 -1
  432. package/src/localReference.ts +4 -3
  433. package/src/mergeTree.ts +66 -84
  434. package/src/mergeTreeDeltaCallback.ts +3 -1
  435. package/src/mergeTreeNodeWalk.ts +6 -6
  436. package/src/mergeTreeNodes.ts +59 -61
  437. package/src/opBuilder.ts +3 -3
  438. package/src/ordinal.ts +1 -1
  439. package/src/partialLengths.ts +11 -10
  440. package/src/revertibles.ts +6 -5
  441. package/src/segmentPropertiesManager.ts +3 -2
  442. package/src/snapshotChunks.ts +3 -2
  443. package/src/snapshotLoader.ts +10 -12
  444. package/src/snapshotV1.ts +15 -12
  445. package/src/snapshotlegacy.ts +8 -6
  446. package/src/textSegment.ts +2 -1
  447. package/src/zamboni.ts +7 -7
  448. package/api-extractor-cjs.json +0 -8
  449. package/dist/merge-tree-alpha.d.ts +0 -1558
  450. package/dist/merge-tree-beta.d.ts +0 -230
  451. package/dist/merge-tree-public.d.ts +0 -230
  452. package/dist/merge-tree-untrimmed.d.ts +0 -1894
  453. package/lib/merge-tree-alpha.d.ts +0 -1558
  454. package/lib/merge-tree-beta.d.ts +0 -230
  455. package/lib/merge-tree-public.d.ts +0 -230
  456. package/lib/merge-tree-untrimmed.d.ts +0 -1894
  457. package/lib/test/types/validateMergeTreePrevious.generated.d.ts +0 -2
  458. package/lib/test/types/validateMergeTreePrevious.generated.d.ts.map +0 -1
  459. package/lib/test/types/validateMergeTreePrevious.generated.js +0 -228
  460. package/lib/test/types/validateMergeTreePrevious.generated.js.map +0 -1
  461. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -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 { assert } from "@fluidframework/core-utils";
5
+ import { assert } from "@fluidframework/core-utils/internal";
6
6
  import { BaseSegment } from "./mergeTreeNodes.js";
7
7
  // Maximum length of text segment to be considered to be merged with other segment.
8
8
  // Maximum segment length is at least 2x of it (not taking into account initial segment creation).
@@ -1 +1 @@
1
- {"version":3,"file":"textSegment.js","sourceRoot":"","sources":["../src/textSegment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAY,MAAM,qBAAqB,CAAC;AAI5D,mFAAmF;AACnF,kGAAkG;AAClG,2FAA2F;AAC3F,qHAAqH;AACrH,8GAA8G;AAC9G,kHAAkH;AAClH,qHAAqH;AACrH,0CAA0C;AAC1C,8BAA8B;AAC9B,MAAM,CAAC,MAAM,sBAAsB,GAAG,G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tEsB,gBAAI,GAAG,aAAa,AAAhB,CAAiB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { BaseSegment, ISegment } from \"./mergeTreeNodes.js\";\nimport { IJSONSegment } from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\n\n// Maximum length of text segment to be considered to be merged with other segment.\n// Maximum segment length is at least 2x of it (not taking into account initial segment creation).\n// The bigger it is, the more expensive it is to break segment into sub-segments (on edits)\n// The smaller it is, the more segments we have in snapshots (and in memory) - it's more expensive to load snapshots.\n// Small number also makes ReplayTool produce false positives (\"same\" snapshots have slightly different binary\n// representations). More measurements needs to be done, but it's very likely the right spot is somewhere between\n// 1K-2K mark. That said, we also break segments on newline and there are very few segments that are longer than 256\n// because of it. Must be an even number.\n// Exported for test use only.\nexport const TextSegmentGranularity = 256;\n\n/**\n * @alpha\n */\nexport interface IJSONTextSegment extends IJSONSegment {\n\ttext: string;\n}\n\n/**\n * @alpha\n */\nexport class TextSegment extends BaseSegment {\n\tpublic static readonly type = \"TextSegment\";\n\tpublic readonly type = TextSegment.type;\n\n\tpublic static is(segment: ISegment): segment is TextSegment {\n\t\treturn segment.type === TextSegment.type;\n\t}\n\n\tpublic static make(text: string, props?: PropertySet) {\n\t\tconst seg = new TextSegment(text);\n\t\tif (props) {\n\t\t\tseg.addProperties(props);\n\t\t}\n\t\treturn seg;\n\t}\n\n\tpublic static fromJSONObject(spec: any) {\n\t\tif (typeof spec === \"string\") {\n\t\t\treturn new TextSegment(spec);\n\t\t} else if (spec && typeof spec === \"object\" && \"text\" in spec) {\n\t\t\tconst textSpec = spec as IJSONTextSegment;\n\t\t\treturn TextSegment.make(textSpec.text, textSpec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tconstructor(public text: string) {\n\t\tsuper();\n\t\tthis.cachedLength = text.length;\n\t}\n\n\tpublic toJSONObject(): IJSONTextSegment | string {\n\t\t// To reduce snapshot/ops size, we serialize a TextSegment as a plain 'string' if it is\n\t\t// not annotated.\n\t\treturn this.properties ? { text: this.text, props: this.properties } : this.text;\n\t}\n\n\tpublic clone(start = 0, end?: number) {\n\t\tconst text = this.text.substring(start, end);\n\t\tconst b = TextSegment.make(text, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn (\n\t\t\t!this.text.endsWith(\"\\n\") &&\n\t\t\tTextSegment.is(segment) &&\n\t\t\t(this.cachedLength <= TextSegmentGranularity ||\n\t\t\t\tsegment.cachedLength <= TextSegmentGranularity)\n\t\t);\n\t}\n\n\tpublic toString() {\n\t\treturn this.text;\n\t}\n\n\tpublic append(segment: ISegment) {\n\t\tassert(TextSegment.is(segment), 0x447 /* can only append text segment */);\n\t\tsuper.append(segment);\n\t\tthis.text += segment.text;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\tif (pos > 0) {\n\t\t\tconst remainingText = this.text.substring(pos);\n\t\t\tthis.text = this.text.substring(0, pos);\n\t\t\tthis.cachedLength = this.text.length;\n\t\t\tconst leafSegment = new TextSegment(remainingText);\n\t\t\treturn leafSegment;\n\t\t}\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface IMergeTreeTextHelper {\n\tgetText(\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tplaceholder: string,\n\t\tstart?: number,\n\t\tend?: number,\n\t): string;\n}\n"]}
1
+ {"version":3,"file":"textSegment.js","sourceRoot":"","sources":["../src/textSegment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAY,MAAM,qBAAqB,CAAC;AAI5D,mFAAmF;AACnF,kGAAkG;AAClG,2FAA2F;AAC3F,qHAAqH;AACrH,8GAA8G;AAC9G,kHAA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W,GAAG,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC;YACnD,OAAO,WAAW,CAAC;SACnB;IACF,CAAC;;AAtEsB,gBAAI,GAAG,aAAa,AAAhB,CAAiB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { BaseSegment, ISegment } from \"./mergeTreeNodes.js\";\nimport { IJSONSegment } from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\n\n// Maximum length of text segment to be considered to be merged with other segment.\n// Maximum segment length is at least 2x of it (not taking into account initial segment creation).\n// The bigger it is, the more expensive it is to break segment into sub-segments (on edits)\n// The smaller it is, the more segments we have in snapshots (and in memory) - it's more expensive to load snapshots.\n// Small number also makes ReplayTool produce false positives (\"same\" snapshots have slightly different binary\n// representations). More measurements needs to be done, but it's very likely the right spot is somewhere between\n// 1K-2K mark. That said, we also break segments on newline and there are very few segments that are longer than 256\n// because of it. Must be an even number.\n// Exported for test use only.\nexport const TextSegmentGranularity = 256;\n\n/**\n * @alpha\n */\nexport interface IJSONTextSegment extends IJSONSegment {\n\ttext: string;\n}\n\n/**\n * @alpha\n */\nexport class TextSegment extends BaseSegment {\n\tpublic static readonly type = \"TextSegment\";\n\tpublic readonly type = TextSegment.type;\n\n\tpublic static is(segment: ISegment): segment is TextSegment {\n\t\treturn segment.type === TextSegment.type;\n\t}\n\n\tpublic static make(text: string, props?: PropertySet) {\n\t\tconst seg = new TextSegment(text);\n\t\tif (props) {\n\t\t\tseg.addProperties(props);\n\t\t}\n\t\treturn seg;\n\t}\n\n\tpublic static fromJSONObject(spec: any) {\n\t\tif (typeof spec === \"string\") {\n\t\t\treturn new TextSegment(spec);\n\t\t} else if (spec && typeof spec === \"object\" && \"text\" in spec) {\n\t\t\tconst textSpec = spec as IJSONTextSegment;\n\t\t\treturn TextSegment.make(textSpec.text, textSpec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tconstructor(public text: string) {\n\t\tsuper();\n\t\tthis.cachedLength = text.length;\n\t}\n\n\tpublic toJSONObject(): IJSONTextSegment | string {\n\t\t// To reduce snapshot/ops size, we serialize a TextSegment as a plain 'string' if it is\n\t\t// not annotated.\n\t\treturn this.properties ? { text: this.text, props: this.properties } : this.text;\n\t}\n\n\tpublic clone(start = 0, end?: number) {\n\t\tconst text = this.text.substring(start, end);\n\t\tconst b = TextSegment.make(text, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn (\n\t\t\t!this.text.endsWith(\"\\n\") &&\n\t\t\tTextSegment.is(segment) &&\n\t\t\t(this.cachedLength <= TextSegmentGranularity ||\n\t\t\t\tsegment.cachedLength <= TextSegmentGranularity)\n\t\t);\n\t}\n\n\tpublic toString() {\n\t\treturn this.text;\n\t}\n\n\tpublic append(segment: ISegment) {\n\t\tassert(TextSegment.is(segment), 0x447 /* can only append text segment */);\n\t\tsuper.append(segment);\n\t\tthis.text += segment.text;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\tif (pos > 0) {\n\t\t\tconst remainingText = this.text.substring(pos);\n\t\t\tthis.text = this.text.substring(0, pos);\n\t\t\tthis.cachedLength = this.text.length;\n\t\t\tconst leafSegment = new TextSegment(remainingText);\n\t\t\treturn leafSegment;\n\t\t}\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface IMergeTreeTextHelper {\n\tgetText(\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tplaceholder: string,\n\t\tstart?: number,\n\t\tend?: number,\n\t): string;\n}\n"]}
package/lib/zamboni.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { MergeTree } from "./mergeTree.js";
6
- import { IMergeBlock } from "./mergeTreeNodes.js";
6
+ import { type MergeBlock } from "./mergeTreeNodes.js";
7
7
  export declare const zamboniSegmentsMax = 2;
8
8
  export declare function zamboniSegments(mergeTree: MergeTree, zamboniSegmentsMaxCount?: number): void;
9
- export declare function packParent(parent: IMergeBlock, mergeTree: MergeTree): void;
9
+ export declare function packParent(parent: MergeBlock, mergeTree: MergeTree): void;
10
10
  //# sourceMappingURL=zamboni.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zamboni.d.ts","sourceRoot":"","sources":["../src/zamboni.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACN,WAAW,EAQX,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAKpC,wBAAgB,eAAe,CAC9B,SAAS,EAAE,SAAS,EACpB,uBAAuB,SAAqB,QAuC5C;AAGD,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,QAwDnE"}
1
+ {"version":3,"file":"zamboni.d.ts","sourceRoot":"","sources":["../src/zamboni.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACN,KAAK,UAAU,EAQf,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAKpC,wBAAgB,eAAe,CAC9B,SAAS,EAAE,SAAS,EACpB,uBAAuB,SAAqB,QAuC5C;AAGD,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,QAwDlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"zamboni.js","sourceRoot":"","sources":["../src/zamboni.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAI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AAwB,CAAC,MAAM;wBAC1C,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,WAAY,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;qBACvD,EACD,SAAS,CACT,CAAC;oBAEF,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;oBAC3B,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;iBAC9E;qBAAM;oBACN,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACxB,WAAW,GAAG,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;iBAC7D;aACD;iBAAM;gBACN,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACxB,WAAW,GAAG,SAAS,CAAC;aACxB;SACD;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { UnassignedSequenceNumber } from \"./constants.js\";\nimport { MergeTree } from \"./mergeTree.js\";\nimport { MergeTreeMaintenanceType } from \"./mergeTreeDeltaCallback.js\";\nimport {\n\tIMergeBlock,\n\tIMergeNode,\n\tISegment,\n\tMarker,\n\tMaxNodesInBlock,\n\tseqLTE,\n\ttoMoveInfo,\n\ttoRemovalInfo,\n} from \"./mergeTreeNodes.js\";\nimport { matchProperties } from \"./properties.js\";\n\nexport const zamboniSegmentsMax = 2;\nfunction underflow(node: IMergeBlock) {\n\treturn node.childCount < MaxNodesInBlock / 2;\n}\n\nexport function zamboniSegments(\n\tmergeTree: MergeTree,\n\tzamboniSegmentsMaxCount = zamboniSegmentsMax,\n) {\n\tif (!mergeTree.collabWindow.collaborating) {\n\t\treturn;\n\t}\n\n\tfor (let i = 0; i < zamboniSegmentsMaxCount; i++) {\n\t\tlet segmentToScour = mergeTree.segmentsToScour.peek()?.value;\n\t\tif (!segmentToScour || segmentToScour.maxSeq > mergeTree.collabWindow.minSeq) {\n\t\t\tbreak;\n\t\t}\n\t\tsegmentToScour = mergeTree.segmentsToScour.get()!;\n\t\t// Only skip scouring if needs scour is explicitly false, not true or undefined\n\t\tif (segmentToScour?.segment?.parent && segmentToScour.segment.parent.needsScour !== false) {\n\t\t\tconst block = segmentToScour.segment.parent;\n\t\t\tconst childrenCopy: IMergeNode[] = [];\n\t\t\tscourNode(block, childrenCopy, mergeTree);\n\t\t\t// This will avoid the cost of re-scouring nodes\n\t\t\t// that have recently been scoured\n\t\t\tblock.needsScour = false;\n\n\t\t\tconst newChildCount = childrenCopy.length;\n\n\t\t\tif (newChildCount < block.childCount) {\n\t\t\t\tblock.childCount = newChildCount;\n\t\t\t\tblock.children = childrenCopy;\n\t\t\t\tfor (let j = 0; j < newChildCount; j++) {\n\t\t\t\t\tblock.assignChild(childrenCopy[j], j, false);\n\t\t\t\t}\n\n\t\t\t\tif (underflow(block) && block.parent) {\n\t\t\t\t\tpackParent(block.parent, mergeTree);\n\t\t\t\t} else {\n\t\t\t\t\tmergeTree.nodeUpdateOrdinals(block);\n\t\t\t\t\tmergeTree.blockUpdatePathLengths(block, UnassignedSequenceNumber, -1, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Interior node with all node children\nexport function packParent(parent: IMergeBlock, mergeTree: MergeTree) {\n\tconst children = parent.children;\n\tlet childIndex: number;\n\tlet childBlock: IMergeBlock;\n\tconst holdNodes: IMergeNode[] = [];\n\tfor (childIndex = 0; childIndex < parent.childCount; childIndex++) {\n\t\t// Debug assert not isLeaf()\n\t\tchildBlock = children[childIndex] as IMergeBlock;\n\t\tscourNode(childBlock, holdNodes, mergeTree);\n\t\t// Will replace this block with a packed block\n\t\tchildBlock.parent = undefined;\n\t}\n\tif (holdNodes.length > 0) {\n\t\tconst totalNodeCount = holdNodes.length;\n\t\tconst halfOfMaxNodeCount = MaxNodesInBlock / 2;\n\t\tlet childCount = Math.min(\n\t\t\tMaxNodesInBlock - 1,\n\t\t\tMath.floor(totalNodeCount / halfOfMaxNodeCount),\n\t\t);\n\t\tif (childCount < 1) {\n\t\t\tchildCount = 1;\n\t\t}\n\t\tconst baseNodesInBlockCount = Math.floor(totalNodeCount / childCount);\n\t\tlet remainderCount = totalNodeCount % childCount;\n\t\tconst packedBlocks = new Array<IMergeBlock>(MaxNodesInBlock);\n\t\tlet childrenPackedCount = 0;\n\t\tfor (let nodeIndex = 0; nodeIndex < childCount; nodeIndex++) {\n\t\t\tlet nodeCount = baseNodesInBlockCount;\n\t\t\tif (remainderCount > 0) {\n\t\t\t\tnodeCount++;\n\t\t\t\tremainderCount--;\n\t\t\t}\n\t\t\tconst packedBlock = mergeTree.makeBlock(nodeCount);\n\t\t\tfor (let packedNodeIndex = 0; packedNodeIndex < nodeCount; packedNodeIndex++) {\n\t\t\t\tconst nodeToPack = holdNodes[childrenPackedCount++];\n\t\t\t\tpackedBlock.assignChild(nodeToPack, packedNodeIndex, false);\n\t\t\t}\n\t\t\tpackedBlock.parent = parent;\n\t\t\tpackedBlocks[nodeIndex] = packedBlock;\n\t\t\tmergeTree.nodeUpdateLengthNewStructure(packedBlock);\n\t\t}\n\t\tparent.children = packedBlocks;\n\t\tfor (let j = 0; j < childCount; j++) {\n\t\t\tparent.assignChild(packedBlocks[j], j, false);\n\t\t}\n\t\tparent.childCount = childCount;\n\t} else {\n\t\tparent.children = [];\n\t\tparent.childCount = 0;\n\t}\n\tif (underflow(parent) && parent.parent) {\n\t\tpackParent(parent.parent, mergeTree);\n\t} else {\n\t\tmergeTree.nodeUpdateOrdinals(parent);\n\t\tmergeTree.blockUpdatePathLengths(parent, UnassignedSequenceNumber, -1, true);\n\t}\n}\n\nfunction scourNode(node: IMergeBlock, holdNodes: IMergeNode[], mergeTree: MergeTree) {\n\t// The previous segment is tracked while scouring for the purposes of merging adjacent segments\n\t// when possible.\n\tlet prevSegment: ISegment | undefined;\n\tfor (let k = 0; k < node.childCount; k++) {\n\t\tconst childNode = node.children[k];\n\t\tif (!childNode.isLeaf() || !childNode.segmentGroups.empty) {\n\t\t\tholdNodes.push(childNode);\n\t\t\tprevSegment = undefined;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst segment = childNode;\n\t\tconst removalInfo = toRemovalInfo(segment);\n\t\tconst moveInfo = toMoveInfo(segment);\n\t\tif (removalInfo !== undefined || moveInfo !== undefined) {\n\t\t\t// If the segment's removal is below the MSN and it's not being held onto by a tracking group,\n\t\t\t// it can be unlinked (i.e. removed from the merge-tree)\n\t\t\tif (\n\t\t\t\t((!!removalInfo && seqLTE(removalInfo.removedSeq, mergeTree.collabWindow.minSeq)) ||\n\t\t\t\t\t(!!moveInfo && seqLTE(moveInfo.movedSeq, mergeTree.collabWindow.minSeq))) &&\n\t\t\t\tsegment.trackingCollection.empty\n\t\t\t) {\n\t\t\t\tmergeTree.mergeTreeMaintenanceCallback?.(\n\t\t\t\t\t{\n\t\t\t\t\t\toperation: MergeTreeMaintenanceType.UNLINK,\n\t\t\t\t\t\tdeltaSegments: [{ segment }],\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t);\n\n\t\t\t\tsegment.parent = undefined;\n\n\t\t\t\tif (Marker.is(segment)) {\n\t\t\t\t\tmergeTree.unlinkMarker(segment);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tholdNodes.push(segment);\n\t\t\t}\n\n\t\t\tprevSegment = undefined;\n\t\t} else {\n\t\t\tif (segment.seq! <= mergeTree.collabWindow.minSeq) {\n\t\t\t\tconst segmentHasPositiveLength = (mergeTree.localNetLength(segment) ?? 0) > 0;\n\t\t\t\tconst canAppend =\n\t\t\t\t\tprevSegment?.canAppend(segment) &&\n\t\t\t\t\tmatchProperties(prevSegment.properties, segment.properties) &&\n\t\t\t\t\tprevSegment.trackingCollection.matches(segment.trackingCollection) &&\n\t\t\t\t\tsegmentHasPositiveLength;\n\n\t\t\t\tif (canAppend) {\n\t\t\t\t\tprevSegment!.append(segment);\n\t\t\t\t\tmergeTree.mergeTreeMaintenanceCallback?.(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toperation: MergeTreeMaintenanceType.APPEND,\n\t\t\t\t\t\t\tdeltaSegments: [{ segment: prevSegment! }, { segment }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\n\t\t\t\t\tsegment.parent = undefined;\n\t\t\t\t\tsegment.trackingCollection.trackingGroups.forEach((tg) => tg.unlink(segment));\n\t\t\t\t} else {\n\t\t\t\t\tholdNodes.push(segment);\n\t\t\t\t\tprevSegment = segmentHasPositiveLength ? segment : undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tholdNodes.push(segment);\n\t\t\t\tprevSegment = undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"zamboni.js","sourceRoot":"","sources":["../src/zamboni.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAIN,MAAM,EACN,eAAe,EACf,MAAM,EACN,UAAU,EACV,aAAa,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,SAAS,SAAS,CAAC,IAAgB;IAClC,OAAO,IAAI,CAAC,UAAU,GAAG,eAAe,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAC9B,SAAoB,EACpB,uBAAuB,GAAG,kBAAkB;IAE5C,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE;QAC1C,OAAO;KACP;IAED,KAAK,IAAI,CAAC,GAAG,CA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AC;iBAC7D;aACD;iBAAM;gBACN,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACxB,WAAW,GAAG,SAAS,CAAC;aACxB;SACD;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { UnassignedSequenceNumber } from \"./constants.js\";\nimport { MergeTree } from \"./mergeTree.js\";\nimport { MergeTreeMaintenanceType } from \"./mergeTreeDeltaCallback.js\";\nimport {\n\ttype MergeBlock,\n\tIMergeNode,\n\tISegment,\n\tMarker,\n\tMaxNodesInBlock,\n\tseqLTE,\n\ttoMoveInfo,\n\ttoRemovalInfo,\n} from \"./mergeTreeNodes.js\";\nimport { matchProperties } from \"./properties.js\";\n\nexport const zamboniSegmentsMax = 2;\nfunction underflow(node: MergeBlock) {\n\treturn node.childCount < MaxNodesInBlock / 2;\n}\n\nexport function zamboniSegments(\n\tmergeTree: MergeTree,\n\tzamboniSegmentsMaxCount = zamboniSegmentsMax,\n) {\n\tif (!mergeTree.collabWindow.collaborating) {\n\t\treturn;\n\t}\n\n\tfor (let i = 0; i < zamboniSegmentsMaxCount; i++) {\n\t\tlet segmentToScour = mergeTree.segmentsToScour.peek()?.value;\n\t\tif (!segmentToScour || segmentToScour.maxSeq > mergeTree.collabWindow.minSeq) {\n\t\t\tbreak;\n\t\t}\n\t\tsegmentToScour = mergeTree.segmentsToScour.get()!;\n\t\t// Only skip scouring if needs scour is explicitly false, not true or undefined\n\t\tif (segmentToScour?.segment?.parent && segmentToScour.segment.parent.needsScour !== false) {\n\t\t\tconst block = segmentToScour.segment.parent;\n\t\t\tconst childrenCopy: IMergeNode[] = [];\n\t\t\tscourNode(block, childrenCopy, mergeTree);\n\t\t\t// This will avoid the cost of re-scouring nodes\n\t\t\t// that have recently been scoured\n\t\t\tblock.needsScour = false;\n\n\t\t\tconst newChildCount = childrenCopy.length;\n\n\t\t\tif (newChildCount < block.childCount) {\n\t\t\t\tblock.childCount = newChildCount;\n\t\t\t\tblock.children = childrenCopy;\n\t\t\t\tfor (let j = 0; j < newChildCount; j++) {\n\t\t\t\t\tblock.assignChild(childrenCopy[j], j, false);\n\t\t\t\t}\n\n\t\t\t\tif (underflow(block) && block.parent) {\n\t\t\t\t\tpackParent(block.parent, mergeTree);\n\t\t\t\t} else {\n\t\t\t\t\tmergeTree.nodeUpdateOrdinals(block);\n\t\t\t\t\tmergeTree.blockUpdatePathLengths(block, UnassignedSequenceNumber, -1, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Interior node with all node children\nexport function packParent(parent: MergeBlock, mergeTree: MergeTree) {\n\tconst children = parent.children;\n\tlet childIndex: number;\n\tlet childBlock: MergeBlock;\n\tconst holdNodes: IMergeNode[] = [];\n\tfor (childIndex = 0; childIndex < parent.childCount; childIndex++) {\n\t\t// Debug assert not isLeaf()\n\t\tchildBlock = children[childIndex] as MergeBlock;\n\t\tscourNode(childBlock, holdNodes, mergeTree);\n\t\t// Will replace this block with a packed block\n\t\tchildBlock.parent = undefined;\n\t}\n\tif (holdNodes.length > 0) {\n\t\tconst totalNodeCount = holdNodes.length;\n\t\tconst halfOfMaxNodeCount = MaxNodesInBlock / 2;\n\t\tlet childCount = Math.min(\n\t\t\tMaxNodesInBlock - 1,\n\t\t\tMath.floor(totalNodeCount / halfOfMaxNodeCount),\n\t\t);\n\t\tif (childCount < 1) {\n\t\t\tchildCount = 1;\n\t\t}\n\t\tconst baseNodesInBlockCount = Math.floor(totalNodeCount / childCount);\n\t\tlet remainderCount = totalNodeCount % childCount;\n\t\tconst packedBlocks = new Array<MergeBlock>(MaxNodesInBlock);\n\t\tlet childrenPackedCount = 0;\n\t\tfor (let nodeIndex = 0; nodeIndex < childCount; nodeIndex++) {\n\t\t\tlet nodeCount = baseNodesInBlockCount;\n\t\t\tif (remainderCount > 0) {\n\t\t\t\tnodeCount++;\n\t\t\t\tremainderCount--;\n\t\t\t}\n\t\t\tconst packedBlock = mergeTree.makeBlock(nodeCount);\n\t\t\tfor (let packedNodeIndex = 0; packedNodeIndex < nodeCount; packedNodeIndex++) {\n\t\t\t\tconst nodeToPack = holdNodes[childrenPackedCount++];\n\t\t\t\tpackedBlock.assignChild(nodeToPack, packedNodeIndex, false);\n\t\t\t}\n\t\t\tpackedBlock.parent = parent;\n\t\t\tpackedBlocks[nodeIndex] = packedBlock;\n\t\t\tmergeTree.nodeUpdateLengthNewStructure(packedBlock);\n\t\t}\n\t\tparent.children = packedBlocks;\n\t\tfor (let j = 0; j < childCount; j++) {\n\t\t\tparent.assignChild(packedBlocks[j], j, false);\n\t\t}\n\t\tparent.childCount = childCount;\n\t} else {\n\t\tparent.children = [];\n\t\tparent.childCount = 0;\n\t}\n\tif (underflow(parent) && parent.parent) {\n\t\tpackParent(parent.parent, mergeTree);\n\t} else {\n\t\tmergeTree.nodeUpdateOrdinals(parent);\n\t\tmergeTree.blockUpdatePathLengths(parent, UnassignedSequenceNumber, -1, true);\n\t}\n}\n\nfunction scourNode(node: MergeBlock, holdNodes: IMergeNode[], mergeTree: MergeTree) {\n\t// The previous segment is tracked while scouring for the purposes of merging adjacent segments\n\t// when possible.\n\tlet prevSegment: ISegment | undefined;\n\tfor (let k = 0; k < node.childCount; k++) {\n\t\tconst childNode = node.children[k];\n\t\tif (!childNode.isLeaf() || !childNode.segmentGroups.empty) {\n\t\t\tholdNodes.push(childNode);\n\t\t\tprevSegment = undefined;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst segment = childNode;\n\t\tconst removalInfo = toRemovalInfo(segment);\n\t\tconst moveInfo = toMoveInfo(segment);\n\t\tif (removalInfo !== undefined || moveInfo !== undefined) {\n\t\t\t// If the segment's removal is below the MSN and it's not being held onto by a tracking group,\n\t\t\t// it can be unlinked (i.e. removed from the merge-tree)\n\t\t\tif (\n\t\t\t\t((!!removalInfo && seqLTE(removalInfo.removedSeq, mergeTree.collabWindow.minSeq)) ||\n\t\t\t\t\t(!!moveInfo && seqLTE(moveInfo.movedSeq, mergeTree.collabWindow.minSeq))) &&\n\t\t\t\tsegment.trackingCollection.empty\n\t\t\t) {\n\t\t\t\tmergeTree.mergeTreeMaintenanceCallback?.(\n\t\t\t\t\t{\n\t\t\t\t\t\toperation: MergeTreeMaintenanceType.UNLINK,\n\t\t\t\t\t\tdeltaSegments: [{ segment }],\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t);\n\n\t\t\t\tsegment.parent = undefined;\n\n\t\t\t\tif (Marker.is(segment)) {\n\t\t\t\t\tmergeTree.unlinkMarker(segment);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tholdNodes.push(segment);\n\t\t\t}\n\n\t\t\tprevSegment = undefined;\n\t\t} else {\n\t\t\tif (segment.seq! <= mergeTree.collabWindow.minSeq) {\n\t\t\t\tconst segmentHasPositiveLength = (mergeTree.localNetLength(segment) ?? 0) > 0;\n\t\t\t\tconst canAppend =\n\t\t\t\t\tprevSegment?.canAppend(segment) &&\n\t\t\t\t\tmatchProperties(prevSegment.properties, segment.properties) &&\n\t\t\t\t\tprevSegment.trackingCollection.matches(segment.trackingCollection) &&\n\t\t\t\t\tsegmentHasPositiveLength;\n\n\t\t\t\tif (canAppend) {\n\t\t\t\t\tprevSegment!.append(segment);\n\t\t\t\t\tmergeTree.mergeTreeMaintenanceCallback?.(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toperation: MergeTreeMaintenanceType.APPEND,\n\t\t\t\t\t\t\tdeltaSegments: [{ segment: prevSegment! }, { segment }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\n\t\t\t\t\tsegment.parent = undefined;\n\t\t\t\t\tsegment.trackingCollection.trackingGroups.forEach((tg) => tg.unlink(segment));\n\t\t\t\t} else {\n\t\t\t\t\tholdNodes.push(segment);\n\t\t\t\t\tprevSegment = segmentHasPositiveLength ? segment : undefined;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tholdNodes.push(segment);\n\t\t\t\tprevSegment = undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/merge-tree",
3
- "version": "2.0.0-rc.2.0.1",
3
+ "version": "2.0.0-rc.3.0.0",
4
4
  "description": "Merge tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -15,31 +15,21 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- }
25
- },
26
- "./public": {
27
- "import": {
28
- "types": "./lib/merge-tree-public.d.ts",
18
+ "types": "./lib/public.d.ts",
29
19
  "default": "./lib/index.js"
30
20
  },
31
21
  "require": {
32
- "types": "./dist/merge-tree-public.d.ts",
22
+ "types": "./dist/public.d.ts",
33
23
  "default": "./dist/index.js"
34
24
  }
35
25
  },
36
- "./alpha": {
26
+ "./legacy": {
37
27
  "import": {
38
- "types": "./lib/merge-tree-alpha.d.ts",
28
+ "types": "./lib/legacy.d.ts",
39
29
  "default": "./lib/index.js"
40
30
  },
41
31
  "require": {
42
- "types": "./dist/merge-tree-alpha.d.ts",
32
+ "types": "./dist/legacy.d.ts",
43
33
  "default": "./dist/index.js"
44
34
  }
45
35
  },
@@ -53,7 +43,7 @@
53
43
  "default": "./dist/index.js"
54
44
  }
55
45
  },
56
- "./test": {
46
+ "./internal/test": {
57
47
  "import": {
58
48
  "types": "./lib/test/index.d.ts",
59
49
  "default": "./lib/test/index.js"
@@ -64,8 +54,8 @@
64
54
  }
65
55
  }
66
56
  },
67
- "main": "dist/index.js",
68
- "types": "dist/index.d.ts",
57
+ "main": "lib/index.js",
58
+ "types": "lib/public.d.ts",
69
59
  "c8": {
70
60
  "all": true,
71
61
  "cache-dir": "nyc/.cache",
@@ -87,29 +77,30 @@
87
77
  "temp-directory": "nyc/.nyc_output"
88
78
  },
89
79
  "dependencies": {
90
- "@fluid-internal/client-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
91
- "@fluidframework/container-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
92
- "@fluidframework/core-interfaces": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
93
- "@fluidframework/core-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
94
- "@fluidframework/datastore-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
80
+ "@fluid-internal/client-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
81
+ "@fluidframework/container-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
82
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
83
+ "@fluidframework/core-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
84
+ "@fluidframework/datastore-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
95
85
  "@fluidframework/protocol-definitions": "^3.2.0",
96
- "@fluidframework/runtime-definitions": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
97
- "@fluidframework/runtime-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
98
- "@fluidframework/shared-object-base": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
99
- "@fluidframework/telemetry-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0"
86
+ "@fluidframework/runtime-definitions": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
87
+ "@fluidframework/runtime-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
88
+ "@fluidframework/shared-object-base": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
89
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0"
100
90
  },
101
91
  "devDependencies": {
102
- "@arethetypeswrong/cli": "^0.13.3",
103
- "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
104
- "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
105
- "@fluid-private/test-pairwise-generator": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
92
+ "@arethetypeswrong/cli": "^0.15.2",
93
+ "@biomejs/biome": "^1.6.2",
94
+ "@fluid-internal/mocha-test-setup": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
95
+ "@fluid-private/stochastic-test-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
96
+ "@fluid-private/test-pairwise-generator": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
106
97
  "@fluid-tools/benchmark": "^0.48.0",
107
- "@fluid-tools/build-cli": "^0.34.0",
98
+ "@fluid-tools/build-cli": "^0.37.0",
108
99
  "@fluidframework/build-common": "^2.0.3",
109
- "@fluidframework/build-tools": "^0.34.0",
110
- "@fluidframework/eslint-config-fluid": "^4.0.0",
100
+ "@fluidframework/build-tools": "^0.37.0",
101
+ "@fluidframework/eslint-config-fluid": "^5.1.0",
111
102
  "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.0.0-internal.8.0.0",
112
- "@fluidframework/test-runtime-utils": ">=2.0.0-rc.2.0.1 <2.0.0-rc.2.1.0",
103
+ "@fluidframework/test-runtime-utils": ">=2.0.0-rc.3.0.0 <2.0.0-rc.3.1.0",
113
104
  "@microsoft/api-extractor": "^7.42.3",
114
105
  "@types/diff": "^3.5.1",
115
106
  "@types/mocha": "^9.1.1",
@@ -128,18 +119,6 @@
128
119
  "rimraf": "^4.4.0",
129
120
  "typescript": "~5.1.6"
130
121
  },
131
- "fluidBuild": {
132
- "tasks": {
133
- "build:docs": {
134
- "dependsOn": [
135
- "...",
136
- "api-extractor:commonjs",
137
- "api-extractor:esnext"
138
- ],
139
- "script": false
140
- }
141
- }
142
- },
143
122
  "typeValidation": {
144
123
  "broken": {
145
124
  "ClassDeclaration_Client": {
@@ -149,30 +128,30 @@
149
128
  },
150
129
  "scripts": {
151
130
  "api": "fluid-build . --task api",
152
- "api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
153
- "api-extractor:esnext": "api-extractor run --local",
131
+ "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
132
+ "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
154
133
  "build": "fluid-build . --task build",
155
134
  "build:commonjs": "fluid-build . --task commonjs",
156
135
  "build:compile": "fluid-build . --task compile",
157
- "build:docs": "fluid-build . --task api",
136
+ "build:docs": "api-extractor run --local",
158
137
  "build:esnext": "tsc --project ./tsconfig.json",
159
138
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
160
139
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
161
140
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
162
- "check:are-the-types-wrong": "attw --pack . --entrypoints .",
141
+ "check:are-the-types-wrong": "attw --pack . --exclude-entrypoints ./internal/test",
142
+ "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
163
143
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
164
144
  "ci:build:docs": "api-extractor run",
165
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
145
+ "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
166
146
  "eslint": "eslint --format stylish src",
167
147
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
168
- "format": "npm run prettier:fix",
169
- "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
170
- "lint:fix": "npm run prettier:fix && npm run eslint:fix",
148
+ "format": "fluid-build --task format .",
149
+ "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
150
+ "lint": "fluid-build . --task lint",
151
+ "lint:fix": "fluid-build . --task eslint:fix --task format",
171
152
  "perf": "cross-env FLUID_TEST_VERBOSE=1 mocha \"dist/**/*.spec.*js\" --node-option unhandled-rejections=strict,expose-gc --exit --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 30000",
172
153
  "perf:measure": "npm run perf -- --fgrep @Measurement",
173
154
  "perf:profile": "node --inspect-brk ./node_modules/mocha/bin/mocha.js \"dist/**/*.spec.*js\" --node-option unhandled-rejections=strict,expose-gc --exit --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 30000",
174
- "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
175
- "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
176
155
  "test": "npm run test:mocha",
177
156
  "test:benchmark:report": "mocha \"dist/test/*.perf.spec.*js\" --node-option unhandled-rejections=strict,expose-gc --exit --perfMode --fgrep @Benchmark -r @fluid-internal/mocha-test-setup --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 60000",
178
157
  "test:coverage": "c8 npm test",
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { IIntegerRange } from "./client.js";
7
- import { ISegment } from "./mergeTreeNodes.js";
8
7
  import { MergeTree } from "./mergeTree.js";
8
+ import { ISegment } from "./mergeTreeNodes.js";
9
9
  // eslint-disable-next-line import/no-deprecated
10
10
  import { IMergeTreeTextHelper, TextSegment } from "./textSegment.js";
11
11
 
@@ -3,12 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert, unreachableCase } from "@fluidframework/core-utils";
6
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
7
  import {
8
8
  AttributionKey,
9
- OpAttributionKey,
10
9
  DetachedAttributionKey,
11
- } from "@fluidframework/runtime-definitions";
10
+ OpAttributionKey,
11
+ } from "@fluidframework/runtime-definitions/internal";
12
+
12
13
  import { ISegment } from "./mergeTreeNodes.js";
13
14
 
14
15
  /**
@@ -3,12 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
7
- import { AttributionKey } from "@fluidframework/runtime-definitions";
6
+ import { assert } from "@fluidframework/core-utils/internal";
8
7
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
9
- import { AttributionPolicy } from "./mergeTree.js";
8
+ import { AttributionKey } from "@fluidframework/runtime-definitions/internal";
9
+
10
+ import { AttributionCollection } from "./attributionCollection.js";
10
11
  // eslint-disable-next-line import/no-deprecated
11
12
  import { Client } from "./client.js";
13
+ import { AttributionPolicy } from "./mergeTree.js";
12
14
  import {
13
15
  IMergeTreeDeltaCallbackArgs,
14
16
  IMergeTreeDeltaOpArgs,
@@ -17,7 +19,6 @@ import {
17
19
  MergeTreeMaintenanceType,
18
20
  } from "./mergeTreeDeltaCallback.js";
19
21
  import { MergeTreeDeltaType } from "./ops.js";
20
- import { AttributionCollection } from "./attributionCollection.js";
21
22
 
22
23
  // Note: these thinly wrap MergeTreeDeltaCallback and MergeTreeMaintenanceCallback to provide the client.
23
24
  // This is because the base callbacks don't always have enough information to infer whether the op being
@@ -223,7 +224,7 @@ export function createInsertOnlyAttributionPolicy(): AttributionPolicy {
223
224
  * const lastBoldedAttributionKey = segment.attribution?.getAtOffset(0, "bold");
224
225
  * const lastItalicizedAttributionKey = segment.attribution?.getAtOffset(0, "italic");
225
226
  * ```
226
- * @alpha
227
+ * @internal
227
228
  */
228
229
  export function createPropertyTrackingAttributionPolicyFactory(
229
230
  ...propNames: string[]
@@ -241,7 +242,7 @@ export function createPropertyTrackingAttributionPolicyFactory(
241
242
  * Creates an attribution policy which tracks insertion as well as annotation of certain property names.
242
243
  * This combines the policies creatable using {@link createPropertyTrackingAttributionPolicyFactory} and
243
244
  * {@link createInsertOnlyAttributionPolicy}: see there for more details.
244
- * @alpha
245
+ * @internal
245
246
  */
246
247
  export function createPropertyTrackingAndInsertionAttributionPolicyFactory(
247
248
  ...propNames: string[]
package/src/client.ts CHANGED
@@ -5,31 +5,42 @@
5
5
 
6
6
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
7
7
 
8
- import { IFluidHandle, type IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
9
- import { IFluidSerializer } from "@fluidframework/shared-object-base";
10
- import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
8
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
9
+ import { type IEventThisPlaceHolder, IFluidHandle } from "@fluidframework/core-interfaces";
10
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
11
11
  import {
12
- IFluidDataStoreRuntime,
13
12
  IChannelStorageService,
13
+ IFluidDataStoreRuntime,
14
14
  } from "@fluidframework/datastore-definitions";
15
+ import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
15
16
  import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
16
- import { assert, unreachableCase } from "@fluidframework/core-utils";
17
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
18
- import { ITelemetryLoggerExt, LoggingError, UsageError } from "@fluidframework/telemetry-utils";
17
+ import { IFluidSerializer } from "@fluidframework/shared-object-base";
18
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
19
+ import { LoggingError, UsageError } from "@fluidframework/telemetry-utils/internal";
20
+
21
+ import { MergeTreeTextHelper } from "./MergeTreeTextHelper.js";
19
22
  import { DoublyLinkedList, RedBlackTree } from "./collections/index.js";
20
23
  import { UnassignedSequenceNumber, UniversalSequenceNumber } from "./constants.js";
21
24
  import { LocalReferencePosition, SlidingPreference } from "./localReference.js";
25
+ import { IMergeTreeOptions, MergeTree } from "./mergeTree.js";
26
+ import type {
27
+ IMergeTreeClientSequenceArgs,
28
+ IMergeTreeDeltaCallbackArgs,
29
+ IMergeTreeDeltaOpArgs,
30
+ IMergeTreeMaintenanceCallbackArgs,
31
+ } from "./mergeTreeDeltaCallback.js";
32
+ import { walkAllChildSegments } from "./mergeTreeNodeWalk.js";
22
33
  import {
23
34
  // eslint-disable-next-line import/no-deprecated
24
35
  CollaborationWindow,
25
- compareStrings,
26
36
  IMoveInfo,
27
- ISegmentLeaf,
28
37
  ISegment,
29
38
  ISegmentAction,
39
+ ISegmentLeaf,
30
40
  Marker,
31
41
  // eslint-disable-next-line import/no-deprecated
32
42
  SegmentGroup,
43
+ compareStrings,
33
44
  } from "./mergeTreeNodes.js";
34
45
  import {
35
46
  createAnnotateMarkerOp,
@@ -47,30 +58,21 @@ import {
47
58
  // eslint-disable-next-line import/no-deprecated
48
59
  IMergeTreeGroupMsg,
49
60
  IMergeTreeInsertMsg,
50
- IMergeTreeRemoveMsg,
61
+ // eslint-disable-next-line import/no-deprecated
62
+ IMergeTreeObliterateMsg,
51
63
  IMergeTreeOp,
64
+ IMergeTreeRemoveMsg,
52
65
  IRelativePosition,
53
66
  MergeTreeDeltaType,
54
67
  ReferenceType,
55
- // eslint-disable-next-line import/no-deprecated
56
- IMergeTreeObliterateMsg,
57
68
  } from "./ops.js";
58
69
  import { PropertySet } from "./properties.js";
59
- import { SnapshotLegacy } from "./snapshotlegacy.js";
70
+ import { DetachedReferencePosition, ReferencePosition } from "./referencePositions.js";
60
71
  import { SnapshotLoader } from "./snapshotLoader.js";
72
+ import { SnapshotV1 } from "./snapshotV1.js";
73
+ import { SnapshotLegacy } from "./snapshotlegacy.js";
61
74
  // eslint-disable-next-line import/no-deprecated
62
75
  import { IMergeTreeTextHelper } from "./textSegment.js";
63
- import { SnapshotV1 } from "./snapshotV1.js";
64
- import { ReferencePosition, DetachedReferencePosition } from "./referencePositions.js";
65
- import { IMergeTreeOptions, MergeTree } from "./mergeTree.js";
66
- import { MergeTreeTextHelper } from "./MergeTreeTextHelper.js";
67
- import { walkAllChildSegments } from "./mergeTreeNodeWalk.js";
68
- import {
69
- IMergeTreeClientSequenceArgs,
70
- IMergeTreeDeltaCallbackArgs,
71
- IMergeTreeDeltaOpArgs,
72
- IMergeTreeMaintenanceCallbackArgs,
73
- } from "./index.js";
74
76
 
75
77
  type IMergeTreeDeltaRemoteOpArgs = Omit<IMergeTreeDeltaOpArgs, "sequencedMessage"> &
76
78
  Required<Pick<IMergeTreeDeltaOpArgs, "sequencedMessage">>;
@@ -262,10 +264,8 @@ export class Client extends TypedEventEmitter<IClientEvents> {
262
264
  return undefined;
263
265
  }
264
266
  const insertOp = createInsertSegmentOp(pos, segment);
265
- if (this.applyInsertOp({ op: insertOp })) {
266
- return insertOp;
267
- }
268
- return undefined;
267
+ this.applyInsertOp({ op: insertOp });
268
+ return insertOp;
269
269
  }
270
270
 
271
271
  /**
@@ -283,13 +283,9 @@ export class Client extends TypedEventEmitter<IClientEvents> {
283
283
  );
284
284
 
285
285
  if (pos === DetachedReferencePosition) {
286
- return undefined;
287
- }
288
- const op = createInsertSegmentOp(pos, segment);
289
-
290
- if (this.applyInsertOp({ op })) {
291
- return op;
286
+ throw new UsageError("Cannot insert at detached local reference.");
292
287
  }
288
+ return this.insertSegmentLocal(pos, segment);
293
289
  }
294
290
 
295
291
  public walkSegments<TClientData>(
@@ -533,7 +529,7 @@ export class Client extends TypedEventEmitter<IClientEvents> {
533
529
  * @param opArgs - The ops args for the op
534
530
  * @returns True if the insert was applied. False if it could not be.
535
531
  */
536
- private applyInsertOp(opArgs: IMergeTreeDeltaOpArgs): boolean {
532
+ private applyInsertOp(opArgs: IMergeTreeDeltaOpArgs): void {
537
533
  assert(
538
534
  opArgs.op.type === MergeTreeDeltaType.INSERT,
539
535
  0x02f /* "Unexpected op type on range insert!" */,
@@ -542,14 +538,7 @@ export class Client extends TypedEventEmitter<IClientEvents> {
542
538
  const clientArgs = this.getClientSequenceArgs(opArgs);
543
539
  const range = this.getValidOpRange(op, clientArgs);
544
540
 
545
- let segments: ISegment[] | undefined;
546
- if (op.seg) {
547
- segments = [this.specToSegment(op.seg)];
548
- }
549
-
550
- if (!segments || segments.length === 0) {
551
- return false;
552
- }
541
+ const segments = [this.specToSegment(op.seg)];
553
542
 
554
543
  this._mergeTree.insertSegments(
555
544
  range.start,
@@ -559,8 +548,6 @@ export class Client extends TypedEventEmitter<IClientEvents> {
559
548
  clientArgs.sequenceNumber,
560
549
  opArgs,
561
550
  );
562
-
563
- return true;
564
551
  }
565
552
 
566
553
  /**
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { UsageError } from "@fluidframework/telemetry-utils";
6
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
 
8
8
  export interface ListNode<T> {
9
9
  readonly list: DoublyLinkedList<T> | undefined;
@@ -3,12 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+
7
8
  import { LocalClientId } from "./constants.js";
8
9
  import { LocalReferenceCollection } from "./localReference.js";
9
10
  import { MergeTree } from "./mergeTree.js";
10
- import { IMergeBlock, IRemovalInfo, ISegment, ISegmentLeaf } from "./mergeTreeNodes.js";
11
- import { depthFirstNodeWalk, NodeAction } from "./mergeTreeNodeWalk.js";
11
+ import { NodeAction, depthFirstNodeWalk } from "./mergeTreeNodeWalk.js";
12
+ import { IRemovalInfo, ISegment, ISegmentLeaf, type MergeBlock } from "./mergeTreeNodes.js";
12
13
 
13
14
  /**
14
15
  * This is a special segment that is not bound or known by the merge tree itself,
@@ -55,7 +56,7 @@ abstract class BaseEndpointSegment {
55
56
  }
56
57
 
57
58
  protected abstract endpointSegmentProps(): {
58
- parent: IMergeBlock;
59
+ parent: MergeBlock;
59
60
  index: number;
60
61
  depth: number;
61
62
  };
package/src/index.ts CHANGED
@@ -10,7 +10,11 @@ export {
10
10
  SerializedAttributionCollection,
11
11
  SequenceOffsets,
12
12
  } from "./attributionCollection.js";
13
- export { createInsertOnlyAttributionPolicy } from "./attributionPolicy.js";
13
+ export {
14
+ createInsertOnlyAttributionPolicy,
15
+ createPropertyTrackingAttributionPolicyFactory,
16
+ createPropertyTrackingAndInsertionAttributionPolicyFactory,
17
+ } from "./attributionPolicy.js";
14
18
  export { Client, IClientEvents } from "./client.js";
15
19
  export {
16
20
  ConflictAction,
@@ -3,14 +3,15 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
7
- import { UsageError } from "@fluidframework/telemetry-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
8
+
8
9
  import { DoublyLinkedList, ListNode, walkList } from "./collections/index.js";
9
10
  import { ISegment } from "./mergeTreeNodes.js";
10
11
  import { TrackingGroup, TrackingGroupCollection } from "./mergeTreeTracking.js";
11
12
  import { ReferenceType } from "./ops.js";
12
13
  // eslint-disable-next-line import/no-deprecated
13
- import { addProperties, PropertySet } from "./properties.js";
14
+ import { PropertySet, addProperties } from "./properties.js";
14
15
  import { ReferencePosition, refTypeIncludesFlag } from "./referencePositions.js";
15
16
 
16
17
  /**