@fluidframework/merge-tree 2.1.0-276985 → 2.1.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 (524) hide show
  1. package/.eslintrc.cjs +2 -4
  2. package/CHANGELOG.md +15 -0
  3. package/README.md +109 -1
  4. package/api-extractor/api-extractor.current.json +5 -0
  5. package/api-extractor/api-extractor.legacy.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/merge-tree.legacy.alpha.api.md +10 -22
  8. package/api-report/merge-tree.legacy.public.api.md +9 -0
  9. package/dist/MergeTreeTextHelper.d.ts.map +1 -1
  10. package/dist/MergeTreeTextHelper.js +1 -1
  11. package/dist/MergeTreeTextHelper.js.map +1 -1
  12. package/dist/attributionCollection.d.ts.map +1 -1
  13. package/dist/attributionCollection.js +65 -17
  14. package/dist/attributionCollection.js.map +1 -1
  15. package/dist/attributionPolicy.d.ts +2 -1
  16. package/dist/attributionPolicy.d.ts.map +1 -1
  17. package/dist/attributionPolicy.js +10 -3
  18. package/dist/attributionPolicy.js.map +1 -1
  19. package/dist/client.d.ts +3 -1
  20. package/dist/client.d.ts.map +1 -1
  21. package/dist/client.js +65 -37
  22. package/dist/client.js.map +1 -1
  23. package/dist/collections/list.d.ts.map +1 -1
  24. package/dist/collections/list.js +5 -2
  25. package/dist/collections/list.js.map +1 -1
  26. package/dist/collections/rbTree.d.ts +2 -2
  27. package/dist/collections/rbTree.d.ts.map +1 -1
  28. package/dist/collections/rbTree.js +23 -35
  29. package/dist/collections/rbTree.js.map +1 -1
  30. package/dist/endOfTreeSegment.d.ts.map +1 -1
  31. package/dist/endOfTreeSegment.js +4 -1
  32. package/dist/endOfTreeSegment.js.map +1 -1
  33. package/dist/legacy.d.ts +1 -1
  34. package/dist/localReference.d.ts +16 -6
  35. package/dist/localReference.d.ts.map +1 -1
  36. package/dist/localReference.js +31 -20
  37. package/dist/localReference.js.map +1 -1
  38. package/dist/mergeTree.d.ts +0 -1
  39. package/dist/mergeTree.d.ts.map +1 -1
  40. package/dist/mergeTree.js +127 -112
  41. package/dist/mergeTree.js.map +1 -1
  42. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  43. package/dist/mergeTreeNodeWalk.js +1 -1
  44. package/dist/mergeTreeNodeWalk.js.map +1 -1
  45. package/dist/mergeTreeNodes.d.ts +6 -5
  46. package/dist/mergeTreeNodes.d.ts.map +1 -1
  47. package/dist/mergeTreeNodes.js +29 -20
  48. package/dist/mergeTreeNodes.js.map +1 -1
  49. package/dist/mergeTreeTracking.js +3 -3
  50. package/dist/mergeTreeTracking.js.map +1 -1
  51. package/dist/opBuilder.d.ts +6 -1
  52. package/dist/opBuilder.d.ts.map +1 -1
  53. package/dist/opBuilder.js +5 -0
  54. package/dist/opBuilder.js.map +1 -1
  55. package/dist/ops.d.ts.map +1 -1
  56. package/dist/ops.js.map +1 -1
  57. package/dist/ordinal.d.ts.map +1 -1
  58. package/dist/ordinal.js +7 -0
  59. package/dist/ordinal.js.map +1 -1
  60. package/dist/partialLengths.d.ts +4 -2
  61. package/dist/partialLengths.d.ts.map +1 -1
  62. package/dist/partialLengths.js +101 -53
  63. package/dist/partialLengths.js.map +1 -1
  64. package/dist/perspective.d.ts +4 -1
  65. package/dist/perspective.d.ts.map +1 -1
  66. package/dist/perspective.js +7 -6
  67. package/dist/perspective.js.map +1 -1
  68. package/dist/properties.d.ts +13 -10
  69. package/dist/properties.d.ts.map +1 -1
  70. package/dist/properties.js +22 -11
  71. package/dist/properties.js.map +1 -1
  72. package/dist/public.d.ts +1 -1
  73. package/dist/referencePositions.d.ts +7 -0
  74. package/dist/referencePositions.d.ts.map +1 -1
  75. package/dist/referencePositions.js +7 -0
  76. package/dist/referencePositions.js.map +1 -1
  77. package/dist/revertibles.d.ts +6 -0
  78. package/dist/revertibles.d.ts.map +1 -1
  79. package/dist/revertibles.js +50 -21
  80. package/dist/revertibles.js.map +1 -1
  81. package/dist/segmentGroupCollection.d.ts.map +1 -1
  82. package/dist/segmentGroupCollection.js +2 -0
  83. package/dist/segmentGroupCollection.js.map +1 -1
  84. package/dist/segmentPropertiesManager.d.ts +7 -3
  85. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  86. package/dist/segmentPropertiesManager.js +20 -15
  87. package/dist/segmentPropertiesManager.js.map +1 -1
  88. package/dist/snapshotChunks.d.ts.map +1 -1
  89. package/dist/snapshotChunks.js +10 -5
  90. package/dist/snapshotChunks.js.map +1 -1
  91. package/dist/snapshotLoader.d.ts.map +1 -1
  92. package/dist/snapshotLoader.js +14 -10
  93. package/dist/snapshotLoader.js.map +1 -1
  94. package/dist/snapshotV1.d.ts.map +1 -1
  95. package/dist/snapshotV1.js +20 -8
  96. package/dist/snapshotV1.js.map +1 -1
  97. package/dist/snapshotlegacy.d.ts.map +1 -1
  98. package/dist/snapshotlegacy.js +4 -2
  99. package/dist/snapshotlegacy.js.map +1 -1
  100. package/dist/sortedSegmentSet.d.ts.map +1 -1
  101. package/dist/sortedSegmentSet.js +8 -1
  102. package/dist/sortedSegmentSet.js.map +1 -1
  103. package/dist/sortedSet.d.ts.map +1 -1
  104. package/dist/sortedSet.js +4 -0
  105. package/dist/sortedSet.js.map +1 -1
  106. package/dist/test/Insertion.perf.spec.js.map +1 -1
  107. package/dist/test/Removal.perf.spec.js.map +1 -1
  108. package/dist/test/Snapshot.perf.spec.js +1 -0
  109. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  110. package/dist/test/attributionCollection.perf.spec.js +3 -1
  111. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  112. package/dist/test/attributionCollection.spec.js +69 -68
  113. package/dist/test/attributionCollection.spec.js.map +1 -1
  114. package/dist/test/attributionPolicy.spec.js +29 -27
  115. package/dist/test/attributionPolicy.spec.js.map +1 -1
  116. package/dist/test/beastTest.spec.d.ts +1 -4
  117. package/dist/test/beastTest.spec.d.ts.map +1 -1
  118. package/dist/test/beastTest.spec.js +32 -30
  119. package/dist/test/beastTest.spec.js.map +1 -1
  120. package/dist/test/client.annotateMarker.spec.js +5 -5
  121. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  122. package/dist/test/client.apis.spec.d.ts.map +1 -1
  123. package/dist/test/client.apis.spec.js +5 -7
  124. package/dist/test/client.apis.spec.js.map +1 -1
  125. package/dist/test/client.applyMsg.spec.js +125 -103
  126. package/dist/test/client.applyMsg.spec.js.map +1 -1
  127. package/dist/test/client.applyStashedOpFarm.spec.js +18 -10
  128. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  129. package/dist/test/client.attributionFarm.spec.js +13 -8
  130. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  131. package/dist/test/client.conflictFarm.spec.js +4 -2
  132. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  133. package/dist/test/client.getPosition.spec.js +10 -10
  134. package/dist/test/client.getPosition.spec.js.map +1 -1
  135. package/dist/test/client.localReference.spec.js +111 -104
  136. package/dist/test/client.localReference.spec.js.map +1 -1
  137. package/dist/test/client.localReferenceFarm.spec.js +14 -10
  138. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  139. package/dist/test/client.rebasePosition.spec.js +12 -12
  140. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  141. package/dist/test/client.reconnectFarm.spec.js +12 -9
  142. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  143. package/dist/test/client.replay.spec.js +11 -10
  144. package/dist/test/client.replay.spec.js.map +1 -1
  145. package/dist/test/client.rollback.spec.js +87 -84
  146. package/dist/test/client.rollback.spec.js.map +1 -1
  147. package/dist/test/client.rollbackFarm.spec.js +3 -1
  148. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  149. package/dist/test/client.searchForMarker.spec.js +122 -112
  150. package/dist/test/client.searchForMarker.spec.js.map +1 -1
  151. package/dist/test/client.walkSegments.spec.js +7 -7
  152. package/dist/test/client.walkSegments.spec.js.map +1 -1
  153. package/dist/test/collections.list.spec.js +14 -14
  154. package/dist/test/collections.list.spec.js.map +1 -1
  155. package/dist/test/createInsertOnlyAttributionPolicy.spec.js +3 -3
  156. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  157. package/dist/test/dirname.cjs +1 -0
  158. package/dist/test/dirname.cjs.map +1 -1
  159. package/dist/test/dirname.d.cts.map +1 -1
  160. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +7 -7
  161. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  162. package/dist/test/mergeTree.annotate.spec.js +87 -87
  163. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  164. package/dist/test/mergeTree.insert.deltaCallback.spec.js +6 -6
  165. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  166. package/dist/test/mergeTree.insertingWalk.spec.js +24 -24
  167. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  168. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +6 -6
  169. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  170. package/dist/test/mergeTree.markRangeRemoved.spec.js +23 -23
  171. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  172. package/dist/test/mergeTree.walk.spec.js +3 -3
  173. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  174. package/dist/test/mergeTree.zamboni.spec.js +10 -10
  175. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  176. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  177. package/dist/test/mergeTreeOperationRunner.js +28 -16
  178. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  179. package/dist/test/mergeTreeOperationRunner.spec.js +9 -5
  180. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  181. package/dist/test/obliterate.concurrent.spec.js +165 -165
  182. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  183. package/dist/test/obliterate.deltaCallback.spec.js +20 -21
  184. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
  185. package/dist/test/obliterate.partialLength.spec.js +7 -7
  186. package/dist/test/obliterate.partialLength.spec.js.map +1 -1
  187. package/dist/test/obliterate.reconnect.spec.js +13 -13
  188. package/dist/test/obliterate.reconnect.spec.js.map +1 -1
  189. package/dist/test/obliterate.spec.js +9 -9
  190. package/dist/test/obliterate.spec.js.map +1 -1
  191. package/dist/test/ordinal.spec.js +10 -4
  192. package/dist/test/ordinal.spec.js.map +1 -1
  193. package/dist/test/partialLength.spec.js.map +1 -1
  194. package/dist/test/properties.spec.js +15 -15
  195. package/dist/test/properties.spec.js.map +1 -1
  196. package/dist/test/reconnectHelper.d.ts +4 -4
  197. package/dist/test/reconnectHelper.d.ts.map +1 -1
  198. package/dist/test/reconnectHelper.js +28 -20
  199. package/dist/test/reconnectHelper.js.map +1 -1
  200. package/dist/test/resetPendingSegmentsToOp.spec.js +35 -29
  201. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  202. package/dist/test/revertibleFarm.spec.js +11 -10
  203. package/dist/test/revertibleFarm.spec.js.map +1 -1
  204. package/dist/test/revertibles.spec.d.ts.map +1 -1
  205. package/dist/test/revertibles.spec.js +96 -57
  206. package/dist/test/revertibles.spec.js.map +1 -1
  207. package/dist/test/segmentGroupCollection.spec.js +17 -17
  208. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  209. package/dist/test/snapshot.spec.js +5 -5
  210. package/dist/test/snapshot.spec.js.map +1 -1
  211. package/dist/test/snapshot.utils.d.ts.map +1 -1
  212. package/dist/test/snapshot.utils.js +6 -6
  213. package/dist/test/snapshot.utils.js.map +1 -1
  214. package/dist/test/snapshotlegacy.spec.js +18 -13
  215. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  216. package/dist/test/sortedSegmentSet.spec.js +22 -18
  217. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  218. package/dist/test/testClient.d.ts +6 -5
  219. package/dist/test/testClient.d.ts.map +1 -1
  220. package/dist/test/testClient.js +30 -32
  221. package/dist/test/testClient.js.map +1 -1
  222. package/dist/test/testClientLogger.d.ts.map +1 -1
  223. package/dist/test/testClientLogger.js +39 -38
  224. package/dist/test/testClientLogger.js.map +1 -1
  225. package/dist/test/testSerializer.d.ts +5 -5
  226. package/dist/test/testSerializer.d.ts.map +1 -1
  227. package/dist/test/testSerializer.js +0 -1
  228. package/dist/test/testSerializer.js.map +1 -1
  229. package/dist/test/testServer.d.ts.map +1 -1
  230. package/dist/test/testServer.js.map +1 -1
  231. package/dist/test/testUtils.d.ts +1 -1
  232. package/dist/test/testUtils.d.ts.map +1 -1
  233. package/dist/test/testUtils.js +15 -17
  234. package/dist/test/testUtils.js.map +1 -1
  235. package/dist/test/text.d.ts.map +1 -1
  236. package/dist/test/text.js +1 -1
  237. package/dist/test/text.js.map +1 -1
  238. package/dist/test/tracking.spec.js +50 -46
  239. package/dist/test/tracking.spec.js.map +1 -1
  240. package/dist/test/wordUnitTests.spec.d.ts.map +1 -1
  241. package/dist/test/wordUnitTests.spec.js +10 -10
  242. package/dist/test/wordUnitTests.spec.js.map +1 -1
  243. package/dist/textSegment.d.ts +1 -1
  244. package/dist/textSegment.d.ts.map +1 -1
  245. package/dist/textSegment.js +3 -3
  246. package/dist/textSegment.js.map +1 -1
  247. package/dist/zamboni.d.ts.map +1 -1
  248. package/dist/zamboni.js +7 -2
  249. package/dist/zamboni.js.map +1 -1
  250. package/internal.d.ts +1 -1
  251. package/legacy.d.ts +1 -1
  252. package/lib/MergeTreeTextHelper.d.ts.map +1 -1
  253. package/lib/MergeTreeTextHelper.js +1 -1
  254. package/lib/MergeTreeTextHelper.js.map +1 -1
  255. package/lib/attributionCollection.d.ts.map +1 -1
  256. package/lib/attributionCollection.js +65 -17
  257. package/lib/attributionCollection.js.map +1 -1
  258. package/lib/attributionPolicy.d.ts +2 -1
  259. package/lib/attributionPolicy.d.ts.map +1 -1
  260. package/lib/attributionPolicy.js +10 -3
  261. package/lib/attributionPolicy.js.map +1 -1
  262. package/lib/client.d.ts +3 -1
  263. package/lib/client.d.ts.map +1 -1
  264. package/lib/client.js +65 -37
  265. package/lib/client.js.map +1 -1
  266. package/lib/collections/list.d.ts.map +1 -1
  267. package/lib/collections/list.js +5 -2
  268. package/lib/collections/list.js.map +1 -1
  269. package/lib/collections/rbTree.d.ts +2 -2
  270. package/lib/collections/rbTree.d.ts.map +1 -1
  271. package/lib/collections/rbTree.js +23 -35
  272. package/lib/collections/rbTree.js.map +1 -1
  273. package/lib/endOfTreeSegment.d.ts.map +1 -1
  274. package/lib/endOfTreeSegment.js +4 -1
  275. package/lib/endOfTreeSegment.js.map +1 -1
  276. package/lib/legacy.d.ts +1 -1
  277. package/lib/localReference.d.ts +16 -6
  278. package/lib/localReference.d.ts.map +1 -1
  279. package/lib/localReference.js +31 -20
  280. package/lib/localReference.js.map +1 -1
  281. package/lib/mergeTree.d.ts +0 -1
  282. package/lib/mergeTree.d.ts.map +1 -1
  283. package/lib/mergeTree.js +127 -112
  284. package/lib/mergeTree.js.map +1 -1
  285. package/lib/mergeTreeNodeWalk.d.ts.map +1 -1
  286. package/lib/mergeTreeNodeWalk.js +1 -1
  287. package/lib/mergeTreeNodeWalk.js.map +1 -1
  288. package/lib/mergeTreeNodes.d.ts +6 -5
  289. package/lib/mergeTreeNodes.d.ts.map +1 -1
  290. package/lib/mergeTreeNodes.js +29 -20
  291. package/lib/mergeTreeNodes.js.map +1 -1
  292. package/lib/mergeTreeTracking.js +3 -3
  293. package/lib/mergeTreeTracking.js.map +1 -1
  294. package/lib/opBuilder.d.ts +6 -1
  295. package/lib/opBuilder.d.ts.map +1 -1
  296. package/lib/opBuilder.js +5 -0
  297. package/lib/opBuilder.js.map +1 -1
  298. package/lib/ops.d.ts.map +1 -1
  299. package/lib/ops.js.map +1 -1
  300. package/lib/ordinal.d.ts.map +1 -1
  301. package/lib/ordinal.js +7 -0
  302. package/lib/ordinal.js.map +1 -1
  303. package/lib/partialLengths.d.ts +4 -2
  304. package/lib/partialLengths.d.ts.map +1 -1
  305. package/lib/partialLengths.js +101 -53
  306. package/lib/partialLengths.js.map +1 -1
  307. package/lib/perspective.d.ts +4 -1
  308. package/lib/perspective.d.ts.map +1 -1
  309. package/lib/perspective.js +7 -6
  310. package/lib/perspective.js.map +1 -1
  311. package/lib/properties.d.ts +13 -10
  312. package/lib/properties.d.ts.map +1 -1
  313. package/lib/properties.js +22 -11
  314. package/lib/properties.js.map +1 -1
  315. package/lib/public.d.ts +1 -1
  316. package/lib/referencePositions.d.ts +7 -0
  317. package/lib/referencePositions.d.ts.map +1 -1
  318. package/lib/referencePositions.js +7 -0
  319. package/lib/referencePositions.js.map +1 -1
  320. package/lib/revertibles.d.ts +6 -0
  321. package/lib/revertibles.d.ts.map +1 -1
  322. package/lib/revertibles.js +50 -21
  323. package/lib/revertibles.js.map +1 -1
  324. package/lib/segmentGroupCollection.d.ts.map +1 -1
  325. package/lib/segmentGroupCollection.js +2 -0
  326. package/lib/segmentGroupCollection.js.map +1 -1
  327. package/lib/segmentPropertiesManager.d.ts +7 -3
  328. package/lib/segmentPropertiesManager.d.ts.map +1 -1
  329. package/lib/segmentPropertiesManager.js +20 -15
  330. package/lib/segmentPropertiesManager.js.map +1 -1
  331. package/lib/snapshotChunks.d.ts.map +1 -1
  332. package/lib/snapshotChunks.js +10 -5
  333. package/lib/snapshotChunks.js.map +1 -1
  334. package/lib/snapshotLoader.d.ts.map +1 -1
  335. package/lib/snapshotLoader.js +14 -10
  336. package/lib/snapshotLoader.js.map +1 -1
  337. package/lib/snapshotV1.d.ts.map +1 -1
  338. package/lib/snapshotV1.js +20 -8
  339. package/lib/snapshotV1.js.map +1 -1
  340. package/lib/snapshotlegacy.d.ts.map +1 -1
  341. package/lib/snapshotlegacy.js +4 -2
  342. package/lib/snapshotlegacy.js.map +1 -1
  343. package/lib/sortedSegmentSet.d.ts.map +1 -1
  344. package/lib/sortedSegmentSet.js +8 -1
  345. package/lib/sortedSegmentSet.js.map +1 -1
  346. package/lib/sortedSet.d.ts.map +1 -1
  347. package/lib/sortedSet.js +4 -0
  348. package/lib/sortedSet.js.map +1 -1
  349. package/lib/test/Insertion.perf.spec.js.map +1 -1
  350. package/lib/test/Removal.perf.spec.js.map +1 -1
  351. package/lib/test/Snapshot.perf.spec.js +1 -0
  352. package/lib/test/Snapshot.perf.spec.js.map +1 -1
  353. package/lib/test/attributionCollection.perf.spec.js +3 -1
  354. package/lib/test/attributionCollection.perf.spec.js.map +1 -1
  355. package/lib/test/attributionCollection.spec.js +3 -2
  356. package/lib/test/attributionCollection.spec.js.map +1 -1
  357. package/lib/test/attributionPolicy.spec.js +3 -1
  358. package/lib/test/attributionPolicy.spec.js.map +1 -1
  359. package/lib/test/beastTest.spec.d.ts +1 -4
  360. package/lib/test/beastTest.spec.d.ts.map +1 -1
  361. package/lib/test/beastTest.spec.js +26 -24
  362. package/lib/test/beastTest.spec.js.map +1 -1
  363. package/lib/test/client.annotateMarker.spec.js +1 -1
  364. package/lib/test/client.annotateMarker.spec.js.map +1 -1
  365. package/lib/test/client.apis.spec.d.ts.map +1 -1
  366. package/lib/test/client.apis.spec.js +4 -6
  367. package/lib/test/client.apis.spec.js.map +1 -1
  368. package/lib/test/client.applyMsg.spec.js +72 -50
  369. package/lib/test/client.applyMsg.spec.js.map +1 -1
  370. package/lib/test/client.applyStashedOpFarm.spec.js +18 -10
  371. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -1
  372. package/lib/test/client.attributionFarm.spec.js +12 -7
  373. package/lib/test/client.attributionFarm.spec.js.map +1 -1
  374. package/lib/test/client.conflictFarm.spec.js +4 -2
  375. package/lib/test/client.conflictFarm.spec.js.map +1 -1
  376. package/lib/test/client.getPosition.spec.js +1 -1
  377. package/lib/test/client.getPosition.spec.js.map +1 -1
  378. package/lib/test/client.localReference.spec.js +14 -7
  379. package/lib/test/client.localReference.spec.js.map +1 -1
  380. package/lib/test/client.localReferenceFarm.spec.js +13 -9
  381. package/lib/test/client.localReferenceFarm.spec.js.map +1 -1
  382. package/lib/test/client.rebasePosition.spec.js +1 -1
  383. package/lib/test/client.rebasePosition.spec.js.map +1 -1
  384. package/lib/test/client.reconnectFarm.spec.js +11 -8
  385. package/lib/test/client.reconnectFarm.spec.js.map +1 -1
  386. package/lib/test/client.replay.spec.js +8 -7
  387. package/lib/test/client.replay.spec.js.map +1 -1
  388. package/lib/test/client.rollback.spec.js +14 -11
  389. package/lib/test/client.rollback.spec.js.map +1 -1
  390. package/lib/test/client.rollbackFarm.spec.js +3 -1
  391. package/lib/test/client.rollbackFarm.spec.js.map +1 -1
  392. package/lib/test/client.searchForMarker.spec.js +29 -19
  393. package/lib/test/client.searchForMarker.spec.js.map +1 -1
  394. package/lib/test/client.walkSegments.spec.js +1 -1
  395. package/lib/test/client.walkSegments.spec.js.map +1 -1
  396. package/lib/test/collections.list.spec.js +1 -1
  397. package/lib/test/collections.list.spec.js.map +1 -1
  398. package/lib/test/createInsertOnlyAttributionPolicy.spec.js +1 -1
  399. package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  400. package/lib/test/dirname.cjs +1 -0
  401. package/lib/test/dirname.cjs.map +1 -1
  402. package/lib/test/dirname.d.cts.map +1 -1
  403. package/lib/test/mergeTree.annotate.deltaCallback.spec.js +1 -1
  404. package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  405. package/lib/test/mergeTree.annotate.spec.js +1 -1
  406. package/lib/test/mergeTree.annotate.spec.js.map +1 -1
  407. package/lib/test/mergeTree.insert.deltaCallback.spec.js +1 -1
  408. package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  409. package/lib/test/mergeTree.insertingWalk.spec.js +8 -8
  410. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
  411. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
  412. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  413. package/lib/test/mergeTree.markRangeRemoved.spec.js +1 -1
  414. package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  415. package/lib/test/mergeTree.walk.spec.js +1 -1
  416. package/lib/test/mergeTree.walk.spec.js.map +1 -1
  417. package/lib/test/mergeTree.zamboni.spec.js +1 -1
  418. package/lib/test/mergeTree.zamboni.spec.js.map +1 -1
  419. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
  420. package/lib/test/mergeTreeOperationRunner.js +27 -15
  421. package/lib/test/mergeTreeOperationRunner.js.map +1 -1
  422. package/lib/test/mergeTreeOperationRunner.spec.js +5 -1
  423. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -1
  424. package/lib/test/obliterate.concurrent.spec.js +4 -4
  425. package/lib/test/obliterate.concurrent.spec.js.map +1 -1
  426. package/lib/test/obliterate.deltaCallback.spec.js +2 -3
  427. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
  428. package/lib/test/obliterate.partialLength.spec.js +1 -1
  429. package/lib/test/obliterate.partialLength.spec.js.map +1 -1
  430. package/lib/test/obliterate.reconnect.spec.js +1 -1
  431. package/lib/test/obliterate.reconnect.spec.js.map +1 -1
  432. package/lib/test/obliterate.spec.js +1 -1
  433. package/lib/test/obliterate.spec.js.map +1 -1
  434. package/lib/test/ordinal.spec.js +7 -1
  435. package/lib/test/ordinal.spec.js.map +1 -1
  436. package/lib/test/partialLength.spec.js.map +1 -1
  437. package/lib/test/properties.spec.js +1 -1
  438. package/lib/test/properties.spec.js.map +1 -1
  439. package/lib/test/reconnectHelper.d.ts +4 -4
  440. package/lib/test/reconnectHelper.d.ts.map +1 -1
  441. package/lib/test/reconnectHelper.js +22 -14
  442. package/lib/test/reconnectHelper.js.map +1 -1
  443. package/lib/test/resetPendingSegmentsToOp.spec.js +8 -2
  444. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  445. package/lib/test/revertibleFarm.spec.js +8 -7
  446. package/lib/test/revertibleFarm.spec.js.map +1 -1
  447. package/lib/test/revertibles.spec.d.ts.map +1 -1
  448. package/lib/test/revertibles.spec.js +93 -54
  449. package/lib/test/revertibles.spec.js.map +1 -1
  450. package/lib/test/segmentGroupCollection.spec.js +1 -1
  451. package/lib/test/segmentGroupCollection.spec.js.map +1 -1
  452. package/lib/test/snapshot.spec.js +1 -1
  453. package/lib/test/snapshot.spec.js.map +1 -1
  454. package/lib/test/snapshot.utils.d.ts.map +1 -1
  455. package/lib/test/snapshot.utils.js +1 -1
  456. package/lib/test/snapshot.utils.js.map +1 -1
  457. package/lib/test/snapshotlegacy.spec.js +10 -5
  458. package/lib/test/snapshotlegacy.spec.js.map +1 -1
  459. package/lib/test/sortedSegmentSet.spec.js +6 -2
  460. package/lib/test/sortedSegmentSet.spec.js.map +1 -1
  461. package/lib/test/testClient.d.ts +6 -5
  462. package/lib/test/testClient.d.ts.map +1 -1
  463. package/lib/test/testClient.js +25 -27
  464. package/lib/test/testClient.js.map +1 -1
  465. package/lib/test/testClientLogger.d.ts.map +1 -1
  466. package/lib/test/testClientLogger.js +37 -36
  467. package/lib/test/testClientLogger.js.map +1 -1
  468. package/lib/test/testSerializer.d.ts +5 -5
  469. package/lib/test/testSerializer.d.ts.map +1 -1
  470. package/lib/test/testSerializer.js +0 -1
  471. package/lib/test/testSerializer.js.map +1 -1
  472. package/lib/test/testServer.d.ts.map +1 -1
  473. package/lib/test/testServer.js.map +1 -1
  474. package/lib/test/testUtils.d.ts +1 -1
  475. package/lib/test/testUtils.d.ts.map +1 -1
  476. package/lib/test/testUtils.js +6 -8
  477. package/lib/test/testUtils.js.map +1 -1
  478. package/lib/test/text.d.ts.map +1 -1
  479. package/lib/test/text.js +1 -1
  480. package/lib/test/text.js.map +1 -1
  481. package/lib/test/tracking.spec.js +9 -5
  482. package/lib/test/tracking.spec.js.map +1 -1
  483. package/lib/test/wordUnitTests.spec.d.ts.map +1 -1
  484. package/lib/test/wordUnitTests.spec.js +9 -9
  485. package/lib/test/wordUnitTests.spec.js.map +1 -1
  486. package/lib/textSegment.d.ts +1 -1
  487. package/lib/textSegment.d.ts.map +1 -1
  488. package/lib/textSegment.js +3 -3
  489. package/lib/textSegment.js.map +1 -1
  490. package/lib/zamboni.d.ts.map +1 -1
  491. package/lib/zamboni.js +7 -2
  492. package/lib/zamboni.js.map +1 -1
  493. package/package.json +29 -27
  494. package/src/MergeTreeTextHelper.ts +2 -2
  495. package/src/attributionCollection.ts +71 -28
  496. package/src/attributionPolicy.ts +14 -9
  497. package/src/client.ts +120 -71
  498. package/src/collections/list.ts +9 -6
  499. package/src/collections/rbTree.ts +62 -71
  500. package/src/endOfTreeSegment.ts +21 -10
  501. package/src/localReference.ts +61 -43
  502. package/src/mergeTree.ts +229 -178
  503. package/src/mergeTreeNodeWalk.ts +2 -1
  504. package/src/mergeTreeNodes.ts +59 -46
  505. package/src/mergeTreeTracking.ts +3 -3
  506. package/src/opBuilder.ts +6 -1
  507. package/src/ops.ts +5 -0
  508. package/src/ordinal.ts +8 -1
  509. package/src/partialLengths.ts +143 -87
  510. package/src/perspective.ts +10 -7
  511. package/src/properties.ts +36 -18
  512. package/src/referencePositions.ts +7 -0
  513. package/src/revertibles.ts +71 -41
  514. package/src/segmentGroupCollection.ts +8 -6
  515. package/src/segmentPropertiesManager.ts +28 -24
  516. package/src/snapshotChunks.ts +12 -7
  517. package/src/snapshotLoader.ts +20 -17
  518. package/src/snapshotV1.ts +36 -18
  519. package/src/snapshotlegacy.ts +7 -5
  520. package/src/sortedSegmentSet.ts +9 -3
  521. package/src/sortedSet.ts +7 -3
  522. package/src/textSegment.ts +9 -9
  523. package/src/zamboni.ts +14 -10
  524. package/tsconfig.json +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAElE,sCAA+C;AAC/C,sDAG2B;AAE3B,2DAA+D;AAC/D,iDAAkD;AAElD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAO,CAAC;IAEZ,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBA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AI,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;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 { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tappendToMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport { TestString, loadSnapshot } from \"./snapshot.utils.js\";\nimport { markRangeRemoved } from \"./testUtils.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"]}
