@fluid-experimental/tree 0.58.2002 → 0.58.3000-61081

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 (815) hide show
  1. package/README.md +9 -9
  2. package/dist/ChangeCompression.d.ts +39 -0
  3. package/dist/ChangeCompression.d.ts.map +1 -0
  4. package/dist/ChangeCompression.js +117 -0
  5. package/dist/ChangeCompression.js.map +1 -0
  6. package/{lib/default-edits/PersistedTypes.d.ts → dist/ChangeTypes.d.ts} +58 -100
  7. package/dist/ChangeTypes.d.ts.map +1 -0
  8. package/dist/{default-edits/PersistedTypes.js → ChangeTypes.js} +21 -76
  9. package/dist/ChangeTypes.js.map +1 -0
  10. package/dist/Checkout.d.ts +39 -27
  11. package/dist/Checkout.d.ts.map +1 -1
  12. package/dist/Checkout.js +59 -31
  13. package/dist/Checkout.js.map +1 -1
  14. package/dist/Common.d.ts +175 -38
  15. package/dist/Common.d.ts.map +1 -1
  16. package/dist/Common.js +240 -103
  17. package/dist/Common.js.map +1 -1
  18. package/dist/EagerCheckout.d.ts +24 -0
  19. package/dist/EagerCheckout.d.ts.map +1 -0
  20. package/dist/{BasicCheckout.js → EagerCheckout.js} +9 -6
  21. package/dist/EagerCheckout.js.map +1 -0
  22. package/dist/EditLog.d.ts +77 -63
  23. package/dist/EditLog.d.ts.map +1 -1
  24. package/dist/EditLog.js +85 -48
  25. package/dist/EditLog.js.map +1 -1
  26. package/dist/EditUtilities.d.ts +168 -0
  27. package/dist/EditUtilities.d.ts.map +1 -0
  28. package/dist/EditUtilities.js +373 -0
  29. package/dist/EditUtilities.js.map +1 -0
  30. package/dist/EventTypes.d.ts +73 -0
  31. package/dist/EventTypes.d.ts.map +1 -0
  32. package/dist/EventTypes.js +78 -0
  33. package/dist/EventTypes.js.map +1 -0
  34. package/dist/Forest.d.ts +29 -7
  35. package/dist/Forest.d.ts.map +1 -1
  36. package/dist/Forest.js +60 -36
  37. package/dist/Forest.js.map +1 -1
  38. package/dist/HistoryEditFactory.d.ts +20 -0
  39. package/dist/HistoryEditFactory.d.ts.map +1 -0
  40. package/dist/HistoryEditFactory.js +226 -0
  41. package/dist/HistoryEditFactory.js.map +1 -0
  42. package/dist/IdConversion.d.ts +12 -0
  43. package/dist/IdConversion.d.ts.map +1 -0
  44. package/dist/IdConversion.js +98 -0
  45. package/dist/IdConversion.js.map +1 -0
  46. package/dist/Identifiers.d.ts +89 -2
  47. package/dist/Identifiers.d.ts.map +1 -1
  48. package/dist/Identifiers.js +10 -0
  49. package/dist/Identifiers.js.map +1 -1
  50. package/dist/InitialTree.d.ts +2 -2
  51. package/dist/InitialTree.d.ts.map +1 -1
  52. package/dist/InitialTree.js +2 -1
  53. package/dist/InitialTree.js.map +1 -1
  54. package/dist/LazyCheckout.d.ts +28 -0
  55. package/dist/LazyCheckout.d.ts.map +1 -0
  56. package/dist/LazyCheckout.js +44 -0
  57. package/dist/LazyCheckout.js.map +1 -0
  58. package/dist/LogViewer.d.ts +130 -85
  59. package/dist/LogViewer.d.ts.map +1 -1
  60. package/dist/LogViewer.js +110 -85
  61. package/dist/LogViewer.js.map +1 -1
  62. package/dist/MergeHealth.d.ts +221 -0
  63. package/dist/MergeHealth.d.ts.map +1 -0
  64. package/dist/MergeHealth.js +263 -0
  65. package/dist/MergeHealth.js.map +1 -0
  66. package/dist/NodeIdUtilities.d.ts +90 -0
  67. package/dist/NodeIdUtilities.d.ts.map +1 -0
  68. package/dist/NodeIdUtilities.js +60 -0
  69. package/dist/NodeIdUtilities.js.map +1 -0
  70. package/dist/PayloadUtilities.d.ts +42 -0
  71. package/dist/PayloadUtilities.d.ts.map +1 -0
  72. package/dist/PayloadUtilities.js +114 -0
  73. package/dist/PayloadUtilities.js.map +1 -0
  74. package/dist/ReconciliationPath.d.ts +18 -13
  75. package/dist/ReconciliationPath.d.ts.map +1 -1
  76. package/dist/ReconciliationPath.js.map +1 -1
  77. package/dist/RevisionValueCache.d.ts +11 -2
  78. package/dist/RevisionValueCache.d.ts.map +1 -1
  79. package/dist/RevisionValueCache.js +2 -3
  80. package/dist/RevisionValueCache.js.map +1 -1
  81. package/dist/RevisionView.d.ts +83 -0
  82. package/dist/RevisionView.d.ts.map +1 -0
  83. package/dist/RevisionView.js +182 -0
  84. package/dist/RevisionView.js.map +1 -0
  85. package/dist/SerializationUtilities.d.ts +36 -0
  86. package/dist/SerializationUtilities.d.ts.map +1 -0
  87. package/dist/SerializationUtilities.js +102 -0
  88. package/dist/SerializationUtilities.js.map +1 -0
  89. package/dist/SharedTree.d.ts +400 -0
  90. package/dist/SharedTree.d.ts.map +1 -0
  91. package/dist/SharedTree.js +1064 -0
  92. package/dist/SharedTree.js.map +1 -0
  93. package/dist/SharedTreeEncoder.d.ts +102 -0
  94. package/dist/SharedTreeEncoder.d.ts.map +1 -0
  95. package/dist/SharedTreeEncoder.js +313 -0
  96. package/dist/SharedTreeEncoder.js.map +1 -0
  97. package/dist/StringInterner.d.ts +46 -0
  98. package/dist/StringInterner.d.ts.map +1 -0
  99. package/dist/StringInterner.js +61 -0
  100. package/dist/StringInterner.js.map +1 -0
  101. package/dist/Summary.d.ts +40 -0
  102. package/dist/Summary.d.ts.map +1 -0
  103. package/dist/Summary.js +23 -0
  104. package/dist/Summary.js.map +1 -0
  105. package/dist/SummaryBackCompatibility.d.ts +22 -22
  106. package/dist/SummaryBackCompatibility.d.ts.map +1 -1
  107. package/dist/SummaryBackCompatibility.js +30 -33
  108. package/dist/SummaryBackCompatibility.js.map +1 -1
  109. package/dist/SummaryTestUtilities.d.ts +31 -0
  110. package/dist/SummaryTestUtilities.d.ts.map +1 -0
  111. package/dist/SummaryTestUtilities.js +37 -0
  112. package/dist/SummaryTestUtilities.js.map +1 -0
  113. package/dist/Transaction.d.ts +53 -0
  114. package/dist/Transaction.d.ts.map +1 -0
  115. package/dist/Transaction.js +76 -0
  116. package/dist/Transaction.js.map +1 -0
  117. package/dist/TransactionInternal.d.ts +543 -0
  118. package/dist/TransactionInternal.d.ts.map +1 -0
  119. package/dist/TransactionInternal.js +622 -0
  120. package/dist/TransactionInternal.js.map +1 -0
  121. package/dist/TreeCompressor.d.ts +37 -0
  122. package/dist/TreeCompressor.d.ts.map +1 -0
  123. package/dist/TreeCompressor.js +132 -0
  124. package/dist/TreeCompressor.js.map +1 -0
  125. package/dist/TreeNodeHandle.d.ts +12 -18
  126. package/dist/TreeNodeHandle.d.ts.map +1 -1
  127. package/dist/TreeNodeHandle.js +13 -23
  128. package/dist/TreeNodeHandle.js.map +1 -1
  129. package/dist/TreeView.d.ts +166 -0
  130. package/dist/TreeView.d.ts.map +1 -0
  131. package/dist/TreeView.js +217 -0
  132. package/dist/TreeView.js.map +1 -0
  133. package/dist/TreeViewUtilities.d.ts +21 -0
  134. package/dist/TreeViewUtilities.d.ts.map +1 -0
  135. package/dist/TreeViewUtilities.js +77 -0
  136. package/dist/TreeViewUtilities.js.map +1 -0
  137. package/dist/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
  138. package/dist/UndoRedoHandler.d.ts.map +1 -0
  139. package/dist/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +5 -9
  140. package/dist/UndoRedoHandler.js.map +1 -0
  141. package/dist/id-compressor/AppendOnlySortedMap.d.ts +127 -0
  142. package/dist/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
  143. package/dist/id-compressor/AppendOnlySortedMap.js +283 -0
  144. package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -0
  145. package/dist/id-compressor/IdCompressor.d.ts +389 -0
  146. package/dist/id-compressor/IdCompressor.d.ts.map +1 -0
  147. package/dist/id-compressor/IdCompressor.js +1353 -0
  148. package/dist/id-compressor/IdCompressor.js.map +1 -0
  149. package/dist/id-compressor/IdRange.d.ts +11 -0
  150. package/dist/id-compressor/IdRange.d.ts.map +1 -0
  151. package/dist/id-compressor/IdRange.js +29 -0
  152. package/dist/id-compressor/IdRange.js.map +1 -0
  153. package/dist/id-compressor/NumericUuid.d.ts +63 -0
  154. package/dist/id-compressor/NumericUuid.d.ts.map +1 -0
  155. package/dist/id-compressor/NumericUuid.js +377 -0
  156. package/dist/id-compressor/NumericUuid.js.map +1 -0
  157. package/dist/id-compressor/index.d.ts +12 -0
  158. package/dist/id-compressor/index.d.ts.map +1 -0
  159. package/dist/id-compressor/index.js +26 -0
  160. package/dist/id-compressor/index.js.map +1 -0
  161. package/dist/id-compressor/persisted-types/0.0.1.d.ts +156 -0
  162. package/dist/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
  163. package/dist/id-compressor/persisted-types/0.0.1.js +7 -0
  164. package/dist/id-compressor/persisted-types/0.0.1.js.map +1 -0
  165. package/dist/id-compressor/persisted-types/index.d.ts +6 -0
  166. package/dist/id-compressor/persisted-types/index.d.ts.map +1 -0
  167. package/dist/id-compressor/persisted-types/index.js +18 -0
  168. package/dist/id-compressor/persisted-types/index.js.map +1 -0
  169. package/dist/index.d.ts +29 -9
  170. package/dist/index.d.ts.map +1 -1
  171. package/dist/index.js +50 -35
  172. package/dist/index.js.map +1 -1
  173. package/dist/persisted-types/0.0.2.d.ts +385 -0
  174. package/dist/persisted-types/0.0.2.d.ts.map +1 -0
  175. package/dist/persisted-types/0.0.2.js +113 -0
  176. package/dist/persisted-types/0.0.2.js.map +1 -0
  177. package/dist/persisted-types/0.1.1.d.ts +314 -0
  178. package/dist/persisted-types/0.1.1.d.ts.map +1 -0
  179. package/dist/persisted-types/0.1.1.js +153 -0
  180. package/dist/persisted-types/0.1.1.js.map +1 -0
  181. package/dist/persisted-types/index.d.ts +7 -0
  182. package/dist/persisted-types/index.d.ts.map +1 -0
  183. package/dist/persisted-types/index.js +20 -0
  184. package/dist/persisted-types/index.js.map +1 -0
  185. package/docs/0-1-1-Compression.md +228 -0
  186. package/docs/Breaking-Change-Migration.md +52 -0
  187. package/docs/Compression.md +2 -2
  188. package/docs/Telemetry.md +43 -0
  189. package/lib/ChangeCompression.d.ts +39 -0
  190. package/lib/ChangeCompression.d.ts.map +1 -0
  191. package/lib/ChangeCompression.js +111 -0
  192. package/lib/ChangeCompression.js.map +1 -0
  193. package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -100
  194. package/lib/ChangeTypes.d.ts.map +1 -0
  195. package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
  196. package/lib/ChangeTypes.js.map +1 -0
  197. package/lib/Checkout.d.ts +39 -27
  198. package/lib/Checkout.d.ts.map +1 -1
  199. package/lib/Checkout.js +51 -23
  200. package/lib/Checkout.js.map +1 -1
  201. package/lib/Common.d.ts +175 -38
  202. package/lib/Common.d.ts.map +1 -1
  203. package/lib/Common.js +226 -101
  204. package/lib/Common.js.map +1 -1
  205. package/lib/EagerCheckout.d.ts +24 -0
  206. package/lib/EagerCheckout.d.ts.map +1 -0
  207. package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
  208. package/lib/EagerCheckout.js.map +1 -0
  209. package/lib/EditLog.d.ts +77 -63
  210. package/lib/EditLog.d.ts.map +1 -1
  211. package/lib/EditLog.js +83 -47
  212. package/lib/EditLog.js.map +1 -1
  213. package/lib/EditUtilities.d.ts +168 -0
  214. package/lib/EditUtilities.d.ts.map +1 -0
  215. package/lib/EditUtilities.js +353 -0
  216. package/lib/EditUtilities.js.map +1 -0
  217. package/lib/EventTypes.d.ts +73 -0
  218. package/lib/EventTypes.d.ts.map +1 -0
  219. package/lib/EventTypes.js +75 -0
  220. package/lib/EventTypes.js.map +1 -0
  221. package/lib/Forest.d.ts +29 -7
  222. package/lib/Forest.d.ts.map +1 -1
  223. package/lib/Forest.js +58 -35
  224. package/lib/Forest.js.map +1 -1
  225. package/lib/HistoryEditFactory.d.ts +20 -0
  226. package/lib/HistoryEditFactory.d.ts.map +1 -0
  227. package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
  228. package/lib/HistoryEditFactory.js.map +1 -0
  229. package/lib/IdConversion.d.ts +12 -0
  230. package/lib/IdConversion.d.ts.map +1 -0
  231. package/lib/IdConversion.js +91 -0
  232. package/lib/IdConversion.js.map +1 -0
  233. package/lib/Identifiers.d.ts +89 -2
  234. package/lib/Identifiers.d.ts.map +1 -1
  235. package/lib/Identifiers.js +8 -1
  236. package/lib/Identifiers.js.map +1 -1
  237. package/lib/InitialTree.d.ts +2 -2
  238. package/lib/InitialTree.d.ts.map +1 -1
  239. package/lib/InitialTree.js +2 -1
  240. package/lib/InitialTree.js.map +1 -1
  241. package/lib/LazyCheckout.d.ts +28 -0
  242. package/lib/LazyCheckout.d.ts.map +1 -0
  243. package/lib/LazyCheckout.js +40 -0
  244. package/lib/LazyCheckout.js.map +1 -0
  245. package/lib/LogViewer.d.ts +130 -85
  246. package/lib/LogViewer.d.ts.map +1 -1
  247. package/lib/LogViewer.js +102 -77
  248. package/lib/LogViewer.js.map +1 -1
  249. package/lib/MergeHealth.d.ts +221 -0
  250. package/lib/MergeHealth.d.ts.map +1 -0
  251. package/lib/MergeHealth.js +258 -0
  252. package/lib/MergeHealth.js.map +1 -0
  253. package/lib/NodeIdUtilities.d.ts +90 -0
  254. package/lib/NodeIdUtilities.d.ts.map +1 -0
  255. package/lib/NodeIdUtilities.js +53 -0
  256. package/lib/NodeIdUtilities.js.map +1 -0
  257. package/lib/PayloadUtilities.d.ts +42 -0
  258. package/lib/PayloadUtilities.d.ts.map +1 -0
  259. package/lib/PayloadUtilities.js +110 -0
  260. package/lib/PayloadUtilities.js.map +1 -0
  261. package/lib/ReconciliationPath.d.ts +18 -13
  262. package/lib/ReconciliationPath.d.ts.map +1 -1
  263. package/lib/ReconciliationPath.js.map +1 -1
  264. package/lib/RevisionValueCache.d.ts +11 -2
  265. package/lib/RevisionValueCache.d.ts.map +1 -1
  266. package/lib/RevisionValueCache.js +2 -3
  267. package/lib/RevisionValueCache.js.map +1 -1
  268. package/lib/RevisionView.d.ts +83 -0
  269. package/lib/RevisionView.d.ts.map +1 -0
  270. package/lib/RevisionView.js +175 -0
  271. package/lib/RevisionView.js.map +1 -0
  272. package/lib/SerializationUtilities.d.ts +36 -0
  273. package/lib/SerializationUtilities.d.ts.map +1 -0
  274. package/lib/SerializationUtilities.js +95 -0
  275. package/lib/SerializationUtilities.js.map +1 -0
  276. package/lib/SharedTree.d.ts +400 -0
  277. package/lib/SharedTree.d.ts.map +1 -0
  278. package/lib/SharedTree.js +1059 -0
  279. package/lib/SharedTree.js.map +1 -0
  280. package/lib/SharedTreeEncoder.d.ts +102 -0
  281. package/lib/SharedTreeEncoder.d.ts.map +1 -0
  282. package/lib/SharedTreeEncoder.js +308 -0
  283. package/lib/SharedTreeEncoder.js.map +1 -0
  284. package/lib/StringInterner.d.ts +46 -0
  285. package/lib/StringInterner.d.ts.map +1 -0
  286. package/lib/StringInterner.js +57 -0
  287. package/lib/StringInterner.js.map +1 -0
  288. package/lib/Summary.d.ts +40 -0
  289. package/lib/Summary.d.ts.map +1 -0
  290. package/lib/Summary.js +19 -0
  291. package/lib/Summary.js.map +1 -0
  292. package/lib/SummaryBackCompatibility.d.ts +22 -22
  293. package/lib/SummaryBackCompatibility.d.ts.map +1 -1
  294. package/lib/SummaryBackCompatibility.js +29 -32
  295. package/lib/SummaryBackCompatibility.js.map +1 -1
  296. package/lib/SummaryTestUtilities.d.ts +31 -0
  297. package/lib/SummaryTestUtilities.d.ts.map +1 -0
  298. package/lib/SummaryTestUtilities.js +32 -0
  299. package/lib/SummaryTestUtilities.js.map +1 -0
  300. package/lib/Transaction.d.ts +53 -0
  301. package/lib/Transaction.d.ts.map +1 -0
  302. package/lib/Transaction.js +72 -0
  303. package/lib/Transaction.js.map +1 -0
  304. package/lib/TransactionInternal.d.ts +543 -0
  305. package/lib/TransactionInternal.d.ts.map +1 -0
  306. package/lib/TransactionInternal.js +618 -0
  307. package/lib/TransactionInternal.js.map +1 -0
  308. package/lib/TreeCompressor.d.ts +37 -0
  309. package/lib/TreeCompressor.d.ts.map +1 -0
  310. package/lib/TreeCompressor.js +128 -0
  311. package/lib/TreeCompressor.js.map +1 -0
  312. package/lib/TreeNodeHandle.d.ts +12 -18
  313. package/lib/TreeNodeHandle.d.ts.map +1 -1
  314. package/lib/TreeNodeHandle.js +14 -24
  315. package/lib/TreeNodeHandle.js.map +1 -1
  316. package/lib/TreeView.d.ts +166 -0
  317. package/lib/TreeView.d.ts.map +1 -0
  318. package/lib/TreeView.js +213 -0
  319. package/lib/TreeView.js.map +1 -0
  320. package/lib/TreeViewUtilities.d.ts +21 -0
  321. package/lib/TreeViewUtilities.d.ts.map +1 -0
  322. package/lib/TreeViewUtilities.js +71 -0
  323. package/lib/TreeViewUtilities.js.map +1 -0
  324. package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
  325. package/lib/UndoRedoHandler.d.ts.map +1 -0
  326. package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
  327. package/lib/UndoRedoHandler.js.map +1 -0
  328. package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
  329. package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
  330. package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
  331. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
  332. package/lib/id-compressor/IdCompressor.d.ts +389 -0
  333. package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
  334. package/lib/id-compressor/IdCompressor.js +1343 -0
  335. package/lib/id-compressor/IdCompressor.js.map +1 -0
  336. package/lib/id-compressor/IdRange.d.ts +11 -0
  337. package/lib/id-compressor/IdRange.d.ts.map +1 -0
  338. package/lib/id-compressor/IdRange.js +25 -0
  339. package/lib/id-compressor/IdRange.js.map +1 -0
  340. package/lib/id-compressor/NumericUuid.d.ts +63 -0
  341. package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
  342. package/lib/id-compressor/NumericUuid.js +365 -0
  343. package/lib/id-compressor/NumericUuid.js.map +1 -0
  344. package/lib/id-compressor/index.d.ts +12 -0
  345. package/lib/id-compressor/index.d.ts.map +1 -0
  346. package/lib/id-compressor/index.js +12 -0
  347. package/lib/id-compressor/index.js.map +1 -0
  348. package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
  349. package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
  350. package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
  351. package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
  352. package/lib/id-compressor/persisted-types/index.d.ts +6 -0
  353. package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
  354. package/lib/id-compressor/persisted-types/index.js +6 -0
  355. package/lib/id-compressor/persisted-types/index.js.map +1 -0
  356. package/lib/index.d.ts +29 -9
  357. package/lib/index.d.ts.map +1 -1
  358. package/lib/index.js +23 -6
  359. package/lib/index.js.map +1 -1
  360. package/lib/persisted-types/0.0.2.d.ts +385 -0
  361. package/lib/persisted-types/0.0.2.d.ts.map +1 -0
  362. package/lib/persisted-types/0.0.2.js +110 -0
  363. package/lib/persisted-types/0.0.2.js.map +1 -0
  364. package/lib/persisted-types/0.1.1.d.ts +314 -0
  365. package/lib/persisted-types/0.1.1.d.ts.map +1 -0
  366. package/lib/persisted-types/0.1.1.js +150 -0
  367. package/lib/persisted-types/0.1.1.js.map +1 -0
  368. package/lib/persisted-types/index.d.ts +7 -0
  369. package/lib/persisted-types/index.d.ts.map +1 -0
  370. package/lib/persisted-types/index.js +8 -0
  371. package/lib/persisted-types/index.js.map +1 -0
  372. package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
  373. package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
  374. package/lib/test/AppendOnlySortedMap.tests.js +169 -0
  375. package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
  376. package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
  377. package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
  378. package/lib/test/ChangeCompression.tests.js +145 -0
  379. package/lib/test/ChangeCompression.tests.js.map +1 -0
  380. package/lib/test/Checkout.tests.d.ts +2 -3
  381. package/lib/test/Checkout.tests.d.ts.map +1 -1
  382. package/lib/test/Checkout.tests.js +126 -69
  383. package/lib/test/Checkout.tests.js.map +1 -1
  384. package/lib/test/Common.tests.js +60 -2
  385. package/lib/test/Common.tests.js.map +1 -1
  386. package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
  387. package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
  388. package/lib/test/EagerCheckout.tests.js +20 -0
  389. package/lib/test/EagerCheckout.tests.js.map +1 -0
  390. package/lib/test/Edit.tests.js +22 -14
  391. package/lib/test/Edit.tests.js.map +1 -1
  392. package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
  393. package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
  394. package/lib/test/EditLog.perf.tests.js +30 -0
  395. package/lib/test/EditLog.perf.tests.js.map +1 -0
  396. package/lib/test/EditLog.tests.js +10 -6
  397. package/lib/test/EditLog.tests.js.map +1 -1
  398. package/lib/test/EditUtilities.tests.d.ts +6 -0
  399. package/lib/test/EditUtilities.tests.d.ts.map +1 -0
  400. package/lib/test/EditUtilities.tests.js +503 -0
  401. package/lib/test/EditUtilities.tests.js.map +1 -0
  402. package/lib/test/Forest.perf.tests.d.ts +6 -0
  403. package/lib/test/Forest.perf.tests.d.ts.map +1 -0
  404. package/lib/test/Forest.perf.tests.js +133 -0
  405. package/lib/test/Forest.perf.tests.js.map +1 -0
  406. package/lib/test/Forest.tests.js +54 -27
  407. package/lib/test/Forest.tests.js.map +1 -1
  408. package/lib/test/GenericTransaction.tests.js +12 -3
  409. package/lib/test/GenericTransaction.tests.js.map +1 -1
  410. package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
  411. package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
  412. package/lib/test/HistoryEditFactory.tests.js +90 -0
  413. package/lib/test/HistoryEditFactory.tests.js.map +1 -0
  414. package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
  415. package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
  416. package/lib/test/IdCompressor.perf.tests.js +304 -0
  417. package/lib/test/IdCompressor.perf.tests.js.map +1 -0
  418. package/lib/test/IdCompressor.tests.d.ts +6 -0
  419. package/lib/test/IdCompressor.tests.d.ts.map +1 -0
  420. package/lib/test/IdCompressor.tests.js +1075 -0
  421. package/lib/test/IdCompressor.tests.js.map +1 -0
  422. package/lib/test/IdConversion.tests.d.ts +6 -0
  423. package/lib/test/IdConversion.tests.d.ts.map +1 -0
  424. package/lib/test/IdConversion.tests.js +36 -0
  425. package/lib/test/IdConversion.tests.js.map +1 -0
  426. package/lib/test/LazyCheckout.tests.d.ts +6 -0
  427. package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
  428. package/lib/test/LazyCheckout.tests.js +22 -0
  429. package/lib/test/LazyCheckout.tests.js.map +1 -0
  430. package/lib/test/LogViewer.tests.js +269 -187
  431. package/lib/test/LogViewer.tests.js.map +1 -1
  432. package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
  433. package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
  434. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
  435. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
  436. package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
  437. package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
  438. package/lib/test/NumericUuid.perf.tests.js +68 -0
  439. package/lib/test/NumericUuid.perf.tests.js.map +1 -0
  440. package/lib/test/NumericUuid.tests.d.ts +6 -0
  441. package/lib/test/NumericUuid.tests.d.ts.map +1 -0
  442. package/lib/test/NumericUuid.tests.js +191 -0
  443. package/lib/test/NumericUuid.tests.js.map +1 -0
  444. package/lib/test/RevisionView.tests.d.ts +6 -0
  445. package/lib/test/RevisionView.tests.d.ts.map +1 -0
  446. package/lib/test/RevisionView.tests.js +133 -0
  447. package/lib/test/RevisionView.tests.js.map +1 -0
  448. package/lib/test/SharedTree.perf.tests.d.ts +6 -0
  449. package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
  450. package/lib/test/SharedTree.perf.tests.js +39 -0
  451. package/lib/test/SharedTree.perf.tests.js.map +1 -0
  452. package/lib/test/SharedTree.tests.js +15 -3
  453. package/lib/test/SharedTree.tests.js.map +1 -1
  454. package/lib/test/StringInterner.tests.d.ts +6 -0
  455. package/lib/test/StringInterner.tests.d.ts.map +1 -0
  456. package/lib/test/StringInterner.tests.js +71 -0
  457. package/lib/test/StringInterner.tests.js.map +1 -0
  458. package/lib/test/Summary.tests.d.ts +8 -0
  459. package/lib/test/Summary.tests.d.ts.map +1 -0
  460. package/lib/test/Summary.tests.js +407 -0
  461. package/lib/test/Summary.tests.js.map +1 -0
  462. package/lib/test/Transaction.tests.js +76 -330
  463. package/lib/test/Transaction.tests.js.map +1 -1
  464. package/lib/test/TransactionInternal.tests.d.ts +6 -0
  465. package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
  466. package/lib/test/TransactionInternal.tests.js +568 -0
  467. package/lib/test/TransactionInternal.tests.js.map +1 -0
  468. package/lib/test/TreeCompression.tests.d.ts +6 -0
  469. package/lib/test/TreeCompression.tests.d.ts.map +1 -0
  470. package/lib/test/TreeCompression.tests.js +292 -0
  471. package/lib/test/TreeCompression.tests.js.map +1 -0
  472. package/lib/test/TreeView.tests.d.ts +6 -0
  473. package/lib/test/TreeView.tests.d.ts.map +1 -0
  474. package/lib/test/TreeView.tests.js +147 -0
  475. package/lib/test/TreeView.tests.js.map +1 -0
  476. package/lib/test/UndoRedoHandler.tests.js +2 -2
  477. package/lib/test/UndoRedoHandler.tests.js.map +1 -1
  478. package/lib/test/Virtualization.tests.js +147 -62
  479. package/lib/test/Virtualization.tests.js.map +1 -1
  480. package/lib/test/fuzz/Generators.d.ts +19 -0
  481. package/lib/test/fuzz/Generators.d.ts.map +1 -0
  482. package/lib/test/fuzz/Generators.js +420 -0
  483. package/lib/test/fuzz/Generators.js.map +1 -0
  484. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
  485. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
  486. package/lib/test/fuzz/SharedTreeFuzzTests.js +200 -0
  487. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
  488. package/lib/test/fuzz/Types.d.ts +133 -0
  489. package/lib/test/fuzz/Types.d.ts.map +1 -0
  490. package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
  491. package/lib/test/fuzz/Types.js.map +1 -0
  492. package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
  493. package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
  494. package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
  495. package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
  496. package/lib/test/utilities/MockTransaction.d.ts +26 -7
  497. package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
  498. package/lib/test/utilities/MockTransaction.js +40 -11
  499. package/lib/test/utilities/MockTransaction.js.map +1 -1
  500. package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
  501. package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
  502. package/lib/test/utilities/PendingLocalStateTests.js +105 -0
  503. package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
  504. package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
  505. package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
  506. package/lib/test/utilities/SharedTreeTests.js +696 -439
  507. package/lib/test/utilities/SharedTreeTests.js.map +1 -1
  508. package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
  509. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
  510. package/lib/test/utilities/SharedTreeVersioningTests.js +345 -0
  511. package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
  512. package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
  513. package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
  514. package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
  515. package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
  516. package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
  517. package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
  518. package/lib/test/utilities/SummarySizeTests.js +158 -0
  519. package/lib/test/utilities/SummarySizeTests.js.map +1 -0
  520. package/lib/test/utilities/TestCommon.d.ts +9 -0
  521. package/lib/test/utilities/TestCommon.d.ts.map +1 -0
  522. package/lib/test/utilities/TestCommon.js +13 -0
  523. package/lib/test/utilities/TestCommon.js.map +1 -0
  524. package/lib/test/utilities/TestNode.d.ts +140 -0
  525. package/lib/test/utilities/TestNode.d.ts.map +1 -0
  526. package/lib/test/utilities/TestNode.js +292 -0
  527. package/lib/test/utilities/TestNode.js.map +1 -0
  528. package/lib/test/utilities/TestUtilities.d.ts +84 -70
  529. package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
  530. package/lib/test/utilities/TestUtilities.js +218 -143
  531. package/lib/test/utilities/TestUtilities.js.map +1 -1
  532. package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
  533. package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
  534. package/lib/test/utilities/UndoRedoTests.js +138 -149
  535. package/lib/test/utilities/UndoRedoTests.js.map +1 -1
  536. package/package.json +19 -14
  537. package/src/ChangeCompression.ts +159 -0
  538. package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -120
  539. package/src/Checkout.ts +81 -52
  540. package/src/Common.ts +317 -117
  541. package/src/EagerCheckout.ts +38 -0
  542. package/src/EditLog.ts +153 -100
  543. package/src/EditUtilities.ts +559 -0
  544. package/src/EventTypes.ts +74 -0
  545. package/src/Forest.ts +81 -73
  546. package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
  547. package/src/IdConversion.ts +125 -0
  548. package/src/Identifiers.ts +101 -1
  549. package/src/InitialTree.ts +5 -4
  550. package/src/LazyCheckout.ts +51 -0
  551. package/src/LogViewer.ts +242 -166
  552. package/src/MergeHealth.ts +447 -0
  553. package/src/NodeIdUtilities.ts +141 -0
  554. package/src/PayloadUtilities.ts +124 -0
  555. package/src/ReconciliationPath.ts +18 -13
  556. package/src/RevisionValueCache.ts +14 -5
  557. package/src/RevisionView.ts +252 -0
  558. package/src/SerializationUtilities.ts +130 -0
  559. package/src/SharedTree.ts +1448 -0
  560. package/src/SharedTreeEncoder.ts +493 -0
  561. package/src/StringInterner.ts +72 -0
  562. package/src/Summary.ts +48 -0
  563. package/src/SummaryBackCompatibility.ts +47 -57
  564. package/src/SummaryTestUtilities.ts +54 -0
  565. package/src/Transaction.ts +94 -0
  566. package/src/TransactionInternal.ts +1088 -0
  567. package/src/TreeCompressor.ts +222 -0
  568. package/src/TreeNodeHandle.ts +19 -32
  569. package/src/TreeView.ts +321 -0
  570. package/src/TreeViewUtilities.ts +77 -0
  571. package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
  572. package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
  573. package/src/id-compressor/IdCompressor.md +3 -0
  574. package/src/id-compressor/IdCompressor.ts +1848 -0
  575. package/src/id-compressor/IdRange.ts +33 -0
  576. package/src/id-compressor/NumericUuid.ts +414 -0
  577. package/src/id-compressor/index.ts +13 -0
  578. package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
  579. package/src/id-compressor/persisted-types/README.md +3 -0
  580. package/src/id-compressor/persisted-types/index.ts +6 -0
  581. package/src/index.ts +119 -59
  582. package/src/persisted-types/0.0.2.ts +442 -0
  583. package/src/persisted-types/0.1.1.ts +476 -0
  584. package/src/persisted-types/README.md +22 -0
  585. package/src/persisted-types/index.ts +9 -0
  586. package/.mocharc.js +0 -41
  587. package/api/tree.api.md +0 -729
  588. package/dist/BasicCheckout.d.ts +0 -23
  589. package/dist/BasicCheckout.d.ts.map +0 -1
  590. package/dist/BasicCheckout.js.map +0 -1
  591. package/dist/Snapshot.d.ts +0 -198
  592. package/dist/Snapshot.d.ts.map +0 -1
  593. package/dist/Snapshot.js +0 -267
  594. package/dist/Snapshot.js.map +0 -1
  595. package/dist/SnapshotUtilities.d.ts +0 -29
  596. package/dist/SnapshotUtilities.d.ts.map +0 -1
  597. package/dist/SnapshotUtilities.js +0 -73
  598. package/dist/SnapshotUtilities.js.map +0 -1
  599. package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
  600. package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
  601. package/dist/anchored-edits/AnchorResolution.js +0 -162
  602. package/dist/anchored-edits/AnchorResolution.js.map +0 -1
  603. package/dist/anchored-edits/Factory.d.ts +0 -56
  604. package/dist/anchored-edits/Factory.d.ts.map +0 -1
  605. package/dist/anchored-edits/Factory.js +0 -79
  606. package/dist/anchored-edits/Factory.js.map +0 -1
  607. package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
  608. package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
  609. package/dist/anchored-edits/PersistedTypes.js +0 -131
  610. package/dist/anchored-edits/PersistedTypes.js.map +0 -1
  611. package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
  612. package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
  613. package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
  614. package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
  615. package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
  616. package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
  617. package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
  618. package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
  619. package/dist/anchored-edits/index.d.ts +0 -10
  620. package/dist/anchored-edits/index.d.ts.map +0 -1
  621. package/dist/anchored-edits/index.js +0 -34
  622. package/dist/anchored-edits/index.js.map +0 -1
  623. package/dist/default-edits/EditUtilities.d.ts +0 -57
  624. package/dist/default-edits/EditUtilities.d.ts.map +0 -1
  625. package/dist/default-edits/EditUtilities.js +0 -192
  626. package/dist/default-edits/EditUtilities.js.map +0 -1
  627. package/dist/default-edits/Factory.d.ts +0 -56
  628. package/dist/default-edits/Factory.d.ts.map +0 -1
  629. package/dist/default-edits/Factory.js +0 -79
  630. package/dist/default-edits/Factory.js.map +0 -1
  631. package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
  632. package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
  633. package/dist/default-edits/HistoryEditFactory.js +0 -187
  634. package/dist/default-edits/HistoryEditFactory.js.map +0 -1
  635. package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
  636. package/dist/default-edits/PersistedTypes.js.map +0 -1
  637. package/dist/default-edits/SharedTree.d.ts +0 -111
  638. package/dist/default-edits/SharedTree.d.ts.map +0 -1
  639. package/dist/default-edits/SharedTree.js +0 -124
  640. package/dist/default-edits/SharedTree.js.map +0 -1
  641. package/dist/default-edits/Summary.d.ts +0 -15
  642. package/dist/default-edits/Summary.d.ts.map +0 -1
  643. package/dist/default-edits/Summary.js +0 -35
  644. package/dist/default-edits/Summary.js.map +0 -1
  645. package/dist/default-edits/Transaction.d.ts +0 -41
  646. package/dist/default-edits/Transaction.d.ts.map +0 -1
  647. package/dist/default-edits/Transaction.js +0 -225
  648. package/dist/default-edits/Transaction.js.map +0 -1
  649. package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
  650. package/dist/default-edits/UndoRedoHandler.js.map +0 -1
  651. package/dist/default-edits/index.d.ts +0 -13
  652. package/dist/default-edits/index.d.ts.map +0 -1
  653. package/dist/default-edits/index.js +0 -41
  654. package/dist/default-edits/index.js.map +0 -1
  655. package/dist/generic/GenericEditUtilities.d.ts +0 -26
  656. package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
  657. package/dist/generic/GenericEditUtilities.js +0 -45
  658. package/dist/generic/GenericEditUtilities.js.map +0 -1
  659. package/dist/generic/GenericSharedTree.d.ts +0 -221
  660. package/dist/generic/GenericSharedTree.d.ts.map +0 -1
  661. package/dist/generic/GenericSharedTree.js +0 -447
  662. package/dist/generic/GenericSharedTree.js.map +0 -1
  663. package/dist/generic/GenericTransaction.d.ts +0 -87
  664. package/dist/generic/GenericTransaction.d.ts.map +0 -1
  665. package/dist/generic/GenericTransaction.js +0 -144
  666. package/dist/generic/GenericTransaction.js.map +0 -1
  667. package/dist/generic/PersistedTypes.d.ts +0 -194
  668. package/dist/generic/PersistedTypes.d.ts.map +0 -1
  669. package/dist/generic/PersistedTypes.js +0 -42
  670. package/dist/generic/PersistedTypes.js.map +0 -1
  671. package/dist/generic/Summary.d.ts +0 -63
  672. package/dist/generic/Summary.d.ts.map +0 -1
  673. package/dist/generic/Summary.js +0 -64
  674. package/dist/generic/Summary.js.map +0 -1
  675. package/dist/generic/index.d.ts +0 -10
  676. package/dist/generic/index.d.ts.map +0 -1
  677. package/dist/generic/index.js +0 -26
  678. package/dist/generic/index.js.map +0 -1
  679. package/lib/BasicCheckout.d.ts +0 -23
  680. package/lib/BasicCheckout.d.ts.map +0 -1
  681. package/lib/BasicCheckout.js.map +0 -1
  682. package/lib/Snapshot.d.ts +0 -198
  683. package/lib/Snapshot.d.ts.map +0 -1
  684. package/lib/Snapshot.js +0 -263
  685. package/lib/Snapshot.js.map +0 -1
  686. package/lib/SnapshotUtilities.d.ts +0 -29
  687. package/lib/SnapshotUtilities.d.ts.map +0 -1
  688. package/lib/SnapshotUtilities.js +0 -67
  689. package/lib/SnapshotUtilities.js.map +0 -1
  690. package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
  691. package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
  692. package/lib/anchored-edits/AnchorResolution.js +0 -152
  693. package/lib/anchored-edits/AnchorResolution.js.map +0 -1
  694. package/lib/anchored-edits/Factory.d.ts +0 -56
  695. package/lib/anchored-edits/Factory.d.ts.map +0 -1
  696. package/lib/anchored-edits/Factory.js +0 -74
  697. package/lib/anchored-edits/Factory.js.map +0 -1
  698. package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
  699. package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
  700. package/lib/anchored-edits/PersistedTypes.js +0 -128
  701. package/lib/anchored-edits/PersistedTypes.js.map +0 -1
  702. package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
  703. package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
  704. package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
  705. package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
  706. package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
  707. package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
  708. package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
  709. package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
  710. package/lib/anchored-edits/index.d.ts +0 -10
  711. package/lib/anchored-edits/index.d.ts.map +0 -1
  712. package/lib/anchored-edits/index.js +0 -11
  713. package/lib/anchored-edits/index.js.map +0 -1
  714. package/lib/default-edits/EditUtilities.d.ts +0 -57
  715. package/lib/default-edits/EditUtilities.d.ts.map +0 -1
  716. package/lib/default-edits/EditUtilities.js +0 -181
  717. package/lib/default-edits/EditUtilities.js.map +0 -1
  718. package/lib/default-edits/Factory.d.ts +0 -56
  719. package/lib/default-edits/Factory.d.ts.map +0 -1
  720. package/lib/default-edits/Factory.js +0 -74
  721. package/lib/default-edits/Factory.js.map +0 -1
  722. package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
  723. package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
  724. package/lib/default-edits/HistoryEditFactory.js.map +0 -1
  725. package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
  726. package/lib/default-edits/PersistedTypes.js.map +0 -1
  727. package/lib/default-edits/SharedTree.d.ts +0 -111
  728. package/lib/default-edits/SharedTree.d.ts.map +0 -1
  729. package/lib/default-edits/SharedTree.js +0 -100
  730. package/lib/default-edits/SharedTree.js.map +0 -1
  731. package/lib/default-edits/Summary.d.ts +0 -15
  732. package/lib/default-edits/Summary.d.ts.map +0 -1
  733. package/lib/default-edits/Summary.js +0 -31
  734. package/lib/default-edits/Summary.js.map +0 -1
  735. package/lib/default-edits/Transaction.d.ts +0 -41
  736. package/lib/default-edits/Transaction.d.ts.map +0 -1
  737. package/lib/default-edits/Transaction.js +0 -221
  738. package/lib/default-edits/Transaction.js.map +0 -1
  739. package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
  740. package/lib/default-edits/UndoRedoHandler.js.map +0 -1
  741. package/lib/default-edits/index.d.ts +0 -13
  742. package/lib/default-edits/index.d.ts.map +0 -1
  743. package/lib/default-edits/index.js +0 -14
  744. package/lib/default-edits/index.js.map +0 -1
  745. package/lib/generic/GenericEditUtilities.d.ts +0 -26
  746. package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
  747. package/lib/generic/GenericEditUtilities.js +0 -38
  748. package/lib/generic/GenericEditUtilities.js.map +0 -1
  749. package/lib/generic/GenericSharedTree.d.ts +0 -221
  750. package/lib/generic/GenericSharedTree.d.ts.map +0 -1
  751. package/lib/generic/GenericSharedTree.js +0 -443
  752. package/lib/generic/GenericSharedTree.js.map +0 -1
  753. package/lib/generic/GenericTransaction.d.ts +0 -87
  754. package/lib/generic/GenericTransaction.d.ts.map +0 -1
  755. package/lib/generic/GenericTransaction.js +0 -140
  756. package/lib/generic/GenericTransaction.js.map +0 -1
  757. package/lib/generic/PersistedTypes.d.ts +0 -194
  758. package/lib/generic/PersistedTypes.d.ts.map +0 -1
  759. package/lib/generic/PersistedTypes.js +0 -39
  760. package/lib/generic/PersistedTypes.js.map +0 -1
  761. package/lib/generic/Summary.d.ts +0 -63
  762. package/lib/generic/Summary.d.ts.map +0 -1
  763. package/lib/generic/Summary.js +0 -58
  764. package/lib/generic/Summary.js.map +0 -1
  765. package/lib/generic/index.d.ts +0 -10
  766. package/lib/generic/index.d.ts.map +0 -1
  767. package/lib/generic/index.js +0 -11
  768. package/lib/generic/index.js.map +0 -1
  769. package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
  770. package/lib/test/Anchors.glassBox.tests.js +0 -410
  771. package/lib/test/Anchors.glassBox.tests.js.map +0 -1
  772. package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
  773. package/lib/test/BasicCheckout.tests.js +0 -8
  774. package/lib/test/BasicCheckout.tests.js.map +0 -1
  775. package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
  776. package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
  777. package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
  778. package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
  779. package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
  780. package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
  781. package/lib/test/Snapshot.tests.d.ts.map +0 -1
  782. package/lib/test/Snapshot.tests.js +0 -96
  783. package/lib/test/Snapshot.tests.js.map +0 -1
  784. package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
  785. package/lib/test/SnapshotUtilities.tests.js +0 -168
  786. package/lib/test/SnapshotUtilities.tests.js.map +0 -1
  787. package/lib/test/undoRedoStackManager.d.ts +0 -26
  788. package/lib/test/undoRedoStackManager.d.ts.map +0 -1
  789. package/lib/test/undoRedoStackManager.js +0 -176
  790. package/lib/test/undoRedoStackManager.js.map +0 -1
  791. package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
  792. package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
  793. package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
  794. package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
  795. package/src/BasicCheckout.ts +0 -34
  796. package/src/Snapshot.ts +0 -363
  797. package/src/SnapshotUtilities.ts +0 -88
  798. package/src/anchored-edits/AnchorResolution.ts +0 -442
  799. package/src/anchored-edits/Factory.ts +0 -94
  800. package/src/anchored-edits/PersistedTypes.ts +0 -310
  801. package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
  802. package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
  803. package/src/anchored-edits/index.ts +0 -21
  804. package/src/default-edits/EditUtilities.ts +0 -220
  805. package/src/default-edits/Factory.ts +0 -94
  806. package/src/default-edits/SharedTree.ts +0 -174
  807. package/src/default-edits/Summary.ts +0 -44
  808. package/src/default-edits/Transaction.ts +0 -262
  809. package/src/default-edits/index.ts +0 -29
  810. package/src/generic/GenericEditUtilities.ts +0 -46
  811. package/src/generic/GenericSharedTree.ts +0 -593
  812. package/src/generic/GenericTransaction.ts +0 -194
  813. package/src/generic/PersistedTypes.ts +0 -221
  814. package/src/generic/Summary.ts +0 -113
  815. package/src/generic/index.ts +0 -41
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Summary.tests.js","sourceRoot":"","sources":["../../src/test/Summary.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAoB,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACN,aAAa,EACb,eAAe,EAGf,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,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CAAC,SAAS,CAAC,CAAC;SACxG;aAAM;YACN,MAAM,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC,cAAc,KAAK,wBAAwB,CAAC,SAAS,CAAC,CAAC;YACxG,IAAI,CAAC,oBAAoB,GAAG,IAAI,YAAY,CAAC,wBAAwB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;SAClG;IACF,CAAC;IAEM,aAAa;QACnB,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,wBAAwB,CAAC,aAAa,CAAW,CAAC;IAC9F,CAAC;IAEM,aAAa;QACnB,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW,CAAC,MAAM,EAAE;YAC5C,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;SAC9D;aAAM;YACN,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;SACxC;IACF,CAAC;IAEO,eAAe;QACtB,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,EAAE,CAAa,CAAC;IAC3G,CAAC;;AA7BsB,kCAAS,GAAG,sCAAmD,CAAC;AAC/D,sCAAa,GAAG,sCAAsC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport * as fs from 'fs';\nimport { join } from 'path';\nimport { IsoBuffer } from '@fluidframework/common-utils';\nimport { expect } from 'chai';\nimport { v5 } from 'uuid';\nimport { Change, StablePlace, StableRange } from '../ChangeTypes';\nimport { assert, RecursiveMutable } from '../Common';\nimport { areRevisionViewsSemanticallyEqual } from '../EditUtilities';\nimport { EditId, NodeId, SessionId, StableId, TraitLabel } from '../Identifiers';\nimport { initialTree } from '../InitialTree';\nimport {\n\teditsPerChunk,\n\treservedIdCount,\n\tSharedTreeSummary,\n\tSharedTreeSummary_0_0_2,\n\tWriteFormat,\n} from '../persisted-types';\nimport { getChangeNodeFromView } from '../SerializationUtilities';\nimport { SharedTree } from '../SharedTree';\nimport { deserialize, getSummaryStatistics, SummaryStatistics } from '../SummaryBackCompatibility';\nimport { getUploadedEditChunkContents, UploadedEditChunkContents } from '../SummaryTestUtilities';\nimport { IdCompressor } from '../id-compressor';\nimport { convertEditIds } from '../IdConversion';\nimport { MutableStringInterner } from '../StringInterner';\nimport { sequencedIdNormalizer } from '../NodeIdUtilities';\nimport { expectDefined } from './utilities/TestCommon';\nimport { TestFluidSerializer } from './utilities/TestSerializer';\nimport {\n\tgetIdNormalizerFromSharedTree,\n\tmakeNodeIdContext,\n\tsetUpLocalServerTestSharedTree,\n\ttestDocumentsPathBase,\n} from './utilities/TestUtilities';\n\nconst directory = join(testDocumentsPathBase, 'summary-tests');\n\n/** Applies a smattering of interesting edits to the given shared tree in an attempt to cover a variety of use cases */\nexport function applyTestEdits(sharedTree: SharedTree): void {\n\tconst uuid = new DeterministicIdGenerator(sharedTree.getWriteFormat(), sharedTree);\n\n\tfunction applyEdit(changes: Change[]): void {\n\t\tconst internalChanges = changes.map((c) => sharedTree.internalizeChange(c));\n\t\tsharedTree.applyEditInternal({ id: uuid.getNextEditId(), changes: internalChanges });\n\t}\n\n\t/**\n\t * Build a tree that looks like the following:\n\t *\n\t * ROOT\n\t * | 'root'\n\t * [root]\n\t * 'left' / \\ 'right'\n\t * [A] [B, C, D]\n\t * | 'leaf'\n\t * [E('payload')]\n\t */\n\n\tconst cDetachedId = 0;\n\tconst rootDetachedId = 1;\n\tconst aId = uuid.getNextNodeId();\n\tconst cId = uuid.getNextNodeId();\n\tconst dId = uuid.getNextNodeId();\n\n\tapplyEdit([\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'C',\n\t\t\t\t\tidentifier: cId,\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleaf: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdefinition: 'E',\n\t\t\t\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\t\t\t\tpayload: 'payload',\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},\n\t\t\t],\n\t\t\tcDetachedId\n\t\t),\n\t\tChange.build(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tdefinition: 'Root',\n\t\t\t\t\tidentifier: uuid.getNextNodeId(),\n\t\t\t\t\ttraits: {\n\t\t\t\t\t\tleft: [{ definition: 'A', identifier: aId }],\n\t\t\t\t\t\tright: [\n\t\t\t\t\t\t\t{ definition: 'B', identifier: uuid.getNextNodeId() },\n\t\t\t\t\t\t\tcDetachedId,\n\t\t\t\t\t\t\t{ definition: 'D', identifier: dId },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\trootDetachedId\n\t\t),\n\t\tChange.insert(\n\t\t\trootDetachedId,\n\t\t\tStablePlace.atStartOf({\n\t\t\t\tlabel: 'root' as TraitLabel,\n\t\t\t\tparent: sharedTree.convertToNodeId(initialTree.identifier),\n\t\t\t})\n\t\t),\n\t]);\n\n\t/**\n\t * Edit the tree\n\t *\n\t * 1. Move C after A\n\t * 2. Delete D\n\t * 3.\n\t * ...\n\t * 102. Set the payload of A to _i_ for all _i_ in 0...100\n\t */\n\n\tapplyEdit([...Change.move(StableRange.only(cId), StablePlace.after(aId))]);\n\tapplyEdit([Change.delete(StableRange.only(dId))]);\n\tfor (let i = 0; i < 100; i++) {\n\t\tapplyEdit([Change.setPayload(aId, i)]);\n\t}\n}\n\nexport async function createSummaryTestTree(writeFormat: WriteFormat, summarizeHistory: boolean): Promise<SharedTree> {\n\tconst { tree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat,\n\t\tsummarizeHistory,\n\t\tuploadEditChunks: summarizeHistory,\n\t});\n\n\tif (writeFormat === WriteFormat.v0_1_1) {\n\t\tconst idCompressor = new IdCompressor('968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId, reservedIdCount);\n\t\tconst interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst context = makeNodeIdContext(idCompressor);\n\t\tconst normalizer = sequencedIdNormalizer(context);\n\t\tconst sharedTreeSummaryWithConstantSessionId: SharedTreeSummary = {\n\t\t\tversion: WriteFormat.v0_1_1,\n\t\t\tcurrentTree: summarizeHistory\n\t\t\t\t? [\n\t\t\t\t\t\tinterner.getOrCreateInternedId(initialTree.definition),\n\t\t\t\t\t\tnormalizer.normalizeToOpSpace(context.convertToNodeId(initialTree.identifier)),\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t\teditHistory: {\n\t\t\t\teditIds: [],\n\t\t\t\teditChunks: [],\n\t\t\t},\n\t\t\tidCompressor: idCompressor.serialize(true),\n\t\t\tinternedStrings: interner.getSerializable(),\n\t\t};\n\n\t\ttree.loadSummary(sharedTreeSummaryWithConstantSessionId);\n\t}\n\n\tapplyTestEdits(tree);\n\n\tawait testObjectProvider.ensureSynchronized();\n\treturn tree;\n}\n\nexport function runSummaryTests(title: string): void {\n\tdescribe(title, () => {\n\t\t// Note: this test serializer doesn't handle blobs properly (it just uses JSON.stringify/JSON.parse).\n\t\tconst testSerializer = new TestFluidSerializer();\n\n\t\tconst {\n\t\t\tsummaryFileWithHistory_0_0_2,\n\t\t\tsummaryFileNoHistory_0_0_2,\n\t\t\tsummaryFileEmptyTraits_0_0_2,\n\t\t\tsummaryFileWithHistory_0_1_1,\n\t\t\tsummaryFileNoHistory_0_1_1,\n\t\t\tsummaryFileUpgrade_0_1_1,\n\t\t\tblobsFile,\n\t\t} = loadSummaryTestFiles();\n\n\t\t// Note: Fluid setup gives stable `absolutePath`s for these blobs across sessions. If that were not the case,\n\t\t// this test suite would need to build some kind of map from the blob info saved on disk to the `IFluidHandle`\n\t\t// list returned by uploading these blobs.\n\t\tconst blobsParsed: UploadedEditChunkContents[] = JSON.parse(blobsFile);\n\t\tconst blobs: ArrayBufferLike[] = blobsParsed.map((blob) =>\n\t\t\tIsoBuffer.from(JSON.stringify(blob.chunkContents), 'utf8')\n\t\t);\n\n\t\t// Re-enable this test for an easy way to write the test summary files to disk\n\t\tit.skip('save files to disk', async () => {\n\t\t\tawait makeSummaryTestFiles();\n\t\t});\n\n\t\tdescribe('0.0.2 write format', () => {\n\t\t\tconst setUp002Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_0_2, ...options });\n\n\t\t\tconst setUp002SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_0_2, summarizeHistory);\n\n\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({});\n\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\texpect(getChangeNodeFromView(tree.currentView)).deep.equals(\n\t\t\t\t\tgetChangeNodeFromView(expectedTree.currentView)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files without history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary_0_0_2> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary_0_0_2 = JSON.parse(summaryFileNoHistory_0_0_2);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\tsummary.sequencedEdits[0].id = expectedSummary.sequencedEdits[0].id;\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t});\n\n\t\t\tit('writes 0.0.2 files with history', async () => {\n\t\t\t\tconst tree = await setUp002SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.0.2 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_0_2);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp002SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp002Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.0.2 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tconst expectedTree = await setUp002SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading next version', () => {\n\t\t\t\tit('reads 0.1.1', async () => {\n\t\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\t// TODO: There may need to be a testObjectProvider synchronization here to upload\n\t\t\t\t\t// blobs from this summary.\n\t\t\t\t\t// We should also look at how this test asserts behavior w.r.t blobs.\n\t\t\t\t\tconst newSummary = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\t\tconst expectedSummary = JSON.parse(summaryFileWithHistory_0_1_1);\n\t\t\t\t\texpect(newSummary).to.deep.equal(expectedSummary);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp002Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_0_2, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_0_2,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('0.1.1 write format', () => {\n\t\t\tconst setUp011Tree: typeof setUpLocalServerTestSharedTree = async (options) =>\n\t\t\t\tsetUpLocalServerTestSharedTree({ writeFormat: WriteFormat.v0_1_1, ...options });\n\n\t\t\tconst setUp011SummaryTestTree = async (summarizeHistory: boolean): Promise<SharedTree> =>\n\t\t\t\tcreateSummaryTestTree(WriteFormat.v0_1_1, summarizeHistory);\n\n\t\t\tit('writes 0.1.1 files without history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(false);\n\t\t\t\tconst summary: RecursiveMutable<SharedTreeSummary> = JSON.parse(tree.saveSerializedSummary());\n\t\t\t\tconst expectedSummary: SharedTreeSummary = JSON.parse(summaryFileNoHistory_0_1_1);\n\t\t\t\t// The edit ID of the single \"no history edit\" is generated randomly. Replace it with the baseline edit for the sake of this test.\n\t\t\t\texpectDefined(summary.editHistory).editIds[0] = expectDefined(expectedSummary.editHistory?.editIds[0]);\n\t\t\t\texpect(summary).to.deep.equal(expectedSummary);\n\t\t\t\texpect(await getUploadedEditChunkContents(tree)).to.deep.equal([]);\n\t\t\t});\n\n\t\t\tit('writes 0.1.1 files with history', async () => {\n\t\t\t\tconst tree = await setUp011SummaryTestTree(true);\n\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_1_1)\n\t\t\t\t);\n\t\t\t\texpect(await getUploadedEditChunkContents(tree)).to.deep.equal(blobsParsed);\n\t\t\t});\n\n\t\t\tdescribe('reading the same version', () => {\n\t\t\t\tit('reads 0.1.1 files without history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({ blobs });\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileNoHistory_0_1_1);\n\t\t\t\t\t// Tree should have exactly one edit, as all \"no history\" summaries do.\n\t\t\t\t\texpect(tree.edits.length).to.equal(1);\n\t\t\t\t\t// Load a baseline tree's own summary with no history to compare with\n\t\t\t\t\tconst summaryNoHistory = (await setUp011SummaryTestTree(false)).saveSummary();\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({ summarizeHistory: false });\n\t\t\t\t\texpectedTree.loadSummary(summaryNoHistory);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree, false);\n\t\t\t\t});\n\n\t\t\t\tit('reads 0.1.1 files with history', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({ blobs });\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(false);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('reading previous versions', () => {\n\t\t\t\tit('reads 0.0.2', async () => {\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileWithHistory_0_0_2)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2', async () => {\n\t\t\t\t\tconst { tree, testObjectProvider } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\t// Synchronize to give a chance for the update op to be sequenced.\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tconst expectedTree = await setUp011SummaryTestTree(true);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, expectedTree);\n\t\t\t\t\texpect(JSON.parse(tree.saveSerializedSummary())).to.deep.equal(\n\t\t\t\t\t\tJSON.parse(summaryFileUpgrade_0_1_1)\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('upgrades 0.0.2 that has several stale ops that it resubmits', async () => {\n\t\t\t\t\tconst { tree: resubmitTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_0_2,\n\t\t\t\t\t});\n\t\t\t\t\tapplyTestEdits(resubmitTree);\n\t\t\t\t\tconst { tree: tree } = await setUpLocalServerTestSharedTree({\n\t\t\t\t\t\twriteFormat: WriteFormat.v0_1_1,\n\t\t\t\t\t\ttestObjectProvider,\n\t\t\t\t\t});\n\t\t\t\t\tawait testObjectProvider.ensureSynchronized();\n\t\t\t\t\tawait expectSharedTreesEqual(resubmitTree, tree);\n\t\t\t\t\tawait expectSharedTreesEqual(tree, await createSummaryTestTree(WriteFormat.v0_1_1, true));\n\t\t\t\t});\n\n\t\t\t\tit('Normalizes a denormalized summary containing nodes with empty traits', async () => {\n\t\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\t\ttree.loadSerializedSummary(summaryFileEmptyTraits_0_0_2);\n\n\t\t\t\t\tconst { tree: expectedTree } = await setUp011Tree({});\n\t\t\t\t\texpectedTree.loadSerializedSummary(summaryFileWithHistory_0_0_2);\n\t\t\t\t\texpect(\n\t\t\t\t\t\tareRevisionViewsSemanticallyEqual(\n\t\t\t\t\t\t\ttree.currentView,\n\t\t\t\t\t\t\ttree,\n\t\t\t\t\t\t\texpectedTree.currentView,\n\t\t\t\t\t\t\texpectedTree\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('gives correct SummaryStatistics', async () => {\n\t\t\t\tconst { tree } = await setUp011Tree({});\n\t\t\t\ttree.loadSerializedSummary(summaryFileWithHistory_0_1_1);\n\t\t\t\tconst editCount = tree.edits.length;\n\t\t\t\tconst summary = deserialize(summaryFileWithHistory_0_1_1, testSerializer);\n\t\t\t\tconst telemetryInfo = getSummaryStatistics(summary);\n\t\t\t\tconst totalChunks = Math.ceil(editCount / editsPerChunk);\n\t\t\t\tconst expectedTelemetryInfo: SummaryStatistics = {\n\t\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\t\thistorySize: editCount,\n\t\t\t\t\ttotalNumberOfChunks: totalChunks,\n\t\t\t\t\tuploadedChunks:\n\t\t\t\t\t\t// If the last chunk is bigger than the number of edits per chunk, it has also been uploaded\n\t\t\t\t\t\teditCount - Math.floor(editCount / editsPerChunk) * editsPerChunk < editsPerChunk &&\n\t\t\t\t\t\ttotalChunks !== 0\n\t\t\t\t\t\t\t? totalChunks - 1\n\t\t\t\t\t\t\t: totalChunks,\n\t\t\t\t};\n\t\t\t\texpect(telemetryInfo).to.deep.equals(expectedTelemetryInfo);\n\t\t\t});\n\t\t});\n\t});\n}\n\nexport function expectAssert(condition: unknown, message?: string): asserts condition {\n\texpect(condition, message);\n}\n\nasync function expectSharedTreesEqual(\n\tsharedTreeA: SharedTree,\n\tsharedTreeB: SharedTree,\n\tcompareEditIds = true\n): Promise<void> {\n\tif (\n\t\t!areRevisionViewsSemanticallyEqual(sharedTreeA.currentView, sharedTreeA, sharedTreeB.currentView, sharedTreeB)\n\t) {\n\t\texpect.fail('trees have different current views');\n\t}\n\n\tif (sharedTreeA.edits.length !== sharedTreeB.edits.length) {\n\t\texpect.fail('trees have different amounts of edits');\n\t}\n\n\tfor (let i = 0; i < sharedTreeA.edits.length; i++) {\n\t\tconst roundTrip = <T>(obj: T): T => JSON.parse(JSON.stringify(obj)) as T;\n\n\t\tconst editA = roundTrip(\n\t\t\tconvertEditIds(await sharedTreeA.editsInternal.getEditAtIndex(i), (id) =>\n\t\t\t\tsharedTreeA.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tconst editB = roundTrip(\n\t\t\tconvertEditIds(await sharedTreeB.editsInternal.getEditAtIndex(i), (id) =>\n\t\t\t\tsharedTreeB.convertToStableNodeId(id)\n\t\t\t)\n\t\t);\n\t\tif (compareEditIds) {\n\t\t\texpect(editA).to.deep.equal(editB, `trees have different edits (index ${i})`);\n\t\t} else {\n\t\t\texpect(editA.changes).to.deep.equal(editB.changes, `edits have different changes (index ${i})`);\n\t\t}\n\t}\n}\n\nfunction loadSummaryTestFiles(): {\n\tsummaryFileWithHistory_0_0_2: string;\n\tsummaryFileNoHistory_0_0_2: string;\n\tsummaryFileEmptyTraits_0_0_2: string;\n\tsummaryFileWithHistory_0_1_1: string;\n\tsummaryFileNoHistory_0_1_1: string;\n\tsummaryFileUpgrade_0_1_1: string;\n\tblobsFile: string;\n} {\n\tconst summaryFileWithHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-0-0-2.json'), 'utf8');\n\tconst summaryFileNoHistory_0_0_2 = fs.readFileSync(join(directory, 'summary-no-history-0-0-2.json'), 'utf8');\n\tconst summaryFileEmptyTraits_0_0_2 = fs.readFileSync(join(directory, 'summary-empty-traits-0-0-2.json'), 'utf8');\n\tconst summaryFileWithHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-0-1-1.json'), 'utf8');\n\tconst summaryFileNoHistory_0_1_1 = fs.readFileSync(join(directory, 'summary-no-history-0-1-1.json'), 'utf8');\n\tconst summaryFileUpgrade_0_1_1 = fs.readFileSync(join(directory, 'summary-upgrade-0-1-1.json'), 'utf8');\n\tconst blobsFile = fs.readFileSync(join(directory, 'blobs-0-1-1.json'), 'utf8');\n\n\treturn {\n\t\tsummaryFileWithHistory_0_0_2,\n\t\tsummaryFileNoHistory_0_0_2,\n\t\tsummaryFileEmptyTraits_0_0_2,\n\t\tsummaryFileWithHistory_0_1_1,\n\t\tsummaryFileNoHistory_0_1_1,\n\t\tsummaryFileUpgrade_0_1_1,\n\t\tblobsFile,\n\t};\n}\n\nasync function makeSummaryTestFiles(): Promise<void> {\n\ttry {\n\t\tfs.accessSync(directory);\n\t} catch {\n\t\tfs.mkdirSync(directory);\n\t}\n\n\tconst treeWithHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, true);\n\tconst treeNoHistory_0_0_2 = await createSummaryTestTree(WriteFormat.v0_0_2, false);\n\tconst treeWithHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, true);\n\tconst treeNoHistory_0_1_1 = await createSummaryTestTree(WriteFormat.v0_1_1, false);\n\n\tfs.writeFileSync(join(directory, `summary-0-0-2.json`), treeWithHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-0-2.json`), treeNoHistory_0_0_2.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-0-1-1.json`), treeWithHistory_0_1_1.saveSerializedSummary());\n\tfs.writeFileSync(join(directory, `summary-no-history-0-1-1.json`), treeNoHistory_0_1_1.saveSerializedSummary());\n\n\tconst blobs = await getUploadedEditChunkContents(treeWithHistory_0_1_1);\n\tassert(blobs.length > 0);\n\tfs.writeFileSync(join(directory, `blobs-0-1-1.json`), JSON.stringify(blobs));\n\n\tconst { tree: upgradedTree, testObjectProvider } = await setUpLocalServerTestSharedTree({\n\t\twriteFormat: WriteFormat.v0_1_1,\n\t\tsummarizeHistory: true,\n\t});\n\tupgradedTree.loadSummary(treeWithHistory_0_0_2.saveSummary());\n\tawait testObjectProvider.ensureSynchronized();\n\tfs.writeFileSync(join(directory, `summary-upgrade-0-1-1.json`), upgradedTree.saveSerializedSummary());\n}\n\n/** Every instance of this class generates the same sequence of v5 UUIDs */\nclass DeterministicIdGenerator {\n\tpublic static readonly sessionId = '968bee41-bcf7-46d2-8035-6eb163b76c4c' as SessionId;\n\tprivate static readonly uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tprivate editIdCount = 0;\n\tprivate readonly constantIdCompressor?: IdCompressor;\n\n\tpublic constructor(public readonly writeFormat: WriteFormat, private readonly sharedTree: SharedTree) {\n\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId === DeterministicIdGenerator.sessionId);\n\t\t} else {\n\t\t\tassert(getIdNormalizerFromSharedTree(sharedTree).localSessionId !== DeterministicIdGenerator.sessionId);\n\t\t\tthis.constantIdCompressor = new IdCompressor(DeterministicIdGenerator.sessionId, reservedIdCount);\n\t\t}\n\t}\n\n\tpublic getNextEditId(): EditId {\n\t\treturn v5((this.editIdCount++).toString(), DeterministicIdGenerator.uuidNamespace) as EditId;\n\t}\n\n\tpublic getNextNodeId(): NodeId {\n\t\tif (this.writeFormat === WriteFormat.v0_0_2) {\n\t\t\treturn this.sharedTree.generateNodeId(this.getNextStableId());\n\t\t} else {\n\t\t\treturn this.sharedTree.generateNodeId();\n\t\t}\n\t}\n\n\tprivate getNextStableId(): StableId {\n\t\tassert(this.constantIdCompressor !== undefined);\n\t\treturn this.constantIdCompressor.decompress(this.constantIdCompressor.generateCompressedId()) as StableId;\n\t}\n}\n"]}
@@ -3,342 +3,88 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { expect } from 'chai';
6
- import { v4 as uuidv4 } from 'uuid';
7
- import { EditStatus } from '../generic';
8
- import { Transaction, Change, ChangeType, ConstraintEffect, Insert, StableRange, StablePlace } from '../default-edits';
9
- import { Side } from '../Snapshot';
10
- import { makeEmptyNode, testTrait, left, leftTraitLocation, right, rightTraitLocation, leftTraitLabel, rightTraitLabel, simpleTreeSnapshotWithValidation, initialSnapshotWithValidation, initialSnapshot, } from './utilities/TestUtilities';
6
+ import { EditStatus, WriteFormat } from '../persisted-types';
7
+ import { Change, StablePlace, StableRange } from '../ChangeTypes';
8
+ import { Transaction } from '../Transaction';
9
+ import { setUpTestSharedTree, setUpTestTree } from './utilities/TestUtilities';
11
10
  describe('Transaction', () => {
12
- describe('Constraints', () => {
13
- it('can be met', () => {
14
- const transaction = new Transaction(initialSnapshotWithValidation);
15
- transaction.applyChange({
16
- toConstrain: StableRange.all(testTrait),
17
- effect: ConstraintEffect.InvalidAndDiscard,
18
- type: ChangeType.Constraint,
19
- });
20
- expect(transaction.status).equals(EditStatus.Applied);
21
- });
22
- const nonExistentNode = '57dd2fc4-72fa-471c-9f37-70010d31b59c';
23
- const invalidStableRange = {
24
- start: { side: Side.After, referenceSibling: nonExistentNode },
25
- end: { side: Side.Before },
26
- };
27
- it('can be unmet', () => {
28
- const transaction = new Transaction(initialSnapshotWithValidation);
29
- transaction.applyChange({
30
- toConstrain: invalidStableRange,
31
- effect: ConstraintEffect.InvalidAndDiscard,
32
- type: ChangeType.Constraint,
33
- });
34
- expect(transaction.status).equals(EditStatus.Invalid);
35
- });
36
- it('effect can apply anyway', () => {
37
- const transaction = new Transaction(initialSnapshotWithValidation);
38
- transaction.applyChange({
39
- toConstrain: invalidStableRange,
40
- effect: ConstraintEffect.ValidRetry,
41
- type: ChangeType.Constraint,
42
- });
43
- expect(transaction.status).equals(EditStatus.Applied);
44
- });
45
- it('length can be met', () => {
46
- const transaction = new Transaction(initialSnapshotWithValidation);
47
- transaction.applyChange({
48
- toConstrain: StableRange.all(testTrait),
49
- effect: ConstraintEffect.InvalidAndDiscard,
50
- type: ChangeType.Constraint,
51
- length: 0,
52
- });
53
- expect(transaction.status).equals(EditStatus.Applied);
54
- });
55
- it('length can be unmet', () => {
56
- const transaction = new Transaction(initialSnapshotWithValidation);
57
- transaction.applyChange({
58
- toConstrain: StableRange.all(testTrait),
59
- effect: ConstraintEffect.InvalidAndDiscard,
60
- type: ChangeType.Constraint,
61
- length: 1,
62
- });
63
- expect(transaction.status).equals(EditStatus.Invalid);
64
- });
65
- it('parent can be met', () => {
66
- const transaction = new Transaction(initialSnapshotWithValidation);
67
- transaction.applyChange({
68
- toConstrain: StableRange.all(testTrait),
69
- effect: ConstraintEffect.InvalidAndDiscard,
70
- type: ChangeType.Constraint,
71
- parentNode: initialSnapshot.root,
72
- });
73
- expect(transaction.status).equals(EditStatus.Applied);
74
- });
75
- it('parent can be unmet', () => {
76
- const transaction = new Transaction(initialSnapshotWithValidation);
77
- transaction.applyChange({
78
- toConstrain: StableRange.all(testTrait),
79
- effect: ConstraintEffect.InvalidAndDiscard,
80
- type: ChangeType.Constraint,
81
- parentNode: nonExistentNode,
82
- });
83
- expect(transaction.status).equals(EditStatus.Invalid);
84
- });
85
- it('label can be met', () => {
86
- const transaction = new Transaction(initialSnapshotWithValidation);
87
- transaction.applyChange({
88
- toConstrain: StableRange.all(testTrait),
89
- effect: ConstraintEffect.InvalidAndDiscard,
90
- type: ChangeType.Constraint,
91
- label: testTrait.label,
92
- });
93
- expect(transaction.status).equals(EditStatus.Applied);
94
- });
95
- it('label can be unmet', () => {
96
- const transaction = new Transaction(initialSnapshotWithValidation);
97
- transaction.applyChange({
98
- toConstrain: StableRange.all(testTrait),
99
- effect: ConstraintEffect.InvalidAndDiscard,
100
- type: ChangeType.Constraint,
101
- label: '7969ee2e-5418-43db-929a-4e9a23c5499d',
102
- });
103
- expect(transaction.status).equals(EditStatus.Invalid);
104
- });
11
+ function createTestTransaction() {
12
+ const { tree } = setUpTestSharedTree({ writeFormat: WriteFormat.v0_1_1 });
13
+ const testTree = setUpTestTree(tree);
14
+ return { tree, testTree, transaction: new Transaction(tree) };
15
+ }
16
+ function createValidChange(testTree) {
17
+ return Change.delete(StableRange.only(testTree.left));
18
+ }
19
+ function createInvalidChange(testTree) {
20
+ return Change.delete(StableRange.only(testTree.generateNodeId()));
21
+ }
22
+ function createMalformedChange(testTree) {
23
+ return Change.insert(Number.NaN, StablePlace.after(testTree.left));
24
+ }
25
+ it('can apply an edit to the tree', () => {
26
+ const { tree, testTree, transaction } = createTestTransaction();
27
+ const editCountBefore = tree.edits.length;
28
+ transaction.apply(createValidChange(testTree));
29
+ transaction.closeAndCommit();
30
+ expect(tree.edits.length).to.equal(editCountBefore + 1);
31
+ expect(tree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(0);
105
32
  });
106
- describe('SetValue', () => {
107
- it('can be invalid', () => {
108
- const transaction = new Transaction(initialSnapshotWithValidation);
109
- transaction.applyChange({
110
- nodeToModify: '7969ee2e-5418-43db-929a-4e9a23c5499d',
111
- payload: {},
112
- type: ChangeType.SetValue,
113
- });
114
- expect(transaction.status).equals(EditStatus.Invalid);
115
- });
116
- it('can change payload', () => {
117
- const transaction = new Transaction(initialSnapshotWithValidation);
118
- const payload = { foo: {} };
119
- transaction.applyChange({
120
- nodeToModify: initialSnapshot.root,
121
- payload,
122
- type: ChangeType.SetValue,
123
- });
124
- expect(transaction.status).equals(EditStatus.Applied);
125
- expect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).deep.equals(payload);
126
- });
127
- // 'null' is not included here since it means clear the payload in setValue.
128
- for (const payload of [0, '', [], {}]) {
129
- it(`can set payload to ${JSON.stringify(payload)}`, () => {
130
- const transaction = new Transaction(initialSnapshotWithValidation);
131
- transaction.applyChange({
132
- nodeToModify: initialSnapshot.root,
133
- payload,
134
- type: ChangeType.SetValue,
135
- });
136
- expect(transaction.status).equals(EditStatus.Applied);
137
- expect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).equals(payload);
138
- });
139
- }
140
- it('can clear an unset payload', () => {
141
- const transaction = new Transaction(initialSnapshotWithValidation);
142
- transaction.applyChange(Change.clearPayload(initialSnapshot.root));
143
- expect(transaction.status).equals(EditStatus.Applied);
144
- expect({}.hasOwnProperty.call(transaction.view.getSnapshotNode(initialSnapshot.root), 'payload')).false;
145
- expect({}.hasOwnProperty.call(transaction.view.getChangeNode(initialSnapshot.root), 'payload')).false;
146
- });
147
- it('can clear a set payload', () => {
148
- const transaction = new Transaction(initialSnapshotWithValidation);
149
- transaction.applyChange({
150
- nodeToModify: initialSnapshot.root,
151
- payload: {},
152
- type: ChangeType.SetValue,
153
- });
154
- expect(transaction.status).equals(EditStatus.Applied);
155
- expect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).not.undefined;
156
- transaction.applyChange(Change.clearPayload(initialSnapshot.root));
157
- expect(transaction.status).equals(EditStatus.Applied);
158
- expect({}.hasOwnProperty.call(transaction.view.getSnapshotNode(initialSnapshot.root), 'payload')).false;
159
- expect({}.hasOwnProperty.call(transaction.view.getChangeNode(initialSnapshot.root), 'payload')).false;
160
- });
33
+ it('has correct edit status when applied', () => {
34
+ const { testTree, transaction } = createTestTransaction();
35
+ expect(transaction.apply(createValidChange(testTree))).to.equal(EditStatus.Applied);
36
+ expect(transaction.status).to.equal(EditStatus.Applied);
37
+ transaction.closeAndCommit();
161
38
  });
162
- describe('Insert', () => {
163
- const buildId = 0;
164
- const builtNodeId = uuidv4();
165
- const newNode = makeEmptyNode(builtNodeId);
166
- it('can be malformed', () => {
167
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
168
- transaction.applyChange(Change.build([newNode], buildId));
169
- transaction.applyChange(Change.insert(
170
- // Non-existent detached id
171
- 1, { referenceSibling: initialSnapshot.root, side: Side.After }));
172
- expect(transaction.status).equals(EditStatus.Malformed);
173
- });
174
- it('can be invalid', () => {
175
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
176
- transaction.applyChange(Change.build([newNode], buildId));
177
- transaction.applyChange(Change.insert(buildId,
178
- // Arbitrary id not present in the tree
179
- { referenceSibling: '7969ee2e-5418-43db-929a-4e9a23c5499d', side: Side.After }));
180
- expect(transaction.status).equals(EditStatus.Invalid);
181
- });
182
- [Side.Before, Side.After].forEach((side) => {
183
- it(`can insert a node at the ${side === Side.After ? 'beginning' : 'end'} of a trait`, () => {
184
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
185
- transaction.applyChanges(Insert.create([newNode], side === Side.After
186
- ? StablePlace.atStartOf(leftTraitLocation)
187
- : StablePlace.atEndOf(leftTraitLocation)));
188
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals(side === Side.After ? [builtNodeId, left.identifier] : [left.identifier, builtNodeId]);
189
- });
190
- it(`can insert a node ${side === Side.Before ? 'before' : 'after'} another node`, () => {
191
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
192
- transaction.applyChanges(Insert.create([newNode], { referenceSibling: left.identifier, side }));
193
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals(side === Side.Before ? [builtNodeId, left.identifier] : [left.identifier, builtNodeId]);
194
- });
195
- });
39
+ it('has correct edit status when invalid', () => {
40
+ const { testTree, transaction } = createTestTransaction();
41
+ expect(transaction.apply(createInvalidChange(testTree))).to.equal(EditStatus.Invalid);
42
+ expect(transaction.status).to.equal(EditStatus.Invalid);
43
+ transaction.closeAndCommit();
196
44
  });
197
- describe('Build', () => {
198
- it('can be malformed due to detached ID collision', () => {
199
- const transaction = new Transaction(initialSnapshotWithValidation);
200
- // Apply two Build_s with the same detached id
201
- transaction.applyChange(Change.build([makeEmptyNode()], 0));
202
- expect(transaction.status).equals(EditStatus.Applied);
203
- transaction.applyChange(Change.build([makeEmptyNode()], 0));
204
- expect(transaction.status).equals(EditStatus.Malformed);
205
- });
206
- it('can be malformed due to duplicate node identifiers', () => {
207
- const transaction = new Transaction(initialSnapshotWithValidation);
208
- // Build two nodes with the same identifier, one of them nested
209
- const newNode = makeEmptyNode();
210
- transaction.applyChange(Change.build([
211
- newNode,
212
- Object.assign(Object.assign({}, makeEmptyNode()), { traits: { [leftTraitLabel]: [Object.assign(Object.assign({}, makeEmptyNode()), { identifier: newNode.identifier })] } }),
213
- ], 0));
214
- expect(transaction.status).equals(EditStatus.Malformed);
215
- });
216
- it('can be invalid', () => {
217
- const transaction = new Transaction(initialSnapshotWithValidation);
218
- // Build two nodes with the same identifier
219
- const identifier = uuidv4();
220
- transaction.applyChange(Change.build([makeEmptyNode(identifier)], 0));
221
- expect(transaction.status).equals(EditStatus.Applied);
222
- transaction.applyChange(Change.build([makeEmptyNode(identifier)], 1));
223
- expect(transaction.status).equals(EditStatus.Invalid);
224
- });
225
- it('can build a detached node', () => {
226
- const transaction = new Transaction(initialSnapshotWithValidation);
227
- const identifier = uuidv4();
228
- const newNode = makeEmptyNode(identifier);
229
- transaction.applyChange(Change.build([newNode], 0));
230
- expect(transaction.status).equals(EditStatus.Applied);
231
- expect(transaction.view.hasNode(identifier)).is.true;
232
- expect(transaction.view.getParentSnapshotNode(identifier)).is.undefined;
233
- expect(transaction.view.getChangeNode(identifier)).deep.equals(newNode);
234
- });
235
- it("is malformed if detached node id doesn't exist", () => {
236
- const transaction = new Transaction(initialSnapshotWithValidation);
237
- const detachedSequenceId = 0;
238
- transaction.applyChange({
239
- destination: 1,
240
- source: [detachedSequenceId],
241
- type: ChangeType.Build,
242
- });
243
- expect(transaction.status).equals(EditStatus.Malformed);
244
- });
245
- it('can build a node with an explicit empty trait', () => {
246
- // Forest should strip off the empty trait
247
- const nodeWithEmpty = makeEmptyNode();
248
- const traits = new Map();
249
- const emptyTrait = [];
250
- traits.set(leftTraitLabel, emptyTrait);
251
- const transaction = new Transaction(initialSnapshotWithValidation);
252
- const detachedSequenceId = 0;
253
- transaction.applyChange(Change.build([nodeWithEmpty], detachedSequenceId));
254
- expect(transaction.status).equals(EditStatus.Applied);
255
- const snapshotNodeWithEmpty = transaction.view.getSnapshotNode(nodeWithEmpty.identifier);
256
- expect(snapshotNodeWithEmpty.traits.size).to.equal(0);
257
- });
45
+ it('has correct edit status when malformed', () => {
46
+ const { testTree, transaction } = createTestTransaction();
47
+ expect(transaction.apply(createMalformedChange(testTree))).to.equal(EditStatus.Malformed);
48
+ expect(transaction.status).to.equal(EditStatus.Malformed);
49
+ transaction.closeAndCommit();
258
50
  });
259
- describe('Detach', () => {
260
- it('can be malformed', () => {
261
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
262
- // Supplied StableRange is malformed
263
- transaction.applyChange(Change.detach({
264
- start: { referenceTrait: leftTraitLocation, referenceSibling: left.identifier, side: Side.Before },
265
- end: StablePlace.after(right),
266
- }));
267
- expect(transaction.status).equals(EditStatus.Malformed);
268
- });
269
- it('can be invalid', () => {
270
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
271
- // Start place is before end place
272
- transaction.applyChange(Change.detach({
273
- start: StablePlace.atEndOf(leftTraitLocation),
274
- end: StablePlace.atStartOf(leftTraitLocation),
275
- }));
276
- expect(transaction.status).equals(EditStatus.Invalid);
277
- });
278
- it('can delete a node', () => {
279
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
280
- transaction.applyChange(Change.detach(StableRange.only(left)));
281
- expect(transaction.view.hasNode(left.identifier)).is.false;
282
- });
51
+ it('can apply multiple changes at once', () => {
52
+ const { tree, testTree, transaction } = createTestTransaction();
53
+ transaction.apply(Change.move(StableRange.only(testTree.left), StablePlace.after(testTree.right)));
54
+ transaction.closeAndCommit();
55
+ expect(tree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(0);
56
+ expect(tree.currentView.getTrait(testTree.right.traitLocation).length).to.equal(2);
283
57
  });
284
- describe('Composite changes', () => {
285
- it('can form a node move', () => {
286
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
287
- const detachedId = 0;
288
- transaction.applyChange(Change.detach(StableRange.only(left), detachedId));
289
- transaction.applyChange(Change.insert(detachedId, StablePlace.after(right)));
290
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals([]);
291
- expect(transaction.view.getTrait(rightTraitLocation)).deep.equals([right.identifier, left.identifier]);
292
- });
293
- it('can form a wrap insert', () => {
294
- // A wrap insert is an edit that inserts a new node between a subtree and its parent atomically.
295
- // Ex: given A -> B -> C, a wrap insert of D around B would produce A -> D -> B -> C
296
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
297
- const leftNodeDetachedId = 0;
298
- const parentDetachedId = 1;
299
- transaction.applyChange(Change.detach(StableRange.only(left), leftNodeDetachedId));
300
- // This is node D, from the example
301
- const wrappingParentId = uuidv4();
302
- const wrappingTraitLabel = 'wrapTrait';
303
- transaction.applyChange(Change.build([
304
- Object.assign(Object.assign({}, makeEmptyNode(wrappingParentId)), { traits: { [wrappingTraitLabel]: [leftNodeDetachedId] } }),
305
- ], parentDetachedId));
306
- transaction.applyChange(Change.insert(parentDetachedId, StablePlace.atStartOf(leftTraitLocation)));
307
- const leftTrait = transaction.view.getTrait(leftTraitLocation);
308
- expect(leftTrait).deep.equals([wrappingParentId]);
309
- const wrappingTrait = transaction.view.getTrait({ parent: wrappingParentId, label: wrappingTraitLabel });
310
- expect(wrappingTrait).deep.equals([left.identifier]);
311
- });
312
- it('can build and insert a tree that contains detached subtrees', () => {
313
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
314
- const leftNodeDetachedId = 0;
315
- const rightNodeDetachedId = 1;
316
- const detachedIdSubtree = 2;
317
- transaction.applyChange(Change.detach(StableRange.only(left), leftNodeDetachedId));
318
- transaction.applyChange(Change.detach(StableRange.only(right), rightNodeDetachedId));
319
- const detachedSubtree = Object.assign(Object.assign({}, makeEmptyNode()), { traits: {
320
- [leftTraitLabel]: [leftNodeDetachedId],
321
- [rightTraitLabel]: [rightNodeDetachedId],
322
- } });
323
- transaction.applyChange(Change.build([detachedSubtree], detachedIdSubtree));
324
- transaction.applyChange(Change.insert(detachedIdSubtree, StablePlace.atStartOf(leftTraitLocation)));
325
- expect(transaction.view.getTrait(rightTraitLocation)).deep.equals([]);
326
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals([detachedSubtree.identifier]);
327
- const insertedSubtree = transaction.view.getChangeNode(detachedSubtree.identifier);
328
- expect(insertedSubtree.traits).deep.equals({
329
- [leftTraitLabel]: [left],
330
- [rightTraitLabel]: [right],
331
- });
332
- });
333
- it('can build and insert a tree with the same identity as that of a detached subtree', () => {
334
- const transaction = new Transaction(simpleTreeSnapshotWithValidation);
335
- transaction.applyChange(Change.detach(StableRange.only(left)));
336
- const idOfDetachedNodeToInsert = 1;
337
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals([]);
338
- transaction.applyChange(Change.build([makeEmptyNode(left.identifier)], idOfDetachedNodeToInsert));
339
- transaction.applyChange(Change.insert(idOfDetachedNodeToInsert, StablePlace.atStartOf(leftTraitLocation)));
340
- expect(transaction.view.getTrait(leftTraitLocation)).deep.equals([left.identifier]);
341
- });
58
+ it('does not apply empty edits', () => {
59
+ const { tree, transaction } = createTestTransaction();
60
+ const editCountBefore = tree.edits.length;
61
+ transaction.apply([]);
62
+ transaction.closeAndCommit();
63
+ expect(tree.edits.length).to.equal(editCountBefore);
64
+ });
65
+ it('does not apply a batch of changes if any of them fail', () => {
66
+ const { testTree, transaction } = createTestTransaction();
67
+ const change = createValidChange(testTree);
68
+ expect(transaction.apply(change, change)).to.equal(EditStatus.Invalid); // Second change is invalid
69
+ expect(transaction.status).to.equal(EditStatus.Invalid);
70
+ transaction.closeAndCommit();
71
+ });
72
+ it('is open when created', () => {
73
+ const { transaction } = createTestTransaction();
74
+ expect(transaction.isOpen).to.be.true;
75
+ });
76
+ it('closes when a change fails to apply', () => {
77
+ const { testTree, transaction } = createTestTransaction();
78
+ transaction.apply(createInvalidChange(testTree));
79
+ expect(transaction.isOpen).to.be.false;
80
+ });
81
+ it('closes when an edit is applied', () => {
82
+ const { testTree, transaction } = createTestTransaction();
83
+ expect(transaction.isOpen).to.be.true;
84
+ transaction.apply(createValidChange(testTree));
85
+ expect(transaction.isOpen).to.be.true;
86
+ transaction.closeAndCommit();
87
+ expect(transaction.isOpen).to.be.false;
342
88
  });
343
89
  });
344
90
  //# sourceMappingURL=Transaction.tests.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.tests.js","sourceRoot":"","sources":["../../src/test/Transaction.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACrF,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 { v4 as uuidv4 } from 'uuid';\nimport { DetachedSequenceId, NodeId, TraitLabel } from '../Identifiers';\nimport { EditStatus } from '../generic';\nimport { Transaction, Change, ChangeType, ConstraintEffect, Insert, StableRange, StablePlace } from '../default-edits';\nimport { Side } from '../Snapshot';\nimport {\n\tmakeEmptyNode,\n\ttestTrait,\n\tleft,\n\tleftTraitLocation,\n\tright,\n\trightTraitLocation,\n\tleftTraitLabel,\n\trightTraitLabel,\n\tsimpleTreeSnapshotWithValidation,\n\tinitialSnapshotWithValidation,\n\tinitialSnapshot,\n} from './utilities/TestUtilities';\n\ndescribe('Transaction', () => {\n\tdescribe('Constraints', () => {\n\t\tit('can be met', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tconst nonExistentNode = '57dd2fc4-72fa-471c-9f37-70010d31b59c' as NodeId;\n\t\tconst invalidStableRange: StableRange = {\n\t\t\tstart: { side: Side.After, referenceSibling: nonExistentNode },\n\t\t\tend: { side: Side.Before },\n\t\t};\n\t\tit('can be unmet', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: invalidStableRange,\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\tit('effect can apply anyway', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: invalidStableRange,\n\t\t\t\teffect: ConstraintEffect.ValidRetry,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('length can be met', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tlength: 0,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('length can be unmet', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tlength: 1,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\tit('parent can be met', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tparentNode: initialSnapshot.root,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('parent can be unmet', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tparentNode: nonExistentNode,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\tit('label can be met', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tlabel: testTrait.label,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t});\n\t\tit('label can be unmet', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\ttoConstrain: StableRange.all(testTrait),\n\t\t\t\teffect: ConstraintEffect.InvalidAndDiscard,\n\t\t\t\ttype: ChangeType.Constraint,\n\t\t\t\tlabel: '7969ee2e-5418-43db-929a-4e9a23c5499d' as TraitLabel, // Arbitrary label not equal to testTrait.label\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t});\n\n\tdescribe('SetValue', () => {\n\t\tit('can be invalid', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\tnodeToModify: '7969ee2e-5418-43db-929a-4e9a23c5499d' as NodeId, // Arbitrary id not equal to initialSnapshot.root\n\t\t\t\tpayload: {}, // Arbitrary payload.\n\t\t\t\ttype: ChangeType.SetValue,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\n\t\tit('can change payload', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\tconst payload = { foo: {} };\n\t\t\ttransaction.applyChange({\n\t\t\t\tnodeToModify: initialSnapshot.root,\n\t\t\t\tpayload, // Arbitrary payload.\n\t\t\t\ttype: ChangeType.SetValue,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).deep.equals(payload);\n\t\t});\n\n\t\t// 'null' is not included here since it means clear the payload in setValue.\n\t\tfor (const payload of [0, '', [], {}]) {\n\t\t\tit(`can set payload to ${JSON.stringify(payload)}`, () => {\n\t\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\t\ttransaction.applyChange({\n\t\t\t\t\tnodeToModify: initialSnapshot.root,\n\t\t\t\t\tpayload,\n\t\t\t\t\ttype: ChangeType.SetValue,\n\t\t\t\t});\n\t\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\t\texpect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).equals(payload);\n\t\t\t});\n\t\t}\n\n\t\tit('can clear an unset payload', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange(Change.clearPayload(initialSnapshot.root));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getSnapshotNode(initialSnapshot.root), 'payload')).false;\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getChangeNode(initialSnapshot.root), 'payload')).false;\n\t\t});\n\n\t\tit('can clear a set payload', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\ttransaction.applyChange({\n\t\t\t\tnodeToModify: initialSnapshot.root,\n\t\t\t\tpayload: {},\n\t\t\t\ttype: ChangeType.SetValue,\n\t\t\t});\n\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.getSnapshotNode(initialSnapshot.root).payload).not.undefined;\n\t\t\ttransaction.applyChange(Change.clearPayload(initialSnapshot.root));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getSnapshotNode(initialSnapshot.root), 'payload')).false;\n\t\t\texpect({}.hasOwnProperty.call(transaction.view.getChangeNode(initialSnapshot.root), 'payload')).false;\n\t\t});\n\t});\n\n\tdescribe('Insert', () => {\n\t\tconst buildId = 0 as DetachedSequenceId;\n\t\tconst builtNodeId = uuidv4() as NodeId;\n\t\tconst newNode = makeEmptyNode(builtNodeId);\n\t\tit('can be malformed', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\ttransaction.applyChange(Change.build([newNode], buildId));\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.insert(\n\t\t\t\t\t// Non-existent detached id\n\t\t\t\t\t1 as DetachedSequenceId,\n\t\t\t\t\t{ referenceSibling: initialSnapshot.root, side: Side.After }\n\t\t\t\t)\n\t\t\t);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t});\n\t\tit('can be invalid', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\ttransaction.applyChange(Change.build([newNode], buildId));\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.insert(\n\t\t\t\t\tbuildId,\n\t\t\t\t\t// Arbitrary id not present in the tree\n\t\t\t\t\t{ referenceSibling: '7969ee2e-5418-43db-929a-4e9a23c5499d' as NodeId, side: Side.After }\n\t\t\t\t)\n\t\t\t);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\t[Side.Before, Side.After].forEach((side) => {\n\t\t\tit(`can insert a node at the ${side === Side.After ? 'beginning' : 'end'} of a trait`, () => {\n\t\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\t\ttransaction.applyChanges(\n\t\t\t\t\tInsert.create(\n\t\t\t\t\t\t[newNode],\n\t\t\t\t\t\tside === Side.After\n\t\t\t\t\t\t\t? StablePlace.atStartOf(leftTraitLocation)\n\t\t\t\t\t\t\t: StablePlace.atEndOf(leftTraitLocation)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals(\n\t\t\t\t\tside === Side.After ? [builtNodeId, left.identifier] : [left.identifier, builtNodeId]\n\t\t\t\t);\n\t\t\t});\n\t\t\tit(`can insert a node ${side === Side.Before ? 'before' : 'after'} another node`, () => {\n\t\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\t\ttransaction.applyChanges(Insert.create([newNode], { referenceSibling: left.identifier, side }));\n\t\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals(\n\t\t\t\t\tside === Side.Before ? [builtNodeId, left.identifier] : [left.identifier, builtNodeId]\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('Build', () => {\n\t\tit('can be malformed due to detached ID collision', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\t// Apply two Build_s with the same detached id\n\t\t\ttransaction.applyChange(Change.build([makeEmptyNode()], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\ttransaction.applyChange(Change.build([makeEmptyNode()], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t});\n\t\tit('can be malformed due to duplicate node identifiers', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\t// Build two nodes with the same identifier, one of them nested\n\t\t\tconst newNode = makeEmptyNode();\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.build(\n\t\t\t\t\t[\n\t\t\t\t\t\tnewNode,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...makeEmptyNode(),\n\t\t\t\t\t\t\ttraits: { [leftTraitLabel]: [{ ...makeEmptyNode(), identifier: newNode.identifier }] },\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t0 as DetachedSequenceId\n\t\t\t\t)\n\t\t\t);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t});\n\t\tit('can be invalid', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\t// Build two nodes with the same identifier\n\t\t\tconst identifier = uuidv4() as NodeId;\n\t\t\ttransaction.applyChange(Change.build([makeEmptyNode(identifier)], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\ttransaction.applyChange(Change.build([makeEmptyNode(identifier)], 1 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\tit('can build a detached node', () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\tconst identifier = uuidv4() as NodeId;\n\t\t\tconst newNode = makeEmptyNode(identifier);\n\t\t\ttransaction.applyChange(Change.build([newNode], 0 as DetachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\texpect(transaction.view.hasNode(identifier)).is.true;\n\t\t\texpect(transaction.view.getParentSnapshotNode(identifier)).is.undefined;\n\t\t\texpect(transaction.view.getChangeNode(identifier)).deep.equals(newNode);\n\t\t});\n\t\tit(\"is malformed if detached node id doesn't exist\", () => {\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChange({\n\t\t\t\tdestination: 1 as DetachedSequenceId,\n\t\t\t\tsource: [detachedSequenceId],\n\t\t\t\ttype: ChangeType.Build,\n\t\t\t});\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t});\n\t\tit('can build a node with an explicit empty trait', () => {\n\t\t\t// Forest should strip off the empty trait\n\t\t\tconst nodeWithEmpty = makeEmptyNode();\n\t\t\tconst traits = new Map<TraitLabel, NodeId[]>();\n\t\t\tconst emptyTrait: NodeId[] = [];\n\t\t\ttraits.set(leftTraitLabel, emptyTrait);\n\n\t\t\tconst transaction = new Transaction(initialSnapshotWithValidation);\n\t\t\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(Change.build([nodeWithEmpty], detachedSequenceId));\n\t\t\texpect(transaction.status).equals(EditStatus.Applied);\n\t\t\tconst snapshotNodeWithEmpty = transaction.view.getSnapshotNode(nodeWithEmpty.identifier);\n\t\t\texpect(snapshotNodeWithEmpty.traits.size).to.equal(0);\n\t\t});\n\t});\n\n\tdescribe('Detach', () => {\n\t\tit('can be malformed', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\t// Supplied StableRange is malformed\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.detach({\n\t\t\t\t\tstart: { referenceTrait: leftTraitLocation, referenceSibling: left.identifier, side: Side.Before },\n\t\t\t\t\tend: StablePlace.after(right),\n\t\t\t\t})\n\t\t\t);\n\t\t\texpect(transaction.status).equals(EditStatus.Malformed);\n\t\t});\n\t\tit('can be invalid', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\t// Start place is before end place\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.detach({\n\t\t\t\t\tstart: StablePlace.atEndOf(leftTraitLocation),\n\t\t\t\t\tend: StablePlace.atStartOf(leftTraitLocation),\n\t\t\t\t})\n\t\t\t);\n\t\t\texpect(transaction.status).equals(EditStatus.Invalid);\n\t\t});\n\t\tit('can delete a node', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(left)));\n\t\t\texpect(transaction.view.hasNode(left.identifier)).is.false;\n\t\t});\n\t});\n\n\tdescribe('Composite changes', () => {\n\t\tit('can form a node move', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\tconst detachedId = 0 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(left), detachedId));\n\t\t\ttransaction.applyChange(Change.insert(detachedId, StablePlace.after(right)));\n\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals([]);\n\t\t\texpect(transaction.view.getTrait(rightTraitLocation)).deep.equals([right.identifier, left.identifier]);\n\t\t});\n\t\tit('can form a wrap insert', () => {\n\t\t\t// A wrap insert is an edit that inserts a new node between a subtree and its parent atomically.\n\t\t\t// Ex: given A -> B -> C, a wrap insert of D around B would produce A -> D -> B -> C\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\tconst leftNodeDetachedId = 0 as DetachedSequenceId;\n\t\t\tconst parentDetachedId = 1 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(left), leftNodeDetachedId));\n\t\t\t// This is node D, from the example\n\t\t\tconst wrappingParentId = uuidv4() as NodeId;\n\t\t\tconst wrappingTraitLabel = 'wrapTrait' as TraitLabel;\n\t\t\ttransaction.applyChange(\n\t\t\t\tChange.build(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...makeEmptyNode(wrappingParentId),\n\t\t\t\t\t\t\ttraits: { [wrappingTraitLabel]: [leftNodeDetachedId] }, // Re-parent left under new node\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tparentDetachedId\n\t\t\t\t)\n\t\t\t);\n\t\t\ttransaction.applyChange(Change.insert(parentDetachedId, StablePlace.atStartOf(leftTraitLocation)));\n\t\t\tconst leftTrait = transaction.view.getTrait(leftTraitLocation);\n\t\t\texpect(leftTrait).deep.equals([wrappingParentId]);\n\t\t\tconst wrappingTrait = transaction.view.getTrait({ parent: wrappingParentId, label: wrappingTraitLabel });\n\t\t\texpect(wrappingTrait).deep.equals([left.identifier]);\n\t\t});\n\t\tit('can build and insert a tree that contains detached subtrees', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\tconst leftNodeDetachedId = 0 as DetachedSequenceId;\n\t\t\tconst rightNodeDetachedId = 1 as DetachedSequenceId;\n\t\t\tconst detachedIdSubtree = 2 as DetachedSequenceId;\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(left), leftNodeDetachedId));\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(right), rightNodeDetachedId));\n\n\t\t\tconst detachedSubtree = {\n\t\t\t\t...makeEmptyNode(),\n\t\t\t\ttraits: {\n\t\t\t\t\t[leftTraitLabel]: [leftNodeDetachedId],\n\t\t\t\t\t[rightTraitLabel]: [rightNodeDetachedId],\n\t\t\t\t},\n\t\t\t};\n\t\t\ttransaction.applyChange(Change.build([detachedSubtree], detachedIdSubtree));\n\t\t\ttransaction.applyChange(Change.insert(detachedIdSubtree, StablePlace.atStartOf(leftTraitLocation)));\n\t\t\texpect(transaction.view.getTrait(rightTraitLocation)).deep.equals([]);\n\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals([detachedSubtree.identifier]);\n\t\t\tconst insertedSubtree = transaction.view.getChangeNode(detachedSubtree.identifier);\n\t\t\texpect(insertedSubtree.traits).deep.equals({\n\t\t\t\t[leftTraitLabel]: [left],\n\t\t\t\t[rightTraitLabel]: [right],\n\t\t\t});\n\t\t});\n\t\tit('can build and insert a tree with the same identity as that of a detached subtree', () => {\n\t\t\tconst transaction = new Transaction(simpleTreeSnapshotWithValidation);\n\t\t\ttransaction.applyChange(Change.detach(StableRange.only(left)));\n\t\t\tconst idOfDetachedNodeToInsert = 1 as DetachedSequenceId;\n\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals([]);\n\t\t\ttransaction.applyChange(Change.build([makeEmptyNode(left.identifier)], idOfDetachedNodeToInsert));\n\t\t\ttransaction.applyChange(Change.insert(idOfDetachedNodeToInsert, StablePlace.atStartOf(leftTraitLocation)));\n\t\t\texpect(transaction.view.getTrait(leftTraitLocation)).deep.equals([left.identifier]);\n\t\t});\n\t});\n});\n"]}
1
+ {"version":3,"file":"Transaction.tests.js","sourceRoot":"","sources":["../../src/test/Transaction.tests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAA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AAW,EAAE,GAAG,qBAAqB,EAAE,CAAC;QAC1D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACtC,WAAW,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACtC,WAAW,CAAC,cAAc,EAAE,CAAC;QAC7B,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IACxC,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 { EditStatus, WriteFormat } from '../persisted-types';\nimport { Change, StablePlace, StableRange } from '../ChangeTypes';\nimport { Transaction } from '../Transaction';\nimport { SharedTree } from '../SharedTree';\nimport { TestTree } from './utilities/TestNode';\nimport { setUpTestSharedTree, setUpTestTree } from './utilities/TestUtilities';\n\ndescribe('Transaction', () => {\n\tfunction createTestTransaction(): { tree: SharedTree; testTree: TestTree; transaction: Transaction } {\n\t\tconst { tree } = setUpTestSharedTree({ writeFormat: WriteFormat.v0_1_1 });\n\t\tconst testTree = setUpTestTree(tree);\n\t\treturn { tree, testTree, transaction: new Transaction(tree) };\n\t}\n\n\tfunction createValidChange(testTree: TestTree): Change {\n\t\treturn Change.delete(StableRange.only(testTree.left));\n\t}\n\n\tfunction createInvalidChange(testTree: TestTree): Change {\n\t\treturn Change.delete(StableRange.only(testTree.generateNodeId()));\n\t}\n\n\tfunction createMalformedChange(testTree: TestTree): Change {\n\t\treturn Change.insert(Number.NaN, StablePlace.after(testTree.left));\n\t}\n\n\tit('can apply an edit to the tree', () => {\n\t\tconst { tree, testTree, transaction } = createTestTransaction();\n\t\tconst editCountBefore = tree.edits.length;\n\t\ttransaction.apply(createValidChange(testTree));\n\t\ttransaction.closeAndCommit();\n\t\texpect(tree.edits.length).to.equal(editCountBefore + 1);\n\t\texpect(tree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(0);\n\t});\n\n\tit('has correct edit status when applied', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\texpect(transaction.apply(createValidChange(testTree))).to.equal(EditStatus.Applied);\n\t\texpect(transaction.status).to.equal(EditStatus.Applied);\n\t\ttransaction.closeAndCommit();\n\t});\n\n\tit('has correct edit status when invalid', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\texpect(transaction.apply(createInvalidChange(testTree))).to.equal(EditStatus.Invalid);\n\t\texpect(transaction.status).to.equal(EditStatus.Invalid);\n\t\ttransaction.closeAndCommit();\n\t});\n\n\tit('has correct edit status when malformed', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\texpect(transaction.apply(createMalformedChange(testTree))).to.equal(EditStatus.Malformed);\n\t\texpect(transaction.status).to.equal(EditStatus.Malformed);\n\t\ttransaction.closeAndCommit();\n\t});\n\n\tit('can apply multiple changes at once', () => {\n\t\tconst { tree, testTree, transaction } = createTestTransaction();\n\t\ttransaction.apply(Change.move(StableRange.only(testTree.left), StablePlace.after(testTree.right)));\n\t\ttransaction.closeAndCommit();\n\t\texpect(tree.currentView.getTrait(testTree.left.traitLocation).length).to.equal(0);\n\t\texpect(tree.currentView.getTrait(testTree.right.traitLocation).length).to.equal(2);\n\t});\n\n\tit('does not apply empty edits', () => {\n\t\tconst { tree, transaction } = createTestTransaction();\n\t\tconst editCountBefore = tree.edits.length;\n\t\ttransaction.apply([]);\n\t\ttransaction.closeAndCommit();\n\t\texpect(tree.edits.length).to.equal(editCountBefore);\n\t});\n\n\tit('does not apply a batch of changes if any of them fail', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\tconst change = createValidChange(testTree);\n\t\texpect(transaction.apply(change, change)).to.equal(EditStatus.Invalid); // Second change is invalid\n\t\texpect(transaction.status).to.equal(EditStatus.Invalid);\n\t\ttransaction.closeAndCommit();\n\t});\n\n\tit('is open when created', () => {\n\t\tconst { transaction } = createTestTransaction();\n\t\texpect(transaction.isOpen).to.be.true;\n\t});\n\n\tit('closes when a change fails to apply', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\ttransaction.apply(createInvalidChange(testTree));\n\t\texpect(transaction.isOpen).to.be.false;\n\t});\n\n\tit('closes when an edit is applied', () => {\n\t\tconst { testTree, transaction } = createTestTransaction();\n\t\texpect(transaction.isOpen).to.be.true;\n\t\ttransaction.apply(createValidChange(testTree));\n\t\texpect(transaction.isOpen).to.be.true;\n\t\ttransaction.closeAndCommit();\n\t\texpect(transaction.isOpen).to.be.false;\n\t});\n});\n"]}