@fluidframework/merge-tree 2.0.0-rc.1.0.4 → 2.0.0-rc.2.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 (770) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +4 -0
  4. package/api-extractor-cjs.json +8 -0
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -9
  7. package/api-report/merge-tree.api.md +6 -12
  8. package/dist/MergeTreeTextHelper.d.ts +2 -2
  9. package/dist/MergeTreeTextHelper.d.ts.map +1 -1
  10. package/dist/MergeTreeTextHelper.js +3 -3
  11. package/dist/MergeTreeTextHelper.js.map +1 -1
  12. package/dist/attributionCollection.d.ts +1 -1
  13. package/dist/attributionCollection.d.ts.map +1 -1
  14. package/dist/attributionCollection.js.map +1 -1
  15. package/dist/attributionPolicy.d.ts +1 -1
  16. package/dist/attributionPolicy.d.ts.map +1 -1
  17. package/dist/attributionPolicy.js +15 -15
  18. package/dist/attributionPolicy.js.map +1 -1
  19. package/dist/client.d.ts +31 -12
  20. package/dist/client.d.ts.map +1 -1
  21. package/dist/client.js +103 -92
  22. package/dist/client.js.map +1 -1
  23. package/dist/collections/index.d.ts +2 -2
  24. package/dist/collections/index.d.ts.map +1 -1
  25. package/dist/collections/index.js +6 -6
  26. package/dist/collections/index.js.map +1 -1
  27. package/dist/endOfTreeSegment.d.ts +3 -3
  28. package/dist/endOfTreeSegment.d.ts.map +1 -1
  29. package/dist/endOfTreeSegment.js +8 -8
  30. package/dist/endOfTreeSegment.js.map +1 -1
  31. package/dist/index.d.ts +20 -20
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +71 -71
  34. package/dist/index.js.map +1 -1
  35. package/dist/localReference.d.ts +9 -39
  36. package/dist/localReference.d.ts.map +1 -1
  37. package/dist/localReference.js +29 -24
  38. package/dist/localReference.js.map +1 -1
  39. package/dist/merge-tree-alpha.d.ts +28 -450
  40. package/dist/merge-tree-beta.d.ts +0 -438
  41. package/dist/merge-tree-public.d.ts +0 -438
  42. package/dist/merge-tree-untrimmed.d.ts +28 -787
  43. package/dist/mergeTree.d.ts +11 -19
  44. package/dist/mergeTree.d.ts.map +1 -1
  45. package/dist/mergeTree.js +201 -189
  46. package/dist/mergeTree.js.map +1 -1
  47. package/dist/mergeTreeDeltaCallback.d.ts +3 -7
  48. package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
  49. package/dist/mergeTreeDeltaCallback.js.map +1 -1
  50. package/dist/mergeTreeNodeWalk.d.ts +1 -1
  51. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  52. package/dist/mergeTreeNodeWalk.js.map +1 -1
  53. package/dist/mergeTreeNodes.d.ts +17 -14
  54. package/dist/mergeTreeNodes.d.ts.map +1 -1
  55. package/dist/mergeTreeNodes.js +32 -32
  56. package/dist/mergeTreeNodes.js.map +1 -1
  57. package/dist/mergeTreeTracking.d.ts +2 -2
  58. package/dist/mergeTreeTracking.d.ts.map +1 -1
  59. package/dist/mergeTreeTracking.js +2 -2
  60. package/dist/mergeTreeTracking.js.map +1 -1
  61. package/dist/opBuilder.d.ts +3 -3
  62. package/dist/opBuilder.d.ts.map +1 -1
  63. package/dist/opBuilder.js +7 -7
  64. package/dist/opBuilder.js.map +1 -1
  65. package/dist/package.json +3 -0
  66. package/dist/partialLengths.d.ts +5 -5
  67. package/dist/partialLengths.d.ts.map +1 -1
  68. package/dist/partialLengths.js +29 -29
  69. package/dist/partialLengths.js.map +1 -1
  70. package/dist/referencePositions.d.ts +4 -4
  71. package/dist/referencePositions.d.ts.map +1 -1
  72. package/dist/referencePositions.js +2 -2
  73. package/dist/referencePositions.js.map +1 -1
  74. package/dist/revertibles.d.ts +7 -7
  75. package/dist/revertibles.d.ts.map +1 -1
  76. package/dist/revertibles.js +39 -39
  77. package/dist/revertibles.js.map +1 -1
  78. package/dist/segmentGroupCollection.d.ts +1 -1
  79. package/dist/segmentGroupCollection.d.ts.map +1 -1
  80. package/dist/segmentGroupCollection.js +3 -3
  81. package/dist/segmentGroupCollection.js.map +1 -1
  82. package/dist/segmentPropertiesManager.d.ts +2 -2
  83. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  84. package/dist/segmentPropertiesManager.js +8 -8
  85. package/dist/segmentPropertiesManager.js.map +1 -1
  86. package/dist/snapshotChunks.d.ts +3 -3
  87. package/dist/snapshotChunks.d.ts.map +1 -1
  88. package/dist/snapshotChunks.js +5 -5
  89. package/dist/snapshotChunks.js.map +1 -1
  90. package/dist/snapshotLoader.d.ts +3 -3
  91. package/dist/snapshotLoader.d.ts.map +1 -1
  92. package/dist/snapshotLoader.js +19 -19
  93. package/dist/snapshotLoader.js.map +1 -1
  94. package/dist/snapshotV1.d.ts +3 -3
  95. package/dist/snapshotV1.d.ts.map +1 -1
  96. package/dist/snapshotV1.js +35 -18
  97. package/dist/snapshotV1.js.map +1 -1
  98. package/dist/snapshotlegacy.d.ts +2 -2
  99. package/dist/snapshotlegacy.d.ts.map +1 -1
  100. package/dist/snapshotlegacy.js +22 -10
  101. package/dist/snapshotlegacy.js.map +1 -1
  102. package/dist/sortedSegmentSet.d.ts +3 -3
  103. package/dist/sortedSegmentSet.d.ts.map +1 -1
  104. package/dist/sortedSegmentSet.js +2 -2
  105. package/dist/sortedSegmentSet.js.map +1 -1
  106. package/dist/test/Insertion.perf.spec.js +15 -15
  107. package/dist/test/Insertion.perf.spec.js.map +1 -1
  108. package/dist/test/PartialLengths.perf.spec.js +13 -13
  109. package/dist/test/PartialLengths.perf.spec.js.map +1 -1
  110. package/dist/test/Removal.perf.spec.js +25 -25
  111. package/dist/test/Removal.perf.spec.js.map +1 -1
  112. package/dist/test/Snapshot.perf.spec.js +3 -3
  113. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  114. package/dist/test/attributionCollection.perf.spec.js +9 -9
  115. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  116. package/dist/test/attributionCollection.spec.js +46 -46
  117. package/dist/test/attributionCollection.spec.js.map +1 -1
  118. package/dist/test/attributionPolicy.spec.js +13 -13
  119. package/dist/test/attributionPolicy.spec.js.map +1 -1
  120. package/dist/test/{beastTest.d.ts → beastTest.spec.d.ts} +3 -3
  121. package/dist/test/beastTest.spec.d.ts.map +1 -0
  122. package/dist/test/{beastTest.js → beastTest.spec.js} +120 -119
  123. package/dist/test/beastTest.spec.js.map +1 -0
  124. package/dist/test/client.annotateMarker.spec.js +13 -13
  125. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  126. package/dist/test/{client.apis.d.ts → client.apis.spec.d.ts} +1 -1
  127. package/dist/test/client.apis.spec.d.ts.map +1 -0
  128. package/dist/test/{client.apis.js → client.apis.spec.js} +8 -8
  129. package/dist/test/client.apis.spec.js.map +1 -0
  130. package/dist/test/client.applyMsg.spec.js +106 -43
  131. package/dist/test/client.applyMsg.spec.js.map +1 -1
  132. package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  133. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  134. package/dist/test/client.applyStashedOpFarm.spec.js +33 -21
  135. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  136. package/dist/test/client.attributionFarm.spec.d.ts +1 -1
  137. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
  138. package/dist/test/client.attributionFarm.spec.js +13 -13
  139. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  140. package/dist/test/client.conflictFarm.spec.d.ts +1 -1
  141. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  142. package/dist/test/client.conflictFarm.spec.js +9 -9
  143. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  144. package/dist/test/client.getPosition.spec.js +4 -4
  145. package/dist/test/client.getPosition.spec.js.map +1 -1
  146. package/dist/test/client.localReference.spec.js +72 -72
  147. package/dist/test/client.localReference.spec.js.map +1 -1
  148. package/dist/test/client.localReferenceFarm.spec.js +18 -18
  149. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  150. package/dist/test/client.rebasePosition.spec.js +2 -2
  151. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  152. package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
  153. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
  154. package/dist/test/client.reconnectFarm.spec.js +10 -10
  155. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  156. package/dist/test/client.replay.spec.js +11 -11
  157. package/dist/test/client.replay.spec.js.map +1 -1
  158. package/dist/test/client.rollback.spec.js +83 -83
  159. package/dist/test/client.rollback.spec.js.map +1 -1
  160. package/dist/test/client.rollbackFarm.spec.js +9 -9
  161. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  162. package/dist/test/client.searchForMarker.spec.js +137 -137
  163. package/dist/test/client.searchForMarker.spec.js.map +1 -1
  164. package/dist/test/client.walkSegments.spec.js +2 -2
  165. package/dist/test/client.walkSegments.spec.js.map +1 -1
  166. package/dist/test/collections.list.spec.js +4 -4
  167. package/dist/test/collections.list.spec.js.map +1 -1
  168. package/dist/test/createInsertOnlyAttributionPolicy.spec.js +4 -4
  169. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  170. package/dist/test/dirname.cjs +16 -0
  171. package/dist/test/dirname.cjs.map +1 -0
  172. package/dist/test/dirname.d.cts +6 -0
  173. package/dist/test/dirname.d.cts.map +1 -0
  174. package/dist/test/index.d.ts +8 -8
  175. package/dist/test/index.d.ts.map +1 -1
  176. package/dist/test/index.js +82 -81
  177. package/dist/test/index.js.map +1 -1
  178. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +39 -39
  179. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  180. package/dist/test/mergeTree.annotate.spec.js +39 -39
  181. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  182. package/dist/test/mergeTree.insert.deltaCallback.spec.js +35 -35
  183. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  184. package/dist/test/mergeTree.insertingWalk.spec.js +77 -77
  185. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  186. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +42 -42
  187. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  188. package/dist/test/mergeTree.markRangeRemoved.spec.js +15 -15
  189. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  190. package/dist/test/mergeTree.walk.spec.js +14 -14
  191. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  192. package/dist/test/mergeTree.zamboni.spec.js +9 -9
  193. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  194. package/dist/test/mergeTreeOperationRunner.d.ts +4 -4
  195. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  196. package/dist/test/mergeTreeOperationRunner.js +16 -15
  197. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  198. package/dist/test/mergeTreeOperationRunner.spec.js +5 -5
  199. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  200. package/dist/test/obliterate.concurrent.spec.js +85 -88
  201. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  202. package/dist/test/obliterate.deltaCallback.spec.d.ts +6 -0
  203. package/dist/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
  204. package/dist/test/obliterate.deltaCallback.spec.js +146 -0
  205. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -0
  206. package/dist/test/obliterate.partialLength.spec.js +39 -44
  207. package/dist/test/obliterate.partialLength.spec.js.map +1 -1
  208. package/dist/test/obliterate.reconnect.spec.js +15 -18
  209. package/dist/test/obliterate.reconnect.spec.js.map +1 -1
  210. package/dist/test/obliterate.spec.js +16 -16
  211. package/dist/test/obliterate.spec.js.map +1 -1
  212. package/dist/test/ordinal.spec.js +5 -5
  213. package/dist/test/ordinal.spec.js.map +1 -1
  214. package/dist/test/partialLength.spec.js +58 -64
  215. package/dist/test/partialLength.spec.js.map +1 -1
  216. package/dist/test/properties.spec.js +15 -15
  217. package/dist/test/properties.spec.js.map +1 -1
  218. package/dist/test/reconnectHelper.d.ts +8 -8
  219. package/dist/test/reconnectHelper.d.ts.map +1 -1
  220. package/dist/test/reconnectHelper.js +3 -3
  221. package/dist/test/reconnectHelper.js.map +1 -1
  222. package/dist/test/resetPendingSegmentsToOp.spec.js +18 -18
  223. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  224. package/dist/test/revertibleFarm.spec.js +21 -21
  225. package/dist/test/revertibleFarm.spec.js.map +1 -1
  226. package/dist/test/revertibles.spec.js +67 -67
  227. package/dist/test/revertibles.spec.js.map +1 -1
  228. package/dist/test/segmentGroupCollection.spec.js +3 -3
  229. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  230. package/dist/test/snapshot.spec.js +16 -16
  231. package/dist/test/snapshot.spec.js.map +1 -1
  232. package/dist/test/snapshot.utils.d.ts +4 -4
  233. package/dist/test/snapshot.utils.d.ts.map +1 -1
  234. package/dist/test/snapshot.utils.js +11 -11
  235. package/dist/test/snapshot.utils.js.map +1 -1
  236. package/dist/test/snapshotlegacy.spec.js +22 -22
  237. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  238. package/dist/test/sortedSegmentSet.spec.js +9 -9
  239. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  240. package/dist/test/testClient.d.ts +13 -16
  241. package/dist/test/testClient.d.ts.map +1 -1
  242. package/dist/test/testClient.js +57 -59
  243. package/dist/test/testClient.js.map +1 -1
  244. package/dist/test/testClientLogger.d.ts +3 -3
  245. package/dist/test/testClientLogger.d.ts.map +1 -1
  246. package/dist/test/testClientLogger.js +19 -19
  247. package/dist/test/testClientLogger.js.map +1 -1
  248. package/dist/test/testServer.d.ts +3 -3
  249. package/dist/test/testServer.d.ts.map +1 -1
  250. package/dist/test/testServer.js +8 -8
  251. package/dist/test/testServer.js.map +1 -1
  252. package/dist/test/testUtils.d.ts +14 -6
  253. package/dist/test/testUtils.d.ts.map +1 -1
  254. package/dist/test/testUtils.js +36 -17
  255. package/dist/test/testUtils.js.map +1 -1
  256. package/dist/test/text.d.ts +2 -2
  257. package/dist/test/text.d.ts.map +1 -1
  258. package/dist/test/text.js +10 -10
  259. package/dist/test/text.js.map +1 -1
  260. package/dist/test/tracking.spec.js +12 -12
  261. package/dist/test/tracking.spec.js.map +1 -1
  262. package/dist/test/{wordUnitTests.d.ts → wordUnitTests.spec.d.ts} +1 -1
  263. package/dist/test/wordUnitTests.spec.d.ts.map +1 -0
  264. package/dist/test/{wordUnitTests.js → wordUnitTests.spec.js} +16 -15
  265. package/dist/test/wordUnitTests.spec.js.map +1 -0
  266. package/dist/textSegment.d.ts +3 -3
  267. package/dist/textSegment.d.ts.map +1 -1
  268. package/dist/textSegment.js +2 -2
  269. package/dist/textSegment.js.map +1 -1
  270. package/dist/tsdoc-metadata.json +1 -1
  271. package/dist/zamboni.d.ts +2 -2
  272. package/dist/zamboni.d.ts.map +1 -1
  273. package/dist/zamboni.js +19 -19
  274. package/dist/zamboni.js.map +1 -1
  275. package/lib/{MergeTreeTextHelper.d.mts → MergeTreeTextHelper.d.ts} +3 -3
  276. package/lib/MergeTreeTextHelper.d.ts.map +1 -0
  277. package/lib/{MergeTreeTextHelper.mjs → MergeTreeTextHelper.js} +3 -2
  278. package/lib/MergeTreeTextHelper.js.map +1 -0
  279. package/lib/{attributionCollection.d.mts → attributionCollection.d.ts} +2 -2
  280. package/lib/attributionCollection.d.ts.map +1 -0
  281. package/lib/{attributionCollection.mjs → attributionCollection.js} +1 -1
  282. package/lib/attributionCollection.js.map +1 -0
  283. package/lib/{attributionPolicy.d.mts → attributionPolicy.d.ts} +2 -2
  284. package/lib/attributionPolicy.d.ts.map +1 -0
  285. package/lib/{attributionPolicy.mjs → attributionPolicy.js} +4 -4
  286. package/lib/attributionPolicy.js.map +1 -0
  287. package/lib/{client.d.mts → client.d.ts} +32 -13
  288. package/lib/client.d.ts.map +1 -0
  289. package/lib/{client.mjs → client.js} +42 -31
  290. package/lib/client.js.map +1 -0
  291. package/lib/collections/{index.d.mts → index.d.ts} +3 -3
  292. package/lib/collections/index.d.ts.map +1 -0
  293. package/lib/collections/index.js +7 -0
  294. package/lib/collections/index.js.map +1 -0
  295. package/lib/collections/{list.d.mts → list.d.ts} +1 -1
  296. package/lib/collections/list.d.ts.map +1 -0
  297. package/lib/collections/{list.mjs → list.js} +1 -1
  298. package/lib/collections/list.js.map +1 -0
  299. package/lib/collections/{rbTree.d.mts → rbTree.d.ts} +1 -1
  300. package/lib/collections/rbTree.d.ts.map +1 -0
  301. package/lib/collections/{rbTree.mjs → rbTree.js} +1 -1
  302. package/lib/collections/rbTree.js.map +1 -0
  303. package/lib/{constants.d.mts → constants.d.ts} +1 -1
  304. package/lib/constants.d.ts.map +1 -0
  305. package/lib/{constants.mjs → constants.js} +1 -1
  306. package/lib/constants.js.map +1 -0
  307. package/lib/{endOfTreeSegment.d.mts → endOfTreeSegment.d.ts} +4 -4
  308. package/lib/endOfTreeSegment.d.ts.map +1 -0
  309. package/lib/{endOfTreeSegment.mjs → endOfTreeSegment.js} +3 -3
  310. package/lib/endOfTreeSegment.js.map +1 -0
  311. package/lib/{index.d.mts → index.d.ts} +21 -21
  312. package/lib/index.d.ts.map +1 -0
  313. package/lib/{index.mjs → index.js} +20 -20
  314. package/lib/index.js.map +1 -0
  315. package/lib/{localReference.d.mts → localReference.d.ts} +10 -40
  316. package/lib/localReference.d.ts.map +1 -0
  317. package/lib/{localReference.mjs → localReference.js} +12 -6
  318. package/lib/localReference.js.map +1 -0
  319. package/lib/{merge-tree-alpha.d.mts → merge-tree-alpha.d.ts} +28 -450
  320. package/lib/merge-tree-beta.d.ts +230 -0
  321. package/lib/merge-tree-public.d.ts +230 -0
  322. package/lib/{merge-tree-untrimmed.d.mts → merge-tree-untrimmed.d.ts} +28 -787
  323. package/lib/{mergeTree.d.mts → mergeTree.d.ts} +12 -20
  324. package/lib/mergeTree.d.ts.map +1 -0
  325. package/lib/{mergeTree.mjs → mergeTree.js} +47 -32
  326. package/lib/mergeTree.js.map +1 -0
  327. package/lib/{mergeTreeDeltaCallback.d.mts → mergeTreeDeltaCallback.d.ts} +8 -8
  328. package/lib/mergeTreeDeltaCallback.d.ts.map +1 -0
  329. package/lib/{mergeTreeDeltaCallback.mjs → mergeTreeDeltaCallback.js} +1 -1
  330. package/lib/mergeTreeDeltaCallback.js.map +1 -0
  331. package/lib/{mergeTreeNodeWalk.d.mts → mergeTreeNodeWalk.d.ts} +2 -2
  332. package/lib/mergeTreeNodeWalk.d.ts.map +1 -0
  333. package/lib/{mergeTreeNodeWalk.mjs → mergeTreeNodeWalk.js} +1 -1
  334. package/lib/mergeTreeNodeWalk.js.map +1 -0
  335. package/lib/{mergeTreeNodes.d.mts → mergeTreeNodes.d.ts} +18 -15
  336. package/lib/mergeTreeNodes.d.ts.map +1 -0
  337. package/lib/{mergeTreeNodes.mjs → mergeTreeNodes.js} +12 -10
  338. package/lib/mergeTreeNodes.js.map +1 -0
  339. package/lib/{mergeTreeTracking.d.mts → mergeTreeTracking.d.ts} +3 -3
  340. package/lib/mergeTreeTracking.d.ts.map +1 -0
  341. package/lib/{mergeTreeTracking.mjs → mergeTreeTracking.js} +3 -2
  342. package/lib/mergeTreeTracking.js.map +1 -0
  343. package/lib/{opBuilder.d.mts → opBuilder.d.ts} +4 -4
  344. package/lib/{opBuilder.d.mts.map → opBuilder.d.ts.map} +1 -1
  345. package/lib/{opBuilder.mjs → opBuilder.js} +2 -2
  346. package/lib/opBuilder.js.map +1 -0
  347. package/lib/{ops.d.mts → ops.d.ts} +1 -1
  348. package/lib/ops.d.ts.map +1 -0
  349. package/lib/{ops.mjs → ops.js} +1 -1
  350. package/lib/ops.js.map +1 -0
  351. package/lib/{ordinal.d.mts → ordinal.d.ts} +1 -1
  352. package/lib/ordinal.d.ts.map +1 -0
  353. package/lib/{ordinal.mjs → ordinal.js} +2 -1
  354. package/lib/ordinal.js.map +1 -0
  355. package/lib/{partialLengths.d.mts → partialLengths.d.ts} +6 -6
  356. package/lib/partialLengths.d.ts.map +1 -0
  357. package/lib/{partialLengths.mjs → partialLengths.js} +11 -10
  358. package/lib/partialLengths.js.map +1 -0
  359. package/lib/{properties.d.mts → properties.d.ts} +1 -1
  360. package/lib/properties.d.ts.map +1 -0
  361. package/lib/{properties.mjs → properties.js} +1 -1
  362. package/lib/properties.js.map +1 -0
  363. package/lib/{referencePositions.d.mts → referencePositions.d.ts} +5 -5
  364. package/lib/referencePositions.d.ts.map +1 -0
  365. package/lib/{referencePositions.mjs → referencePositions.js} +2 -2
  366. package/lib/referencePositions.js.map +1 -0
  367. package/lib/{revertibles.d.mts → revertibles.d.ts} +8 -8
  368. package/lib/revertibles.d.ts.map +1 -0
  369. package/lib/{revertibles.mjs → revertibles.js} +13 -13
  370. package/lib/revertibles.js.map +1 -0
  371. package/lib/{segmentGroupCollection.d.mts → segmentGroupCollection.d.ts} +2 -2
  372. package/lib/segmentGroupCollection.d.ts.map +1 -0
  373. package/lib/{segmentGroupCollection.mjs → segmentGroupCollection.js} +2 -2
  374. package/lib/segmentGroupCollection.js.map +1 -0
  375. package/lib/{segmentPropertiesManager.d.mts → segmentPropertiesManager.d.ts} +3 -3
  376. package/lib/segmentPropertiesManager.d.ts.map +1 -0
  377. package/lib/{segmentPropertiesManager.mjs → segmentPropertiesManager.js} +5 -3
  378. package/lib/segmentPropertiesManager.js.map +1 -0
  379. package/lib/{snapshotChunks.d.mts → snapshotChunks.d.ts} +4 -4
  380. package/lib/snapshotChunks.d.ts.map +1 -0
  381. package/lib/{snapshotChunks.mjs → snapshotChunks.js} +2 -2
  382. package/lib/snapshotChunks.js.map +1 -0
  383. package/lib/{snapshotLoader.d.mts → snapshotLoader.d.ts} +4 -4
  384. package/lib/snapshotLoader.d.ts.map +1 -0
  385. package/lib/{snapshotLoader.mjs → snapshotLoader.js} +10 -9
  386. package/lib/snapshotLoader.js.map +1 -0
  387. package/lib/{snapshotV1.d.mts → snapshotV1.d.ts} +4 -4
  388. package/lib/snapshotV1.d.ts.map +1 -0
  389. package/lib/{snapshotV1.mjs → snapshotV1.js} +24 -7
  390. package/lib/snapshotV1.js.map +1 -0
  391. package/lib/{snapshotlegacy.d.mts → snapshotlegacy.d.ts} +3 -3
  392. package/lib/snapshotlegacy.d.ts.map +1 -0
  393. package/lib/{snapshotlegacy.mjs → snapshotlegacy.js} +17 -4
  394. package/lib/snapshotlegacy.js.map +1 -0
  395. package/lib/{sortedSegmentSet.d.mts → sortedSegmentSet.d.ts} +4 -4
  396. package/lib/sortedSegmentSet.d.ts.map +1 -0
  397. package/lib/{sortedSegmentSet.mjs → sortedSegmentSet.js} +3 -2
  398. package/lib/sortedSegmentSet.js.map +1 -0
  399. package/lib/{sortedSet.d.mts → sortedSet.d.ts} +1 -1
  400. package/lib/sortedSet.d.ts.map +1 -0
  401. package/lib/{sortedSet.mjs → sortedSet.js} +1 -1
  402. package/lib/sortedSet.js.map +1 -0
  403. package/lib/test/Insertion.perf.spec.d.ts +6 -0
  404. package/lib/test/Insertion.perf.spec.d.ts.map +1 -0
  405. package/lib/test/Insertion.perf.spec.js +111 -0
  406. package/lib/test/Insertion.perf.spec.js.map +1 -0
  407. package/lib/test/PartialLengths.perf.spec.d.ts +6 -0
  408. package/lib/test/PartialLengths.perf.spec.d.ts.map +1 -0
  409. package/lib/test/PartialLengths.perf.spec.js +65 -0
  410. package/lib/test/PartialLengths.perf.spec.js.map +1 -0
  411. package/lib/test/Removal.perf.spec.d.ts +6 -0
  412. package/lib/test/Removal.perf.spec.d.ts.map +1 -0
  413. package/lib/test/Removal.perf.spec.js +164 -0
  414. package/lib/test/Removal.perf.spec.js.map +1 -0
  415. package/lib/test/Snapshot.perf.spec.d.ts +6 -0
  416. package/lib/test/Snapshot.perf.spec.d.ts.map +1 -0
  417. package/lib/test/Snapshot.perf.spec.js +31 -0
  418. package/lib/test/Snapshot.perf.spec.js.map +1 -0
  419. package/lib/test/attributionCollection.perf.spec.d.ts +6 -0
  420. package/lib/test/attributionCollection.perf.spec.d.ts.map +1 -0
  421. package/lib/test/attributionCollection.perf.spec.js +229 -0
  422. package/lib/test/attributionCollection.perf.spec.js.map +1 -0
  423. package/lib/test/attributionCollection.spec.d.ts +6 -0
  424. package/lib/test/attributionCollection.spec.d.ts.map +1 -0
  425. package/lib/test/attributionCollection.spec.js +484 -0
  426. package/lib/test/attributionCollection.spec.js.map +1 -0
  427. package/lib/test/attributionPolicy.spec.d.ts +6 -0
  428. package/lib/test/attributionPolicy.spec.d.ts.map +1 -0
  429. package/lib/test/attributionPolicy.spec.js +187 -0
  430. package/lib/test/attributionPolicy.spec.js.map +1 -0
  431. package/lib/test/beastTest.spec.d.ts +54 -0
  432. package/lib/test/beastTest.spec.d.ts.map +1 -0
  433. package/lib/test/beastTest.spec.js +1318 -0
  434. package/lib/test/beastTest.spec.js.map +1 -0
  435. package/lib/test/client.annotateMarker.spec.d.ts +6 -0
  436. package/lib/test/client.annotateMarker.spec.d.ts.map +1 -0
  437. package/lib/test/client.annotateMarker.spec.js +43 -0
  438. package/lib/test/client.annotateMarker.spec.js.map +1 -0
  439. package/lib/test/client.apis.spec.d.ts +7 -0
  440. package/lib/test/client.apis.spec.d.ts.map +1 -0
  441. package/lib/test/client.apis.spec.js +67 -0
  442. package/lib/test/client.apis.spec.js.map +1 -0
  443. package/lib/test/client.applyMsg.spec.d.ts +6 -0
  444. package/lib/test/client.applyMsg.spec.d.ts.map +1 -0
  445. package/lib/test/client.applyMsg.spec.js +561 -0
  446. package/lib/test/client.applyMsg.spec.js.map +1 -0
  447. package/lib/test/client.applyStashedOpFarm.spec.d.ts +12 -0
  448. package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
  449. package/lib/test/client.applyStashedOpFarm.spec.js +153 -0
  450. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -0
  451. package/lib/test/client.attributionFarm.spec.d.ts +7 -0
  452. package/lib/test/client.attributionFarm.spec.d.ts.map +1 -0
  453. package/lib/test/client.attributionFarm.spec.js +92 -0
  454. package/lib/test/client.attributionFarm.spec.js.map +1 -0
  455. package/lib/test/client.conflictFarm.spec.d.ts +15 -0
  456. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -0
  457. package/lib/test/client.conflictFarm.spec.js +85 -0
  458. package/lib/test/client.conflictFarm.spec.js.map +1 -0
  459. package/lib/test/client.getPosition.spec.d.ts +6 -0
  460. package/lib/test/client.getPosition.spec.d.ts.map +1 -0
  461. package/lib/test/client.getPosition.spec.js +52 -0
  462. package/lib/test/client.getPosition.spec.js.map +1 -0
  463. package/lib/test/client.localReference.spec.d.ts +6 -0
  464. package/lib/test/client.localReference.spec.d.ts.map +1 -0
  465. package/lib/test/client.localReference.spec.js +468 -0
  466. package/lib/test/client.localReference.spec.js.map +1 -0
  467. package/lib/test/client.localReferenceFarm.spec.d.ts +6 -0
  468. package/lib/test/client.localReferenceFarm.spec.d.ts.map +1 -0
  469. package/lib/test/client.localReferenceFarm.spec.js +86 -0
  470. package/lib/test/client.localReferenceFarm.spec.js.map +1 -0
  471. package/lib/test/client.rebasePosition.spec.d.ts +6 -0
  472. package/lib/test/client.rebasePosition.spec.d.ts.map +1 -0
  473. package/lib/test/client.rebasePosition.spec.js +100 -0
  474. package/lib/test/client.rebasePosition.spec.js.map +1 -0
  475. package/lib/test/client.reconnectFarm.spec.d.ts +12 -0
  476. package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -0
  477. package/lib/test/client.reconnectFarm.spec.js +88 -0
  478. package/lib/test/client.reconnectFarm.spec.js.map +1 -0
  479. package/lib/test/client.replay.spec.d.ts +6 -0
  480. package/lib/test/client.replay.spec.d.ts.map +1 -0
  481. package/lib/test/client.replay.spec.js +57 -0
  482. package/lib/test/client.replay.spec.js.map +1 -0
  483. package/lib/test/client.rollback.spec.d.ts +6 -0
  484. package/lib/test/client.rollback.spec.d.ts.map +1 -0
  485. package/lib/test/client.rollback.spec.js +451 -0
  486. package/lib/test/client.rollback.spec.js.map +1 -0
  487. package/lib/test/client.rollbackFarm.spec.d.ts +6 -0
  488. package/lib/test/client.rollbackFarm.spec.d.ts.map +1 -0
  489. package/lib/test/client.rollbackFarm.spec.js +46 -0
  490. package/lib/test/client.rollbackFarm.spec.js.map +1 -0
  491. package/lib/test/client.searchForMarker.spec.d.ts +6 -0
  492. package/lib/test/client.searchForMarker.spec.d.ts.map +1 -0
  493. package/lib/test/client.searchForMarker.spec.js +495 -0
  494. package/lib/test/client.searchForMarker.spec.js.map +1 -0
  495. package/lib/test/client.walkSegments.spec.d.ts +6 -0
  496. package/lib/test/client.walkSegments.spec.d.ts.map +1 -0
  497. package/lib/test/client.walkSegments.spec.js +52 -0
  498. package/lib/test/client.walkSegments.spec.js.map +1 -0
  499. package/lib/test/collections.list.spec.d.ts +6 -0
  500. package/lib/test/collections.list.spec.d.ts.map +1 -0
  501. package/lib/test/collections.list.spec.js +82 -0
  502. package/lib/test/collections.list.spec.js.map +1 -0
  503. package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
  504. package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
  505. package/lib/test/createInsertOnlyAttributionPolicy.spec.js +33 -0
  506. package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
  507. package/lib/test/dirname.cjs +16 -0
  508. package/lib/test/dirname.cjs.map +1 -0
  509. package/lib/test/dirname.d.cts +6 -0
  510. package/lib/test/dirname.d.cts.map +1 -0
  511. package/lib/test/index.d.ts +13 -0
  512. package/lib/test/index.d.ts.map +1 -0
  513. package/lib/test/index.js +13 -0
  514. package/lib/test/index.js.map +1 -0
  515. package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
  516. package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
  517. package/lib/test/mergeTree.annotate.deltaCallback.spec.js +140 -0
  518. package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
  519. package/lib/test/mergeTree.annotate.spec.d.ts +6 -0
  520. package/lib/test/mergeTree.annotate.spec.d.ts.map +1 -0
  521. package/lib/test/mergeTree.annotate.spec.js +446 -0
  522. package/lib/test/mergeTree.annotate.spec.js.map +1 -0
  523. package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
  524. package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
  525. package/lib/test/mergeTree.insert.deltaCallback.spec.js +124 -0
  526. package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
  527. package/lib/test/mergeTree.insertingWalk.spec.d.ts +6 -0
  528. package/lib/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
  529. package/lib/test/mergeTree.insertingWalk.spec.js +277 -0
  530. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -0
  531. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
  532. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
  533. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +176 -0
  534. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
  535. package/lib/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
  536. package/lib/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
  537. package/lib/test/mergeTree.markRangeRemoved.spec.js +128 -0
  538. package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
  539. package/lib/test/mergeTree.walk.spec.d.ts +6 -0
  540. package/lib/test/mergeTree.walk.spec.d.ts.map +1 -0
  541. package/lib/test/mergeTree.walk.spec.js +61 -0
  542. package/lib/test/mergeTree.walk.spec.js.map +1 -0
  543. package/lib/test/mergeTree.zamboni.spec.d.ts +6 -0
  544. package/lib/test/mergeTree.zamboni.spec.d.ts.map +1 -0
  545. package/lib/test/mergeTree.zamboni.spec.js +50 -0
  546. package/lib/test/mergeTree.zamboni.spec.js.map +1 -0
  547. package/lib/test/mergeTreeOperationRunner.d.ts +63 -0
  548. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -0
  549. package/lib/test/mergeTreeOperationRunner.js +207 -0
  550. package/lib/test/mergeTreeOperationRunner.js.map +1 -0
  551. package/lib/test/mergeTreeOperationRunner.spec.d.ts +6 -0
  552. package/lib/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
  553. package/lib/test/mergeTreeOperationRunner.spec.js +154 -0
  554. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -0
  555. package/lib/test/obliterate.concurrent.spec.d.ts +6 -0
  556. package/lib/test/obliterate.concurrent.spec.d.ts.map +1 -0
  557. package/lib/test/obliterate.concurrent.spec.js +1441 -0
  558. package/lib/test/obliterate.concurrent.spec.js.map +1 -0
  559. package/lib/test/obliterate.deltaCallback.spec.d.ts +6 -0
  560. package/lib/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
  561. package/lib/test/obliterate.deltaCallback.spec.js +144 -0
  562. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -0
  563. package/lib/test/obliterate.partialLength.spec.d.ts +6 -0
  564. package/lib/test/obliterate.partialLength.spec.d.ts.map +1 -0
  565. package/lib/test/obliterate.partialLength.spec.js +272 -0
  566. package/lib/test/obliterate.partialLength.spec.js.map +1 -0
  567. package/lib/test/obliterate.reconnect.spec.d.ts +6 -0
  568. package/lib/test/obliterate.reconnect.spec.d.ts.map +1 -0
  569. package/lib/test/obliterate.reconnect.spec.js +159 -0
  570. package/lib/test/obliterate.reconnect.spec.js.map +1 -0
  571. package/lib/test/obliterate.spec.d.ts +6 -0
  572. package/lib/test/obliterate.spec.d.ts.map +1 -0
  573. package/lib/test/obliterate.spec.js +160 -0
  574. package/lib/test/obliterate.spec.js.map +1 -0
  575. package/lib/test/ordinal.spec.d.ts +2 -0
  576. package/lib/test/ordinal.spec.d.ts.map +1 -0
  577. package/lib/test/ordinal.spec.js +38 -0
  578. package/lib/test/ordinal.spec.js.map +1 -0
  579. package/lib/test/partialLength.spec.d.ts +6 -0
  580. package/lib/test/partialLength.spec.d.ts.map +1 -0
  581. package/lib/test/partialLength.spec.js +274 -0
  582. package/lib/test/partialLength.spec.js.map +1 -0
  583. package/lib/test/properties.spec.d.ts +6 -0
  584. package/lib/test/properties.spec.d.ts.map +1 -0
  585. package/lib/test/properties.spec.js +53 -0
  586. package/lib/test/properties.spec.js.map +1 -0
  587. package/lib/test/reconnectHelper.d.ts +48 -0
  588. package/lib/test/reconnectHelper.d.ts.map +1 -0
  589. package/lib/test/reconnectHelper.js +82 -0
  590. package/lib/test/reconnectHelper.js.map +1 -0
  591. package/lib/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
  592. package/lib/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
  593. package/lib/test/resetPendingSegmentsToOp.spec.js +235 -0
  594. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -0
  595. package/lib/test/revertibleFarm.spec.d.ts +6 -0
  596. package/lib/test/revertibleFarm.spec.d.ts.map +1 -0
  597. package/lib/test/revertibleFarm.spec.js +119 -0
  598. package/lib/test/revertibleFarm.spec.js.map +1 -0
  599. package/lib/test/revertibles.spec.d.ts +17 -0
  600. package/lib/test/revertibles.spec.d.ts.map +1 -0
  601. package/lib/test/revertibles.spec.js +381 -0
  602. package/lib/test/revertibles.spec.js.map +1 -0
  603. package/lib/test/segmentGroupCollection.spec.d.ts +6 -0
  604. package/lib/test/segmentGroupCollection.spec.d.ts.map +1 -0
  605. package/lib/test/segmentGroupCollection.spec.js +58 -0
  606. package/lib/test/segmentGroupCollection.spec.js.map +1 -0
  607. package/lib/test/snapshot.spec.d.ts +6 -0
  608. package/lib/test/snapshot.spec.d.ts.map +1 -0
  609. package/lib/test/snapshot.spec.js +176 -0
  610. package/lib/test/snapshot.spec.js.map +1 -0
  611. package/lib/test/snapshot.utils.d.ts +33 -0
  612. package/lib/test/snapshot.utils.d.ts.map +1 -0
  613. package/lib/test/snapshot.utils.js +104 -0
  614. package/lib/test/snapshot.utils.js.map +1 -0
  615. package/lib/test/snapshotlegacy.spec.d.ts +6 -0
  616. package/lib/test/snapshotlegacy.spec.d.ts.map +1 -0
  617. package/lib/test/snapshotlegacy.spec.js +137 -0
  618. package/lib/test/snapshotlegacy.spec.js.map +1 -0
  619. package/lib/test/sortedSegmentSet.spec.d.ts +6 -0
  620. package/lib/test/sortedSegmentSet.spec.d.ts.map +1 -0
  621. package/lib/test/sortedSegmentSet.spec.js +93 -0
  622. package/lib/test/sortedSegmentSet.spec.js.map +1 -0
  623. package/lib/test/testClient.d.ts +116 -0
  624. package/lib/test/testClient.d.ts.map +1 -0
  625. package/lib/test/testClient.js +430 -0
  626. package/lib/test/testClient.js.map +1 -0
  627. package/lib/test/testClientLogger.d.ts +44 -0
  628. package/lib/test/testClientLogger.d.ts.map +1 -0
  629. package/lib/test/testClientLogger.js +282 -0
  630. package/lib/test/testClientLogger.js.map +1 -0
  631. package/lib/test/testSerializer.d.ts +18 -0
  632. package/lib/test/testSerializer.d.ts.map +1 -0
  633. package/lib/test/testSerializer.js +29 -0
  634. package/lib/test/testSerializer.js.map +1 -0
  635. package/lib/test/testServer.d.ts +36 -0
  636. package/lib/test/testServer.d.ts.map +1 -0
  637. package/lib/test/testServer.js +133 -0
  638. package/lib/test/testServer.js.map +1 -0
  639. package/lib/test/testUtils.d.ts +77 -0
  640. package/lib/test/testUtils.d.ts.map +1 -0
  641. package/lib/test/testUtils.js +151 -0
  642. package/lib/test/testUtils.js.map +1 -0
  643. package/lib/test/text.d.ts +9 -0
  644. package/lib/test/text.d.ts.map +1 -0
  645. package/lib/test/text.js +71 -0
  646. package/lib/test/text.js.map +1 -0
  647. package/lib/test/tracking.spec.d.ts +6 -0
  648. package/lib/test/tracking.spec.d.ts.map +1 -0
  649. package/lib/test/tracking.spec.js +118 -0
  650. package/lib/test/tracking.spec.js.map +1 -0
  651. package/lib/test/types/validateMergeTreePrevious.generated.d.ts +2 -0
  652. package/lib/test/types/validateMergeTreePrevious.generated.d.ts.map +1 -0
  653. package/lib/test/types/validateMergeTreePrevious.generated.js +228 -0
  654. package/lib/test/types/validateMergeTreePrevious.generated.js.map +1 -0
  655. package/lib/test/wordUnitTests.spec.d.ts +6 -0
  656. package/lib/test/wordUnitTests.spec.d.ts.map +1 -0
  657. package/lib/test/wordUnitTests.spec.js +166 -0
  658. package/lib/test/wordUnitTests.spec.js.map +1 -0
  659. package/lib/{textSegment.d.mts → textSegment.d.ts} +4 -4
  660. package/lib/textSegment.d.ts.map +1 -0
  661. package/lib/{textSegment.mjs → textSegment.js} +2 -2
  662. package/lib/textSegment.js.map +1 -0
  663. package/lib/{zamboni.d.mts → zamboni.d.ts} +3 -3
  664. package/lib/zamboni.d.ts.map +1 -0
  665. package/lib/{zamboni.mjs → zamboni.js} +7 -6
  666. package/lib/zamboni.js.map +1 -0
  667. package/package.json +50 -57
  668. package/src/MergeTreeTextHelper.ts +4 -4
  669. package/src/attributionCollection.ts +1 -1
  670. package/src/attributionPolicy.ts +5 -5
  671. package/src/client.ts +50 -41
  672. package/src/collections/index.ts +2 -2
  673. package/src/endOfTreeSegment.ts +5 -5
  674. package/src/index.ts +20 -20
  675. package/src/localReference.ts +13 -7
  676. package/src/mergeTree.ts +53 -44
  677. package/src/mergeTreeDeltaCallback.ts +3 -8
  678. package/src/mergeTreeNodeWalk.ts +1 -1
  679. package/src/mergeTreeNodes.ts +21 -19
  680. package/src/mergeTreeTracking.ts +3 -3
  681. package/src/opBuilder.ts +3 -3
  682. package/src/partialLengths.ts +10 -10
  683. package/src/referencePositions.ts +4 -4
  684. package/src/revertibles.ts +14 -18
  685. package/src/segmentGroupCollection.ts +2 -2
  686. package/src/segmentPropertiesManager.ts +3 -3
  687. package/src/snapshotChunks.ts +4 -4
  688. package/src/snapshotLoader.ts +14 -11
  689. package/src/snapshotV1.ts +29 -9
  690. package/src/snapshotlegacy.ts +19 -5
  691. package/src/sortedSegmentSet.ts +3 -3
  692. package/src/textSegment.ts +3 -3
  693. package/src/zamboni.ts +7 -7
  694. package/tsconfig.cjs.json +7 -0
  695. package/tsconfig.json +2 -5
  696. package/api-extractor-esm.json +0 -17
  697. package/dist/test/beastTest.d.ts.map +0 -1
  698. package/dist/test/beastTest.js.map +0 -1
  699. package/dist/test/client.apis.d.ts.map +0 -1
  700. package/dist/test/client.apis.js.map +0 -1
  701. package/dist/test/wordUnitTests.d.ts.map +0 -1
  702. package/dist/test/wordUnitTests.js.map +0 -1
  703. package/lib/MergeTreeTextHelper.d.mts.map +0 -1
  704. package/lib/MergeTreeTextHelper.mjs.map +0 -1
  705. package/lib/attributionCollection.d.mts.map +0 -1
  706. package/lib/attributionCollection.mjs.map +0 -1
  707. package/lib/attributionPolicy.d.mts.map +0 -1
  708. package/lib/attributionPolicy.mjs.map +0 -1
  709. package/lib/client.d.mts.map +0 -1
  710. package/lib/client.mjs.map +0 -1
  711. package/lib/collections/index.d.mts.map +0 -1
  712. package/lib/collections/index.mjs +0 -7
  713. package/lib/collections/index.mjs.map +0 -1
  714. package/lib/collections/list.d.mts.map +0 -1
  715. package/lib/collections/list.mjs.map +0 -1
  716. package/lib/collections/rbTree.d.mts.map +0 -1
  717. package/lib/collections/rbTree.mjs.map +0 -1
  718. package/lib/constants.d.mts.map +0 -1
  719. package/lib/constants.mjs.map +0 -1
  720. package/lib/endOfTreeSegment.d.mts.map +0 -1
  721. package/lib/endOfTreeSegment.mjs.map +0 -1
  722. package/lib/index.d.mts.map +0 -1
  723. package/lib/index.mjs.map +0 -1
  724. package/lib/localReference.d.mts.map +0 -1
  725. package/lib/localReference.mjs.map +0 -1
  726. package/lib/merge-tree-beta.d.mts +0 -668
  727. package/lib/merge-tree-public.d.mts +0 -668
  728. package/lib/mergeTree.d.mts.map +0 -1
  729. package/lib/mergeTree.mjs.map +0 -1
  730. package/lib/mergeTreeDeltaCallback.d.mts.map +0 -1
  731. package/lib/mergeTreeDeltaCallback.mjs.map +0 -1
  732. package/lib/mergeTreeNodeWalk.d.mts.map +0 -1
  733. package/lib/mergeTreeNodeWalk.mjs.map +0 -1
  734. package/lib/mergeTreeNodes.d.mts.map +0 -1
  735. package/lib/mergeTreeNodes.mjs.map +0 -1
  736. package/lib/mergeTreeTracking.d.mts.map +0 -1
  737. package/lib/mergeTreeTracking.mjs.map +0 -1
  738. package/lib/opBuilder.mjs.map +0 -1
  739. package/lib/ops.d.mts.map +0 -1
  740. package/lib/ops.mjs.map +0 -1
  741. package/lib/ordinal.d.mts.map +0 -1
  742. package/lib/ordinal.mjs.map +0 -1
  743. package/lib/partialLengths.d.mts.map +0 -1
  744. package/lib/partialLengths.mjs.map +0 -1
  745. package/lib/properties.d.mts.map +0 -1
  746. package/lib/properties.mjs.map +0 -1
  747. package/lib/referencePositions.d.mts.map +0 -1
  748. package/lib/referencePositions.mjs.map +0 -1
  749. package/lib/revertibles.d.mts.map +0 -1
  750. package/lib/revertibles.mjs.map +0 -1
  751. package/lib/segmentGroupCollection.d.mts.map +0 -1
  752. package/lib/segmentGroupCollection.mjs.map +0 -1
  753. package/lib/segmentPropertiesManager.d.mts.map +0 -1
  754. package/lib/segmentPropertiesManager.mjs.map +0 -1
  755. package/lib/snapshotChunks.d.mts.map +0 -1
  756. package/lib/snapshotChunks.mjs.map +0 -1
  757. package/lib/snapshotLoader.d.mts.map +0 -1
  758. package/lib/snapshotLoader.mjs.map +0 -1
  759. package/lib/snapshotV1.d.mts.map +0 -1
  760. package/lib/snapshotV1.mjs.map +0 -1
  761. package/lib/snapshotlegacy.d.mts.map +0 -1
  762. package/lib/snapshotlegacy.mjs.map +0 -1
  763. package/lib/sortedSegmentSet.d.mts.map +0 -1
  764. package/lib/sortedSegmentSet.mjs.map +0 -1
  765. package/lib/sortedSet.d.mts.map +0 -1
  766. package/lib/sortedSet.mjs.map +0 -1
  767. package/lib/textSegment.d.mts.map +0 -1
  768. package/lib/textSegment.mjs.map +0 -1
  769. package/lib/zamboni.d.mts.map +0 -1
  770. package/lib/zamboni.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":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,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACvB;YAED,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,GAAG,GAAG,MAAM,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC;YAExC,IAAA,4BAAgB,EAAC;gBAChB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC;gBACX,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,wBAAkB,CAAC,MAAM,EAAE,EAAE;gBACnD,SAAS,EAAE,KAAK;aAChB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { MergeTreeDeltaType } from \"../ops\";\nimport { appendToMergeTreeDeltaRevertibles, MergeTreeDeltaRevertible } from \"../revertibles\";\nimport { markRangeRemoved } from \"./testUtils\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary;\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\t// baseline summary benchmark to compare to other remove tests. such a\n\t\t// comparison should give a (rough) sense of overhead caused by summary\n\t\t// loading\n\t\ttitle: \"baseline summary load\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tawait loadSnapshot(summary);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove large range of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tfor (const length of [10, 100, 1000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: \"remove large range of large tree with undo-redo\",\n\t\t\tcategory: \"remove\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < length / 2; i++) {\n\t\t\t\t\tstr.append(\"a\", true);\n\t\t\t\t\tstr.appendMarker(true);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\t\tconst revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\tstr.on(\"delta\", (_op, delta) => {\n\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, revertibles);\n\t\t\t\t});\n\n\t\t\t\tconst op = str.removeRangeLocal(0, length - 1);\n\t\t\t\tstr.applyMsg(\n\t\t\t\t\tstr.makeOpMessage(\n\t\t\t\t\t\top,\n\t\t\t\t\t\t/* seq */ length + 1,\n\t\t\t\t\t\t/* refSeq */ length,\n\t\t\t\t\t\tstr.longClientId,\n\t\t\t\t\t\t/* minSeq */ length,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove start of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove middle of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 499,\n\t\t\t\tend: 501,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove end of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 999,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n});\n"]}
