@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,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=AppendOnlySortedMap.perf.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppendOnlySortedMap.perf.tests.d.ts","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,49 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { benchmark, BenchmarkType } from '@fluid-tools/benchmark';
6
- import { makeRandom } from '@fluid-private/stochastic-test-utils';
7
- import { compareFiniteNumbers } from '../Common.js';
8
- import { AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';
9
- function runAppendOnlyMapPerfTests(mapBuilder) {
10
- const type = BenchmarkType.Measurement;
11
- let map;
12
- let rand;
13
- const keyChoices = [];
14
- let localChoice = 0;
15
- const before = () => {
16
- rand = makeRandom(42);
17
- map = mapBuilder();
18
- let curKey = 0;
19
- for (let i = 0; i < 100000; i++) {
20
- map.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));
21
- curKey += rand.integer(1, 10);
22
- }
23
- const keys = [...map.keys()];
24
- for (let i = 0; i < map.size; i++) {
25
- keyChoices.push(keys[rand.integer(0, map.size - 1)]);
26
- }
27
- localChoice = 0;
28
- };
29
- benchmark({
30
- type,
31
- title: `lookup a key`,
32
- before,
33
- benchmarkFn: () => {
34
- map.get(keyChoices[localChoice++ % keyChoices.length]);
35
- },
36
- });
37
- benchmark({
38
- type,
39
- title: `lookup a pair or lower`,
40
- before,
41
- benchmarkFn: () => {
42
- map.getPairOrNextLower(keyChoices[localChoice++ % keyChoices.length]);
43
- },
44
- });
45
- }
46
- describe('AppendOnlySortedMap Perf', () => {
47
- runAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));
48
- });
49
- //# sourceMappingURL=AppendOnlySortedMap.perf.tests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppendOnlySortedMap.perf.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.perf.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAW,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,SAAS,yBAAyB,CAAC,UAAqD;IACvF,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC;IACvC,IAAI,GAAwC,CAAC;IAC7C,IAAI,IAAa,CAAC;IAClB,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,MAAM,MAAM,GAAG,GAAG,EAAE;QACnB,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QACtB,GAAG,GAAG,UAAU,EAAE,CAAC;QACnB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAChC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC7D,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SAC9B;QACD,MAAM,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YAClC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACrD;QACD,WAAW,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,SAAS,CAAC;QACT,IAAI;QACJ,KAAK,EAAE,cAAc;QACrB,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,CAAC;KACD,CAAC,CAAC;IAEH,SAAS,CAAC;QACT,IAAI;QACJ,KAAK,EAAE,wBAAwB;QAC/B,MAAM;QACN,WAAW,EAAE,GAAG,EAAE;YACjB,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACzC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from '@fluid-tools/benchmark';\nimport { IRandom, makeRandom } from '@fluid-private/stochastic-test-utils';\nimport { compareFiniteNumbers } from '../Common.js';\nimport { AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';\n\nfunction runAppendOnlyMapPerfTests(mapBuilder: () => AppendOnlySortedMap<number, number>) {\n\tconst type = BenchmarkType.Measurement;\n\tlet map: AppendOnlySortedMap<number, number>;\n\tlet rand: IRandom;\n\tconst keyChoices: number[] = [];\n\tlet localChoice = 0;\n\tconst before = () => {\n\t\trand = makeRandom(42);\n\t\tmap = mapBuilder();\n\t\tlet curKey = 0;\n\t\tfor (let i = 0; i < 100000; i++) {\n\t\t\tmap.append(curKey, rand.integer(0, Number.MAX_SAFE_INTEGER));\n\t\t\tcurKey += rand.integer(1, 10);\n\t\t}\n\t\tconst keys = [...map.keys()];\n\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\tkeyChoices.push(keys[rand.integer(0, map.size - 1)]);\n\t\t}\n\t\tlocalChoice = 0;\n\t};\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a key`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.get(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype,\n\t\ttitle: `lookup a pair or lower`,\n\t\tbefore,\n\t\tbenchmarkFn: () => {\n\t\t\tmap.getPairOrNextLower(keyChoices[localChoice++ % keyChoices.length]);\n\t\t},\n\t});\n}\n\ndescribe('AppendOnlySortedMap Perf', () => {\n\trunAppendOnlyMapPerfTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\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=AppendOnlySortedMap.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppendOnlySortedMap.tests.d.ts","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,213 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /* eslint-disable no-bitwise */
6
- import { strict as assert } from 'assert';
7
- import { expect } from 'chai';
8
- import { validateAssertionError } from '@fluidframework/test-runtime-utils';
9
- import { assertNotUndefined, compareFiniteNumbers } from '../Common.js';
10
- import { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';
11
- function runAppendOnlyMapTests(mapBuilder) {
12
- it('detects out-of-order keys', () => {
13
- const map = mapBuilder();
14
- map.append(0, 0);
15
- const exception = 'Inserted key must be > all others in the map.';
16
- assert.throws(() => map.append(-1, 1), (e) => validateAssertionError(e, exception));
17
- map.append(1, 2);
18
- });
19
- it('can get the min and max keys', () => {
20
- const map = mapBuilder();
21
- const elementCount = 10;
22
- expect(map.maxKey()).to.be.undefined;
23
- for (let i = 0; i < elementCount; i++) {
24
- map.append(i, i);
25
- expect(map.maxKey()).to.equal(i);
26
- expect(map.minKey()).to.equal(0);
27
- }
28
- });
29
- it('can get the first and last pairs', () => {
30
- const map = mapBuilder();
31
- const elementCount = 10;
32
- expect(map.first()).to.be.undefined;
33
- expect(map.last()).to.be.undefined;
34
- for (let i = 0; i < elementCount; i++) {
35
- map.append(i, i);
36
- expect(map.last()).to.deep.equal([i, i]);
37
- expect(map.first()).to.deep.equal([0, 0]);
38
- }
39
- });
40
- it('can get values', () => {
41
- const map = mapBuilder();
42
- const elementCount = 10;
43
- for (let i = 0; i < elementCount; i++) {
44
- map.append(i, i);
45
- }
46
- expect(map.get(-1)).to.be.undefined;
47
- expect(map.get(10)).to.be.undefined;
48
- for (let i = 0; i < elementCount; i++) {
49
- expect(map.get(i)).to.equal(i);
50
- }
51
- });
52
- it('can get pairs by index', () => {
53
- const map = mapBuilder();
54
- const elementCount = 10;
55
- for (let i = 0; i < elementCount; i++) {
56
- map.append(i * 10, i);
57
- }
58
- expect(map.getAtIndex(-1)).to.be.undefined;
59
- expect(map.getAtIndex(10)).to.be.undefined;
60
- for (let i = 0; i < elementCount; i++) {
61
- expect(map.getAtIndex(i)).to.deep.equal([i * 10, i]);
62
- }
63
- });
64
- it('can get an entry or next lower by key', () => {
65
- [99, 100].forEach((elementCount) => {
66
- const map = mapBuilder();
67
- for (let i = 0; i < elementCount; i++) {
68
- map.append(i * 2, i * 2);
69
- }
70
- expect(map.getPairOrNextLower(-1)).to.be.undefined;
71
- for (let i = 0; i < map.size; i++) {
72
- expect(map.getPairOrNextLower(i * 2)).to.deep.equal([i * 2, i * 2]);
73
- expect(map.getPairOrNextLower(i * 2 + 1)).to.deep.equal([i * 2, i * 2]);
74
- }
75
- const maxKey = assertNotUndefined(map.maxKey());
76
- expect(map.getPairOrNextLower(maxKey + 1)).to.deep.equal([maxKey, maxKey]);
77
- });
78
- });
79
- it('can get an entry or next higher by key', () => {
80
- [99, 100].forEach((elementCount) => {
81
- const map = mapBuilder();
82
- for (let i = 0; i < elementCount; i++) {
83
- map.append(i * 2, i * 2);
84
- }
85
- const minKey = assertNotUndefined(map.minKey());
86
- expect(map.getPairOrNextHigher(minKey - 1)).to.deep.equal([minKey, minKey]);
87
- for (let i = 0; i < map.size - 1; i++) {
88
- expect(map.getPairOrNextHigher(i * 2)).to.deep.equal([i * 2, i * 2]);
89
- expect(map.getPairOrNextHigher(i * 2 + 1)).to.deep.equal([i * 2 + 2, i * 2 + 2]);
90
- }
91
- expect(map.getPairOrNextHigher(map.size * 2 + 1)).to.be.undefined;
92
- });
93
- });
94
- it('knows how big it is', () => {
95
- const map = mapBuilder();
96
- const elementCount = 10;
97
- for (let i = 0; i < elementCount; i++) {
98
- expect(map.size).to.equal(i);
99
- map.append(i, i);
100
- }
101
- expect(map.size).to.equal(elementCount);
102
- });
103
- it('can enumerate its keys and values', () => {
104
- const map = mapBuilder();
105
- const elementCount = 10;
106
- const keys = [];
107
- const values = [];
108
- for (let i = 0; i < elementCount; i++) {
109
- const key = i;
110
- const value = i * 2;
111
- map.append(key, value);
112
- keys.push(key);
113
- values.push(value);
114
- }
115
- expect([...map.keys()]).to.deep.equal(keys);
116
- expect([...map.values()]).to.deep.equal(values);
117
- });
118
- it('can calculate the indexOf a search element', () => {
119
- const elements = [0, 0, 2, 0, 3, 0];
120
- const comparator = (search, key, value) => {
121
- return compareFiniteNumbers(search, key);
122
- };
123
- expect(AppendOnlySortedMap.keyIndexOf(elements, 0, comparator)).to.equal(0);
124
- expect(AppendOnlySortedMap.keyIndexOf(elements, 2, comparator)).to.equal(2);
125
- expect(AppendOnlySortedMap.keyIndexOf(elements, 3, comparator)).to.equal(4);
126
- expect(AppendOnlySortedMap.keyIndexOf(elements, -1, comparator)).to.equal(0 ^ AppendOnlySortedMap.failureXor);
127
- expect(AppendOnlySortedMap.keyIndexOf(elements, 1, comparator)).to.equal(2 ^ AppendOnlySortedMap.failureXor);
128
- expect(AppendOnlySortedMap.keyIndexOf(elements, 10, comparator)).to.equal(6 ^ AppendOnlySortedMap.failureXor);
129
- });
130
- describe('can perform range queries', () => {
131
- const map = mapBuilder();
132
- const elementCount = 10;
133
- for (let i = 0; i < elementCount; i++) {
134
- map.append(i * 2, i * 2);
135
- }
136
- const maxKey = assertNotUndefined(map.maxKey());
137
- it('on empty ranges', () => {
138
- expect([...map.getRange(1, -1)]).to.deep.equal([]);
139
- expect([...map.getRange(maxKey + 1, maxKey + 1)]).to.deep.equal([]);
140
- });
141
- it('on ranges of size 1', () => {
142
- expect([...map.getRange(0, 0)]).to.deep.equal([[0, 0]]);
143
- expect([...map.getRange(1, 1)]).to.deep.equal([]);
144
- expect([...map.getRange(-1, -1)]).to.deep.equal([]);
145
- });
146
- it('on non-empty ranges', () => {
147
- expect([...map.getRange(0, 1)]).to.deep.equal([[0, 0]]);
148
- expect([...map.getRange(0, 2)]).to.deep.equal([
149
- [0, 0],
150
- [2, 2],
151
- ]);
152
- expect([...map.getRange(1, 5)]).to.deep.equal([
153
- [2, 2],
154
- [4, 4],
155
- ]);
156
- const allEntries = [...map.entries()];
157
- expect([...map.getRange(0, maxKey)]).to.deep.equal(allEntries);
158
- expect([...map.getRange(-maxKey, maxKey)]).to.deep.equal(allEntries);
159
- expect([...map.getRange(0, 2 * maxKey)]).to.deep.equal(allEntries);
160
- expect([...map.getRange(-maxKey, 2 * maxKey)]).to.deep.equal(allEntries);
161
- });
162
- });
163
- }
164
- describe('AppendOnlySortedMap', () => {
165
- runAppendOnlyMapTests(() => new AppendOnlySortedMap(compareFiniteNumbers));
166
- });
167
- describe('AppendOnlyDoublySortedMap', () => {
168
- const mapBuilder = () => new AppendOnlyDoublySortedMap(compareFiniteNumbers, (value) => value, compareFiniteNumbers);
169
- runAppendOnlyMapTests(mapBuilder);
170
- it('detects out-of-order values', () => {
171
- const map = mapBuilder();
172
- map.append(0, 0);
173
- const exception = 'Inserted value must be > all others in the map.';
174
- assert.throws(() => map.append(1, -1), (e) => validateAssertionError(e, exception));
175
- map.append(2, 1);
176
- });
177
- it('can get an entry or next lower by value', () => {
178
- [99, 100].forEach((elementCount) => {
179
- const map = mapBuilder();
180
- for (let i = 0; i < elementCount; i++) {
181
- map.append(i - elementCount, i * 2);
182
- }
183
- expect(map.getPairOrNextLowerByValue(-1)).to.be.undefined;
184
- for (let i = 1; i < elementCount; i++) {
185
- expect(map.getPairOrNextLowerByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);
186
- expect(map.getPairOrNextLowerByValue(i * 2 + 1)).to.deep.equal([i - elementCount, i * 2]);
187
- }
188
- });
189
- });
190
- it('can get an entry or next higher by value', () => {
191
- [99, 100].forEach((elementCount) => {
192
- const map = mapBuilder();
193
- for (let i = 0; i < elementCount; i++) {
194
- map.append(i - elementCount, i * 2);
195
- }
196
- for (let i = 0; i < elementCount - 1; i++) {
197
- expect(map.getPairOrNextHigherByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);
198
- expect(map.getPairOrNextHigherByValue(i * 2 + 1)).to.deep.equal([i - elementCount + 1, i * 2 + 2]);
199
- }
200
- const maxValue = (elementCount - 1) * 2;
201
- expect(map.getPairOrNextHigherByValue(maxValue)).to.deep.equal([-1, maxValue]);
202
- expect(map.getPairOrNextHigherByValue(maxValue + 1)).to.be.undefined;
203
- });
204
- });
205
- it('validity assertion detects out-of-order keys', () => {
206
- const map = new AppendOnlyDoublySortedMap((a, b) => compareFiniteNumbers(a[0], b[0]), (value) => value[0], compareFiniteNumbers);
207
- map.append([0], [0]);
208
- map.append([1], [1]);
209
- assertNotUndefined(map.get([1]))[0] = -1; // mutate value
210
- assert.throws(() => map.assertValid(), (e) => validateAssertionError(e, 'Values in map must be sorted.'));
211
- });
212
- });
213
- //# sourceMappingURL=AppendOnlySortedMap.tests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppendOnlySortedMap.tests.js","sourceRoot":"","sources":["../../src/test/AppendOnlySortedMap.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAE/B,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAEzG,SAAS,qBAAqB,CAAC,UAAqD;IACnF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACpC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,MAAM,SAAS,GAAG,+CAA+C,CAAC;QAClE,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,SAAS,CAAC,CAClD,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,G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AAC,EAAE,CAAC,SAAS,CAAC;QACtE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,GAAG,IAAI,yBAAyB,CACxC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EACnB,oBAAoB,CACpB,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe;QACzD,MAAM,CAAC,MAAM,CACZ,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,EACvB,CAAC,CAAQ,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,+BAA+B,CAAC,CACxE,CAAC;IACH,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\n/* eslint-disable no-bitwise */\n\nimport { strict as assert } from 'assert';\nimport { expect } from 'chai';\nimport { validateAssertionError } from '@fluidframework/test-runtime-utils';\nimport { assertNotUndefined, compareFiniteNumbers } from '../Common.js';\nimport { AppendOnlyDoublySortedMap, AppendOnlySortedMap } from '../id-compressor/AppendOnlySortedMap.js';\n\nfunction runAppendOnlyMapTests(mapBuilder: () => AppendOnlySortedMap<number, number>) {\n\tit('detects out-of-order keys', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted key must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(-1, 1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(1, 2);\n\t});\n\n\tit('can get the min and max keys', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.maxKey()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.maxKey()).to.equal(i);\n\t\t\texpect(map.minKey()).to.equal(0);\n\t\t}\n\t});\n\n\tit('can get the first and last pairs', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\texpect(map.first()).to.be.undefined;\n\t\texpect(map.last()).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t\texpect(map.last()).to.deep.equal([i, i]);\n\t\t\texpect(map.first()).to.deep.equal([0, 0]);\n\t\t}\n\t});\n\n\tit('can get values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.get(-1)).to.be.undefined;\n\t\texpect(map.get(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.get(i)).to.equal(i);\n\t\t}\n\t});\n\n\tit('can get pairs by index', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 10, i);\n\t\t}\n\t\texpect(map.getAtIndex(-1)).to.be.undefined;\n\t\texpect(map.getAtIndex(10)).to.be.undefined;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.getAtIndex(i)).to.deep.equal([i * 10, i]);\n\t\t}\n\t});\n\n\tit('can get an entry or next lower by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLower(-1)).to.be.undefined;\n\t\t\tfor (let i = 0; i < map.size; i++) {\n\t\t\t\texpect(map.getPairOrNextLower(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLower(i * 2 + 1)).to.deep.equal([i * 2, i * 2]);\n\t\t\t}\n\t\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\t\t\texpect(map.getPairOrNextLower(maxKey + 1)).to.deep.equal([maxKey, maxKey]);\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by key', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i * 2, i * 2);\n\t\t\t}\n\t\t\tconst minKey = assertNotUndefined(map.minKey());\n\t\t\texpect(map.getPairOrNextHigher(minKey - 1)).to.deep.equal([minKey, minKey]);\n\t\t\tfor (let i = 0; i < map.size - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2)).to.deep.equal([i * 2, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigher(i * 2 + 1)).to.deep.equal([i * 2 + 2, i * 2 + 2]);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextHigher(map.size * 2 + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('knows how big it is', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\texpect(map.size).to.equal(i);\n\t\t\tmap.append(i, i);\n\t\t}\n\t\texpect(map.size).to.equal(elementCount);\n\t});\n\n\tit('can enumerate its keys and values', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tconst keys: number[] = [];\n\t\tconst values: number[] = [];\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tconst key = i;\n\t\t\tconst value = i * 2;\n\t\t\tmap.append(key, value);\n\t\t\tkeys.push(key);\n\t\t\tvalues.push(value);\n\t\t}\n\t\texpect([...map.keys()]).to.deep.equal(keys);\n\t\texpect([...map.values()]).to.deep.equal(values);\n\t});\n\n\tit('can calculate the indexOf a search element', () => {\n\t\tconst elements: number[] = [0, 0, 2, 0, 3, 0];\n\t\tconst comparator = (search: number, key: number, value: number): number => {\n\t\t\treturn compareFiniteNumbers(search, key);\n\t\t};\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 0, comparator)).to.equal(0);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 2, comparator)).to.equal(2);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 3, comparator)).to.equal(4);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, -1, comparator)).to.equal(0 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 1, comparator)).to.equal(2 ^ AppendOnlySortedMap.failureXor);\n\t\texpect(AppendOnlySortedMap.keyIndexOf(elements, 10, comparator)).to.equal(6 ^ AppendOnlySortedMap.failureXor);\n\t});\n\n\tdescribe('can perform range queries', () => {\n\t\tconst map = mapBuilder();\n\t\tconst elementCount = 10;\n\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\tmap.append(i * 2, i * 2);\n\t\t}\n\t\tconst maxKey = assertNotUndefined(map.maxKey());\n\n\t\tit('on empty ranges', () => {\n\t\t\texpect([...map.getRange(1, -1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(maxKey + 1, maxKey + 1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on ranges of size 1', () => {\n\t\t\texpect([...map.getRange(0, 0)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(1, 1)]).to.deep.equal([]);\n\t\t\texpect([...map.getRange(-1, -1)]).to.deep.equal([]);\n\t\t});\n\n\t\tit('on non-empty ranges', () => {\n\t\t\texpect([...map.getRange(0, 1)]).to.deep.equal([[0, 0]]);\n\t\t\texpect([...map.getRange(0, 2)]).to.deep.equal([\n\t\t\t\t[0, 0],\n\t\t\t\t[2, 2],\n\t\t\t]);\n\t\t\texpect([...map.getRange(1, 5)]).to.deep.equal([\n\t\t\t\t[2, 2],\n\t\t\t\t[4, 4],\n\t\t\t]);\n\t\t\tconst allEntries = [...map.entries()];\n\t\t\texpect([...map.getRange(0, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(0, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t\texpect([...map.getRange(-maxKey, 2 * maxKey)]).to.deep.equal(allEntries);\n\t\t});\n\t});\n}\n\ndescribe('AppendOnlySortedMap', () => {\n\trunAppendOnlyMapTests(() => new AppendOnlySortedMap(compareFiniteNumbers));\n});\n\ndescribe('AppendOnlyDoublySortedMap', () => {\n\tconst mapBuilder = () =>\n\t\tnew AppendOnlyDoublySortedMap<number, number, number>(\n\t\t\tcompareFiniteNumbers,\n\t\t\t(value) => value,\n\t\t\tcompareFiniteNumbers\n\t\t);\n\trunAppendOnlyMapTests(mapBuilder);\n\n\tit('detects out-of-order values', () => {\n\t\tconst map = mapBuilder();\n\t\tmap.append(0, 0);\n\t\tconst exception = 'Inserted value must be > all others in the map.';\n\t\tassert.throws(\n\t\t\t() => map.append(1, -1),\n\t\t\t(e: Error) => validateAssertionError(e, exception)\n\t\t);\n\t\tmap.append(2, 1);\n\t});\n\n\tit('can get an entry or next lower by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\texpect(map.getPairOrNextLowerByValue(-1)).to.be.undefined;\n\t\t\tfor (let i = 1; i < elementCount; i++) {\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextLowerByValue(i * 2 + 1)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t}\n\t\t});\n\t});\n\n\tit('can get an entry or next higher by value', () => {\n\t\t[99, 100].forEach((elementCount) => {\n\t\t\tconst map = mapBuilder();\n\t\t\tfor (let i = 0; i < elementCount; i++) {\n\t\t\t\tmap.append(i - elementCount, i * 2);\n\t\t\t}\n\t\t\tfor (let i = 0; i < elementCount - 1; i++) {\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2)).to.deep.equal([i - elementCount, i * 2]);\n\t\t\t\texpect(map.getPairOrNextHigherByValue(i * 2 + 1)).to.deep.equal([i - elementCount + 1, i * 2 + 2]);\n\t\t\t}\n\t\t\tconst maxValue = (elementCount - 1) * 2;\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue)).to.deep.equal([-1, maxValue]);\n\t\t\texpect(map.getPairOrNextHigherByValue(maxValue + 1)).to.be.undefined;\n\t\t});\n\t});\n\n\tit('validity assertion detects out-of-order keys', () => {\n\t\tconst map = new AppendOnlyDoublySortedMap<[number], [number], number>(\n\t\t\t(a, b) => compareFiniteNumbers(a[0], b[0]),\n\t\t\t(value) => value[0],\n\t\t\tcompareFiniteNumbers\n\t\t);\n\t\tmap.append([0], [0]);\n\t\tmap.append([1], [1]);\n\t\tassertNotUndefined(map.get([1]))[0] = -1; // mutate value\n\t\tassert.throws(\n\t\t\t() => map.assertValid(),\n\t\t\t(e: Error) => validateAssertionError(e, 'Values in map must be sorted.')\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=ChangeCompression.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChangeCompression.tests.d.ts","sourceRoot":"","sources":["../../src/test/ChangeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,154 +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 { MutableStringInterner } from '../StringInterner.js';
7
- import { ChangeInternal, ChangeTypeInternal, ConstraintEffect, } from '../persisted-types/index.js';
8
- import { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression.js';
9
- import { StablePlace, StableRange } from '../ChangeTypes.js';
10
- import { newEdit, newEditId } from '../EditUtilities.js';
11
- import { InterningTreeCompressor } from '../TreeCompressor.js';
12
- import { scopeIdNormalizer } from '../NodeIdUtilities.js';
13
- import { convertStableRangeIds } from '../IdConversion.js';
14
- import { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities.js';
15
- class TestTreeCompressor {
16
- constructor(treeCompressor = new InterningTreeCompressor()) {
17
- this.treeCompressor = treeCompressor;
18
- this.compressTreeCalls = [];
19
- this.decompressTreeCalls = [];
20
- }
21
- compress(node, interner, idNormalizer) {
22
- this.compressTreeCalls.push(node);
23
- return this.treeCompressor.compress(node, interner, idNormalizer);
24
- }
25
- decompress(node, interner, idNormalizer) {
26
- this.decompressTreeCalls.push(node);
27
- return this.treeCompressor.decompress(node, interner, idNormalizer);
28
- }
29
- }
30
- describe('ChangeCompression', () => {
31
- const treeCompressor = new TestTreeCompressor();
32
- beforeEach(() => {
33
- treeCompressor.compressTreeCalls.length = 0;
34
- treeCompressor.decompressTreeCalls.length = 0;
35
- });
36
- const compressor = new ChangeCompressor(treeCompressor);
37
- /**
38
- * Verifies an edit can round-trip through compression/decompression. Optionally also asserts the compressed state
39
- * matches some expected state.
40
- *
41
- * The mocked treeCompressor above is used for tree-level compression, so that tests can assert tree compression is invoked
42
- * without taking a dependency on its implementation.
43
- */
44
- function testCompression(edit, idNormalizer, compressed) {
45
- const interner = new MutableStringInterner();
46
- const compressedEdit = compressEdit(compressor, interner, idNormalizer, edit);
47
- if (compressed !== undefined) {
48
- expect(compressedEdit).to.deep.equal(compressed);
49
- }
50
- const buildChanges = edit.changes.filter((change) => change.type === ChangeTypeInternal.Build);
51
- let treeIndex = 0;
52
- for (const buildChange of buildChanges) {
53
- for (const tree of buildChange.source) {
54
- const treeParam = treeCompressor.compressTreeCalls[treeIndex];
55
- expect(treeParam).to.equal(tree);
56
- treeIndex++;
57
- }
58
- }
59
- expect(treeIndex).to.equal(treeCompressor.compressTreeCalls.length);
60
- expect(treeCompressor.decompressTreeCalls.length).to.equal(0);
61
- const internedStrings = interner.getSerializable();
62
- const newInterner = new MutableStringInterner(internedStrings);
63
- const decompressedEdit = decompressEdit(compressor, newInterner, idNormalizer, compressedEdit);
64
- const compressedBuildChanges = compressedEdit.changes.filter((change) => change.type === ChangeTypeInternal.CompressedBuild);
65
- treeIndex = 0;
66
- for (const buildChange of compressedBuildChanges) {
67
- for (const tree of buildChange.source) {
68
- const treeParam = treeCompressor.decompressTreeCalls[treeIndex];
69
- expect(treeParam).to.equal(tree);
70
- treeIndex++;
71
- }
72
- }
73
- expect(treeIndex).to.equal(treeCompressor.decompressTreeCalls.length);
74
- expect(decompressedEdit).to.deep.equal(edit);
75
- }
76
- it('Compresses the BuildNodes of an edit with Build Changes', () => {
77
- const tree = setUpTestTree();
78
- const edit = newEdit(ChangeInternal.insertTree([tree.toChangeNode()], StablePlace.after(tree.left)));
79
- const expectedCompressedEdit = {
80
- id: edit.id,
81
- changes: [
82
- {
83
- destination: 0,
84
- source: [
85
- new InterningTreeCompressor().compress(tree, new MutableStringInterner(), scopeIdNormalizer(tree)),
86
- ],
87
- type: ChangeTypeInternal.CompressedBuild,
88
- },
89
- {
90
- destination: { side: 1, referenceSibling: tree.normalizeToOpSpace(tree.left.identifier) },
91
- source: 0,
92
- type: ChangeTypeInternal.Insert,
93
- },
94
- ],
95
- };
96
- testCompression(edit, scopeIdNormalizer(tree), expectedCompressedEdit);
97
- });
98
- it('compresses id references in Detach changes to op space', () => {
99
- const tree = setUpTestTree();
100
- const detach = {
101
- destination: 0,
102
- source: StableRange.only(tree),
103
- type: ChangeTypeInternal.Detach,
104
- };
105
- const edit = {
106
- id: newEditId(),
107
- changes: [detach],
108
- };
109
- testCompression(edit, scopeIdNormalizer(tree), {
110
- ...edit,
111
- changes: [{ ...detach, source: convertStableRangeIds(detach.source, (id) => tree.normalizeToOpSpace(id)) }],
112
- });
113
- });
114
- it('compresses id references in SetValue changes to op space', () => {
115
- const context = makeNodeIdContext();
116
- const id = context.generateNodeId();
117
- const setValue = {
118
- nodeToModify: id,
119
- payload: 5,
120
- type: ChangeTypeInternal.SetValue,
121
- };
122
- const edit = {
123
- id: newEditId(),
124
- changes: [setValue],
125
- };
126
- testCompression(edit, scopeIdNormalizer(context, context.localSessionId), {
127
- ...edit,
128
- changes: [{ ...setValue, nodeToModify: context.normalizeToOpSpace(id) }],
129
- });
130
- });
131
- it('compresses id references in Constraint changes to op space', () => {
132
- const tree = setUpTestTree();
133
- const constraint = {
134
- toConstrain: StableRange.only(tree),
135
- effect: ConstraintEffect.InvalidAndDiscard,
136
- type: ChangeTypeInternal.Constraint,
137
- };
138
- const edit = {
139
- id: newEditId(),
140
- changes: [constraint],
141
- };
142
- testCompression(edit, scopeIdNormalizer(tree), {
143
- ...edit,
144
- changes: [
145
- {
146
- type: constraint.type,
147
- effect: constraint.effect,
148
- toConstrain: convertStableRangeIds(constraint.toConstrain, (id) => tree.normalizeToOpSpace(id)),
149
- },
150
- ],
151
- });
152
- });
153
- });
154
- //# sourceMappingURL=ChangeCompression.tests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChangeCompression.tests.js","sourceRoot":"","sources":["../../src/test/ChangeCompression.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAkB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAEN,cAAc,EACd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IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;iBAC/F;aACD;SACD,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 { DetachedSequenceId, OpSpaceNodeId } from '../Identifiers.js';\nimport { MutableStringInterner, StringInterner } from '../StringInterner.js';\nimport {\n\tBuildInternal,\n\tChangeInternal,\n\tChangeTypeInternal,\n\tCompressedBuildInternal,\n\tCompressedChangeInternal,\n\tCompressedPlaceholderTree,\n\tConstraintEffect,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tPlaceholderTree,\n\tSetValueInternal,\n} from '../persisted-types/index.js';\nimport { ChangeCompressor, compressEdit, decompressEdit } from '../ChangeCompression.js';\nimport { StablePlace, StableRange } from '../ChangeTypes.js';\nimport { newEdit, newEditId } from '../EditUtilities.js';\nimport { TreeCompressor, InterningTreeCompressor } from '../TreeCompressor.js';\nimport { ContextualizedNodeIdNormalizer, scopeIdNormalizer } from '../NodeIdUtilities.js';\nimport { convertStableRangeIds } from '../IdConversion.js';\nimport { makeNodeIdContext, setUpTestTree } from './utilities/TestUtilities.js';\n\n// CompressedChange type for this test suite. It aligns with CompressedChangeInternal but doesn't actually compress trees.\ntype TestCompressedChange = CompressedChangeInternal<OpSpaceNodeId>;\n\nclass TestTreeCompressor<TPlaceholder extends DetachedSequenceId | never> implements TreeCompressor<TPlaceholder> {\n\tpublic compressTreeCalls: PlaceholderTree<TPlaceholder>[] = [];\n\tpublic decompressTreeCalls: CompressedPlaceholderTree<OpSpaceNodeId, TPlaceholder>[] = [];\n\n\tpublic constructor(private readonly treeCompressor = new InterningTreeCompressor<TPlaceholder>()) {}\n\n\tpublic compress<TId extends OpSpaceNodeId>(\n\t\tnode: PlaceholderTree<TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): CompressedPlaceholderTree<TId, TPlaceholder> {\n\t\tthis.compressTreeCalls.push(node);\n\t\treturn this.treeCompressor.compress(node, interner, idNormalizer);\n\t}\n\n\tpublic decompress<TId extends OpSpaceNodeId>(\n\t\tnode: CompressedPlaceholderTree<TId, TPlaceholder>,\n\t\tinterner: StringInterner,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<TId>\n\t): PlaceholderTree<TPlaceholder> {\n\t\tthis.decompressTreeCalls.push(node);\n\t\treturn this.treeCompressor.decompress(node, interner, idNormalizer);\n\t}\n}\n\ndescribe('ChangeCompression', () => {\n\tconst treeCompressor = new TestTreeCompressor();\n\n\tbeforeEach(() => {\n\t\ttreeCompressor.compressTreeCalls.length = 0;\n\t\ttreeCompressor.decompressTreeCalls.length = 0;\n\t});\n\n\tconst compressor = new ChangeCompressor(treeCompressor);\n\n\t/**\n\t * Verifies an edit can round-trip through compression/decompression. Optionally also asserts the compressed state\n\t * matches some expected state.\n\t *\n\t * The mocked treeCompressor above is used for tree-level compression, so that tests can assert tree compression is invoked\n\t * without taking a dependency on its implementation.\n\t */\n\tfunction testCompression(\n\t\tedit: Edit<ChangeInternal>,\n\t\tidNormalizer: ContextualizedNodeIdNormalizer<OpSpaceNodeId>,\n\t\tcompressed?: Edit<TestCompressedChange>\n\t): void {\n\t\tconst interner = new MutableStringInterner();\n\t\tconst compressedEdit = compressEdit(compressor, interner, idNormalizer, edit);\n\t\tif (compressed !== undefined) {\n\t\t\texpect(compressedEdit).to.deep.equal(compressed);\n\t\t}\n\n\t\tconst buildChanges = edit.changes.filter<BuildInternal>(\n\t\t\t(change: ChangeInternal): change is BuildInternal => change.type === ChangeTypeInternal.Build\n\t\t);\n\t\tlet treeIndex = 0;\n\t\tfor (const buildChange of buildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.compressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.compressTreeCalls.length);\n\n\t\texpect(treeCompressor.decompressTreeCalls.length).to.equal(0);\n\n\t\tconst internedStrings = interner.getSerializable();\n\t\tconst newInterner = new MutableStringInterner(internedStrings);\n\t\tconst decompressedEdit = decompressEdit(compressor, newInterner, idNormalizer, compressedEdit);\n\n\t\tconst compressedBuildChanges = compressedEdit.changes.filter<CompressedBuildInternal<OpSpaceNodeId>>(\n\t\t\t(change): change is CompressedBuildInternal<OpSpaceNodeId> =>\n\t\t\t\tchange.type === ChangeTypeInternal.CompressedBuild\n\t\t);\n\n\t\ttreeIndex = 0;\n\t\tfor (const buildChange of compressedBuildChanges) {\n\t\t\tfor (const tree of buildChange.source) {\n\t\t\t\tconst treeParam = treeCompressor.decompressTreeCalls[treeIndex];\n\t\t\t\texpect(treeParam).to.equal(tree);\n\t\t\t\ttreeIndex++;\n\t\t\t}\n\t\t}\n\t\texpect(treeIndex).to.equal(treeCompressor.decompressTreeCalls.length);\n\t\texpect(decompressedEdit).to.deep.equal(edit);\n\t}\n\n\tit('Compresses the BuildNodes of an edit with Build Changes', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst edit = newEdit(ChangeInternal.insertTree([tree.toChangeNode()], StablePlace.after(tree.left)));\n\t\tconst expectedCompressedEdit: Edit<TestCompressedChange> = {\n\t\t\tid: edit.id,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\t\t\tsource: [\n\t\t\t\t\t\tnew InterningTreeCompressor().compress(\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\tnew MutableStringInterner(),\n\t\t\t\t\t\t\tscopeIdNormalizer(tree)\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\ttype: ChangeTypeInternal.CompressedBuild,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdestination: { side: 1, referenceSibling: tree.normalizeToOpSpace(tree.left.identifier) },\n\t\t\t\t\tsource: 0 as DetachedSequenceId,\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), expectedCompressedEdit);\n\t});\n\n\tit('compresses id references in Detach changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst detach: DetachInternal = {\n\t\t\tdestination: 0 as DetachedSequenceId,\n\t\t\tsource: StableRange.only(tree),\n\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [detach],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...detach, source: convertStableRangeIds(detach.source, (id) => tree.normalizeToOpSpace(id)) }],\n\t\t});\n\t});\n\n\tit('compresses id references in SetValue changes to op space', () => {\n\t\tconst context = makeNodeIdContext();\n\t\tconst id = context.generateNodeId();\n\t\tconst setValue: SetValueInternal = {\n\t\t\tnodeToModify: id,\n\t\t\tpayload: 5,\n\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [setValue],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(context, context.localSessionId), {\n\t\t\t...edit,\n\t\t\tchanges: [{ ...setValue, nodeToModify: context.normalizeToOpSpace(id) }],\n\t\t});\n\t});\n\n\tit('compresses id references in Constraint changes to op space', () => {\n\t\tconst tree = setUpTestTree();\n\t\tconst constraint: ConstraintInternal = {\n\t\t\ttoConstrain: StableRange.only(tree),\n\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t};\n\t\tconst edit: Edit<ChangeInternal> = {\n\t\t\tid: newEditId(),\n\t\t\tchanges: [constraint],\n\t\t};\n\t\ttestCompression(edit, scopeIdNormalizer(tree), {\n\t\t\t...edit,\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: constraint.type,\n\t\t\t\t\teffect: constraint.effect,\n\t\t\t\t\ttoConstrain: convertStableRangeIds(constraint.toConstrain, (id) => tree.normalizeToOpSpace(id)),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t});\n});\n"]}
@@ -1,10 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { SharedTree, Checkout } from '../index.js';
6
- /**
7
- * Checkout test suite
8
- */
9
- export declare function checkoutTests(checkoutName: string, checkoutFactory: (tree: SharedTree) => Promise<Checkout>, additionalTests?: () => void): void;
10
- //# sourceMappingURL=Checkout.tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Checkout.tests.d.ts","sourceRoot":"","sources":["../../src/test/Checkout.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAMN,UAAU,EAEV,QAAQ,EAKR,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,wBAAgB,aAAa,CAC5B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,QAAQ,CAAC,EACxD,eAAe,CAAC,EAAE,MAAM,IAAI,GAC1B,IAAI,CAwkBN"}