@fluid-experimental/tree 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (571) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/experimental-tree.api.md +2 -2
  3. package/dist/ChangeCompression.d.ts +2 -2
  4. package/dist/ChangeCompression.d.ts.map +1 -1
  5. package/dist/ChangeCompression.js +1 -1
  6. package/dist/ChangeCompression.js.map +1 -1
  7. package/dist/ChangeTypes.d.ts +1 -1
  8. package/dist/ChangeTypes.d.ts.map +1 -1
  9. package/dist/ChangeTypes.js +4 -4
  10. package/dist/ChangeTypes.js.map +1 -1
  11. package/dist/Checkout.d.ts +3 -3
  12. package/dist/Checkout.d.ts.map +1 -1
  13. package/dist/Checkout.js +17 -17
  14. package/dist/Checkout.js.map +1 -1
  15. package/dist/EditLog.d.ts +1 -1
  16. package/dist/EditLog.d.ts.map +1 -1
  17. package/dist/EditLog.js +9 -9
  18. package/dist/EditLog.js.map +1 -1
  19. package/dist/EditUtilities.d.ts +3 -3
  20. package/dist/EditUtilities.d.ts.map +1 -1
  21. package/dist/EditUtilities.js +6 -6
  22. package/dist/EditUtilities.js.map +1 -1
  23. package/dist/Forest.d.ts.map +1 -1
  24. package/dist/Forest.js +23 -23
  25. package/dist/Forest.js.map +1 -1
  26. package/dist/HistoryEditFactory.d.ts +1 -1
  27. package/dist/HistoryEditFactory.d.ts.map +1 -1
  28. package/dist/HistoryEditFactory.js +7 -7
  29. package/dist/HistoryEditFactory.js.map +1 -1
  30. package/dist/IdConversion.d.ts.map +1 -1
  31. package/dist/IdConversion.js.map +1 -1
  32. package/dist/LogViewer.d.ts +2 -2
  33. package/dist/LogViewer.d.ts.map +1 -1
  34. package/dist/LogViewer.js +7 -7
  35. package/dist/LogViewer.js.map +1 -1
  36. package/dist/MergeHealth.d.ts.map +1 -1
  37. package/dist/MergeHealth.js +1 -1
  38. package/dist/MergeHealth.js.map +1 -1
  39. package/dist/NodeIdUtilities.d.ts +1 -1
  40. package/dist/NodeIdUtilities.d.ts.map +1 -1
  41. package/dist/NodeIdUtilities.js +1 -1
  42. package/dist/NodeIdUtilities.js.map +1 -1
  43. package/dist/PayloadUtilities.d.ts.map +1 -1
  44. package/dist/PayloadUtilities.js +2 -2
  45. package/dist/PayloadUtilities.js.map +1 -1
  46. package/dist/ReconciliationPath.d.ts +1 -1
  47. package/dist/ReconciliationPath.d.ts.map +1 -1
  48. package/dist/ReconciliationPath.js.map +1 -1
  49. package/dist/RevisionValueCache.d.ts.map +1 -1
  50. package/dist/RevisionValueCache.js +2 -2
  51. package/dist/RevisionValueCache.js.map +1 -1
  52. package/dist/RevisionView.d.ts +2 -2
  53. package/dist/RevisionView.d.ts.map +1 -1
  54. package/dist/RevisionView.js.map +1 -1
  55. package/dist/SerializationUtilities.d.ts +1 -1
  56. package/dist/SerializationUtilities.d.ts.map +1 -1
  57. package/dist/SerializationUtilities.js.map +1 -1
  58. package/dist/SharedTree.d.ts +8 -7
  59. package/dist/SharedTree.d.ts.map +1 -1
  60. package/dist/SharedTree.js +78 -78
  61. package/dist/SharedTree.js.map +1 -1
  62. package/dist/SharedTreeEncoder.d.ts +1 -1
  63. package/dist/SharedTreeEncoder.d.ts.map +1 -1
  64. package/dist/SharedTreeEncoder.js +31 -31
  65. package/dist/SharedTreeEncoder.js.map +1 -1
  66. package/dist/Summary.d.ts +2 -2
  67. package/dist/Summary.d.ts.map +1 -1
  68. package/dist/Summary.js +2 -2
  69. package/dist/Summary.js.map +1 -1
  70. package/dist/SummaryBackCompatibility.d.ts.map +1 -1
  71. package/dist/SummaryBackCompatibility.js.map +1 -1
  72. package/dist/SummaryTestUtilities.d.ts +1 -1
  73. package/dist/SummaryTestUtilities.d.ts.map +1 -1
  74. package/dist/SummaryTestUtilities.js.map +1 -1
  75. package/dist/Transaction.d.ts +3 -3
  76. package/dist/Transaction.d.ts.map +1 -1
  77. package/dist/Transaction.js +3 -3
  78. package/dist/Transaction.js.map +1 -1
  79. package/dist/TransactionInternal.d.ts +3 -3
  80. package/dist/TransactionInternal.d.ts.map +1 -1
  81. package/dist/TransactionInternal.js +6 -6
  82. package/dist/TransactionInternal.js.map +1 -1
  83. package/dist/TreeCompressor.d.ts +5 -1
  84. package/dist/TreeCompressor.d.ts.map +1 -1
  85. package/dist/TreeCompressor.js +5 -5
  86. package/dist/TreeCompressor.js.map +1 -1
  87. package/dist/TreeNodeHandle.d.ts +1 -1
  88. package/dist/TreeNodeHandle.d.ts.map +1 -1
  89. package/dist/TreeNodeHandle.js.map +1 -1
  90. package/dist/TreeView.d.ts +1 -1
  91. package/dist/TreeView.d.ts.map +1 -1
  92. package/dist/TreeView.js +2 -3
  93. package/dist/TreeView.js.map +1 -1
  94. package/dist/UuidUtilities.d.ts.map +1 -1
  95. package/dist/UuidUtilities.js.map +1 -1
  96. package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
  97. package/dist/id-compressor/AppendOnlySortedMap.js +3 -3
  98. package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
  99. package/dist/id-compressor/IdCompressor.d.ts +1 -1
  100. package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
  101. package/dist/id-compressor/IdCompressor.js +25 -26
  102. package/dist/id-compressor/IdCompressor.js.map +1 -1
  103. package/dist/id-compressor/IdRange.d.ts.map +1 -1
  104. package/dist/id-compressor/IdRange.js +2 -2
  105. package/dist/id-compressor/IdRange.js.map +1 -1
  106. package/dist/id-compressor/NumericUuid.d.ts.map +1 -1
  107. package/dist/id-compressor/NumericUuid.js +2 -1
  108. package/dist/id-compressor/NumericUuid.js.map +1 -1
  109. package/dist/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
  110. package/dist/id-compressor/SessionIdNormalizer.js +8 -9
  111. package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
  112. package/dist/migration-shim/migrationDeltaHandler.d.ts +1 -1
  113. package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
  114. package/dist/migration-shim/migrationDeltaHandler.js +11 -11
  115. package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
  116. package/dist/migration-shim/migrationShim.d.ts +8 -4
  117. package/dist/migration-shim/migrationShim.d.ts.map +1 -1
  118. package/dist/migration-shim/migrationShim.js +13 -13
  119. package/dist/migration-shim/migrationShim.js.map +1 -1
  120. package/dist/migration-shim/migrationShimFactory.d.ts +2 -2
  121. package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
  122. package/dist/migration-shim/migrationShimFactory.js +2 -2
  123. package/dist/migration-shim/migrationShimFactory.js.map +1 -1
  124. package/dist/migration-shim/packageVersion.d.ts +0 -2
  125. package/dist/migration-shim/packageVersion.d.ts.map +1 -1
  126. package/dist/migration-shim/packageVersion.js +0 -2
  127. package/dist/migration-shim/packageVersion.js.map +1 -1
  128. package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
  129. package/dist/migration-shim/sharedTreeDeltaHandler.js +8 -8
  130. package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  131. package/dist/migration-shim/sharedTreeShim.d.ts +2 -2
  132. package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
  133. package/dist/migration-shim/sharedTreeShim.js +8 -4
  134. package/dist/migration-shim/sharedTreeShim.js.map +1 -1
  135. package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
  136. package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
  137. package/dist/migration-shim/sharedTreeShimFactory.js +2 -2
  138. package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
  139. package/dist/migration-shim/shimChannelServices.d.ts +1 -1
  140. package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
  141. package/dist/migration-shim/shimChannelServices.js.map +1 -1
  142. package/dist/migration-shim/shimDeltaConnection.d.ts +1 -1
  143. package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
  144. package/dist/migration-shim/shimDeltaConnection.js +2 -2
  145. package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
  146. package/dist/migration-shim/shimHandle.d.ts.map +1 -1
  147. package/dist/migration-shim/shimHandle.js.map +1 -1
  148. package/dist/migration-shim/types.d.ts +1 -1
  149. package/dist/migration-shim/types.d.ts.map +1 -1
  150. package/dist/migration-shim/types.js.map +1 -1
  151. package/dist/migration-shim/utils.d.ts +1 -1
  152. package/dist/migration-shim/utils.d.ts.map +1 -1
  153. package/dist/migration-shim/utils.js.map +1 -1
  154. package/dist/persisted-types/0.0.2.d.ts +1 -1
  155. package/dist/persisted-types/0.0.2.d.ts.map +1 -1
  156. package/dist/persisted-types/0.0.2.js.map +1 -1
  157. package/dist/persisted-types/0.1.1.d.ts +1 -1
  158. package/dist/persisted-types/0.1.1.d.ts.map +1 -1
  159. package/dist/persisted-types/0.1.1.js +3 -3
  160. package/dist/persisted-types/0.1.1.js.map +1 -1
  161. package/lib/ChangeCompression.d.ts +2 -2
  162. package/lib/ChangeCompression.d.ts.map +1 -1
  163. package/lib/ChangeCompression.js +1 -1
  164. package/lib/ChangeCompression.js.map +1 -1
  165. package/lib/ChangeTypes.d.ts +1 -1
  166. package/lib/ChangeTypes.d.ts.map +1 -1
  167. package/lib/ChangeTypes.js +2 -2
  168. package/lib/ChangeTypes.js.map +1 -1
  169. package/lib/Checkout.d.ts +3 -3
  170. package/lib/Checkout.d.ts.map +1 -1
  171. package/lib/Checkout.js +4 -4
  172. package/lib/Checkout.js.map +1 -1
  173. package/lib/EditLog.d.ts +1 -1
  174. package/lib/EditLog.d.ts.map +1 -1
  175. package/lib/EditLog.js +2 -2
  176. package/lib/EditLog.js.map +1 -1
  177. package/lib/EditUtilities.d.ts +3 -3
  178. package/lib/EditUtilities.d.ts.map +1 -1
  179. package/lib/EditUtilities.js +5 -5
  180. package/lib/EditUtilities.js.map +1 -1
  181. package/lib/Forest.d.ts.map +1 -1
  182. package/lib/Forest.js +2 -2
  183. package/lib/Forest.js.map +1 -1
  184. package/lib/HistoryEditFactory.d.ts +1 -1
  185. package/lib/HistoryEditFactory.d.ts.map +1 -1
  186. package/lib/HistoryEditFactory.js +5 -5
  187. package/lib/HistoryEditFactory.js.map +1 -1
  188. package/lib/IdConversion.d.ts.map +1 -1
  189. package/lib/IdConversion.js.map +1 -1
  190. package/lib/LogViewer.d.ts +2 -2
  191. package/lib/LogViewer.d.ts.map +1 -1
  192. package/lib/LogViewer.js +3 -3
  193. package/lib/LogViewer.js.map +1 -1
  194. package/lib/MergeHealth.d.ts.map +1 -1
  195. package/lib/MergeHealth.js +1 -1
  196. package/lib/MergeHealth.js.map +1 -1
  197. package/lib/NodeIdUtilities.d.ts +1 -1
  198. package/lib/NodeIdUtilities.d.ts.map +1 -1
  199. package/lib/NodeIdUtilities.js +1 -1
  200. package/lib/NodeIdUtilities.js.map +1 -1
  201. package/lib/PayloadUtilities.d.ts.map +1 -1
  202. package/lib/PayloadUtilities.js +1 -1
  203. package/lib/PayloadUtilities.js.map +1 -1
  204. package/lib/ReconciliationPath.d.ts +1 -1
  205. package/lib/ReconciliationPath.d.ts.map +1 -1
  206. package/lib/ReconciliationPath.js.map +1 -1
  207. package/lib/RevisionValueCache.d.ts.map +1 -1
  208. package/lib/RevisionValueCache.js +2 -2
  209. package/lib/RevisionValueCache.js.map +1 -1
  210. package/lib/RevisionView.d.ts +2 -2
  211. package/lib/RevisionView.d.ts.map +1 -1
  212. package/lib/RevisionView.js.map +1 -1
  213. package/lib/SerializationUtilities.d.ts +1 -1
  214. package/lib/SerializationUtilities.d.ts.map +1 -1
  215. package/lib/SerializationUtilities.js.map +1 -1
  216. package/lib/SharedTree.d.ts +8 -7
  217. package/lib/SharedTree.d.ts.map +1 -1
  218. package/lib/SharedTree.js +13 -13
  219. package/lib/SharedTree.js.map +1 -1
  220. package/lib/SharedTreeEncoder.d.ts +1 -1
  221. package/lib/SharedTreeEncoder.d.ts.map +1 -1
  222. package/lib/SharedTreeEncoder.js +5 -5
  223. package/lib/SharedTreeEncoder.js.map +1 -1
  224. package/lib/Summary.d.ts +2 -2
  225. package/lib/Summary.d.ts.map +1 -1
  226. package/lib/Summary.js +1 -1
  227. package/lib/Summary.js.map +1 -1
  228. package/lib/SummaryBackCompatibility.d.ts.map +1 -1
  229. package/lib/SummaryBackCompatibility.js.map +1 -1
  230. package/lib/SummaryTestUtilities.d.ts +1 -1
  231. package/lib/SummaryTestUtilities.d.ts.map +1 -1
  232. package/lib/SummaryTestUtilities.js.map +1 -1
  233. package/lib/Transaction.d.ts +3 -3
  234. package/lib/Transaction.d.ts.map +1 -1
  235. package/lib/Transaction.js +3 -3
  236. package/lib/Transaction.js.map +1 -1
  237. package/lib/TransactionInternal.d.ts +3 -3
  238. package/lib/TransactionInternal.d.ts.map +1 -1
  239. package/lib/TransactionInternal.js +3 -3
  240. package/lib/TransactionInternal.js.map +1 -1
  241. package/lib/TreeCompressor.d.ts +5 -1
  242. package/lib/TreeCompressor.d.ts.map +1 -1
  243. package/lib/TreeCompressor.js +2 -2
  244. package/lib/TreeCompressor.js.map +1 -1
  245. package/lib/TreeNodeHandle.d.ts +1 -1
  246. package/lib/TreeNodeHandle.d.ts.map +1 -1
  247. package/lib/TreeNodeHandle.js.map +1 -1
  248. package/lib/TreeView.d.ts +1 -1
  249. package/lib/TreeView.d.ts.map +1 -1
  250. package/lib/TreeView.js +1 -2
  251. package/lib/TreeView.js.map +1 -1
  252. package/lib/UuidUtilities.d.ts.map +1 -1
  253. package/lib/UuidUtilities.js +1 -1
  254. package/lib/UuidUtilities.js.map +1 -1
  255. package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -1
  256. package/lib/id-compressor/AppendOnlySortedMap.js +1 -1
  257. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
  258. package/lib/id-compressor/IdCompressor.d.ts +1 -1
  259. package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
  260. package/lib/id-compressor/IdCompressor.js +4 -5
  261. package/lib/id-compressor/IdCompressor.js.map +1 -1
  262. package/lib/id-compressor/IdRange.d.ts.map +1 -1
  263. package/lib/id-compressor/IdRange.js +1 -1
  264. package/lib/id-compressor/IdRange.js.map +1 -1
  265. package/lib/id-compressor/NumericUuid.d.ts.map +1 -1
  266. package/lib/id-compressor/NumericUuid.js +2 -1
  267. package/lib/id-compressor/NumericUuid.js.map +1 -1
  268. package/lib/id-compressor/SessionIdNormalizer.d.ts.map +1 -1
  269. package/lib/id-compressor/SessionIdNormalizer.js +1 -2
  270. package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
  271. package/lib/migration-shim/migrationDeltaHandler.d.ts +1 -1
  272. package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
  273. package/lib/migration-shim/migrationDeltaHandler.js +1 -1
  274. package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
  275. package/lib/migration-shim/migrationShim.d.ts +8 -4
  276. package/lib/migration-shim/migrationShim.d.ts.map +1 -1
  277. package/lib/migration-shim/migrationShim.js +3 -3
  278. package/lib/migration-shim/migrationShim.js.map +1 -1
  279. package/lib/migration-shim/migrationShimFactory.d.ts +2 -2
  280. package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
  281. package/lib/migration-shim/migrationShimFactory.js +1 -1
  282. package/lib/migration-shim/migrationShimFactory.js.map +1 -1
  283. package/lib/migration-shim/packageVersion.d.ts +0 -2
  284. package/lib/migration-shim/packageVersion.d.ts.map +1 -1
  285. package/lib/migration-shim/packageVersion.js +0 -2
  286. package/lib/migration-shim/packageVersion.js.map +1 -1
  287. package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
  288. package/lib/migration-shim/sharedTreeDeltaHandler.js +1 -1
  289. package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
  290. package/lib/migration-shim/sharedTreeShim.d.ts +2 -2
  291. package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
  292. package/lib/migration-shim/sharedTreeShim.js +6 -2
  293. package/lib/migration-shim/sharedTreeShim.js.map +1 -1
  294. package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
  295. package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
  296. package/lib/migration-shim/sharedTreeShimFactory.js +1 -1
  297. package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
  298. package/lib/migration-shim/shimChannelServices.d.ts +1 -1
  299. package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
  300. package/lib/migration-shim/shimChannelServices.js.map +1 -1
  301. package/lib/migration-shim/shimDeltaConnection.d.ts +1 -1
  302. package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
  303. package/lib/migration-shim/shimDeltaConnection.js +1 -1
  304. package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
  305. package/lib/migration-shim/shimHandle.d.ts.map +1 -1
  306. package/lib/migration-shim/shimHandle.js.map +1 -1
  307. package/lib/migration-shim/types.d.ts +1 -1
  308. package/lib/migration-shim/types.d.ts.map +1 -1
  309. package/lib/migration-shim/types.js.map +1 -1
  310. package/lib/migration-shim/utils.d.ts +1 -1
  311. package/lib/migration-shim/utils.d.ts.map +1 -1
  312. package/lib/migration-shim/utils.js.map +1 -1
  313. package/lib/persisted-types/0.0.2.d.ts +1 -1
  314. package/lib/persisted-types/0.0.2.d.ts.map +1 -1
  315. package/lib/persisted-types/0.0.2.js.map +1 -1
  316. package/lib/persisted-types/0.1.1.d.ts +1 -1
  317. package/lib/persisted-types/0.1.1.d.ts.map +1 -1
  318. package/lib/persisted-types/0.1.1.js +1 -1
  319. package/lib/persisted-types/0.1.1.js.map +1 -1
  320. package/package.json +33 -32
  321. package/src/ChangeCompression.ts +8 -8
  322. package/src/ChangeTypes.ts +5 -4
  323. package/src/Checkout.ts +9 -7
  324. package/src/EditLog.ts +4 -3
  325. package/src/EditUtilities.ts +9 -8
  326. package/src/Forest.ts +3 -2
  327. package/src/HistoryEditFactory.ts +12 -11
  328. package/src/IdConversion.ts +2 -2
  329. package/src/LogViewer.ts +5 -4
  330. package/src/MergeHealth.ts +2 -1
  331. package/src/NodeIdUtilities.ts +2 -2
  332. package/src/PayloadUtilities.ts +2 -1
  333. package/src/ReconciliationPath.ts +1 -1
  334. package/src/RevisionValueCache.ts +3 -2
  335. package/src/RevisionView.ts +3 -3
  336. package/src/SerializationUtilities.ts +1 -1
  337. package/src/SharedTree.ts +46 -49
  338. package/src/SharedTreeEncoder.ts +30 -29
  339. package/src/Summary.ts +5 -3
  340. package/src/SummaryBackCompatibility.ts +1 -0
  341. package/src/SummaryTestUtilities.ts +2 -1
  342. package/src/Transaction.ts +7 -6
  343. package/src/TransactionInternal.ts +17 -16
  344. package/src/TreeCompressor.ts +6 -4
  345. package/src/TreeNodeHandle.ts +2 -2
  346. package/src/TreeView.ts +3 -3
  347. package/src/UuidUtilities.ts +2 -1
  348. package/src/id-compressor/AppendOnlySortedMap.ts +2 -1
  349. package/src/id-compressor/IdCompressor.ts +18 -17
  350. package/src/id-compressor/IdRange.ts +2 -1
  351. package/src/id-compressor/NumericUuid.ts +1 -1
  352. package/src/id-compressor/SessionIdNormalizer.ts +3 -3
  353. package/src/migration-shim/migrationDeltaHandler.ts +3 -2
  354. package/src/migration-shim/migrationShim.ts +14 -10
  355. package/src/migration-shim/migrationShimFactory.ts +6 -4
  356. package/src/migration-shim/packageVersion.ts +0 -2
  357. package/src/migration-shim/sharedTreeDeltaHandler.ts +3 -2
  358. package/src/migration-shim/sharedTreeShim.ts +7 -5
  359. package/src/migration-shim/sharedTreeShimFactory.ts +3 -3
  360. package/src/migration-shim/shimChannelServices.ts +1 -1
  361. package/src/migration-shim/shimDeltaConnection.ts +3 -2
  362. package/src/migration-shim/shimHandle.ts +1 -0
  363. package/src/migration-shim/types.ts +3 -1
  364. package/src/migration-shim/utils.ts +2 -1
  365. package/src/persisted-types/0.0.2.ts +2 -2
  366. package/src/persisted-types/0.1.1.ts +10 -8
  367. package/dist/tree-alpha.d.ts +0 -2901
  368. package/dist/tree-beta.d.ts +0 -348
  369. package/dist/tree-public.d.ts +0 -348
  370. package/dist/tree-untrimmed.d.ts +0 -3820
  371. package/lib/test/AppendOnlySortedMap.perf.tests.d.ts +0 -6
  372. package/lib/test/AppendOnlySortedMap.perf.tests.d.ts.map +0 -1
  373. package/lib/test/AppendOnlySortedMap.perf.tests.js +0 -49
  374. package/lib/test/AppendOnlySortedMap.perf.tests.js.map +0 -1
  375. package/lib/test/AppendOnlySortedMap.tests.d.ts +0 -6
  376. package/lib/test/AppendOnlySortedMap.tests.d.ts.map +0 -1
  377. package/lib/test/AppendOnlySortedMap.tests.js +0 -213
  378. package/lib/test/AppendOnlySortedMap.tests.js.map +0 -1
  379. package/lib/test/ChangeCompression.tests.d.ts +0 -6
  380. package/lib/test/ChangeCompression.tests.d.ts.map +0 -1
  381. package/lib/test/ChangeCompression.tests.js +0 -154
  382. package/lib/test/ChangeCompression.tests.js.map +0 -1
  383. package/lib/test/Checkout.tests.d.ts +0 -10
  384. package/lib/test/Checkout.tests.d.ts.map +0 -1
  385. package/lib/test/Checkout.tests.js +0 -460
  386. package/lib/test/Checkout.tests.js.map +0 -1
  387. package/lib/test/Common.tests.d.ts +0 -6
  388. package/lib/test/Common.tests.d.ts.map +0 -1
  389. package/lib/test/Common.tests.js +0 -102
  390. package/lib/test/Common.tests.js.map +0 -1
  391. package/lib/test/EagerCheckout.tests.d.ts +0 -6
  392. package/lib/test/EagerCheckout.tests.d.ts.map +0 -1
  393. package/lib/test/EagerCheckout.tests.js +0 -20
  394. package/lib/test/EagerCheckout.tests.js.map +0 -1
  395. package/lib/test/Edit.tests.d.ts +0 -6
  396. package/lib/test/Edit.tests.d.ts.map +0 -1
  397. package/lib/test/Edit.tests.js +0 -60
  398. package/lib/test/Edit.tests.js.map +0 -1
  399. package/lib/test/EditLog.perf.tests.d.ts +0 -6
  400. package/lib/test/EditLog.perf.tests.d.ts.map +0 -1
  401. package/lib/test/EditLog.perf.tests.js +0 -41
  402. package/lib/test/EditLog.perf.tests.js.map +0 -1
  403. package/lib/test/EditLog.tests.d.ts +0 -6
  404. package/lib/test/EditLog.tests.d.ts.map +0 -1
  405. package/lib/test/EditLog.tests.js +0 -355
  406. package/lib/test/EditLog.tests.js.map +0 -1
  407. package/lib/test/EditUtilities.tests.d.ts +0 -6
  408. package/lib/test/EditUtilities.tests.d.ts.map +0 -1
  409. package/lib/test/EditUtilities.tests.js +0 -512
  410. package/lib/test/EditUtilities.tests.js.map +0 -1
  411. package/lib/test/Forest.perf.tests.d.ts +0 -6
  412. package/lib/test/Forest.perf.tests.d.ts.map +0 -1
  413. package/lib/test/Forest.perf.tests.js +0 -135
  414. package/lib/test/Forest.perf.tests.js.map +0 -1
  415. package/lib/test/Forest.tests.d.ts +0 -6
  416. package/lib/test/Forest.tests.d.ts.map +0 -1
  417. package/lib/test/Forest.tests.js +0 -213
  418. package/lib/test/Forest.tests.js.map +0 -1
  419. package/lib/test/GenericTransaction.tests.d.ts +0 -6
  420. package/lib/test/GenericTransaction.tests.d.ts.map +0 -1
  421. package/lib/test/GenericTransaction.tests.js +0 -31
  422. package/lib/test/GenericTransaction.tests.js.map +0 -1
  423. package/lib/test/HistoryEditFactory.tests.d.ts +0 -6
  424. package/lib/test/HistoryEditFactory.tests.d.ts.map +0 -1
  425. package/lib/test/HistoryEditFactory.tests.js +0 -170
  426. package/lib/test/HistoryEditFactory.tests.js.map +0 -1
  427. package/lib/test/IdCompressor.perf.tests.d.ts +0 -6
  428. package/lib/test/IdCompressor.perf.tests.d.ts.map +0 -1
  429. package/lib/test/IdCompressor.perf.tests.js +0 -290
  430. package/lib/test/IdCompressor.perf.tests.js.map +0 -1
  431. package/lib/test/IdCompressor.tests.d.ts +0 -6
  432. package/lib/test/IdCompressor.tests.d.ts.map +0 -1
  433. package/lib/test/IdCompressor.tests.js +0 -1542
  434. package/lib/test/IdCompressor.tests.js.map +0 -1
  435. package/lib/test/IdConversion.tests.d.ts +0 -6
  436. package/lib/test/IdConversion.tests.d.ts.map +0 -1
  437. package/lib/test/IdConversion.tests.js +0 -36
  438. package/lib/test/IdConversion.tests.js.map +0 -1
  439. package/lib/test/LazyCheckout.tests.d.ts +0 -6
  440. package/lib/test/LazyCheckout.tests.d.ts.map +0 -1
  441. package/lib/test/LazyCheckout.tests.js +0 -22
  442. package/lib/test/LazyCheckout.tests.js.map +0 -1
  443. package/lib/test/LogViewer.tests.d.ts +0 -6
  444. package/lib/test/LogViewer.tests.d.ts.map +0 -1
  445. package/lib/test/LogViewer.tests.js +0 -588
  446. package/lib/test/LogViewer.tests.js.map +0 -1
  447. package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts +0 -6
  448. package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +0 -1
  449. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +0 -351
  450. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +0 -1
  451. package/lib/test/NumericUuid.perf.tests.d.ts +0 -6
  452. package/lib/test/NumericUuid.perf.tests.d.ts.map +0 -1
  453. package/lib/test/NumericUuid.perf.tests.js +0 -68
  454. package/lib/test/NumericUuid.perf.tests.js.map +0 -1
  455. package/lib/test/NumericUuid.tests.d.ts +0 -6
  456. package/lib/test/NumericUuid.tests.d.ts.map +0 -1
  457. package/lib/test/NumericUuid.tests.js +0 -192
  458. package/lib/test/NumericUuid.tests.js.map +0 -1
  459. package/lib/test/RevisionValueCache.tests.d.ts +0 -6
  460. package/lib/test/RevisionValueCache.tests.d.ts.map +0 -1
  461. package/lib/test/RevisionValueCache.tests.js +0 -106
  462. package/lib/test/RevisionValueCache.tests.js.map +0 -1
  463. package/lib/test/RevisionView.tests.d.ts +0 -6
  464. package/lib/test/RevisionView.tests.d.ts.map +0 -1
  465. package/lib/test/RevisionView.tests.js +0 -131
  466. package/lib/test/RevisionView.tests.js.map +0 -1
  467. package/lib/test/SessionIdNormalizer.tests.d.ts +0 -6
  468. package/lib/test/SessionIdNormalizer.tests.d.ts.map +0 -1
  469. package/lib/test/SessionIdNormalizer.tests.js +0 -377
  470. package/lib/test/SessionIdNormalizer.tests.js.map +0 -1
  471. package/lib/test/SharedTree.fuzz.tests.d.ts +0 -6
  472. package/lib/test/SharedTree.fuzz.tests.d.ts.map +0 -1
  473. package/lib/test/SharedTree.fuzz.tests.js +0 -9
  474. package/lib/test/SharedTree.fuzz.tests.js.map +0 -1
  475. package/lib/test/SharedTree.perf.tests.d.ts +0 -6
  476. package/lib/test/SharedTree.perf.tests.d.ts.map +0 -1
  477. package/lib/test/SharedTree.perf.tests.js +0 -39
  478. package/lib/test/SharedTree.perf.tests.js.map +0 -1
  479. package/lib/test/SharedTree.tests.d.ts +0 -6
  480. package/lib/test/SharedTree.tests.d.ts.map +0 -1
  481. package/lib/test/SharedTree.tests.js +0 -22
  482. package/lib/test/SharedTree.tests.js.map +0 -1
  483. package/lib/test/StringInterner.tests.d.ts +0 -6
  484. package/lib/test/StringInterner.tests.d.ts.map +0 -1
  485. package/lib/test/StringInterner.tests.js +0 -73
  486. package/lib/test/StringInterner.tests.js.map +0 -1
  487. package/lib/test/Summary.tests.d.ts +0 -7
  488. package/lib/test/Summary.tests.d.ts.map +0 -1
  489. package/lib/test/Summary.tests.js +0 -386
  490. package/lib/test/Summary.tests.js.map +0 -1
  491. package/lib/test/Transaction.tests.d.ts +0 -6
  492. package/lib/test/Transaction.tests.d.ts.map +0 -1
  493. package/lib/test/Transaction.tests.js +0 -124
  494. package/lib/test/Transaction.tests.js.map +0 -1
  495. package/lib/test/TransactionInternal.tests.d.ts +0 -6
  496. package/lib/test/TransactionInternal.tests.d.ts.map +0 -1
  497. package/lib/test/TransactionInternal.tests.js +0 -576
  498. package/lib/test/TransactionInternal.tests.js.map +0 -1
  499. package/lib/test/TreeCompression.tests.d.ts +0 -6
  500. package/lib/test/TreeCompression.tests.d.ts.map +0 -1
  501. package/lib/test/TreeCompression.tests.js +0 -291
  502. package/lib/test/TreeCompression.tests.js.map +0 -1
  503. package/lib/test/TreeView.tests.d.ts +0 -6
  504. package/lib/test/TreeView.tests.d.ts.map +0 -1
  505. package/lib/test/TreeView.tests.js +0 -178
  506. package/lib/test/TreeView.tests.js.map +0 -1
  507. package/lib/test/UndoRedoHandler.tests.d.ts +0 -6
  508. package/lib/test/UndoRedoHandler.tests.d.ts.map +0 -1
  509. package/lib/test/UndoRedoHandler.tests.js +0 -37
  510. package/lib/test/UndoRedoHandler.tests.js.map +0 -1
  511. package/lib/test/fuzz/Generators.d.ts +0 -8
  512. package/lib/test/fuzz/Generators.d.ts.map +0 -1
  513. package/lib/test/fuzz/Generators.js +0 -345
  514. package/lib/test/fuzz/Generators.js.map +0 -1
  515. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +0 -23
  516. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +0 -1
  517. package/lib/test/fuzz/SharedTreeFuzzTests.js +0 -241
  518. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +0 -1
  519. package/lib/test/fuzz/Types.d.ts +0 -136
  520. package/lib/test/fuzz/Types.d.ts.map +0 -1
  521. package/lib/test/fuzz/Types.js +0 -6
  522. package/lib/test/fuzz/Types.js.map +0 -1
  523. package/lib/test/utilities/IdCompressorTestUtilities.d.ts +0 -246
  524. package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +0 -1
  525. package/lib/test/utilities/IdCompressorTestUtilities.js +0 -608
  526. package/lib/test/utilities/IdCompressorTestUtilities.js.map +0 -1
  527. package/lib/test/utilities/MockTransaction.d.ts +0 -35
  528. package/lib/test/utilities/MockTransaction.d.ts.map +0 -1
  529. package/lib/test/utilities/MockTransaction.js +0 -51
  530. package/lib/test/utilities/MockTransaction.js.map +0 -1
  531. package/lib/test/utilities/PendingLocalStateTests.d.ts +0 -12
  532. package/lib/test/utilities/PendingLocalStateTests.d.ts.map +0 -1
  533. package/lib/test/utilities/PendingLocalStateTests.js +0 -223
  534. package/lib/test/utilities/PendingLocalStateTests.js.map +0 -1
  535. package/lib/test/utilities/SharedTreeTests.d.ts +0 -12
  536. package/lib/test/utilities/SharedTreeTests.d.ts.map +0 -1
  537. package/lib/test/utilities/SharedTreeTests.js +0 -949
  538. package/lib/test/utilities/SharedTreeTests.js.map +0 -1
  539. package/lib/test/utilities/SharedTreeVersioningTests.d.ts +0 -11
  540. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +0 -1
  541. package/lib/test/utilities/SharedTreeVersioningTests.js +0 -439
  542. package/lib/test/utilities/SharedTreeVersioningTests.js.map +0 -1
  543. package/lib/test/utilities/SummaryLoadPerfTests.d.ts +0 -10
  544. package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +0 -1
  545. package/lib/test/utilities/SummaryLoadPerfTests.js +0 -105
  546. package/lib/test/utilities/SummaryLoadPerfTests.js.map +0 -1
  547. package/lib/test/utilities/SummarySizeTests.d.ts +0 -11
  548. package/lib/test/utilities/SummarySizeTests.d.ts.map +0 -1
  549. package/lib/test/utilities/SummarySizeTests.js +0 -160
  550. package/lib/test/utilities/SummarySizeTests.js.map +0 -1
  551. package/lib/test/utilities/TestCommon.d.ts +0 -13
  552. package/lib/test/utilities/TestCommon.d.ts.map +0 -1
  553. package/lib/test/utilities/TestCommon.js +0 -19
  554. package/lib/test/utilities/TestCommon.js.map +0 -1
  555. package/lib/test/utilities/TestNode.d.ts +0 -140
  556. package/lib/test/utilities/TestNode.d.ts.map +0 -1
  557. package/lib/test/utilities/TestNode.js +0 -282
  558. package/lib/test/utilities/TestNode.js.map +0 -1
  559. package/lib/test/utilities/TestSerializer.d.ts +0 -24
  560. package/lib/test/utilities/TestSerializer.d.ts.map +0 -1
  561. package/lib/test/utilities/TestSerializer.js +0 -40
  562. package/lib/test/utilities/TestSerializer.js.map +0 -1
  563. package/lib/test/utilities/TestUtilities.d.ts +0 -212
  564. package/lib/test/utilities/TestUtilities.d.ts.map +0 -1
  565. package/lib/test/utilities/TestUtilities.js +0 -413
  566. package/lib/test/utilities/TestUtilities.js.map +0 -1
  567. package/lib/test/utilities/UndoRedoTests.d.ts +0 -32
  568. package/lib/test/utilities/UndoRedoTests.d.ts.map +0 -1
  569. package/lib/test/utilities/UndoRedoTests.js +0 -317
  570. package/lib/test/utilities/UndoRedoTests.js.map +0 -1
  571. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1,170 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { expect } from 'chai';