1
+ {"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAGlE,sCAA+C;AAC/C,sDAG2B;AAE3B,2DAA+D;AAC/D,iDAAkD;AAElD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAqB,CAAC;IAE1B,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,sEAAsE;QACtE,uEAAuE;QACvE,UAAU;QACV,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,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E,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 { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\n\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tappendToMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport { TestString, loadSnapshot } from \"./snapshot.utils.js\";\nimport { markRangeRemoved } from \"./testUtils.js\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary: ISummaryTree;\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"]}
@@ -22,6 +22,7 @@ describe("MergeTree snapshots", () => {
22
22
  summary = str.getSummary();
23
23
  },
24
24
  benchmarkFnAsync: async () => {
25
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
25
26
  await (0, snapshot_utils_js_1.loadSnapshot)(summary);
26
27
  },
27
28
  after: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAElE,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,CAAC;QACnE,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,CAAC;oBACtC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACxB,CAAC;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;IACJ,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\n\nimport { TestString, loadSnapshot } 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"]}
1
+ {"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAGlE,2DAA+D;AAE/D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAiC,CAAC;IAEtC,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAM,CAAC,EAAE,CAAC;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,CAAC;oBACtC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACxB,CAAC;gBAED,GAAG,CAAC,eAAe,EAAE,CAAC;gBACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;gBAC5B,oEAAoE;gBACpE,MAAM,IAAA,gCAAY,EAAC,OAAQ,CAAC,CAAC;YAC9B,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,SAAS,CAAC;YACrB,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\n\nimport { TestString, loadSnapshot } from \"./snapshot.utils.js\";\n\ndescribe(\"MergeTree snapshots\", () => {\n\tlet summary: ISummaryTree | undefined;\n\n\tfor (const summarySize of [10, 50, 100, 500, 1000, 5000, 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\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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"]}
@@ -96,7 +96,9 @@ function runAttributionCollectionSuite(ctor, suiteBaseType) {
96
96
  const segments = Array.from({ length: 9 }, () => ({
97
97
  cachedLength: Math.floor(summary.length / 10),
98
98
  }));
99
- segments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) });
99
+ segments.push({
100
+ cachedLength: summary.length - 9 * Math.floor(summary.length / 10),
101
+ });
100
102
  (0, benchmark_1.benchmark)({
101
103
  title: "deserialize into 10 segments",
102
104
  benchmarkFn: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources":["../../src/test/attributionColl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AC;QACT,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,+BAA+B,CAAC,mBAAmB,CAAC;QAC5E,IAAI,EAAE,aAAa;KACnB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAI,CAAC,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;IAC1E,MAAM,QAAQ,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7D,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC;KAC7C,CAAC,CAAe,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,EAAS,CAAC,CAAC;IAC7F,IAAA,qBAAS,EAAC;QACT,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,GAAG,EAAE;YACjB,IAAI,CAAC,8BAA8B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,EAAE,aAAa;KACnB,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,gIAAgI;IAChI,oEAAoE;IACpE,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 { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\tIAttributionCollection,\n\tAttributionCollection as NewAttributionCollection,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection.js\";\nimport { ISegment } from \"../mergeTreeNodes.js\";\nimport { TextSegmentGranularity } from \"../textSegment.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: \"getKeysInOffsetRange from start to end\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getKeysInOffsetRange from start to mid\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(0, length / 2),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getKeysInOffsetRange from mid to end\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(length / 2, length - 1),\n\t\t\t\ttype,\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\ndescribe(\"IAttributionCollection perf\", () => {\n\t// There was a RedBlack tree based implementation for the collection entries, but the linear array based one won due to constant\n\t// factors/memory characteristics, so just kept the array based one.\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,sDAAkE;AAGlE,0EAIqC;AAErC,sDAA2D;AAkB3D,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;IAC7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GAAG,EAAE,CAAC;KAC7C,CAAC,CAAe,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC;QACb,YAAY,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC;KACtC,CAAC,CAAC;IAC/B,IAAA,qBAAS,EAAC;QACT,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,GAAG,EAAE;YACjB,IAAI,CAAC,8BAA8B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,EAAE,aAAa;KACnB,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,gIAAgI;IAChI,oEAAoE;IACpE,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 { BenchmarkType, benchmark } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\tIAttributionCollection,\n\tAttributionCollection as NewAttributionCollection,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection.js\";\nimport { ISegment } from \"../mergeTreeNodes.js\";\nimport { TextSegmentGranularity } from \"../textSegment.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<Partial<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: \"getKeysInOffsetRange from start to end\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getKeysInOffsetRange from start to mid\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(0, length / 2),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getKeysInOffsetRange from mid to end\",\n\t\t\t\tbenchmarkFn: () => collection.getKeysInOffsetRange(length / 2, length - 1),\n\t\t\t\ttype,\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: Partial<ISegment>[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({\n\t\tcachedLength: summary.length - 9 * Math.floor(summary.length / 10),\n\t} satisfies Partial<ISegment>);\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\ndescribe(\"IAttributionCollection perf\", () => {\n\t// There was a RedBlack tree based implementation for the collection entries, but the linear array based one won due to constant\n\t// factors/memory characteristics, so just kept the array based one.\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
@@ -4,14 +4,15 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const assert_1 = require("assert");
7
+ /* eslint-disable unicorn/no-null */
8
+ const node_assert_1 = require("node:assert");
8
9
  const stochastic_test_utils_1 = require("@fluid-private/stochastic-test-utils");
9
10
  const attributionCollection_js_1 = require("../attributionCollection.js");
10
11
  const mergeTreeNodes_js_1 = require("../mergeTreeNodes.js");
11
12
  const opKey = (seq) => ({ type: "op", seq });
12
13
  const detachedKey = { type: "detached", id: 0 };
13
14
  describe("AttributionCollection", () => {
14
- const makeCollectionWithChannel = ({ length, seq }) => {
15
+ const makeCollectionWithChannel = ({ length, seq, }) => {
15
16
  const collection = new attributionCollection_js_1.AttributionCollection(length, null);
16
17
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(length, opKey(seq)));
17
18
  return collection;
@@ -21,12 +22,12 @@ describe("AttributionCollection", () => {
21
22
  const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
22
23
  it("returns the entry for offsets within the length range", () => {
23
24
  for (let i = 0; i < 5; i++) {
24
- assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
25
+ node_assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
25
26
  }
26
27
  });
27
28
  it("throws for queries outside the range", () => {
28
- assert_1.strict.throws(() => collection.getAtOffset(-1));
29
- assert_1.strict.throws(() => collection.getAtOffset(5));
29
+ node_assert_1.strict.throws(() => collection.getAtOffset(-1));
30
+ node_assert_1.strict.throws(() => collection.getAtOffset(5));
30
31
  });
31
32
  });
32
33
  describe("on a collection with multiple entries", () => {
@@ -34,17 +35,17 @@ describe("AttributionCollection", () => {
34
35
  collection.append(new attributionCollection_js_1.AttributionCollection(5, opKey(101)));
35
36
  it("returns the correct entries", () => {
36
37
  for (let i = 0; i < 3; i++) {
37
- assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
38
+ node_assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
38
39
  }
39
40
  for (let i = 3; i < 8; i++) {
40
- assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(101));
41
+ node_assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(101));
41
42
  }
42
43
  });
43
44
  });
44
45
  it("works on collections with entries in channels", () => {
45
46
  const collection = makeCollectionWithChannel({ length: 3, seq: 300 });
46
47
  for (const offset of [0, 1, 2]) {
47
- assert_1.strict.deepEqual(collection.getAtOffset(offset, "foo"), opKey(300));
48
+ node_assert_1.strict.deepEqual(collection.getAtOffset(offset, "foo"), opKey(300));
48
49
  }
49
50
  });
50
51
  });
@@ -52,17 +53,17 @@ describe("AttributionCollection", () => {
52
53
  describe("on a collection with a single entry", () => {
53
54
  const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
54
55
  it("returns the entry for offsets within the length range", () => {
55
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1), [{ offset: 0, key: opKey(100) }], "first");
56
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(4), [{ offset: 0, key: opKey(100) }], "second");
57
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1, 4), [{ offset: 0, key: opKey(100) }], "third");
58
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(0, 4), [{ offset: 0, key: opKey(100) }], "fourth");
56
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1), [{ offset: 0, key: opKey(100) }], "first");
57
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(4), [{ offset: 0, key: opKey(100) }], "second");
58
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1, 4), [{ offset: 0, key: opKey(100) }], "third");
59
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(0, 4), [{ offset: 0, key: opKey(100) }], "fourth");
59
60
  });