1
+ {"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,sCAA+C;AAC/C,sDAAgG;AAChG,iDAAkD;AAClD,2DAA+D;AAE/D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAO,CAAC;IAEZ,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,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,CAAC,CAAC;aACvB;YAED,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAY,EAAC,OAAO,CAAC,CAAC;YAExC,IAAA,+BAAgB,EAAC;gBAChB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,KAAK,EAAE,GAAG;gBACV,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC;gBACX,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,2BAAkB,CAAC,MAAM,EAAE,EAAE;gBACnD,SAAS,EAAE,KAAK;aAChB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { appendToMergeTreeDeltaRevertibles, MergeTreeDeltaRevertible } from \"../revertibles.js\";\nimport { markRangeRemoved } from \"./testUtils.js\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils.js\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary;\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\t// baseline summary benchmark to compare to other remove tests. such a\n\t\t// comparison should give a (rough) sense of overhead caused by summary\n\t\t// loading\n\t\ttitle: \"baseline summary load\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tawait loadSnapshot(summary);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove large range of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tfor (const length of [10, 100, 1000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: \"remove large range of large tree with undo-redo\",\n\t\t\tcategory: \"remove\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < length / 2; i++) {\n\t\t\t\t\tstr.append(\"a\", true);\n\t\t\t\t\tstr.appendMarker(true);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\t\tconst revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\tstr.on(\"delta\", (_op, delta) => {\n\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, revertibles);\n\t\t\t\t});\n\n\t\t\t\tconst op = str.removeRangeLocal(0, length - 1);\n\t\t\t\tstr.applyMsg(\n\t\t\t\t\tstr.makeOpMessage(\n\t\t\t\t\t\top,\n\t\t\t\t\t\t/* seq */ length + 1,\n\t\t\t\t\t\t/* refSeq */ length,\n\t\t\t\t\t\tstr.longClientId,\n\t\t\t\t\t\t/* minSeq */ length,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove start of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove middle of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 499,\n\t\t\t\tend: 501,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove end of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 999,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n});\n"]}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const benchmark_1 = require("@fluid-tools/benchmark");
8
- const snapshot_utils_1 = require("./snapshot.utils");
8
+ const snapshot_utils_js_1 = require("./snapshot.utils.js");
9
9
  describe("MergeTree snapshots", () => {
10
10
  let summary;
11
11
  for (const summarySize of [10, 50, 100, 500, 1000, 5000, 10000]) {
@@ -14,7 +14,7 @@ describe("MergeTree snapshots", () => {
14
14
  title: `load snapshot with ${summarySize} segments`,
15
15
  category: "snapshot loading",
16
16
  before: () => {
17
- const str = new snapshot_utils_1.TestString("id", {});
17
+ const str = new snapshot_utils_js_1.TestString("id", {});
18
18
  for (let i = 0; i < summarySize; i++) {
19
19
  str.append("a", false);
20
20
  }
@@ -22,7 +22,7 @@ describe("MergeTree snapshots", () => {
22
22
  summary = str.getSummary();
23
23
  },
24
24
  benchmarkFnAsync: async () => {
25
- await (0, snapshot_utils_1.loadSnapshot)(summary);
25
+ await (0, snapshot_utils_js_1.loadSnapshot)(summary);
26
26
  },
27
27
  after: () => {
28
28
  summary = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,qDAA4D;AAE5D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAO,CAAC;IAEZ,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAK,EAAE,KAAM,CAAC,EAAE;QAClE,IAAA,qBAAS,EAAC;YACT,IAAI,EAAE,yBAAa,CAAC,WAAW;YAC/B,KAAK,EAAE,sBAAsB,WAAW,WAAW;YACnD,QAAQ,EAAE,kBAAkB;YAC5B,MAAM,EAAE,GAAG,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;oBACrC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBACvB;gBAED,GAAG,CAAC,eAAe,EAAE,CAAC;gBACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,SAAS,CAAC;YACrB,CAAC;SACD,CAAC,CAAC;KACH;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils\";\n\ndescribe(\"MergeTree snapshots\", () => {\n\tlet summary;\n\n\tfor (const summarySize of [10, 50, 100, 500, 1000, 5_000, 10_000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: `load snapshot with ${summarySize} segments`,\n\t\t\tcategory: \"snapshot loading\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < summarySize; i++) {\n\t\t\t\t\tstr.append(\"a\", false);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tawait loadSnapshot(summary);\n\t\t\t},\n\t\t\tafter: () => {\n\t\t\t\tsummary = undefined;\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
1
+ {"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,2DAA+D;AAE/D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAO,CAAC;IAEZ,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAK,EAAE,KAAM,CAAC,EAAE;QAClE,IAAA,qBAAS,EAAC;YACT,IAAI,EAAE,yBAAa,CAAC,WAAW;YAC/B,KAAK,EAAE,sBAAsB,WAAW,WAAW;YACnD,QAAQ,EAAE,kBAAkB;YAC5B,MAAM,EAAE,GAAG,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,8BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;oBACrC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBACvB;gBAED,GAAG,CAAC,eAAe,EAAE,CAAC;gBACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAA,gCAAY,EAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,SAAS,CAAC;YACrB,CAAC;SACD,CAAC,CAAC;KACH;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils.js\";\n\ndescribe(\"MergeTree snapshots\", () => {\n\tlet summary;\n\n\tfor (const summarySize of [10, 50, 100, 500, 1000, 5_000, 10_000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: `load snapshot with ${summarySize} segments`,\n\t\t\tcategory: \"snapshot loading\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < summarySize; i++) {\n\t\t\t\t\tstr.append(\"a\", false);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tawait loadSnapshot(summary);\n\t\t\t},\n\t\t\tafter: () => {\n\t\t\t\tsummary = undefined;\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
@@ -6,10 +6,10 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const assert_1 = require("assert");
8
8
  const benchmark_1 = require("@fluid-tools/benchmark");
9
- const attributionCollection_1 = require("../attributionCollection");
10
- const textSegment_1 = require("../textSegment");
11
- const mergeTreeNodes_1 = require("../mergeTreeNodes");
12
- const collections_1 = require("../collections");
9
+ const attributionCollection_js_1 = require("../attributionCollection.js");
10
+ const textSegment_js_1 = require("../textSegment.js");
11
+ const mergeTreeNodes_js_1 = require("../mergeTreeNodes.js");
12
+ const index_js_1 = require("../collections/index.js");
13
13
  function getCollectionSizes(ctor, baseSuiteType) {
14
14
  const singleKeyCollection = new ctor(5, { type: "op", seq: 42 });
15
15
  const tenKeyCollection = new ctor(2, { type: "op", seq: 0 });
@@ -17,7 +17,7 @@ function getCollectionSizes(ctor, baseSuiteType) {
17
17
  tenKeyCollection.append(new ctor(3 * i, { type: "op", seq: i }));
18
18
  }
19
19
  const maxSizeCollection = new ctor(1, { type: "op", seq: 0 });
20
- for (let i = 1; i < textSegment_1.TextSegmentGranularity; i++) {
20
+ for (let i = 1; i < textSegment_js_1.TextSegmentGranularity; i++) {
21
21
  maxSizeCollection.append(new ctor(1, { type: "op", seq: i }));
22
22
  }
23
23
  return [
@@ -99,7 +99,7 @@ class TreeAttributionCollection {
99
99
  // eslint-disable-next-line @rushstack/no-new-null
100
100
  baseEntry) {
101
101
  this._length = _length;
102
- this.entries = new collections_1.RedBlackTree(mergeTreeNodes_1.compareNumbers);
102
+ this.entries = new index_js_1.RedBlackTree(mergeTreeNodes_js_1.compareNumbers);
103
103
  if (baseEntry !== undefined) {
104
104
  this.entries.put(0, baseEntry);
105
105
  }
@@ -135,7 +135,7 @@ class TreeAttributionCollection {
135
135
  append(other) {
136
136
  const lastEntry = this.getAtOffset(this.length - 1);
137
137
  other.entries.map(({ key, data }) => {
138
- if (key !== 0 || !(0, attributionCollection_1.areEqualAttributionKeys)(lastEntry, data)) {
138
+ if (key !== 0 || !(0, attributionCollection_js_1.areEqualAttributionKeys)(lastEntry, data)) {
139
139
  this.entries.put(key + this.length, data);
140
140
  }
141
141
  return true;
@@ -199,7 +199,7 @@ class TreeAttributionCollection {
199
199
  segmentsWithAttribution++;
200
200
  for (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {
201
201
  if (mostRecentAttributionKey === undefined ||
202
- !(0, attributionCollection_1.areEqualAttributionKeys)(info, mostRecentAttributionKey)) {
202
+ !(0, attributionCollection_js_1.areEqualAttributionKeys)(info, mostRecentAttributionKey)) {
203
203
  posBreakpoints.push(offset + cumulativePos);
204
204
  seqs.push(!info ? null : info.type === "op" ? info.seq : info);
205
205
  }
@@ -225,7 +225,7 @@ describe("IAttributionCollection perf", () => {
225
225
  runAttributionCollectionSuite(TreeAttributionCollection, benchmark_1.BenchmarkType.Diagnostic);
226
226
  });
227
227
  describe("list-based implementation", () => {
228
- runAttributionCollectionSuite(attributionCollection_1.AttributionCollection, benchmark_1.BenchmarkType.Measurement);
228
+ runAttributionCollectionSuite(attributionCollection_js_1.AttributionCollection, benchmark_1.BenchmarkType.Measurement);
229
229
  });
230
230
  });
231
231
  //# sourceMappingURL=attributionCollection.perf.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources":["../../src/test/attributionCollection.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,mCAA0C;AAC1C,sDAAkE;AAElE,oEAMkC;AAClC,gDAAwD;AACxD,sDAA6D;AAC7D,gDAA8C;AAkB9C,SAAS,kBAAkB,CAC1B,IAAgC,EAChC,aAA4B;IAM5B,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAA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AqB,EAAE,GAAG,EAAE;QACpC,6BAA6B,CAAC,yBAAyB,EAAE,yBAAa,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,6BAA6B,CAAC,6CAAwB,EAAE,yBAAa,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport {\n\tareEqualAttributionKeys,\n\tAttributionCollection as NewAttributionCollection,\n\tIAttributionCollection,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection\";\nimport { TextSegmentGranularity } from \"../textSegment\";\nimport { compareNumbers, ISegment } from \"../mergeTreeNodes\";\nimport { RedBlackTree } from \"../collections\";\n\ninterface IAttributionCollectionCtor {\n\tnew (length: number, key?: AttributionKey): IAttributionCollection<AttributionKey>;\n\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\nfunction getCollectionSizes(\n\tctor: IAttributionCollectionCtor,\n\tbaseSuiteType: BenchmarkType,\n): {\n\tname: string;\n\tcollection: IAttributionCollection<AttributionKey>;\n\ttype: BenchmarkType;\n}[] {\n\tconst singleKeyCollection = new ctor(5, { type: \"op\", seq: 42 });\n\tconst tenKeyCollection = new ctor(2, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < 10; i++) {\n\t\ttenKeyCollection.append(new ctor(3 * i, { type: \"op\", seq: i }));\n\t}\n\tconst maxSizeCollection = new ctor(1, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < TextSegmentGranularity; i++) {\n\t\tmaxSizeCollection.append(new ctor(1, { type: \"op\", seq: i }));\n\t}\n\treturn [\n\t\t{ name: \"one key\", collection: singleKeyCollection, type: BenchmarkType.Diagnostic },\n\t\t{ name: \"ten keys\", collection: tenKeyCollection, type: baseSuiteType },\n\t\t{ name: \"maximum keys\", collection: maxSizeCollection, type: BenchmarkType.Diagnostic },\n\t];\n}\n\nfunction runAttributionCollectionSuite(\n\tctor: IAttributionCollectionCtor,\n\tsuiteBaseType: BenchmarkType,\n): void {\n\tconst collectionTestCases = getCollectionSizes(ctor, suiteBaseType);\n\tfor (const { name, collection, type } of collectionTestCases) {\n\t\tdescribe(`using a collection with ${name}`, () => {\n\t\t\tconst { length } = collection;\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the start\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the end\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length - 1),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset in the middle\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length / 2),\n\t\t\t\ttype: BenchmarkType.Diagnostic,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAll\",\n\t\t\t\tbenchmarkFn: () => collection.getAll(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"clone\",\n\t\t\t\tbenchmarkFn: () => collection.clone(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"split + append in the middle\",\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\tconst split = collection.splitAt(length / 2);\n\t\t\t\t\tcollection.append(split);\n\t\t\t\t},\n\t\t\t\ttype,\n\t\t\t});\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttitle: \"construction\",\n\t\tbenchmarkFn: () => new ctor(42, { type: \"op\", seq: 5 }),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst segmentsToSerialize = collectionTestCases.map(({ collection }) => ({\n\t\tattribution: collection,\n\t\tcachedLength: collection.length,\n\t}));\n\n\tbenchmark({\n\t\ttitle: \"serializing\",\n\t\tbenchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst summary = ctor.serializeAttributionCollections(segmentsToSerialize);\n\tconst segments: ISegment[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) } as any);\n\tbenchmark({\n\t\ttitle: \"deserialize into 10 segments\",\n\t\tbenchmarkFn: () => {\n\t\t\tctor.populateAttributionCollections(segments, summary);\n\t\t},\n\t\ttype: suiteBaseType,\n\t});\n}\n\n// Note: channel functionality is left unimplemented.\nclass TreeAttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate readonly entries: RedBlackTree<number, AttributionKey | null> = new RedBlackTree(\n\t\tcompareNumbers,\n\t);\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.entries.put(0, baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames() {\n\t\treturn [];\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey | undefined {\n\t\tassert(offset >= 0 && offset < this._length, \"Requested offset should be valid\");\n\t\tconst node = this.entries.floor(offset);\n\t\tassert(node !== undefined, \"Collection should have at least one entry\");\n\t\treturn node.data ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): TreeAttributionCollection {\n\t\tconst splitBaseEntry = this.getAtOffset(pos);\n\t\tconst splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);\n\t\tfor (\n\t\t\tlet current = this.entries.ceil(pos);\n\t\t\tcurrent !== undefined;\n\t\t\tcurrent = this.entries.ceil(pos)\n\t\t) {\n\t\t\t// If there happened to be an attribution change at exactly pos, it's already set in the base entry\n\t\t\tif (current.key !== pos) {\n\t\t\t\tsplitCollection.entries.put(current.key - pos, current.data);\n\t\t\t}\n\t\t\tthis.entries.remove(current.key);\n\t\t}\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: TreeAttributionCollection): void {\n\t\tconst lastEntry = this.getAtOffset(this.length - 1);\n\t\tother.entries.map(({ key, data }) => {\n\t\t\tif (key !== 0 || !areEqualAttributionKeys(lastEntry, data)) {\n\t\t\t\tthis.entries.put(key + this.length, data);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\tconst results: { offset: number; key: AttributionKey | null }[] = [];\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tresults.push({ offset: key, key: data });\n\t\t\treturn true;\n\t\t});\n\t\treturn { root: results, length: this.length };\n\t}\n\n\tpublic clone(): TreeAttributionCollection {\n\t\tconst copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tcopy.entries.put(key, data);\n\t\t\treturn true;\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { seqs, posBreakpoints } = summary;\n\t\tassert(\n\t\t\tseqs.length === posBreakpoints.length && seqs.length > 0,\n\t\t\t\"Invalid attribution summary blob provided\",\n\t\t);\n\t\tlet curIndex = 0;\n\t\tlet cumulativeSegPos = 0;\n\t\tlet currentInfo = seqs[curIndex];\n\t\tconst getCurrentKey = () =>\n\t\t\ttypeof currentInfo === \"object\"\n\t\t\t\t? currentInfo\n\t\t\t\t: ({ type: \"op\", seq: currentInfo } as const);\n\n\t\tfor (const segment of segments) {\n\t\t\tconst attribution = new TreeAttributionCollection(\n\t\t\t\tsegment.cachedLength,\n\t\t\t\tgetCurrentKey(),\n\t\t\t);\n\t\t\twhile (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\tcurrentInfo = seqs[curIndex];\n\t\t\t\tattribution.entries.put(\n\t\t\t\t\tposBreakpoints[curIndex] - cumulativeSegPos,\n\t\t\t\t\tgetCurrentKey(),\n\t\t\t\t);\n\t\t\t\tcurIndex++;\n\t\t\t}\n\n\t\t\tsegment.attribution = attribution;\n\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t}\n\t}\n\n\tpublic update(): void {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst posBreakpoints: number[] = [];\n\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\tlet cumulativePos = 0;\n\n\t\tlet segmentsWithAttribution = 0;\n\t\tlet segmentsWithoutAttribution = 0;\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.attribution) {\n\t\t\t\tsegmentsWithAttribution++;\n\t\t\t\tfor (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(info, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\tseqs.push(!info ? null : info.type === \"op\" ? info.seq : info);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = info;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentsWithoutAttribution++;\n\t\t\t}\n\n\t\t\tcumulativePos += segment.cachedLength;\n\t\t}\n\n\t\tassert(\n\t\t\tsegmentsWithAttribution === 0 || segmentsWithoutAttribution === 0,\n\t\t\t\"Expected either all segments or no segments to have attribution information.\",\n\t\t);\n\n\t\tconst blobContents: SerializedAttributionCollection = {\n\t\t\tseqs,\n\t\t\tposBreakpoints,\n\t\t\tlength: cumulativePos,\n\t\t};\n\t\treturn blobContents;\n\t}\n}\n\ndescribe(\"IAttributionCollection perf\", () => {\n\tdescribe(\"tree implementation\", () => {\n\t\trunAttributionCollectionSuite(TreeAttributionCollection, BenchmarkType.Diagnostic);\n\t});\n\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
1
+ {"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources":["../../src/test/attributionCollection.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,mCAA0C;AAC1C,sDAAkE;AAElE,0EAMqC;AACrC,sDAA2D;AAC3D,4DAAgE;AAChE,sDAAuD;AAkBvD,SAAS,kBAAkB,CAC1B,IAAgC,EAChC,aAA4B;IAM5B,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,IAAI,IAA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I;YACJ,cAAc;YACd,MAAM,EAAE,aAAa;SACrB,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpC,6BAA6B,CAAC,yBAAyB,EAAE,yBAAa,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,6BAA6B,CAAC,gDAAwB,EAAE,yBAAa,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport {\n\tareEqualAttributionKeys,\n\tAttributionCollection as NewAttributionCollection,\n\tIAttributionCollection,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection.js\";\nimport { TextSegmentGranularity } from \"../textSegment.js\";\nimport { compareNumbers, ISegment } from \"../mergeTreeNodes.js\";\nimport { RedBlackTree } from \"../collections/index.js\";\n\ninterface IAttributionCollectionCtor {\n\tnew (length: number, key?: AttributionKey): IAttributionCollection<AttributionKey>;\n\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\nfunction getCollectionSizes(\n\tctor: IAttributionCollectionCtor,\n\tbaseSuiteType: BenchmarkType,\n): {\n\tname: string;\n\tcollection: IAttributionCollection<AttributionKey>;\n\ttype: BenchmarkType;\n}[] {\n\tconst singleKeyCollection = new ctor(5, { type: \"op\", seq: 42 });\n\tconst tenKeyCollection = new ctor(2, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < 10; i++) {\n\t\ttenKeyCollection.append(new ctor(3 * i, { type: \"op\", seq: i }));\n\t}\n\tconst maxSizeCollection = new ctor(1, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < TextSegmentGranularity; i++) {\n\t\tmaxSizeCollection.append(new ctor(1, { type: \"op\", seq: i }));\n\t}\n\treturn [\n\t\t{ name: \"one key\", collection: singleKeyCollection, type: BenchmarkType.Diagnostic },\n\t\t{ name: \"ten keys\", collection: tenKeyCollection, type: baseSuiteType },\n\t\t{ name: \"maximum keys\", collection: maxSizeCollection, type: BenchmarkType.Diagnostic },\n\t];\n}\n\nfunction runAttributionCollectionSuite(\n\tctor: IAttributionCollectionCtor,\n\tsuiteBaseType: BenchmarkType,\n): void {\n\tconst collectionTestCases = getCollectionSizes(ctor, suiteBaseType);\n\tfor (const { name, collection, type } of collectionTestCases) {\n\t\tdescribe(`using a collection with ${name}`, () => {\n\t\t\tconst { length } = collection;\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the start\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the end\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length - 1),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset in the middle\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length / 2),\n\t\t\t\ttype: BenchmarkType.Diagnostic,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAll\",\n\t\t\t\tbenchmarkFn: () => collection.getAll(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"clone\",\n\t\t\t\tbenchmarkFn: () => collection.clone(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"split + append in the middle\",\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\tconst split = collection.splitAt(length / 2);\n\t\t\t\t\tcollection.append(split);\n\t\t\t\t},\n\t\t\t\ttype,\n\t\t\t});\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttitle: \"construction\",\n\t\tbenchmarkFn: () => new ctor(42, { type: \"op\", seq: 5 }),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst segmentsToSerialize = collectionTestCases.map(({ collection }) => ({\n\t\tattribution: collection,\n\t\tcachedLength: collection.length,\n\t}));\n\n\tbenchmark({\n\t\ttitle: \"serializing\",\n\t\tbenchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst summary = ctor.serializeAttributionCollections(segmentsToSerialize);\n\tconst segments: ISegment[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) } as any);\n\tbenchmark({\n\t\ttitle: \"deserialize into 10 segments\",\n\t\tbenchmarkFn: () => {\n\t\t\tctor.populateAttributionCollections(segments, summary);\n\t\t},\n\t\ttype: suiteBaseType,\n\t});\n}\n\n// Note: channel functionality is left unimplemented.\nclass TreeAttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate readonly entries: RedBlackTree<number, AttributionKey | null> = new RedBlackTree(\n\t\tcompareNumbers,\n\t);\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.entries.put(0, baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames() {\n\t\treturn [];\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey | undefined {\n\t\tassert(offset >= 0 && offset < this._length, \"Requested offset should be valid\");\n\t\tconst node = this.entries.floor(offset);\n\t\tassert(node !== undefined, \"Collection should have at least one entry\");\n\t\treturn node.data ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): TreeAttributionCollection {\n\t\tconst splitBaseEntry = this.getAtOffset(pos);\n\t\tconst splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);\n\t\tfor (\n\t\t\tlet current = this.entries.ceil(pos);\n\t\t\tcurrent !== undefined;\n\t\t\tcurrent = this.entries.ceil(pos)\n\t\t) {\n\t\t\t// If there happened to be an attribution change at exactly pos, it's already set in the base entry\n\t\t\tif (current.key !== pos) {\n\t\t\t\tsplitCollection.entries.put(current.key - pos, current.data);\n\t\t\t}\n\t\t\tthis.entries.remove(current.key);\n\t\t}\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: TreeAttributionCollection): void {\n\t\tconst lastEntry = this.getAtOffset(this.length - 1);\n\t\tother.entries.map(({ key, data }) => {\n\t\t\tif (key !== 0 || !areEqualAttributionKeys(lastEntry, data)) {\n\t\t\t\tthis.entries.put(key + this.length, data);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\tconst results: { offset: number; key: AttributionKey | null }[] = [];\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tresults.push({ offset: key, key: data });\n\t\t\treturn true;\n\t\t});\n\t\treturn { root: results, length: this.length };\n\t}\n\n\tpublic clone(): TreeAttributionCollection {\n\t\tconst copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tcopy.entries.put(key, data);\n\t\t\treturn true;\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { seqs, posBreakpoints } = summary;\n\t\tassert(\n\t\t\tseqs.length === posBreakpoints.length && seqs.length > 0,\n\t\t\t\"Invalid attribution summary blob provided\",\n\t\t);\n\t\tlet curIndex = 0;\n\t\tlet cumulativeSegPos = 0;\n\t\tlet currentInfo = seqs[curIndex];\n\t\tconst getCurrentKey = () =>\n\t\t\ttypeof currentInfo === \"object\"\n\t\t\t\t? currentInfo\n\t\t\t\t: ({ type: \"op\", seq: currentInfo } as const);\n\n\t\tfor (const segment of segments) {\n\t\t\tconst attribution = new TreeAttributionCollection(\n\t\t\t\tsegment.cachedLength,\n\t\t\t\tgetCurrentKey(),\n\t\t\t);\n\t\t\twhile (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\tcurrentInfo = seqs[curIndex];\n\t\t\t\tattribution.entries.put(\n\t\t\t\t\tposBreakpoints[curIndex] - cumulativeSegPos,\n\t\t\t\t\tgetCurrentKey(),\n\t\t\t\t);\n\t\t\t\tcurIndex++;\n\t\t\t}\n\n\t\t\tsegment.attribution = attribution;\n\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t}\n\t}\n\n\tpublic update(): void {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst posBreakpoints: number[] = [];\n\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\tlet cumulativePos = 0;\n\n\t\tlet segmentsWithAttribution = 0;\n\t\tlet segmentsWithoutAttribution = 0;\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.attribution) {\n\t\t\t\tsegmentsWithAttribution++;\n\t\t\t\tfor (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(info, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\tseqs.push(!info ? null : info.type === \"op\" ? info.seq : info);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = info;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentsWithoutAttribution++;\n\t\t\t}\n\n\t\t\tcumulativePos += segment.cachedLength;\n\t\t}\n\n\t\tassert(\n\t\t\tsegmentsWithAttribution === 0 || segmentsWithoutAttribution === 0,\n\t\t\t\"Expected either all segments or no segments to have attribution information.\",\n\t\t);\n\n\t\tconst blobContents: SerializedAttributionCollection = {\n\t\t\tseqs,\n\t\t\tposBreakpoints,\n\t\t\tlength: cumulativePos,\n\t\t};\n\t\treturn blobContents;\n\t}\n}\n\ndescribe(\"IAttributionCollection perf\", () => {\n\tdescribe(\"tree implementation\", () => {\n\t\trunAttributionCollectionSuite(TreeAttributionCollection, BenchmarkType.Diagnostic);\n\t});\n\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
@@ -6,19 +6,19 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const assert_1 = require("assert");
8
8
  const stochastic_test_utils_1 = require("@fluid-private/stochastic-test-utils");
9
- const attributionCollection_1 = require("../attributionCollection");
10
- const mergeTreeNodes_1 = require("../mergeTreeNodes");
9
+ const attributionCollection_js_1 = require("../attributionCollection.js");
10
+ const mergeTreeNodes_js_1 = require("../mergeTreeNodes.js");
11
11
  const opKey = (seq) => ({ type: "op", seq });
12
12
  const detachedKey = { type: "detached", id: 0 };
13
13
  describe("AttributionCollection", () => {
14
14
  const makeCollectionWithChannel = ({ length, seq }) => {
15
- const collection = new attributionCollection_1.AttributionCollection(length, null);
16
- collection.update("foo", new attributionCollection_1.AttributionCollection(length, opKey(seq)));
15
+ const collection = new attributionCollection_js_1.AttributionCollection(length, null);
16
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(length, opKey(seq)));
17
17
  return collection;
18
18
  };
19
19
  describe(".getAtOffset", () => {
20
20
  describe("on a collection with a single entry", () => {
21
- const collection = new attributionCollection_1.AttributionCollection(5, opKey(100));
21
+ const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
22
22
  it("returns the entry for offsets within the length range", () => {
23
23
  for (let i = 0; i < 5; i++) {
24
24
  assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
@@ -30,8 +30,8 @@ describe("AttributionCollection", () => {
30
30
  });
31
31
  });
32
32
  describe("on a collection with multiple entries", () => {
33
- const collection = new attributionCollection_1.AttributionCollection(3, opKey(100));
34
- collection.append(new attributionCollection_1.AttributionCollection(5, opKey(101)));
33
+ const collection = new attributionCollection_js_1.AttributionCollection(3, opKey(100));
34
+ collection.append(new attributionCollection_js_1.AttributionCollection(5, opKey(101)));
35
35
  it("returns the correct entries", () => {
36
36
  for (let i = 0; i < 3; i++) {
37
37
  assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
@@ -52,9 +52,9 @@ describe("AttributionCollection", () => {
52
52
  describe("on a collection with 3 entries", () => {
53
53
  let collection;
54
54
  beforeEach(() => {
55
- collection = new attributionCollection_1.AttributionCollection(3, opKey(100));
56
- collection.append(new attributionCollection_1.AttributionCollection(2, opKey(101)));
57
- collection.append(new attributionCollection_1.AttributionCollection(1, opKey(102)));
55
+ collection = new attributionCollection_js_1.AttributionCollection(3, opKey(100));
56
+ collection.append(new attributionCollection_js_1.AttributionCollection(2, opKey(101)));
57
+ collection.append(new attributionCollection_js_1.AttributionCollection(1, opKey(102)));
58
58
  });
59
59
  it("can split on non-breakpoints", () => {
60
60
  const splitCollection = collection.splitAt(4);
@@ -81,7 +81,7 @@ describe("AttributionCollection", () => {
81
81
  });
82
82
  });
83
83
  it("can split collection with a single value", () => {
84
- const collection = new attributionCollection_1.AttributionCollection(5, opKey(100));
84
+ const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
85
85
  const splitCollection = collection.splitAt(3);
86
86
  assert_1.strict.equal(collection.length, 3);
87
87
  assert_1.strict.equal(splitCollection.length, 2);
@@ -89,8 +89,8 @@ describe("AttributionCollection", () => {
89
89
  assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(100) }]);
90
90
  });
91
91
  it("splits channels", () => {
92
- const collection = new attributionCollection_1.AttributionCollection(5, null);
93
- collection.update("foo", new attributionCollection_1.AttributionCollection(5, opKey(100)));
92
+ const collection = new attributionCollection_js_1.AttributionCollection(5, null);
93
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(5, opKey(100)));
94
94
  const splitCollection = collection.splitAt(2);
95
95
  assert_1.strict.deepEqual(collection.getAll().channels, {
96
96
  foo: [{ offset: 0, key: opKey(100) }],
@@ -102,24 +102,24 @@ describe("AttributionCollection", () => {
102
102
  });
103
103
  describe(".append", () => {
104
104
  it("modifies the receiving collection", () => {
105
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
105
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
106
106
  assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
107
- collection.append(new attributionCollection_1.AttributionCollection(1, opKey(101)));
107
+ collection.append(new attributionCollection_js_1.AttributionCollection(1, opKey(101)));
108
108
  assert_1.strict.deepEqual(collection.getAll().root, [
109
109
  { offset: 0, key: opKey(100) },
110
110
  { offset: 2, key: opKey(101) },
111
111
  ]);
112
112
  });
113
113
  it("does not modify the argument collection", () => {
114
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
115
- const appendedCollection = new attributionCollection_1.AttributionCollection(1, opKey(101));
114
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
115
+ const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
116
116
  assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
117
117
  collection.append(appendedCollection);
118
118
  assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
119
119
  });
120
120
  it("coalesces referentially equal values at the join point", () => {
121
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
122
- collection.append(new attributionCollection_1.AttributionCollection(7, opKey(100)));
121
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
122
+ collection.append(new attributionCollection_js_1.AttributionCollection(7, opKey(100)));
123
123
  assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
124
124
  assert_1.strict.equal(collection.length, 9);
125
125
  });
@@ -145,7 +145,7 @@ describe("AttributionCollection", () => {
145
145
  });
146
146
  });
147
147
  it("when only appended collection has a channel", () => {
148
- const appender = new attributionCollection_1.AttributionCollection(2, null);
148
+ const appender = new attributionCollection_js_1.AttributionCollection(2, null);
149
149
  appender.append(makeCollectionWithChannel({ length: 5, seq: 200 }));
150
150
  assert_1.strict.deepEqual(appender.getAll(), {
151
151
  length: 7,
@@ -166,7 +166,7 @@ describe("AttributionCollection", () => {
166
166
  });
167
167
  it("when only segment being appended to has a channel", () => {
168
168
  const appender = makeCollectionWithChannel({ length: 2, seq: 100 });
169
- appender.append(new attributionCollection_1.AttributionCollection(5, null));
169
+ appender.append(new attributionCollection_js_1.AttributionCollection(5, null));
170
170
  assert_1.strict.deepEqual(appender.getAll(), {
171
171
  length: 7,
172
172
  root: [{ offset: 0, key: null }],
@@ -188,20 +188,20 @@ describe("AttributionCollection", () => {
188
188
  });
189
189
  describe(".channelNames", () => {
190
190
  it("is empty when collection has no channels", () => {
191
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
191
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
192
192
  assert_1.strict.deepEqual(collection.channelNames, []);
193
193
  });
194
194
  it("returns all channels with content for collection with channels", () => {
195
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
196
- collection.update("foo", new attributionCollection_1.AttributionCollection(2));
197
- collection.update("bar", new attributionCollection_1.AttributionCollection(2));
195
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
196
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(2));
197
+ collection.update("bar", new attributionCollection_js_1.AttributionCollection(2));
198
198
  assert_1.strict.deepEqual(collection.channelNames, ["foo", "bar"]);
199
199
  });
200
200
  });
201
201
  describe(".populateAttributionCollections", () => {
202
202
  it("correctly splits segment boundaries on breakpoints", () => {
203
203
  const segments = [{ cachedLength: 5 }, { cachedLength: 4 }];
204
- attributionCollection_1.AttributionCollection.populateAttributionCollections(segments, {
204
+ attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, {
205
205
  length: 9,
206
206
  posBreakpoints: [0, 2, 5, 7],
207
207
  seqs: [10, 12, 15, 17],
@@ -220,7 +220,7 @@ describe("AttributionCollection", () => {
220
220
  });
221
221
  it("correctly splits segment boundaries between breakpoints", () => {
222
222
  const segments = [{ cachedLength: 4 }, { cachedLength: 5 }];
223
- attributionCollection_1.AttributionCollection.populateAttributionCollections(segments, {
223
+ attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, {
224
224
  length: 9,
225
225
  posBreakpoints: [0, 2, 5, 7],
226
226
  seqs: [10, 12, 15, 17],
@@ -243,15 +243,15 @@ describe("AttributionCollection", () => {
243
243
  it("combines equal values on endpoints", () => {
244
244
  const segments = [
245
245
  {
246
- attribution: new attributionCollection_1.AttributionCollection(4, opKey(0)),
246
+ attribution: new attributionCollection_js_1.AttributionCollection(4, opKey(0)),
247
247
  cachedLength: 4,
248
248
  },
249
249
  {
250
- attribution: new attributionCollection_1.AttributionCollection(5, opKey(0)),
250
+ attribution: new attributionCollection_js_1.AttributionCollection(5, opKey(0)),
251
251
  cachedLength: 5,
252
252
  },
253
253
  ];
254
- const blob = attributionCollection_1.AttributionCollection.serializeAttributionCollections(segments);
254
+ const blob = attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments);
255
255
  assert_1.strict.deepEqual(blob, {
256
256
  posBreakpoints: [0],
257
257
  seqs: [0],
@@ -326,15 +326,15 @@ describe("AttributionCollection", () => {
326
326
  ];
327
327
  for (const { name, blob, segments } of testCases) {
328
328
  it(name, () => {
329
- attributionCollection_1.AttributionCollection.populateAttributionCollections(segments, blob);
330
- assert_1.strict.deepEqual(attributionCollection_1.AttributionCollection.serializeAttributionCollections(segments), blob);
329
+ attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, blob);
330
+ assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments), blob);
331
331
  });
332
332
  }
333
333
  });
334
334
  describe(".clone", () => {
335
335
  it("copies the original collection", () => {
336
- const collection = new attributionCollection_1.AttributionCollection(2, opKey(100));
337
- const appendedCollection = new attributionCollection_1.AttributionCollection(1, opKey(101));
336
+ const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
337
+ const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
338
338
  const copy = collection.clone();
339
339
  collection.append(appendedCollection);
340
340
  assert_1.strict.deepEqual(collection.getAll().root, [
@@ -358,32 +358,32 @@ describe("AttributionCollection", () => {
358
358
  describe(".update", () => {
359
359
  let collection;
360
360
  beforeEach(() => {
361
- collection = new attributionCollection_1.AttributionCollection(2, null);
362
- collection.update("bar", new attributionCollection_1.AttributionCollection(2, opKey(10)));
361
+ collection = new attributionCollection_js_1.AttributionCollection(2, null);
362
+ collection.update("bar", new attributionCollection_js_1.AttributionCollection(2, opKey(10)));
363
363
  assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), undefined, "channel should be undefined on creation");
364
364
  });
365
365
  afterEach(() => {
366
366
  assert_1.strict.deepEqual(collection.getAtOffset(0, "bar"), opKey(10), "update should never modify unrelated channels");
367
367
  });
368
368
  it("creates a new channel when updating from an undefined state", () => {
369
- collection.update("foo", new attributionCollection_1.AttributionCollection(2, opKey(5)));
369
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
370
370
  assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
371
371
  });
372
372
  it("overrides earlier calls with later ones", () => {
373
- collection.update("foo", new attributionCollection_1.AttributionCollection(2, opKey(3)));
374
- collection.update("foo", new attributionCollection_1.AttributionCollection(2, opKey(5)));
373
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
374
+ collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
375
375
  assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
376
376
  });
377
377
  it("can update the root channel", () => {
378
- collection.update(undefined, new attributionCollection_1.AttributionCollection(2, opKey(3)));
378
+ collection.update(undefined, new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
379
379
  assert_1.strict.deepEqual(collection.getAtOffset(0), opKey(3));
380
380
  });
381
381
  it("doesn't tolerate updates to channels having inconsistent length fields", () => {
382
- assert_1.strict.throws(() => collection.update("foo", new attributionCollection_1.AttributionCollection(3, null)));
382
+ assert_1.strict.throws(() => collection.update("foo", new attributionCollection_js_1.AttributionCollection(3, null)));
383
383
  });
384
384
  });
385
385
  describe("serialized structure is independent of segment lengths", () => {
386
- class Segment extends mergeTreeNodes_1.BaseSegment {
386
+ class Segment extends mergeTreeNodes_js_1.BaseSegment {
387
387
  constructor(length) {
388
388
  super();
389
389
  this.type = "testSeg";
@@ -416,11 +416,11 @@ describe("AttributionCollection", () => {
416
416
  const channelNamePool = ["ch1", "ch2", "ch3"];
417
417
  const insertGenerator = (0, stochastic_test_utils_1.take)(segmentCount, ({ random }) => {
418
418
  const length = random.integer(1, 20);
419
- const collection = new attributionCollection_1.AttributionCollection(length, generateAttributionKey(random));
419
+ const collection = new attributionCollection_js_1.AttributionCollection(length, generateAttributionKey(random));
420
420
  if (random.bool(0.25)) {
421
421
  for (const channel of channelNamePool) {
422
422
  if (random.bool()) {
423
- collection.update(channel, new attributionCollection_1.AttributionCollection(length, generateAttributionKey(random)));
423
+ collection.update(channel, new attributionCollection_js_1.AttributionCollection(length, generateAttributionKey(random)));
424
424
  }
425
425
  }
426
426
  }
@@ -438,7 +438,7 @@ describe("AttributionCollection", () => {
438
438
  return state;
439
439
  },
440
440
  }, { random: (0, stochastic_test_utils_1.makeRandom)(seed), segments: [] });
441
- const expected = attributionCollection_1.AttributionCollection.serializeAttributionCollections(initialState.segments);
441
+ const expected = attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(initialState.segments);
442
442
  const split = ({ segments, random }) => {
443
443
  const validIndices = segments
444
444
  .map((seg, i) => (seg.cachedLength > 1 ? i : -1))
@@ -478,7 +478,7 @@ describe("AttributionCollection", () => {
478
478
  return state;
479
479
  },
480
480
  }, initialState);
481
- assert_1.strict.deepEqual(attributionCollection_1.AttributionCollection.serializeAttributionCollections(finalState.segments), expected);
481
+ assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(finalState.segments), expected);
482
482
  });
483
483
  }
484
484
  });