6
- import { HistoryEditFactoryEvents, revert } from '../HistoryEditFactory.js';
7
- import { ChangeInternal, StablePlaceInternal, StableRangeInternal } from '../persisted-types/index.js';
8
- import { expectDefined } from './utilities/TestCommon.js';
9
- import { refreshTestTree } from './utilities/TestUtilities.js';
10
- describe('revert', () => {
11
- const testTree = refreshTestTree();
12
- it('can revert a single detached node', () => {
13
- const firstDetachedId = 0;
14
- const node = testTree.buildLeafInternal();
15
- const firstBuild = ChangeInternal.build([node], firstDetachedId);
16
- const insertedNodeId = 1;
17
- const insertedBuild = ChangeInternal.build([firstDetachedId], insertedNodeId);
18
- const insertChange = ChangeInternal.insert(insertedNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
19
- const result = expectDefined(revert([firstBuild, insertedBuild, insertChange], testTree.view));
20
- expect(result.length).to.equal(1);
21
- const revertedChange = result[0];
22
- expect(revertedChange.source.start.referenceSibling).to.deep.equal(node.identifier);
23
- expect(revertedChange.source.end.referenceSibling).to.deep.equal(node.identifier);
24
- });
25
- it('can revert multiple detached nodes', () => {
26
- const firstDetachedId = 0;
27
- const firstNode = testTree.buildLeafInternal();
28
- const firstBuild = ChangeInternal.build([firstNode], firstDetachedId);
29
- const secondDetachedId = 1;
30
- const secondNode = testTree.buildLeafInternal();
31
- const secondBuild = ChangeInternal.build([secondNode], secondDetachedId);
32
- const insertedNodeId = 2;
33
- const insertedBuild = ChangeInternal.build([firstDetachedId, secondDetachedId], insertedNodeId);
34
- const insertChange = ChangeInternal.insert(insertedNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
35
- const result = expectDefined(revert([firstBuild, secondBuild, insertedBuild, insertChange], testTree.view));
36
- expect(result.length).to.equal(1);
37
- const revertedChange = result[0];
38
- expect(revertedChange.source.start.referenceSibling).to.deep.equal(firstNode.identifier);
39
- expect(revertedChange.source.end.referenceSibling).to.deep.equal(secondNode.identifier);
40
- });
41
- it('handles reverting the insert of empty nodes, with subsequent non-empty nodes', () => {
42
- // build and insert of empty traits
43
- const emptyTraitNodeId = 0;
44
- const emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);
45
- const emptyTraitInsert = ChangeInternal.insert(emptyTraitNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
46
- // build and insert of non-empty traits
47
- const firstDetachedId = 1;
48
- const firstNode = testTree.buildLeafInternal();
49
- const firstBuild = ChangeInternal.build([firstNode], firstDetachedId);
50
- const insertedNodeId = 3;
51
- const insertedBuild = ChangeInternal.build([firstDetachedId], insertedNodeId);
52
- const insertChange = ChangeInternal.insert(insertedNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
53
- const result = expectDefined(revert([emptyTraitBuild, emptyTraitInsert, firstBuild, insertedBuild, insertChange], testTree.view));
54
- expect(result.length).to.equal(1);
55
- const revertedChange = result[0];
56
- expect(revertedChange.source.start.referenceSibling).to.deep.equal(firstNode.identifier);
57
- });
58
- /** This is a regression test for a bug where we make sure that any built/detached nodes are cleared when any
59
- * empty insert/detach change is skipped once encountered. The expected outcome is undefined, as during the second
60
- * empty insert (with the same DetachSequenceId), there should be no such node in the builtNodes.
61
- */
62
- it('handles reverting the insert of empty nodes, with subsequent empty nodes of same DetachedSequenceId', () => {
63
- const emptyTraitNodeId = 0;
64
- const emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);
65
- const emptyTraitInsert = ChangeInternal.insert(emptyTraitNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
66
- const result = revert([emptyTraitBuild, emptyTraitInsert, emptyTraitInsert], testTree.view);
67
- expect(result).to.be.undefined;
68
- });
69
- it('handles reverting the detach of an empty trait', () => {
70
- const insertedNodeId = 0;
71
- const result = expectDefined(revert([
72
- ChangeInternal.detach(StableRangeInternal.all({
73
- label: 'someNonExistentTraitLabel',
74
- parent: testTree.identifier,
75
- }), insertedNodeId),
76
- ], testTree.view));
77
- expect(result).to.have.lengthOf(0);
78
- });
79
- it('handles reverting the insert of an empty trait', () => {
80
- const emptyTraitNodeId = 0;
81
- const emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);
82
- const emptyTraitInsert = ChangeInternal.insert(emptyTraitNodeId, StablePlaceInternal.atStartOf(testTree.left.traitLocation));
83
- const result = expectDefined(revert([emptyTraitBuild, emptyTraitInsert], testTree.view));
84
- expect(result).to.have.lengthOf(0);
85
- });
86
- describe('returns undefined for reverts that require more context than the view directly before the edit', () => {
87
- describe('because the edit conflicted', () => {
88
- it('when reverting a detach of a node that is not in the tree', () => {
89
- let missingNodeEvents = 0;
90
- const nodeNotInTree = testTree.buildLeafInternal();
91
- const change = ChangeInternal.detach(StableRangeInternal.only(nodeNotInTree));
92
- const result = revert([change], testTree.view, undefined, (event) => {
93
- if (event === HistoryEditFactoryEvents.MissingNodes) {
94
- missingNodeEvents++;
95
- }
96
- });
97
- expect(missingNodeEvents).to.equal(1);
98
- expect(result).to.be.undefined;
99
- });
100
- it('when reverting a set value of a node that is not in the tree', () => {
101
- let missingNodeEvents = 0;
102
- const nodeNotInTree = testTree.buildLeafInternal();
103
- const change = ChangeInternal.setPayload(nodeNotInTree, '42');
104
- const result = revert([change], testTree.view, undefined, (event) => {
105
- if (event === HistoryEditFactoryEvents.MissingNodes) {
106
- missingNodeEvents++;
107
- }
108
- });
109
- expect(missingNodeEvents).to.equal(1);
110
- expect(result).to.be.undefined;
111
- });
112
- });
113
- describe('because the edit was malformed', () => {
114
- it('when reverting an insert whose source is not insertable', () => {
115
- const detachedId = 0;
116
- let missingNodeEvents = 0;
117
- // Revert an insert where the source is not a valid detached sequence ID (nothing has been built/detached with that ID)
118
- expect(revert([ChangeInternal.insert(detachedId, StablePlaceInternal.atStartOf(testTree.left.traitLocation))], testTree.view, undefined, (event) => {
119
- if (event === HistoryEditFactoryEvents.MissingNodes) {
120
- missingNodeEvents++;
121
- }
122
- })).to.be.undefined;
123
- expect(missingNodeEvents).to.equal(1);
124
- // Revert a duplicate insert (the source has already been inserted by a previous insert in the same edit)
125
- expect(revert([
126
- ChangeInternal.build([testTree.buildLeafInternal()], detachedId),
127
- ChangeInternal.insert(detachedId, StablePlaceInternal.atStartOf(testTree.left.traitLocation)),
128
- ChangeInternal.insert(detachedId, StablePlaceInternal.atStartOf(testTree.left.traitLocation)),
129
- ], testTree.view, undefined, (event) => {
130
- if (event === HistoryEditFactoryEvents.MissingNodes) {
131
- missingNodeEvents++;
132
- }
133
- })).to.be.undefined;
134
- expect(missingNodeEvents).to.equal(2);
135
- });
136
- it('when reverting a detach whose destination is already occupied', () => {
137
- const detachedId = 0;
138
- let malformedEditEvents = 0;
139
- let missingNodeEvents = 0;
140
- // Revert a detach where the destination is already occupied due to a prior detach
141
- expect(revert([
142
- ChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),
143
- ChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),
144
- ], testTree.view, undefined, (event) => {
145
- if (event === HistoryEditFactoryEvents.MalformedEdit) {
146
- malformedEditEvents++;
147
- }
148
- if (event === HistoryEditFactoryEvents.MissingNodes) {
149
- missingNodeEvents++;
150
- }
151
- })).to.be.undefined;
152
- expect(missingNodeEvents).to.equal(1);
153
- // Revert a detach where the destination is already occupied due to a prior build
154
- expect(revert([
155
- ChangeInternal.build([testTree.buildLeafInternal()], detachedId),
156
- ChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),
157
- ], testTree.view, undefined, (event) => {
158
- if (event === HistoryEditFactoryEvents.MalformedEdit) {
159
- malformedEditEvents++;
160
- }
161
- if (event === HistoryEditFactoryEvents.MissingNodes) {
162
- missingNodeEvents++;
163
- }
164
- })).to.be.undefined;
165
- expect(malformedEditEvents).to.equal(1);
166
- });
167
- });
168
- });
169
- });
170
- //# sourceMappingURL=HistoryEditFactory.tests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HistoryEditFactory.tests.js","sourceRoot":"","sources":["../../src/test/HistoryEditFactory.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAkB,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACvB,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IAEnC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC5C,MAAM,eAAe,GAAG,CAAuB,CAAC;QAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAC;QACjE,MAAM,cAAc,GAAG,CAAuB,CAAC;QAC/C,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC,CAAC;QAC9E,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,CACzC,cAAc,EACd,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAC1D,CAAC;QACF,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/F,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,C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AC,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,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 { expect } from 'chai';\nimport { HistoryEditFactoryEvents, revert } from '../HistoryEditFactory.js';\nimport { DetachedSequenceId, TraitLabel } from '../Identifiers.js';\nimport { ChangeInternal, DetachInternal, StablePlaceInternal, StableRangeInternal } from '../persisted-types/index.js';\nimport { expectDefined } from './utilities/TestCommon.js';\nimport { refreshTestTree } from './utilities/TestUtilities.js';\n\ndescribe('revert', () => {\n\tconst testTree = refreshTestTree();\n\n\tit('can revert a single detached node', () => {\n\t\tconst firstDetachedId = 0 as DetachedSequenceId;\n\t\tconst node = testTree.buildLeafInternal();\n\t\tconst firstBuild = ChangeInternal.build([node], firstDetachedId);\n\t\tconst insertedNodeId = 1 as DetachedSequenceId;\n\t\tconst insertedBuild = ChangeInternal.build([firstDetachedId], insertedNodeId);\n\t\tconst insertChange = ChangeInternal.insert(\n\t\t\tinsertedNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\t\tconst result = expectDefined(revert([firstBuild, insertedBuild, insertChange], testTree.view));\n\t\texpect(result.length).to.equal(1);\n\t\tconst revertedChange = result[0] as DetachInternal;\n\t\texpect(revertedChange.source.start.referenceSibling).to.deep.equal(node.identifier);\n\t\texpect(revertedChange.source.end.referenceSibling).to.deep.equal(node.identifier);\n\t});\n\n\tit('can revert multiple detached nodes', () => {\n\t\tconst firstDetachedId = 0 as DetachedSequenceId;\n\t\tconst firstNode = testTree.buildLeafInternal();\n\t\tconst firstBuild = ChangeInternal.build([firstNode], firstDetachedId);\n\t\tconst secondDetachedId = 1 as DetachedSequenceId;\n\t\tconst secondNode = testTree.buildLeafInternal();\n\t\tconst secondBuild = ChangeInternal.build([secondNode], secondDetachedId);\n\t\tconst insertedNodeId = 2 as DetachedSequenceId;\n\t\tconst insertedBuild = ChangeInternal.build([firstDetachedId, secondDetachedId], insertedNodeId);\n\t\tconst insertChange = ChangeInternal.insert(\n\t\t\tinsertedNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\t\tconst result = expectDefined(revert([firstBuild, secondBuild, insertedBuild, insertChange], testTree.view));\n\t\texpect(result.length).to.equal(1);\n\t\tconst revertedChange = result[0] as DetachInternal;\n\t\texpect(revertedChange.source.start.referenceSibling).to.deep.equal(firstNode.identifier);\n\t\texpect(revertedChange.source.end.referenceSibling).to.deep.equal(secondNode.identifier);\n\t});\n\n\tit('handles reverting the insert of empty nodes, with subsequent non-empty nodes', () => {\n\t\t// build and insert of empty traits\n\t\tconst emptyTraitNodeId = 0 as DetachedSequenceId;\n\t\tconst emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);\n\t\tconst emptyTraitInsert = ChangeInternal.insert(\n\t\t\temptyTraitNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\n\t\t// build and insert of non-empty traits\n\t\tconst firstDetachedId = 1 as DetachedSequenceId;\n\t\tconst firstNode = testTree.buildLeafInternal();\n\t\tconst firstBuild = ChangeInternal.build([firstNode], firstDetachedId);\n\t\tconst insertedNodeId = 3 as DetachedSequenceId;\n\t\tconst insertedBuild = ChangeInternal.build([firstDetachedId], insertedNodeId);\n\t\tconst insertChange = ChangeInternal.insert(\n\t\t\tinsertedNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\t\tconst result = expectDefined(\n\t\t\trevert([emptyTraitBuild, emptyTraitInsert, firstBuild, insertedBuild, insertChange], testTree.view)\n\t\t);\n\t\texpect(result.length).to.equal(1);\n\t\tconst revertedChange = result[0] as DetachInternal;\n\t\texpect(revertedChange.source.start.referenceSibling).to.deep.equal(firstNode.identifier);\n\t});\n\n\t/** This is a regression test for a bug where we make sure that any built/detached nodes are cleared when any\n\t * empty insert/detach change is skipped once encountered. The expected outcome is undefined, as during the second\n\t * empty insert (with the same DetachSequenceId), there should be no such node in the builtNodes.\n\t */\n\tit('handles reverting the insert of empty nodes, with subsequent empty nodes of same DetachedSequenceId', () => {\n\t\tconst emptyTraitNodeId = 0 as DetachedSequenceId;\n\t\tconst emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);\n\t\tconst emptyTraitInsert = ChangeInternal.insert(\n\t\t\temptyTraitNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\t\tconst result = revert([emptyTraitBuild, emptyTraitInsert, emptyTraitInsert], testTree.view);\n\t\texpect(result).to.be.undefined;\n\t});\n\n\tit('handles reverting the detach of an empty trait', () => {\n\t\tconst insertedNodeId = 0 as DetachedSequenceId;\n\t\tconst result = expectDefined(\n\t\t\trevert(\n\t\t\t\t[\n\t\t\t\t\tChangeInternal.detach(\n\t\t\t\t\t\tStableRangeInternal.all({\n\t\t\t\t\t\t\tlabel: 'someNonExistentTraitLabel' as TraitLabel,\n\t\t\t\t\t\t\tparent: testTree.identifier,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tinsertedNodeId\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\ttestTree.view\n\t\t\t)\n\t\t);\n\t\texpect(result).to.have.lengthOf(0);\n\t});\n\n\tit('handles reverting the insert of an empty trait', () => {\n\t\tconst emptyTraitNodeId = 0 as DetachedSequenceId;\n\t\tconst emptyTraitBuild = ChangeInternal.build([], emptyTraitNodeId);\n\t\tconst emptyTraitInsert = ChangeInternal.insert(\n\t\t\temptyTraitNodeId,\n\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t);\n\t\tconst result = expectDefined(revert([emptyTraitBuild, emptyTraitInsert], testTree.view));\n\t\texpect(result).to.have.lengthOf(0);\n\t});\n\n\tdescribe('returns undefined for reverts that require more context than the view directly before the edit', () => {\n\t\tdescribe('because the edit conflicted', () => {\n\t\t\tit('when reverting a detach of a node that is not in the tree', () => {\n\t\t\t\tlet missingNodeEvents = 0;\n\t\t\t\tconst nodeNotInTree = testTree.buildLeafInternal();\n\t\t\t\tconst change = ChangeInternal.detach(StableRangeInternal.only(nodeNotInTree));\n\t\t\t\tconst result = revert([change], testTree.view, undefined, (event) => {\n\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\texpect(missingNodeEvents).to.equal(1);\n\t\t\t\texpect(result).to.be.undefined;\n\t\t\t});\n\n\t\t\tit('when reverting a set value of a node that is not in the tree', () => {\n\t\t\t\tlet missingNodeEvents = 0;\n\t\t\t\tconst nodeNotInTree = testTree.buildLeafInternal();\n\t\t\t\tconst change = ChangeInternal.setPayload(nodeNotInTree, '42');\n\t\t\t\tconst result = revert([change], testTree.view, undefined, (event) => {\n\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\texpect(missingNodeEvents).to.equal(1);\n\t\t\t\texpect(result).to.be.undefined;\n\t\t\t});\n\t\t});\n\n\t\tdescribe('because the edit was malformed', () => {\n\t\t\tit('when reverting an insert whose source is not insertable', () => {\n\t\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\t\tlet missingNodeEvents = 0;\n\t\t\t\t// Revert an insert where the source is not a valid detached sequence ID (nothing has been built/detached with that ID)\n\t\t\t\texpect(\n\t\t\t\t\trevert(\n\t\t\t\t\t\t[ChangeInternal.insert(detachedId, StablePlaceInternal.atStartOf(testTree.left.traitLocation))],\n\t\t\t\t\t\ttestTree.view,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t(event) => {\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t).to.be.undefined;\n\t\t\t\texpect(missingNodeEvents).to.equal(1);\n\t\t\t\t// Revert a duplicate insert (the source has already been inserted by a previous insert in the same edit)\n\t\t\t\texpect(\n\t\t\t\t\trevert(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tChangeInternal.build([testTree.buildLeafInternal()], detachedId),\n\t\t\t\t\t\t\tChangeInternal.insert(\n\t\t\t\t\t\t\t\tdetachedId,\n\t\t\t\t\t\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tChangeInternal.insert(\n\t\t\t\t\t\t\t\tdetachedId,\n\t\t\t\t\t\t\t\tStablePlaceInternal.atStartOf(testTree.left.traitLocation)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttestTree.view,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t(event) => {\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t).to.be.undefined;\n\t\t\t\texpect(missingNodeEvents).to.equal(2);\n\t\t\t});\n\n\t\t\tit('when reverting a detach whose destination is already occupied', () => {\n\t\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\t\tlet malformedEditEvents = 0;\n\t\t\t\tlet missingNodeEvents = 0;\n\t\t\t\t// Revert a detach where the destination is already occupied due to a prior detach\n\t\t\t\texpect(\n\t\t\t\t\trevert(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),\n\t\t\t\t\t\t\tChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttestTree.view,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t(event) => {\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MalformedEdit) {\n\t\t\t\t\t\t\t\tmalformedEditEvents++;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t).to.be.undefined;\n\t\t\t\texpect(missingNodeEvents).to.equal(1);\n\t\t\t\t// Revert a detach where the destination is already occupied due to a prior build\n\t\t\t\texpect(\n\t\t\t\t\trevert(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tChangeInternal.build([testTree.buildLeafInternal()], detachedId),\n\t\t\t\t\t\t\tChangeInternal.detach(StableRangeInternal.only(testTree.left), detachedId),\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttestTree.view,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t(event) => {\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MalformedEdit) {\n\t\t\t\t\t\t\t\tmalformedEditEvents++;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (event === HistoryEditFactoryEvents.MissingNodes) {\n\t\t\t\t\t\t\t\tmissingNodeEvents++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\t\t\t\t).to.be.undefined;\n\t\t\t\texpect(malformedEditEvents).to.equal(1);\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export {};
6
- //# sourceMappingURL=IdCompressor.perf.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdCompressor.perf.tests.d.ts","sourceRoot":"","sources":["../../src/test/IdCompressor.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,290 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
6
- import { benchmark, BenchmarkType } from '@fluid-tools/benchmark';
7
- import { take } from '@fluid-private/stochastic-test-utils';
8
- import { fail } from '../Common.js';
9
- import { defaultClusterCapacity, IdCompressor, isFinalId, isLocalId } from '../id-compressor/IdCompressor.js';
10
- import { createSessionId, numericUuidFromStableId, stableIdFromNumericUuid } from '../id-compressor/NumericUuid.js';
11
- import { Client, IdCompressorTestNetwork, makeOpGenerator, performFuzzActions, sessionIds, } from './utilities/IdCompressorTestUtilities.js';
12
- describe('IdCompressor Perf', () => {
13
- const type = BenchmarkType.Measurement;
14
- const localClient = Client.Client1;
15
- const remoteClient = Client.Client2;
16
- let perfCompressor;
17
- let network;
18
- let compressor;
19
- function setupCompressors(clusterSize, allowLocal, includeOverrides) {
20
- network = new IdCompressorTestNetwork(clusterSize);
21
- [compressor] = createPerfCompressor(network, allowLocal, includeOverrides, localClient);
22
- perfCompressor = undefined;
23
- return network;
24
- }
25
- function createPerfCompressor(network, allowLocal, includeOverrides, client) {
26
- const maxClusterSize = 25;
27
- const generator = take(1000, makeOpGenerator({ includeOverrides, validateInterval: 2000, maxClusterSize }));
28
- if (network.initialClusterSize > maxClusterSize) {
29
- network.enqueueCapacityChange(maxClusterSize);
30
- }
31
- performFuzzActions(generator, network, Math.E, allowLocal ? undefined : client, !allowLocal);
32
- return [network.getCompressorUnsafe(client), network.getIdLog(client)];
33
- }
34
- function setupCompressorWithId(local, override, clusterHasOtherOverrides) {
35
- const clusterCapacity = defaultClusterCapacity;
36
- const network = setupCompressors(clusterCapacity, true, true);
37
- if (!clusterHasOtherOverrides) {
38
- network.allocateAndSendIds(localClient, clusterCapacity);
39
- }
40
- else {
41
- network.allocateAndSendIds(localClient, 2, {
42
- 0: 'override1',
43
- 1: 'override2',
44
- });
45
- }
46
- if (override) {
47
- network.allocateAndSendIds(localClient, 1, { 0: 'override3' });
48
- }
49
- else {
50
- network.allocateAndSendIds(localClient, 1);
51
- }
52
- if (!local) {
53
- network.deliverOperations(localClient);
54
- }
55
- const ids = network.getIdLog(localClient);
56
- const lastId = ids[ids.length - 1].id;
57
- return lastId;
58
- }
59
- function benchmarkWithIdTypes(creator) {
60
- for (const local of [true, false]) {
61
- for (const override of [true, false]) {
62
- const titleSuffix = ` (${override ? 'override' : 'sequential'})`;
63
- creator(local, override, titleSuffix);
64
- }
65
- }
66
- }
67
- [true, false].forEach((override) => {
68
- const numericSource = numericUuidFromStableId(createSessionId());
69
- let overrideIndex = 0;
70
- benchmark({
71
- type,
72
- title: `allocate local ID (${override ? 'override' : 'sequential'})`,
73
- before: () => {
74
- setupCompressors(defaultClusterCapacity, true, false);
75
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
76
- },
77
- benchmarkFn: () => {
78
- perfCompressor.generateCompressedId(override ? stableIdFromNumericUuid(numericSource, overrideIndex++) : undefined);
79
- },
80
- });
81
- });
82
- [true, false].forEach((override) => {
83
- for (const clusterSize of [1, 10, 500, 1000]) {
84
- const overrideCount = 3;
85
- const numIds = 7;
86
- const session1 = '8150a099-5302-4672-b5f3-7a4492b59418';
87
- const session2 = 'f2ded886-92da-4248-967b-eb96ee04cf51';
88
- let session = session1;
89
- let lastFinalizedLocalId1 = 0;
90
- let lastFinalizedLocalId2 = 0;
91
- let overrideIndex = 0;
92
- benchmark({
93
- type,
94
- title: `finalize a range of IDs (cluster size =${clusterSize}${override ? ', overrides present' : ''})`,
95
- before: () => {
96
- setupCompressors(clusterSize, false, false);
97
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
98
- },
99
- benchmarkFn: () => {
100
- // Create a range with as minimal overhead as possible, as we'd like for this code to not exist
101
- // in the timing loop at all (but benchmark forces us to do so)
102
- const isLocal = session === session1;
103
- const first = ((isLocal ? lastFinalizedLocalId1 : lastFinalizedLocalId2) - 1);
104
- let overrides;
105
- const actualOverrideCount = override ? overrideCount : 0;
106
- if (actualOverrideCount > 0) {
107
- overrides = [];
108
- for (let i = 0; i < actualOverrideCount; i++) {
109
- overrides.push([
110
- (first - i),
111
- `override${overrideIndex++}`,
112
- ]);
113
- }
114
- }
115
- const last = (first - numIds);
116
- const range = {
117
- sessionId: session,
118
- ids: {
119
- first,
120
- last,
121
- overrides,
122
- },
123
- };
124
- perfCompressor.finalizeCreationRange(range);
125
- if (isLocal) {
126
- lastFinalizedLocalId1 = last;
127
- }
128
- else {
129
- lastFinalizedLocalId2 = last;
130
- }
131
- // Alternate clients to sidestep optimization that packs them all into last cluster
132
- session = isLocal ? session1 : session2;
133
- },
134
- });
135
- }
136
- });
137
- benchmark({
138
- type,
139
- title: `takes a ID creation range'})`,
140
- before: () => {
141
- setupCompressors(defaultClusterCapacity, true, false);
142
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
143
- },
144
- benchmarkFn: () => {
145
- perfCompressor.generateCompressedId();
146
- perfCompressor.takeNextCreationRange();
147
- },
148
- });
149
- benchmarkWithIdTypes((local, override, titleSuffix) => {
150
- let idToDecompress;
151
- const before = () => {
152
- idToDecompress = setupCompressorWithId(local, override, true);
153
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
154
- };
155
- const benchmarkFn = () => {
156
- perfCompressor.decompress(idToDecompress);
157
- };
158
- if (local) {
159
- benchmark({
160
- type,
161
- title: `decompress local ID into stable IDs${titleSuffix}`,
162
- before,
163
- benchmarkFn,
164
- });
165
- }
166
- else {
167
- const titleBase = 'decompress final ID into stable IDs';
168
- if (override) {
169
- benchmark({
170
- type,
171
- title: titleBase + titleSuffix,
172
- before,
173
- benchmarkFn,
174
- });
175
- }
176
- else {
177
- for (const clusterHasOverride of [true, false]) {
178
- benchmark({
179
- type,
180
- title: `${titleBase} (sequential, overrides ${clusterHasOverride ? 'present' : 'not present'} in owning cluster)`,
181
- before: () => {
182
- idToDecompress = setupCompressorWithId(local, override, clusterHasOverride);
183
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
184
- },
185
- benchmarkFn,
186
- });
187
- }
188
- }
189
- }
190
- });
191
- benchmarkWithIdTypes((local, override, titleSuffix) => {
192
- let stableToCompress;
193
- benchmark({
194
- type,
195
- title: `compress a stable ID to a ${local ? 'local' : 'final'} ID${titleSuffix}`,
196
- before: () => {
197
- const idAdded = setupCompressorWithId(local, override, true);
198
- stableToCompress = compressor.decompress(idAdded);
199
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
200
- },
201
- benchmarkFn: () => {
202
- perfCompressor.recompress(stableToCompress);
203
- },
204
- });
205
- });
206
- let final;
207
- benchmark({
208
- type,
209
- title: `normalize a final ID from the local session to session space`,
210
- before: () => {
211
- const network = setupCompressors(defaultClusterCapacity, true, true);
212
- network.allocateAndSendIds(localClient, 1);
213
- network.deliverOperations(localClient);
214
- const log = network.getSequencedIdLog(localClient);
215
- const id = compressor.normalizeToOpSpace(log[log.length - 1].id);
216
- final = isFinalId(id) ? id : fail('not a final ID');
217
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
218
- },
219
- benchmarkFn: () => {
220
- perfCompressor.normalizeToSessionSpace(final, compressor.localSessionId);
221
- },
222
- });
223
- function getLastLocalId(client, network) {
224
- const log = network.getIdLog(client);
225
- for (let i = log.length - 1; i > 0; i--) {
226
- const cur = log[i].id;
227
- if (isLocalId(cur)) {
228
- return cur;
229
- }
230
- }
231
- fail('no local ID found in log');
232
- }
233
- let localId;
234
- benchmark({
235
- type,
236
- title: `normalize a local ID from the local session to session space`,
237
- before: () => {
238
- const network = setupCompressors(defaultClusterCapacity, true, true);
239
- network.deliverOperations(localClient);
240
- localId = getLastLocalId(localClient, network);
241
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
242
- },
243
- benchmarkFn: () => {
244
- perfCompressor.normalizeToOpSpace(localId);
245
- },
246
- });
247
- const remoteSessionId = sessionIds.get(remoteClient);
248
- let opSpaceId;
249
- benchmark({
250
- type,
251
- title: `normalize a local ID from a remote session to session space`,
252
- before: () => {
253
- const network = setupCompressors(defaultClusterCapacity, true, true);
254
- network.deliverOperations(localClient);
255
- opSpaceId = getLastLocalId(remoteClient, network);
256
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
257
- },
258
- benchmarkFn: () => {
259
- perfCompressor.normalizeToSessionSpace(opSpaceId ?? fail(), remoteSessionId);
260
- },
261
- });
262
- for (const overrideInClusters of [true, false]) {
263
- const titleSuffix = ` (${overrideInClusters ? 'with' : 'without'} overrides)`;
264
- benchmark({
265
- type,
266
- title: `serialize an IdCompressor${titleSuffix}`,
267
- before: () => {
268
- setupCompressors(defaultClusterCapacity, false, overrideInClusters);
269
- perfCompressor = network.getCompressorUnsafeNoProxy(localClient);
270
- },
271
- benchmarkFn: () => {
272
- perfCompressor.serialize(false);
273
- },
274
- });
275
- let serialized;
276
- const remoteSessionId = createSessionId();
277
- benchmark({
278
- type,
279
- title: `deserialize an IdCompressor${titleSuffix}`,
280
- before: () => {
281
- setupCompressors(defaultClusterCapacity, false, overrideInClusters);
282
- serialized = compressor.serialize(false);
283
- },
284
- benchmarkFn: () => {
285
- IdCompressor.deserialize(serialized, remoteSessionId);
286
- },
287
- });
288
- }
289
- });
290
- //# sourceMappingURL=IdCompressor.perf.tests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdCompressor.perf.tests.js","sourceRoot":"","sources":["../../src/test/IdCompressor.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAW,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE9G,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE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S,CAAC;YACT,IAAI;YACJ,KAAK,EAAE,4BAA4B,WAAW,EAAE;YAChD,MAAM,EAAE,GAAG,EAAE;gBACZ,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;gBACpE,cAAc,GAAG,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;YAClE,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBACjB,cAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;SACD,CAAC,CAAC;QAEH,IAAI,UAAgD,CAAC;QACrD,MAAM,eAAe,GAAG,eAAe,EAAE,CAAC;QAC1C,SAAS,CAAC;YACT,IAAI;YACJ,KAAK,EAAE,8BAA8B,WAAW,EAAE;YAClD,MAAM,EAAE,GAAG,EAAE;gBACZ,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;gBACpE,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBACjB,YAAY,CAAC,WAAW,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;YACvD,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\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { benchmark, BenchmarkType } from '@fluid-tools/benchmark';\nimport { take } from '@fluid-private/stochastic-test-utils';\nimport { fail, Mutable } from '../Common.js';\nimport { defaultClusterCapacity, IdCompressor, isFinalId, isLocalId } from '../id-compressor/IdCompressor.js';\nimport { IdCreationRange, UnackedLocalId, SerializedIdCompressorWithNoSession } from '../id-compressor/index.js';\nimport { createSessionId, numericUuidFromStableId, stableIdFromNumericUuid } from '../id-compressor/NumericUuid.js';\nimport { CompressedId, FinalCompressedId, LocalCompressedId, OpSpaceCompressedId, SessionId } from '../Identifiers.js';\nimport {\n\tClient,\n\tIdCompressorTestNetwork,\n\tmakeOpGenerator,\n\tperformFuzzActions,\n\tsessionIds,\n\tTestIdData,\n} from './utilities/IdCompressorTestUtilities.js';\n\ndescribe('IdCompressor Perf', () => {\n\tconst type = BenchmarkType.Measurement;\n\tconst localClient = Client.Client1;\n\tconst remoteClient = Client.Client2;\n\tlet perfCompressor: IdCompressor | undefined;\n\tlet network: IdCompressorTestNetwork;\n\tlet compressor: IdCompressor;\n\n\tfunction setupCompressors(\n\t\tclusterSize: number,\n\t\tallowLocal: boolean,\n\t\tincludeOverrides: boolean\n\t): IdCompressorTestNetwork {\n\t\tnetwork = new IdCompressorTestNetwork(clusterSize);\n\t\t[compressor] = createPerfCompressor(network, allowLocal, includeOverrides, localClient);\n\t\tperfCompressor = undefined;\n\t\treturn network;\n\t}\n\n\tfunction createPerfCompressor(\n\t\tnetwork: IdCompressorTestNetwork,\n\t\tallowLocal: boolean,\n\t\tincludeOverrides: boolean,\n\t\tclient: Client\n\t): [IdCompressor, readonly TestIdData[]] {\n\t\tconst maxClusterSize = 25;\n\t\tconst generator = take(1000, makeOpGenerator({ includeOverrides, validateInterval: 2000, maxClusterSize }));\n\t\tif (network.initialClusterSize > maxClusterSize) {\n\t\t\tnetwork.enqueueCapacityChange(maxClusterSize);\n\t\t}\n\t\tperformFuzzActions(generator, network, Math.E, allowLocal ? undefined : client, !allowLocal);\n\t\treturn [network.getCompressorUnsafe(client), network.getIdLog(client)];\n\t}\n\n\tfunction setupCompressorWithId(local: boolean, override: boolean, clusterHasOtherOverrides: boolean): CompressedId {\n\t\tconst clusterCapacity = defaultClusterCapacity;\n\t\tconst network = setupCompressors(clusterCapacity, true, true);\n\t\tif (!clusterHasOtherOverrides) {\n\t\t\tnetwork.allocateAndSendIds(localClient, clusterCapacity);\n\t\t} else {\n\t\t\tnetwork.allocateAndSendIds(localClient, 2, {\n\t\t\t\t0: 'override1',\n\t\t\t\t1: 'override2',\n\t\t\t});\n\t\t}\n\t\tif (override) {\n\t\t\tnetwork.allocateAndSendIds(localClient, 1, { 0: 'override3' });\n\t\t} else {\n\t\t\tnetwork.allocateAndSendIds(localClient, 1);\n\t\t}\n\n\t\tif (!local) {\n\t\t\tnetwork.deliverOperations(localClient);\n\t\t}\n\n\t\tconst ids = network.getIdLog(localClient);\n\t\tconst lastId = ids[ids.length - 1].id;\n\t\treturn lastId;\n\t}\n\n\tfunction benchmarkWithIdTypes(creator: (local: boolean, override: boolean, titleSuffix: string) => void) {\n\t\tfor (const local of [true, false]) {\n\t\t\tfor (const override of [true, false]) {\n\t\t\t\tconst titleSuffix = ` (${override ? 'override' : 'sequential'})`;\n\t\t\t\tcreator(local, override, titleSuffix);\n\t\t\t}\n\t\t}\n\t}\n\n\t[true, false].forEach((override) => {\n\t\tconst numericSource = numericUuidFromStableId(createSessionId());\n\t\tlet overrideIndex = 0;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `allocate local ID (${override ? 'override' : 'sequential'})`,\n\t\t\tbefore: () => {\n\t\t\t\tsetupCompressors(defaultClusterCapacity, true, false);\n\t\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.generateCompressedId(\n\t\t\t\t\toverride ? stableIdFromNumericUuid(numericSource, overrideIndex++) : undefined\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t});\n\n\t[true, false].forEach((override) => {\n\t\tfor (const clusterSize of [1, 10, 500, 1000]) {\n\t\t\tconst overrideCount = 3;\n\t\t\tconst numIds = 7;\n\t\t\tconst session1 = '8150a099-5302-4672-b5f3-7a4492b59418' as SessionId;\n\t\t\tconst session2 = 'f2ded886-92da-4248-967b-eb96ee04cf51' as SessionId;\n\t\t\tlet session: SessionId = session1;\n\t\t\tlet lastFinalizedLocalId1 = 0 as LocalCompressedId;\n\t\t\tlet lastFinalizedLocalId2 = 0 as LocalCompressedId;\n\t\t\tlet overrideIndex = 0;\n\t\t\tbenchmark({\n\t\t\t\ttype,\n\t\t\t\ttitle: `finalize a range of IDs (cluster size =${clusterSize}${override ? ', overrides present' : ''})`,\n\t\t\t\tbefore: () => {\n\t\t\t\t\tsetupCompressors(clusterSize, false, false);\n\t\t\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t\t\t},\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\t// Create a range with as minimal overhead as possible, as we'd like for this code to not exist\n\t\t\t\t\t// in the timing loop at all (but benchmark forces us to do so)\n\t\t\t\t\tconst isLocal = session === session1;\n\t\t\t\t\tconst first = ((isLocal ? lastFinalizedLocalId1 : lastFinalizedLocalId2) - 1) as LocalCompressedId &\n\t\t\t\t\t\tOpSpaceCompressedId;\n\t\t\t\t\tlet overrides: Mutable<IdCreationRange.Overrides> | undefined;\n\t\t\t\t\tconst actualOverrideCount = override ? overrideCount : 0;\n\t\t\t\t\tif (actualOverrideCount > 0) {\n\t\t\t\t\t\toverrides = [] as unknown as Mutable<IdCreationRange.Overrides>;\n\t\t\t\t\t\tfor (let i = 0; i < actualOverrideCount; i++) {\n\t\t\t\t\t\t\toverrides.push([\n\t\t\t\t\t\t\t\t(first - i) as LocalCompressedId & OpSpaceCompressedId,\n\t\t\t\t\t\t\t\t`override${overrideIndex++}`,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst last = (first - numIds) as UnackedLocalId;\n\t\t\t\t\tconst range: IdCreationRange = {\n\t\t\t\t\t\tsessionId: session,\n\t\t\t\t\t\tids: {\n\t\t\t\t\t\t\tfirst,\n\t\t\t\t\t\t\tlast,\n\t\t\t\t\t\t\toverrides,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\n\t\t\t\t\tperfCompressor!.finalizeCreationRange(range);\n\n\t\t\t\t\tif (isLocal) {\n\t\t\t\t\t\tlastFinalizedLocalId1 = last;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlastFinalizedLocalId2 = last;\n\t\t\t\t\t}\n\t\t\t\t\t// Alternate clients to sidestep optimization that packs them all into last cluster\n\t\t\t\t\tsession = isLocal ? session1 : session2;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `takes a ID creation range'})`,\n\t\tbefore: () => {\n\t\t\tsetupCompressors(defaultClusterCapacity, true, false);\n\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.generateCompressedId();\n\t\t\tperfCompressor!.takeNextCreationRange();\n\t\t},\n\t});\n\n\tbenchmarkWithIdTypes((local, override, titleSuffix) => {\n\t\tlet idToDecompress!: CompressedId;\n\t\tconst before = () => {\n\t\t\tidToDecompress = setupCompressorWithId(local, override, true);\n\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t};\n\t\tconst benchmarkFn = () => {\n\t\t\tperfCompressor!.decompress(idToDecompress);\n\t\t};\n\t\tif (local) {\n\t\t\tbenchmark({\n\t\t\t\ttype,\n\t\t\t\ttitle: `decompress local ID into stable IDs${titleSuffix}`,\n\t\t\t\tbefore,\n\t\t\t\tbenchmarkFn,\n\t\t\t});\n\t\t} else {\n\t\t\tconst titleBase = 'decompress final ID into stable IDs';\n\t\t\tif (override) {\n\t\t\t\tbenchmark({\n\t\t\t\t\ttype,\n\t\t\t\t\ttitle: titleBase + titleSuffix,\n\t\t\t\t\tbefore,\n\t\t\t\t\tbenchmarkFn,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tfor (const clusterHasOverride of [true, false]) {\n\t\t\t\t\tbenchmark({\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\ttitle: `${titleBase} (sequential, overrides ${\n\t\t\t\t\t\t\tclusterHasOverride ? 'present' : 'not present'\n\t\t\t\t\t\t} in owning cluster)`,\n\t\t\t\t\t\tbefore: () => {\n\t\t\t\t\t\t\tidToDecompress = setupCompressorWithId(local, override, clusterHasOverride);\n\t\t\t\t\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbenchmarkFn,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tbenchmarkWithIdTypes((local, override, titleSuffix) => {\n\t\tlet stableToCompress!: string;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `compress a stable ID to a ${local ? 'local' : 'final'} ID${titleSuffix}`,\n\t\t\tbefore: () => {\n\t\t\t\tconst idAdded = setupCompressorWithId(local, override, true);\n\t\t\t\tstableToCompress = compressor.decompress(idAdded);\n\t\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.recompress(stableToCompress);\n\t\t\t},\n\t\t});\n\t});\n\n\tlet final!: FinalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `normalize a final ID from the local session to session space`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(defaultClusterCapacity, true, true);\n\t\t\tnetwork.allocateAndSendIds(localClient, 1);\n\t\t\tnetwork.deliverOperations(localClient);\n\t\t\tconst log = network.getSequencedIdLog(localClient);\n\t\t\tconst id = compressor.normalizeToOpSpace(log[log.length - 1].id);\n\t\t\tfinal = isFinalId(id) ? id : fail('not a final ID');\n\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.normalizeToSessionSpace(final, compressor.localSessionId);\n\t\t},\n\t});\n\n\tfunction getLastLocalId(client: Client, network: IdCompressorTestNetwork): LocalCompressedId {\n\t\tconst log = network.getIdLog(client);\n\t\tfor (let i = log.length - 1; i > 0; i--) {\n\t\t\tconst cur = log[i].id;\n\t\t\tif (isLocalId(cur)) {\n\t\t\t\treturn cur;\n\t\t\t}\n\t\t}\n\t\tfail('no local ID found in log');\n\t}\n\n\tlet localId!: LocalCompressedId;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `normalize a local ID from the local session to session space`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(defaultClusterCapacity, true, true);\n\t\t\tnetwork.deliverOperations(localClient);\n\t\t\tlocalId = getLastLocalId(localClient, network);\n\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.normalizeToOpSpace(localId);\n\t\t},\n\t});\n\n\tconst remoteSessionId = sessionIds.get(remoteClient);\n\tlet opSpaceId: OpSpaceCompressedId | undefined;\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `normalize a local ID from a remote session to session space`,\n\t\tbefore: () => {\n\t\t\tconst network = setupCompressors(defaultClusterCapacity, true, true);\n\t\t\tnetwork.deliverOperations(localClient);\n\t\t\topSpaceId = getLastLocalId(remoteClient, network) as OpSpaceCompressedId;\n\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t},\n\t\tbenchmarkFn: () => {\n\t\t\tperfCompressor!.normalizeToSessionSpace(opSpaceId ?? fail(), remoteSessionId);\n\t\t},\n\t});\n\n\tfor (const overrideInClusters of [true, false]) {\n\t\tconst titleSuffix = ` (${overrideInClusters ? 'with' : 'without'} overrides)`;\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `serialize an IdCompressor${titleSuffix}`,\n\t\t\tbefore: () => {\n\t\t\t\tsetupCompressors(defaultClusterCapacity, false, overrideInClusters);\n\t\t\t\tperfCompressor = network.getCompressorUnsafeNoProxy(localClient);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tperfCompressor!.serialize(false);\n\t\t\t},\n\t\t});\n\n\t\tlet serialized!: SerializedIdCompressorWithNoSession;\n\t\tconst remoteSessionId = createSessionId();\n\t\tbenchmark({\n\t\t\ttype,\n\t\t\ttitle: `deserialize an IdCompressor${titleSuffix}`,\n\t\t\tbefore: () => {\n\t\t\t\tsetupCompressors(defaultClusterCapacity, false, overrideInClusters);\n\t\t\t\tserialized = compressor.serialize(false);\n\t\t\t},\n\t\t\tbenchmarkFn: () => {\n\t\t\t\tIdCompressor.deserialize(serialized, remoteSessionId);\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export {};
6
- //# sourceMappingURL=IdCompressor.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdCompressor.tests.d.ts","sourceRoot":"","sources":["../../src/test/IdCompressor.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}