60
61
  it("throws for queries outside the range", () => {
61
- assert_1.strict.throws(() => collection.getKeysInOffsetRange(-1));
62
- assert_1.strict.throws(() => collection.getKeysInOffsetRange(7));
63
- assert_1.strict.throws(() => collection.getKeysInOffsetRange(0, -1));
64
- assert_1.strict.throws(() => collection.getKeysInOffsetRange(1, 7));
65
- assert_1.strict.throws(() => collection.getKeysInOffsetRange(2, 1));
62
+ node_assert_1.strict.throws(() => collection.getKeysInOffsetRange(-1));
63
+ node_assert_1.strict.throws(() => collection.getKeysInOffsetRange(7));
64
+ node_assert_1.strict.throws(() => collection.getKeysInOffsetRange(0, -1));
65
+ node_assert_1.strict.throws(() => collection.getKeysInOffsetRange(1, 7));
66
+ node_assert_1.strict.throws(() => collection.getKeysInOffsetRange(2, 1));
66
67
  });
67
68
  });
68
69
  describe("on a collection with multiple entries", () => {
@@ -72,26 +73,26 @@ describe("AttributionCollection", () => {
72
73
  collection.append(new attributionCollection_js_1.AttributionCollection(10, opKey(40)));
73
74
  collection.append(new attributionCollection_js_1.AttributionCollection(10, opKey(50)));
74
75
  it("returns the correct entries", () => {
75
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 25), [
76
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 25), [
76
77
  { offset: 10, key: { type: "op", seq: 20 } },
77
78
  { offset: 20, key: { type: "op", seq: 30 } },
78
79
  ]);
79
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 19), [
80
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 19), [
80
81
  { offset: 10, key: { type: "op", seq: 20 } },
81
82
  ]);
82
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 49), [
83
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 49), [
83
84
  { offset: 10, key: { type: "op", seq: 20 } },
84
85
  { offset: 20, key: { type: "op", seq: 30 } },
85
86
  { offset: 30, key: { type: "op", seq: 40 } },
86
87
  { offset: 40, key: { type: "op", seq: 50 } },
87
88
  ]);
88
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 40), [
89
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(15, 40), [
89
90
  { offset: 10, key: { type: "op", seq: 20 } },
90
91
  { offset: 20, key: { type: "op", seq: 30 } },
91
92
  { offset: 30, key: { type: "op", seq: 40 } },
92
93
  { offset: 40, key: { type: "op", seq: 50 } },
93
94
  ]);
94
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(0), [
95
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(0), [
95
96
  { offset: 0, key: { type: "op", seq: 10 } },
96
97
  { offset: 10, key: { type: "op", seq: 20 } },
97
98
  { offset: 20, key: { type: "op", seq: 30 } },
@@ -102,7 +103,7 @@ describe("AttributionCollection", () => {
102
103
  });
103
104
  it("works on collections with entries in channels", () => {
104
105
  const collection = makeCollectionWithChannel({ length: 3, seq: 300 });
105
- assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1, undefined, "foo"), [
106
+ node_assert_1.strict.deepEqual(collection.getKeysInOffsetRange(1, undefined, "foo"), [
106
107
  { offset: 0, key: opKey(300) },
107
108
  ]);
108
109
  });
@@ -117,44 +118,44 @@ describe("AttributionCollection", () => {
117
118
  });
118
119
  it("can split on non-breakpoints", () => {
119
120
  const splitCollection = collection.splitAt(4);
120
- assert_1.strict.deepEqual(collection.getAll().root, [
121
+ node_assert_1.strict.deepEqual(collection.getAll().root, [
121
122
  { offset: 0, key: opKey(100) },
122
123
  { offset: 3, key: opKey(101) },
123
124
  ]);
124
- assert_1.strict.equal(collection.length, 4);
125
- assert_1.strict.deepEqual(splitCollection.getAll().root, [
125
+ node_assert_1.strict.equal(collection.length, 4);
126
+ node_assert_1.strict.deepEqual(splitCollection.getAll().root, [
126
127
  { offset: 0, key: opKey(101) },
127
128
  { offset: 1, key: opKey(102) },
128
129
  ]);
129
- assert_1.strict.equal(splitCollection.length, 2);
130
+ node_assert_1.strict.equal(splitCollection.length, 2);
130
131
  });
131
132
  it("can split on breakpoints", () => {
132
133
  const splitCollection = collection.splitAt(5);
133
- assert_1.strict.deepEqual(collection.getAll().root, [
134
+ node_assert_1.strict.deepEqual(collection.getAll().root, [
134
135
  { offset: 0, key: opKey(100) },
135
136
  { offset: 3, key: opKey(101) },
136
137
  ]);
137
- assert_1.strict.equal(collection.length, 5);
138
- assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(102) }]);
139
- assert_1.strict.equal(splitCollection.length, 1);
138
+ node_assert_1.strict.equal(collection.length, 5);
139
+ node_assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(102) }]);
140
+ node_assert_1.strict.equal(splitCollection.length, 1);
140
141
  });
141
142
  });
142
143
  it("can split collection with a single value", () => {
143
144
  const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
144
145
  const splitCollection = collection.splitAt(3);
145
- assert_1.strict.equal(collection.length, 3);
146
- assert_1.strict.equal(splitCollection.length, 2);
147
- assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
148
- assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(100) }]);
146
+ node_assert_1.strict.equal(collection.length, 3);
147
+ node_assert_1.strict.equal(splitCollection.length, 2);
148
+ node_assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
149
+ node_assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(100) }]);
149
150
  });
150
151
  it("splits channels", () => {
151
152
  const collection = new attributionCollection_js_1.AttributionCollection(5, null);
152
153
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(5, opKey(100)));
153
154
  const splitCollection = collection.splitAt(2);
154
- assert_1.strict.deepEqual(collection.getAll().channels, {
155
+ node_assert_1.strict.deepEqual(collection.getAll().channels, {
155
156
  foo: [{ offset: 0, key: opKey(100) }],
156
157
  });
157
- assert_1.strict.deepEqual(splitCollection.getAll().channels, {
158
+ node_assert_1.strict.deepEqual(splitCollection.getAll().channels, {
158
159
  foo: [{ offset: 0, key: opKey(100) }],
159
160
  });
160
161
  });
@@ -162,9 +163,9 @@ describe("AttributionCollection", () => {
162
163
  describe(".append", () => {
163
164
  it("modifies the receiving collection", () => {
164
165
  const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
165
- assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
166
+ node_assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
166
167
  collection.append(new attributionCollection_js_1.AttributionCollection(1, opKey(101)));
167
- assert_1.strict.deepEqual(collection.getAll().root, [
168
+ node_assert_1.strict.deepEqual(collection.getAll().root, [
168
169
  { offset: 0, key: opKey(100) },
169
170
  { offset: 2, key: opKey(101) },
170
171
  ]);
@@ -172,21 +173,21 @@ describe("AttributionCollection", () => {
172
173
  it("does not modify the argument collection", () => {
173
174
  const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
174
175
  const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
175
- assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
176
+ node_assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
176
177
  collection.append(appendedCollection);
177
- assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
178
+ node_assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
178
179
  });
179
180
  it("coalesces referentially equal values at the join point", () => {
180
181
  const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
181
182
  collection.append(new attributionCollection_js_1.AttributionCollection(7, opKey(100)));
182
- assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
183
- assert_1.strict.equal(collection.length, 9);
183
+ node_assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
184
+ node_assert_1.strict.equal(collection.length, 9);
184
185
  });
185
186
  describe("appends channels", () => {
186
187
  it("when both collections have the channel", () => {
187
188
  const appender = makeCollectionWithChannel({ length: 2, seq: 100 });
188
189
  appender.append(makeCollectionWithChannel({ length: 5, seq: 200 }));
189
- assert_1.strict.deepEqual(appender.getAll(), {
190
+ node_assert_1.strict.deepEqual(appender.getAll(), {
190
191
  length: 7,
191
192
  root: [{ offset: 0, key: null }],
192
193
  channels: {
@@ -206,7 +207,7 @@ describe("AttributionCollection", () => {
206
207
  it("when only appended collection has a channel", () => {
207
208
  const appender = new attributionCollection_js_1.AttributionCollection(2, null);
208
209
  appender.append(makeCollectionWithChannel({ length: 5, seq: 200 }));
209
- assert_1.strict.deepEqual(appender.getAll(), {
210
+ node_assert_1.strict.deepEqual(appender.getAll(), {
210
211
  length: 7,
211
212
  root: [{ offset: 0, key: null }],
212
213
  channels: {
@@ -226,7 +227,7 @@ describe("AttributionCollection", () => {
226
227
  it("when only segment being appended to has a channel", () => {
227
228
  const appender = makeCollectionWithChannel({ length: 2, seq: 100 });
228
229
  appender.append(new attributionCollection_js_1.AttributionCollection(5, null));
229
- assert_1.strict.deepEqual(appender.getAll(), {
230
+ node_assert_1.strict.deepEqual(appender.getAll(), {
230
231
  length: 7,
231
232
  root: [{ offset: 0, key: null }],
232
233
  channels: {
@@ -248,13 +249,13 @@ describe("AttributionCollection", () => {
248
249
  describe(".channelNames", () => {
249
250
  it("is empty when collection has no channels", () => {
250
251
  const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
251
- assert_1.strict.deepEqual(collection.channelNames, []);
252
+ node_assert_1.strict.deepEqual(collection.channelNames, []);
252
253
  });
253
254
  it("returns all channels with content for collection with channels", () => {
254
255
  const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
255
256
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(2));
256
257
  collection.update("bar", new attributionCollection_js_1.AttributionCollection(2));
257
- assert_1.strict.deepEqual(collection.channelNames, ["foo", "bar"]);
258
+ node_assert_1.strict.deepEqual(collection.channelNames, ["foo", "bar"]);
258
259
  });
259
260
  });
260
261
  describe(".populateAttributionCollections", () => {
@@ -265,16 +266,16 @@ describe("AttributionCollection", () => {
265
266
  posBreakpoints: [0, 2, 5, 7],
266
267
  seqs: [10, 12, 15, 17],
267
268
  });
268
- assert_1.strict.deepEqual(segments[0].attribution?.getAll().root, [
269
+ node_assert_1.strict.deepEqual(segments[0].attribution?.getAll().root, [
269
270
  { offset: 0, key: opKey(10) },
270
271
  { offset: 2, key: opKey(12) },
271
272
  ]);
272
- assert_1.strict.deepEqual(segments[1].attribution?.getAll().root, [
273
+ node_assert_1.strict.deepEqual(segments[1].attribution?.getAll().root, [
273
274
  { offset: 0, key: opKey(15) },
274
275
  { offset: 2, key: opKey(17) },
275
276
  ]);
276
277
  for (const segment of segments) {
277
- assert_1.strict.equal(segment.attribution?.length, segment.cachedLength);
278
+ node_assert_1.strict.equal(segment.attribution?.length, segment.cachedLength);
278
279
  }
279
280
  });
280
281
  it("correctly splits segment boundaries between breakpoints", () => {
@@ -284,17 +285,17 @@ describe("AttributionCollection", () => {
284
285
  posBreakpoints: [0, 2, 5, 7],
285
286
  seqs: [10, 12, 15, 17],
286
287
  });
287
- assert_1.strict.deepEqual(segments[0].attribution?.getAll().root, [
288
+ node_assert_1.strict.deepEqual(segments[0].attribution?.getAll().root, [
288
289
  { offset: 0, key: opKey(10) },
289
290
  { offset: 2, key: opKey(12) },
290
291
  ]);
291
- assert_1.strict.deepEqual(segments[1].attribution?.getAll().root, [
292
+ node_assert_1.strict.deepEqual(segments[1].attribution?.getAll().root, [
292
293
  { offset: 0, key: opKey(12) },
293
294
  { offset: 1, key: opKey(15) },
294
295
  { offset: 3, key: opKey(17) },
295
296
  ]);
296
297
  for (const segment of segments) {
297
- assert_1.strict.equal(segment.attribution?.length, segment.cachedLength);
298
+ node_assert_1.strict.equal(segment.attribution?.length, segment.cachedLength);
298
299
  }
299
300
  });
300
301
  });
@@ -311,7 +312,7 @@ describe("AttributionCollection", () => {
311
312
  },
312
313
  ];
313
314
  const blob = attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments);
314
- assert_1.strict.deepEqual(blob, {
315
+ node_assert_1.strict.deepEqual(blob, {
315
316
  posBreakpoints: [0],
316
317
  seqs: [0],
317
318
  length: 9,
@@ -386,7 +387,7 @@ describe("AttributionCollection", () => {
386
387
  for (const { name, blob, segments } of testCases) {
387
388
  it(name, () => {
388
389
  attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, blob);
389
- assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments), blob);
390
+ node_assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments), blob);
390
391
  });
391
392
  }
392
393
  });
@@ -396,22 +397,22 @@ describe("AttributionCollection", () => {
396
397
  const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
397
398
  const copy = collection.clone();
398
399
  collection.append(appendedCollection);
399
- assert_1.strict.deepEqual(collection.getAll().root, [
400
+ node_assert_1.strict.deepEqual(collection.getAll().root, [
400
401
  { offset: 0, key: opKey(100) },
401
402
  { offset: 2, key: opKey(101) },
402
403
  ]);
403
- assert_1.strict.deepEqual(copy.getAll().root, [{ offset: 0, key: opKey(100) }]);
404
+ node_assert_1.strict.deepEqual(copy.getAll().root, [{ offset: 0, key: opKey(100) }]);
404
405
  });
405
406
  it("copies channels", () => {
406
407
  const collection = makeCollectionWithChannel({ length: 2, seq: 25 });
407
408
  const appendedCollection = makeCollectionWithChannel({ length: 3, seq: 26 });
408
409
  const copy = collection.clone();
409
410
  collection.append(appendedCollection);
410
- assert_1.strict.deepEqual(collection.getAll().channels?.foo, [
411
+ node_assert_1.strict.deepEqual(collection.getAll().channels?.foo, [
411
412
  { offset: 0, key: opKey(25) },
412
413
  { offset: 2, key: opKey(26) },
413
414
  ]);
414
- assert_1.strict.deepEqual(copy.getAll().channels?.foo, [{ offset: 0, key: opKey(25) }]);
415
+ node_assert_1.strict.deepEqual(copy.getAll().channels?.foo, [{ offset: 0, key: opKey(25) }]);
415
416
  });
416
417
  });
417
418
  describe(".update", () => {
@@ -419,26 +420,26 @@ describe("AttributionCollection", () => {
419
420
  beforeEach(() => {
420
421
  collection = new attributionCollection_js_1.AttributionCollection(2, null);
421
422
  collection.update("bar", new attributionCollection_js_1.AttributionCollection(2, opKey(10)));
422
- assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), undefined, "channel should be undefined on creation");
423
+ node_assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), undefined, "channel should be undefined on creation");
423
424
  });
424
425
  afterEach(() => {
425
- assert_1.strict.deepEqual(collection.getAtOffset(0, "bar"), opKey(10), "update should never modify unrelated channels");
426
+ node_assert_1.strict.deepEqual(collection.getAtOffset(0, "bar"), opKey(10), "update should never modify unrelated channels");
426
427
  });
427
428
  it("creates a new channel when updating from an undefined state", () => {
428
429
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
429
- assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
430
+ node_assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
430
431
  });
431
432
  it("overrides earlier calls with later ones", () => {
432
433
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
433
434
  collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
434
- assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
435
+ node_assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
435
436
  });
436
437
  it("can update the root channel", () => {
437
438
  collection.update(undefined, new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
438
- assert_1.strict.deepEqual(collection.getAtOffset(0), opKey(3));
439
+ node_assert_1.strict.deepEqual(collection.getAtOffset(0), opKey(3));
439
440
  });
440
441
  it("doesn't tolerate updates to channels having inconsistent length fields", () => {
441
- assert_1.strict.throws(() => collection.update("foo", new attributionCollection_js_1.AttributionCollection(3, null)));
442
+ node_assert_1.strict.throws(() => collection.update("foo", new attributionCollection_js_1.AttributionCollection(3, null)));
442
443
  });
443
444
  });
444
445
  describe("serialized structure is independent of segment lengths", () => {
@@ -522,7 +523,7 @@ describe("AttributionCollection", () => {
522
523
  split: (state, { segIndex, offset }) => {
523
524
  const { segments } = state;
524
525
  const splitSeg = segments[segIndex].splitAt(offset);
525
- (0, assert_1.strict)(splitSeg !== undefined);
526
+ (0, node_assert_1.strict)(splitSeg !== undefined);
526
527
  segments.splice(segIndex + 1, 0, splitSeg);
527
528
  return state;
528
529
  },
@@ -533,7 +534,7 @@ describe("AttributionCollection", () => {
533
534
  return state;
534
535
  },
535
536
  }, initialState);
536
- assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(finalState.segments), expected);
537
+ node_assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(finalState.segments), expected);
537
538
  });
538
539
  }
539
540
  });