@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
@@ -1,187 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.revert = void 0;
8
- const Common_1 = require("../Common");
9
- const Snapshot_1 = require("../Snapshot");
10
- const PersistedTypes_1 = require("./PersistedTypes");
11
- const Transaction_1 = require("./Transaction");
12
- const EditUtilities_1 = require("./EditUtilities");
13
- /**
14
- * Given a sequence of changes, produces an inverse sequence of changes, i.e. the minimal changes required to revert the given changes
15
- * @param changes - the changes for which to produce an inverse.
16
- * @param before - a snapshot of the tree state before `changes` are/were applied - used as a basis for generating the inverse.
17
- * @returns a sequence of changes _r_ that will produce `before` if applied to a snapshot _A_, where _A_ is the result of
18
- * applying `changes` to `before`. Applying _r_ to snapshots other than _A_ is legal but may cause the changes to fail to apply or may
19
- * not be a true semantic inverse.
20
- *
21
- * TODO: what should this do if `changes` fails to apply to `before`?
22
- * @public
23
- */
24
- function revert(changes, before) {
25
- const result = [];
26
- const builtNodes = new Map();
27
- const detachedNodes = new Map();
28
- // Open edit on revision to update it as changes are walked through
29
- const editor = new Transaction_1.Transaction(before);
30
- // Apply `edit`, generating an inverse as we go.
31
- for (const change of changes) {
32
- // Generate an inverse of each change
33
- switch (change.type) {
34
- case PersistedTypes_1.ChangeType.Build: {
35
- // Save nodes added to the detached state for use in future changes
36
- const { destination, source } = change;
37
- Common_1.assert(!builtNodes.has(destination), `Cannot revert Build: destination is already used by a Build`);
38
- Common_1.assert(!detachedNodes.has(destination), `Cannot revert Build: destination is already used by a Detach`);
39
- builtNodes.set(destination, source.map((node) => node.identifier));
40
- break;
41
- }
42
- case PersistedTypes_1.ChangeType.Insert: {
43
- const { source } = change;
44
- const nodesBuilt = builtNodes.get(source);
45
- const nodesDetached = detachedNodes.get(source);
46
- if (nodesBuilt !== undefined) {
47
- result.unshift(createInvertedInsert(change, nodesBuilt));
48
- builtNodes.delete(source);
49
- }
50
- else if (nodesDetached !== undefined) {
51
- result.unshift(createInvertedInsert(change, nodesDetached, true));
52
- detachedNodes.delete(source);
53
- }
54
- else {
55
- Common_1.fail('Cannot revert Insert: source has not been built or detached.');
56
- }
57
- break;
58
- }
59
- case PersistedTypes_1.ChangeType.Detach: {
60
- const { destination } = change;
61
- const { invertedDetach, detachedNodeIds } = createInvertedDetach(change, editor.view);
62
- if (destination !== undefined) {
63
- Common_1.assert(!builtNodes.has(destination), `Cannot revert Detach: destination is already used by a Build`);
64
- Common_1.assert(!detachedNodes.has(destination), `Cannot revert Detach: destination is already used by a Detach`);
65
- detachedNodes.set(destination, detachedNodeIds);
66
- }
67
- result.unshift(...invertedDetach);
68
- break;
69
- }
70
- case PersistedTypes_1.ChangeType.SetValue:
71
- result.unshift(...createInvertedSetValue(change, editor.view));
72
- break;
73
- case PersistedTypes_1.ChangeType.Constraint:
74
- // TODO:#46759: Support Constraint in reverts
75
- Common_1.fail('Revert currently does not support Constraints');
76
- break;
77
- default:
78
- Common_1.fail('Revert does not support the change type.');
79
- }
80
- // Update the revision
81
- editor.applyChange(change);
82
- }
83
- editor.close();
84
- return result;
85
- }
86
- exports.revert = revert;
87
- /**
88
- * Inverse of an Insert is a Detach that starts before the leftmost node inserted and ends after the rightmost.
89
- */
90
- function createInvertedInsert(insert, nodesInserted, saveDetached = false) {
91
- const leftmostNode = nodesInserted[0];
92
- const rightmostNode = nodesInserted[nodesInserted.length - 1];
93
- const source = {
94
- start: {
95
- referenceSibling: leftmostNode,
96
- side: Snapshot_1.Side.Before,
97
- },
98
- end: {
99
- referenceSibling: rightmostNode,
100
- side: Snapshot_1.Side.After,
101
- },
102
- };
103
- return PersistedTypes_1.Change.detach(source, saveDetached ? insert.source : undefined);
104
- }
105
- /**
106
- * If a detach does not include a destination, its inverse is a build and insert. Otherwise, it is just an insert.
107
- * Information on the nodes that were detached is obtained by going to the revision before the detach.
108
- *
109
- * The anchor for the resulting Insert is chosen in the following order:
110
- * 1. If detach.source.start.side is After: detach.source.start
111
- *
112
- * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
113
- * if detach.source.start is "After B", the anchor for the resulting Insert will also be "After B".
114
- *
115
- * For nodes [A..F] G H where [A..F] represents the detached nodes,
116
- * if detach.source.start is "After start of trait", the anchor for the resulting Insert will also be "After start of trait".
117
- *
118
- * 2. Else if detach.source.end.side is Before: detach.source.end
119
- *
120
- * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
121
- * if detach.source.start is "Before C" and detach.source.end is "Before G",
122
- * the anchor for the resulting Insert will be "Before G".
123
- *
124
- * 3. Else: After the node directly to the left of the originally detached nodes
125
- *
126
- * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,
127
- * if detach.source.start is "Before C" and detach.source.end is "After F",
128
- * the anchor for the resulting Insert will be "After B".
129
- *
130
- * When choosing the anchor, the existing anchors on detach.source are preferred when they have a valid sibling. Otherwise, the valid
131
- * anchor to the left of the originally detached nodes is chosen.
132
- */
133
- function createInvertedDetach(detach, snapshotBeforeEdit) {
134
- const { source } = detach;
135
- const { start, end } = EditUtilities_1.rangeFromStableRange(snapshotBeforeEdit, source);
136
- const { trait: referenceTrait } = start;
137
- const nodes = snapshotBeforeEdit.getTrait(referenceTrait);
138
- const startIndex = snapshotBeforeEdit.findIndexWithinTrait(start);
139
- const endIndex = snapshotBeforeEdit.findIndexWithinTrait(end);
140
- const detachedNodeIds = nodes.slice(startIndex, endIndex);
141
- const leftOfDetached = nodes.slice(0, startIndex);
142
- let insertDestination;
143
- if (start.side === Snapshot_1.Side.After) {
144
- insertDestination =
145
- start.sibling === undefined
146
- ? { side: Snapshot_1.Side.After, referenceTrait }
147
- : { side: Snapshot_1.Side.After, referenceSibling: start.sibling };
148
- }
149
- else if (end.side === Snapshot_1.Side.Before) {
150
- insertDestination =
151
- end.sibling === undefined
152
- ? { side: Snapshot_1.Side.Before, referenceTrait }
153
- : { side: Snapshot_1.Side.Before, referenceSibling: end.sibling };
154
- }
155
- else {
156
- const referenceSibling = leftOfDetached.pop();
157
- insertDestination = {
158
- side: Snapshot_1.Side.After,
159
- referenceSibling,
160
- referenceTrait: referenceSibling === undefined ? referenceTrait : undefined,
161
- };
162
- }
163
- if (detach.destination !== undefined) {
164
- return {
165
- invertedDetach: [PersistedTypes_1.Change.insert(detach.destination, insertDestination)],
166
- detachedNodeIds,
167
- };
168
- }
169
- const detachedSequenceId = 0;
170
- return {
171
- invertedDetach: [
172
- PersistedTypes_1.Change.build(snapshotBeforeEdit.getChangeNodes(detachedNodeIds), detachedSequenceId),
173
- PersistedTypes_1.Change.insert(detachedSequenceId, insertDestination),
174
- ],
175
- detachedNodeIds,
176
- };
177
- }
178
- function createInvertedSetValue(setValue, revisionBeforeEdit) {
179
- const { nodeToModify } = setValue;
180
- const oldPayload = revisionBeforeEdit.getSnapshotNode(nodeToModify).payload;
181
- // Rationale: 'undefined' is reserved for future use (see 'SetValue' interface)
182
- if (oldPayload !== null) {
183
- return [PersistedTypes_1.Change.setPayload(nodeToModify, oldPayload)];
184
- }
185
- return [PersistedTypes_1.Change.clearPayload(nodeToModify)];
186
- }
187
- //# sourceMappingURL=HistoryEditFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HistoryEditFactory.js","sourceRoot":"","sources":["../../src/default-edits/HistoryEditFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAyC;AACzC,0CAA6C;AAE7C,qDAA0G;AAC1G,+CAA4C;AAC5C,mDAAuD;AAEvD;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,OAA0B,EAAE,MAAgB;IAClE,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC3D,MAAM,aAAa,GAAG,IAAI,GAAG,EAAgC,CAAC;IAE9D,mEAAmE;IACnE,MAAM,MAAM,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;IACvC,gDAAgD;IAChD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC7B,qCAAqC;QACrC,QAAQ,MAAM,CAAC,IAAI,EAAE;YACpB,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;gBACtB,mEAAmE;gBACnE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;gBACvC,eAAM,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,6DAA6D,CAAC,CAAC;gBACpG,eAAM,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,8DAA8D,CAAC,CAAC;gBACxG,UAAU,CAAC,GAAG,CACb,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAE,IAA4B,CAAC,UAAU,CAAC,CAC9D,CAAC;gBACF,MAAM;aACN;YACD,KAAK,2BAAU,CAAC,MAAM,CAAC,CAAC;gBACvB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;gBAC1B,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,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M,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;YACtE,eAAe;SACf,CAAC;KACF;IAED,MAAM,kBAAkB,GAAG,CAAuB,CAAC;IACnD,OAAO;QACN,cAAc,EAAE;YACf,uBAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,kBAAkB,CAAC;YACpF,uBAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;SACpD;QACD,eAAe;KACf,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAkB,EAAE,kBAA4B;IAC/E,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IAClC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;IAE5E,+EAA+E;IAC/E,IAAI,UAAU,KAAK,IAAI,EAAE;QACxB,OAAO,CAAC,uBAAM,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;KACrD;IACD,OAAO,CAAC,uBAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DetachedSequenceId, NodeId } from '../Identifiers';\nimport { assert, fail } from '../Common';\nimport { Snapshot, Side } from '../Snapshot';\nimport { BuildNode, TreeNode } from '../generic';\nimport { Change, ChangeType, Detach, Insert, SetValue, StableRange, StablePlace } from './PersistedTypes';\nimport { Transaction } from './Transaction';\nimport { rangeFromStableRange } from './EditUtilities';\n\n/**\n * Given a sequence of changes, produces an inverse sequence of changes, i.e. the minimal changes required to revert the given changes\n * @param changes - the changes for which to produce an inverse.\n * @param before - a snapshot of the tree state before `changes` are/were applied - used as a basis for generating the inverse.\n * @returns a sequence of changes _r_ that will produce `before` if applied to a snapshot _A_, where _A_ is the result of\n * applying `changes` to `before`. Applying _r_ to snapshots other than _A_ is legal but may cause the changes to fail to apply or may\n * not be a true semantic inverse.\n *\n * TODO: what should this do if `changes` fails to apply to `before`?\n * @public\n */\nexport function revert(changes: readonly Change[], before: Snapshot): Change[] {\n\tconst result: Change[] = [];\n\n\tconst builtNodes = new Map<DetachedSequenceId, NodeId[]>();\n\tconst detachedNodes = new Map<DetachedSequenceId, NodeId[]>();\n\n\t// Open edit on revision to update it as changes are walked through\n\tconst editor = new Transaction(before);\n\t// Apply `edit`, generating an inverse as we go.\n\tfor (const change of changes) {\n\t\t// Generate an inverse of each change\n\t\tswitch (change.type) {\n\t\t\tcase ChangeType.Build: {\n\t\t\t\t// Save nodes added to the detached state for use in future changes\n\t\t\t\tconst { destination, source } = change;\n\t\t\t\tassert(!builtNodes.has(destination), `Cannot revert Build: destination is already used by a Build`);\n\t\t\t\tassert(!detachedNodes.has(destination), `Cannot revert Build: destination is already used by a Detach`);\n\t\t\t\tbuiltNodes.set(\n\t\t\t\t\tdestination,\n\t\t\t\t\tsource.map((node) => (node as TreeNode<BuildNode>).identifier)\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeType.Insert: {\n\t\t\t\tconst { source } = change;\n\t\t\t\tconst nodesBuilt = builtNodes.get(source);\n\t\t\t\tconst nodesDetached = detachedNodes.get(source);\n\n\t\t\t\tif (nodesBuilt !== undefined) {\n\t\t\t\t\tresult.unshift(createInvertedInsert(change, nodesBuilt));\n\t\t\t\t\tbuiltNodes.delete(source);\n\t\t\t\t} else if (nodesDetached !== undefined) {\n\t\t\t\t\tresult.unshift(createInvertedInsert(change, nodesDetached, true));\n\t\t\t\t\tdetachedNodes.delete(source);\n\t\t\t\t} else {\n\t\t\t\t\tfail('Cannot revert Insert: source has not been built or detached.');\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeType.Detach: {\n\t\t\t\tconst { destination } = change;\n\t\t\t\tconst { invertedDetach, detachedNodeIds } = createInvertedDetach(change, editor.view);\n\n\t\t\t\tif (destination !== undefined) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!builtNodes.has(destination),\n\t\t\t\t\t\t`Cannot revert Detach: destination is already used by a Build`\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!detachedNodes.has(destination),\n\t\t\t\t\t\t`Cannot revert Detach: destination is already used by a Detach`\n\t\t\t\t\t);\n\t\t\t\t\tdetachedNodes.set(destination, detachedNodeIds);\n\t\t\t\t}\n\n\t\t\t\tresult.unshift(...invertedDetach);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ChangeType.SetValue:\n\t\t\t\tresult.unshift(...createInvertedSetValue(change, editor.view));\n\t\t\t\tbreak;\n\t\t\tcase ChangeType.Constraint:\n\t\t\t\t// TODO:#46759: Support Constraint in reverts\n\t\t\t\tfail('Revert currently does not support Constraints');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfail('Revert does not support the change type.');\n\t\t}\n\n\t\t// Update the revision\n\t\teditor.applyChange(change);\n\t}\n\n\teditor.close();\n\treturn result;\n}\n\n/**\n * Inverse of an Insert is a Detach that starts before the leftmost node inserted and ends after the rightmost.\n */\nfunction createInvertedInsert(insert: Insert, nodesInserted: readonly NodeId[], saveDetached = false): Change {\n\tconst leftmostNode = nodesInserted[0];\n\tconst rightmostNode = nodesInserted[nodesInserted.length - 1];\n\n\tconst source: StableRange = {\n\t\tstart: {\n\t\t\treferenceSibling: leftmostNode,\n\t\t\tside: Side.Before,\n\t\t},\n\t\tend: {\n\t\t\treferenceSibling: rightmostNode,\n\t\t\tside: Side.After,\n\t\t},\n\t};\n\n\treturn Change.detach(source, saveDetached ? insert.source : undefined);\n}\n\n/**\n * If a detach does not include a destination, its inverse is a build and insert. Otherwise, it is just an insert.\n * Information on the nodes that were detached is obtained by going to the revision before the detach.\n *\n * The anchor for the resulting Insert is chosen in the following order:\n * 1. If detach.source.start.side is After: detach.source.start\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"After B\", the anchor for the resulting Insert will also be \"After B\".\n *\n * For nodes [A..F] G H where [A..F] represents the detached nodes,\n * if detach.source.start is \"After start of trait\", the anchor for the resulting Insert will also be \"After start of trait\".\n *\n * 2. Else if detach.source.end.side is Before: detach.source.end\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"Before C\" and detach.source.end is \"Before G\",\n * the anchor for the resulting Insert will be \"Before G\".\n *\n * 3. Else: After the node directly to the left of the originally detached nodes\n *\n * ex: For nodes A B [C..F] G H where [C..F] represents the detached nodes,\n * if detach.source.start is \"Before C\" and detach.source.end is \"After F\",\n * the anchor for the resulting Insert will be \"After B\".\n *\n * When choosing the anchor, the existing anchors on detach.source are preferred when they have a valid sibling. Otherwise, the valid\n * anchor to the left of the originally detached nodes is chosen.\n */\nfunction createInvertedDetach(\n\tdetach: Detach,\n\tsnapshotBeforeEdit: Snapshot\n): { invertedDetach: Change[]; detachedNodeIds: NodeId[] } {\n\tconst { source } = detach;\n\n\tconst { start, end } = rangeFromStableRange(snapshotBeforeEdit, source);\n\tconst { trait: referenceTrait } = start;\n\tconst nodes = snapshotBeforeEdit.getTrait(referenceTrait);\n\n\tconst startIndex = snapshotBeforeEdit.findIndexWithinTrait(start);\n\tconst endIndex = snapshotBeforeEdit.findIndexWithinTrait(end);\n\tconst detachedNodeIds: NodeId[] = nodes.slice(startIndex, endIndex);\n\n\tconst leftOfDetached = nodes.slice(0, startIndex);\n\n\tlet insertDestination: StablePlace;\n\n\tif (start.side === Side.After) {\n\t\tinsertDestination =\n\t\t\tstart.sibling === undefined\n\t\t\t\t? { side: Side.After, referenceTrait }\n\t\t\t\t: { side: Side.After, referenceSibling: start.sibling };\n\t} else if (end.side === Side.Before) {\n\t\tinsertDestination =\n\t\t\tend.sibling === undefined\n\t\t\t\t? { side: Side.Before, referenceTrait }\n\t\t\t\t: { side: Side.Before, referenceSibling: end.sibling };\n\t} else {\n\t\tconst referenceSibling = leftOfDetached.pop();\n\t\tinsertDestination = {\n\t\t\tside: Side.After,\n\t\t\treferenceSibling,\n\t\t\treferenceTrait: referenceSibling === undefined ? referenceTrait : undefined,\n\t\t};\n\t}\n\n\tif (detach.destination !== undefined) {\n\t\treturn {\n\t\t\tinvertedDetach: [Change.insert(detach.destination, insertDestination)],\n\t\t\tdetachedNodeIds,\n\t\t};\n\t}\n\n\tconst detachedSequenceId = 0 as DetachedSequenceId;\n\treturn {\n\t\tinvertedDetach: [\n\t\t\tChange.build(snapshotBeforeEdit.getChangeNodes(detachedNodeIds), detachedSequenceId),\n\t\t\tChange.insert(detachedSequenceId, insertDestination),\n\t\t],\n\t\tdetachedNodeIds,\n\t};\n}\n\nfunction createInvertedSetValue(setValue: SetValue, revisionBeforeEdit: Snapshot): Change[] {\n\tconst { nodeToModify } = setValue;\n\tconst oldPayload = revisionBeforeEdit.getSnapshotNode(nodeToModify).payload;\n\n\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface)\n\tif (oldPayload !== null) {\n\t\treturn [Change.setPayload(nodeToModify, oldPayload)];\n\t}\n\treturn [Change.clearPayload(nodeToModify)];\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PersistedTypes.d.ts","sourceRoot":"","sources":["../../src/default-edits/PersistedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;GAGG;AACH,oBAAY,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;A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C,KAAK,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,SAAgB,UAAU,CAAC,IAAuB;IACjD,OAAQ,IAAiB,CAAC,UAAU,KAAK,SAAS,IAAK,IAAiB,CAAC,UAAU,KAAK,SAAS,CAAC;AACnG,CAAC;AAFD,gCAEC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAuB;IAChD,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC;KACvB;SAAM;QACN,OAAO,IAAI,CAAC;KACZ;AACF,CAAC;AAND,8BAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// All types imported into this file inherit the requirements documented below.\n// These imports are ok because they consist only of type aliases for primitive types,\n// and thus have no impact on serialization as long as the primitive type they are an alias for does not change.\n// This does mean that the various UuidString types must remain strings, and must never change the format unless the process for changing\n// persisted types (as documented below) is followed.\nimport { DetachedSequenceId, NodeId, TraitLabel, UuidString } from '../Identifiers';\nimport { assertNotUndefined, assert } from '../Common';\nimport { Side } from '../Snapshot';\nimport { EditBase, BuildNode, NodeData, Payload, TraitLocation, TreeNodeSequence } from '../generic';\n\n/**\n * Types for Edits in Fluid Ops and Fluid summaries.\n *\n * Types describing locations in the tree are stable in the presence of other concurrent edits.\n *\n * All types are compatible with Fluid Serializable.\n *\n * These types can only be modified in ways that are both backwards and forwards compatible since they\n * are used in edits, and thus are persisted (using Fluid serialization).\n *\n * This means these types cannot be changed in any way that impacts their Fluid serialization\n * except through a very careful process:\n *\n * 1. The planned change must support all old data, and maintain the exact semantics of it.\n * This means that the change is pretty much limited to adding optional fields,\n * or making required fields optional.\n * 2. Support for the new format must be deployed to all users (This means all applications using SharedTree must do this),\n * and this deployment must be confirmed to be stable and will not be rolled back.\n * 3. Usage of the new format may start.\n *\n * Support for the old format can NEVER be removed: it must be maintained indefinably or old documents will break.\n * Because this process puts requirements on applications using shared tree,\n * step 3 should only ever be done in a Major version update,\n * and must be explicitly called out in the release notes\n * stating which versions of SharedTree are supported for documents modified by the new version.\n */\n\n/**\n * The information included in an edit.\n * @public\n */\nexport type DefaultEditBase = EditBase<Change>;\n\n/**\n * The type of a Change\n * @public\n */\nexport enum ChangeType {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n}\n\n/**\n * A change that composes an Edit.\n *\n * `Change` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n * @example\n * Change.insert(sourceId, destination)\n * @public\n */\nexport type Change = Insert | Detach | Build | SetValue | Constraint;\n\n/**\n * Constructs a sequence of nodes, associates it with the supplied ID, and stores it for use in later changes.\n * Does not modify the document.\n *\n * Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),\n * and all Nodes' identifiers are previously unused.\n *\n * TODO: Design Decision:\n * If allowing 'moving from nowhere' to restore nodes: all new Nodes must have never before used identifiers.\n * Otherwise could just forbid identifiers currently reachable?\n * Could also allow introducing a node with a particular identifier to mean replacing that node with the new one\n * (could include optional constraint to require/prevent this).\n *\n * @public\n */\nexport interface Build {\n\treadonly destination: DetachedSequenceId;\n\treadonly source: TreeNodeSequence<BuildNode>;\n\treadonly type: typeof ChangeType.Build;\n}\n\n/**\n * Inserts a sequence of nodes at the specified destination.\n * The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a \"move\" operation).\n * @public\n */\nexport interface Insert {\n\treadonly destination: StablePlace;\n\treadonly source: DetachedSequenceId;\n\treadonly type: typeof ChangeType.Insert;\n}\n\n/**\n * Removes a sequence of nodes from the tree.\n * If a destination is specified, the detached sequence is associated with that ID and held for possible reuse\n * by later changes in this same Edit (such as by an Insert).\n * A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.\n * @public\n */\nexport interface Detach {\n\treadonly destination?: DetachedSequenceId;\n\treadonly source: StableRange;\n\treadonly type: typeof ChangeType.Detach;\n}\n\n/**\n * Modifies the payload of a node.\n * @public\n */\nexport interface SetValue {\n\treadonly nodeToModify: NodeId;\n\t/**\n\t * Sets or clears the payload.\n\t * To improve ease of forwards compatibility, an explicit `null` value is used to represent the clearing of a payload.\n\t * SetValue may use `undefined` in future API versions to mean \"don't change the payload\" (which is useful if e.g. other\n\t * fields are added to SetValue that can be changed without altering the payload)\n\t */\n\treadonly payload: Payload | null;\n\treadonly type: typeof ChangeType.SetValue;\n}\n\n/**\n * A set of constraints on the validity of an Edit.\n * A Constraint is used to detect when an Edit, due to other concurrent edits, may have unintended effects or merge in\n * non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the\n * various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).\n * Does not modify the document.\n * @public\n */\nexport interface Constraint {\n\t/**\n\t * Selects a sequence of nodes which will be checked against the constraints specified by the optional fields.\n\t * If `toConstrain` is invalid, it will be treated like a constraint being unmet.\n\t * Depending on `effect` this may or may not make the Edit invalid.\n\t *\n\t * When a constraint is not met, the effects is specified by `effect`.\n\t */\n\treadonly toConstrain: StableRange;\n\n\t/**\n\t * Require that the identities of all the nodes in toConstrain hash to this value.\n\t * Hash is order dependent.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes to have specific identities.\n\t */\n\treadonly identityHash?: UuidString;\n\n\t/**\n\t * Require that the number of nodes in toConstrain is this value.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * Require that the contents of all of the nodes in toConstrain hash to this value.\n\t * Hash is an order dependant deep hash, which includes all subtree content recursively.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes have exact values (transitively).\n\t */\n\treadonly contentHash?: UuidString;\n\n\t/**\n\t * Require that parent under which toConstrain is located has this identifier.\n\t */\n\treadonly parentNode?: NodeId;\n\n\t/**\n\t * Require that the trait under which toConstrain is located has this label.\n\t */\n\treadonly label?: TraitLabel;\n\n\t/**\n\t * What to do if a constraint is not met.\n\t */\n\treadonly effect: ConstraintEffect;\n\n\t/**\n\t * Marker for which kind of Change this is.\n\t */\n\treadonly type: typeof ChangeType.Constraint;\n}\n\n/**\n * What to do when a Constraint is violated.\n * @public\n */\nexport enum ConstraintEffect {\n\t/**\n\t * Discard Edit.\n\t */\n\tInvalidAndDiscard,\n\n\t/**\n\t * Discard Edit, but record metadata that application may want to try and recover this change by recreating it.\n\t * Should this be the default policy for when another (non Constraint) change is invalid?\n\t */\n\tInvalidRetry,\n\n\t/**\n\t * Apply the change, but flag it for possible reconsideration by the app\n\t * (applying it is better than not, but perhaps the high level logic could produce something better).\n\t */\n\tValidRetry,\n}\n\n// Note: Documentation of this constant is merged with documentation of the `Change` interface.\n/**\n * @public\n */\nexport const Change = {\n\tbuild: (source: TreeNodeSequence<BuildNode>, destination: DetachedSequenceId): Build => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Build,\n\t}),\n\n\tinsert: (source: DetachedSequenceId, destination: StablePlace): Insert => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Insert,\n\t}),\n\n\tdetach: (source: StableRange, destination?: DetachedSequenceId): Detach => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeId, payload: Payload): SetValue => ({\n\t\tnodeToModify,\n\t\tpayload,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeId): SetValue => ({\n\t\tnodeToModify,\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRange,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): Constraint => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeType.Constraint,\n\t}),\n};\n\n/**\n * Helper for creating a `Delete` edit.\n * @public\n */\nexport const Delete = {\n\t/**\n\t * @returns a Change that deletes the supplied part of the tree.\n\t */\n\tcreate: (stableRange: StableRange): Change => Change.detach(stableRange),\n};\n\n/**\n * Helper for creating an `Insert` edit.\n * @public\n */\nexport const Insert = {\n\t/**\n\t * @returns a Change that inserts 'nodes' into the specified location in the tree.\n\t */\n\tcreate: (nodes: TreeNodeSequence<BuildNode>, destination: StablePlace): Change[] => {\n\t\tconst build = Change.build(nodes, 0 as DetachedSequenceId);\n\t\treturn [build, Change.insert(build.destination, destination)];\n\t},\n};\n\n/**\n * Helper for creating a `Move` edit.\n * @public\n */\nexport const Move = {\n\t/**\n\t * @returns a Change that moves the specified content to a new location in the tree.\n\t */\n\tcreate: (source: StableRange, destination: StablePlace): Change[] => {\n\t\tconst detach = Change.detach(source, 0 as DetachedSequenceId);\n\t\treturn [detach, Change.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * A location in a trait.\n * This is NOT the location of a node, but a location where a node could be inserted:\n * it is next to a sibling or at one end of the trait.\n *\n * To be well formed, either `sibling` or `trait` must be defined, but not both.\n *\n * Any given insertion location can be described by two `StablePlace` objects, one with `Side.After` and one with `Side.Before`.\n * For example, in a trait containing two strings \"foo\" and \"bar\", there are 6 places corresponding to 3 places into the trait a new node\n * could be inserted: at the start, before \"foo\", after \"foo\", before \"bar\", after \"bar\", and at the end.\n * The anchor (`referenceSibling` or `referenceTrait`) used for a particular `StablePlace` can have an impact in collaborative scenarios.\n *\n * `StablePlace` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n * @example\n * StablePlace.before(node)\n * StablePlace.atStartOf(trait)\n * @public\n */\nexport interface StablePlace {\n\t/**\n\t * Where this StablePlace is relative to the sibling (if specified), or an end of the trait (if no sibling specified).\n\t * If 'After' and there is no sibling, this StablePlace is after the front of the trait.\n\t * If 'Before' and there is no sibling, this StablePlace is before the back of the trait.\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * The sibling to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceTrait must be unspecified.\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * The trait to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceSibling must be unspecified.\n\t */\n\treadonly referenceTrait?: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait.\n * Valid iff start and end are valid and are within the same trait and the start does not occur after the end in the trait.\n *\n * `StableRange` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n * @example\n * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n * @public\n */\nexport interface StableRange {\n\treadonly start: StablePlace;\n\treadonly end: StablePlace;\n}\n\n/**\n * The remainder of this file consists of ergonomic factory methods for persisted types, or common combinations thereof (e.g. \"Move\" as a\n * combination of a \"Detach\" change and an \"Insert\" change).\n *\n * None of these helpers are persisted in documents, and therefore changes to their semantics need only follow standard semantic versioning\n * practices.\n */\n\n// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.\n/**\n * @public\n */\nexport const StablePlace = {\n\t/**\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData | NodeId): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData | NodeId): StablePlace => ({ side: Side.After, referenceSibling: getNodeId(node) }),\n\t/**\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocation): StablePlace => ({ side: Side.After, referenceTrait: trait }),\n\t/**\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocation): StablePlace => ({ side: Side.Before, referenceTrait: trait }),\n};\n\n// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.\n/**\n * @public\n */\nexport const StableRange = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t * @example\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t */\n\tfrom: (start: StablePlace): { to: (end: StablePlace) => StableRange } => ({\n\t\tto: (end: StablePlace): StableRange => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tconst message = 'StableRange must be constructed with endpoints from the same trait';\n\t\t\t\tassert(start.referenceTrait.parent === end.referenceTrait.parent, message);\n\t\t\t\tassert(start.referenceTrait.label === end.referenceTrait.label, message);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains only the provided `node`.\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData | NodeId): StableRange => ({ start: StablePlace.before(node), end: StablePlace.after(node) }),\n\t/**\n\t * @returns a `StableRange` which contains everything in the trait.\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocation): StableRange => ({\n\t\tstart: StablePlace.atStartOf(trait),\n\t\tend: StablePlace.atEndOf(trait),\n\t}),\n};\n\n/**\n * @returns True iff the given `node` is of type NodeData.\n * @internal\n */\nexport function isNodeData(node: NodeData | NodeId): node is NodeData {\n\treturn (node as NodeData).definition !== undefined && (node as NodeData).identifier !== undefined;\n}\n\n/**\n * @returns The NodeId for a given node or its id.\n * @internal\n */\nexport function getNodeId(node: NodeData | NodeId): NodeId {\n\tif (isNodeData(node)) {\n\t\treturn node.identifier;\n\t} else {\n\t\treturn node;\n\t}\n}\n"]}
@@ -1,111 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
- import { EditId, NodeId } from '../Identifiers';
7
- import { Snapshot } from '../Snapshot';
8
- import { Edit, BuildNode, GenericSharedTree, NodeData, SharedTreeSummaryBase } from '../generic';
9
- import { OrderedEditSet } from '../EditLog';
10
- import { Change, StableRange, StablePlace } from './PersistedTypes';
11
- import { SharedTreeFactory } from './Factory';
12
- /**
13
- * Wrapper around a `SharedTree` which provides ergonomic imperative editing functionality. All methods apply changes in their own edit.
14
- *
15
- * @example
16
- * // The following two lines of code are equivalent:
17
- * tree.applyEdit(...Insert.create([newNode], StablePlace.before(existingNode)));
18
- * tree.editor.insert(newNode, StablePlace.before(existingNode))
19
- * @public
20
- */
21
- export declare class SharedTreeEditor {
22
- private readonly tree;
23
- constructor(tree: SharedTree);
24
- /**
25
- * Inserts a node at a location.
26
- * @param node - Node to insert.
27
- * @param destination - StablePlace at which the insert should take place.
28
- */
29
- insert(node: BuildNode, destination: StablePlace): EditId;
30
- /**
31
- * Inserts nodes at a location.
32
- * @param nodes - Nodes to insert.
33
- * @param destination - StablePlace at which the insert should take place.
34
- */
35
- insert(nodes: BuildNode[], destination: StablePlace): EditId;
36
- /**
37
- * Moves a node to a specified location.
38
- * @param source - Node to move.
39
- * @param destination - StablePlace to which the node should be moved.
40
- */
41
- move(source: NodeData, destination: StablePlace): EditId;
42
- /**
43
- * Moves a node to a specified location.
44
- * @param source - Node to move.
45
- * @param destination - StablePlace to which the node should be moved.
46
- */
47
- move(source: NodeId, destination: StablePlace): EditId;
48
- /**
49
- * Moves a part of a trait to a specified location.
50
- * @param source - Portion of a trait to move.
51
- * @param destination - StablePlace to which the portion of the trait should be moved.
52
- */
53
- move(source: StableRange, destination: StablePlace): EditId;
54
- /**
55
- * Deletes a node.
56
- * @param target - Node to delete
57
- */
58
- delete(target: NodeData): EditId;
59
- /**
60
- * Deletes a node.
61
- * @param target - Node to delete
62
- */
63
- delete(target: NodeId): EditId;
64
- /**
65
- * Deletes a portion of a trait.
66
- * @param target - Range of nodes to delete, specified as a `StableRange`
67
- */
68
- delete(target: StableRange): EditId;
69
- /**
70
- * Reverts a previous edit.
71
- * @param edit - the edit to revert
72
- * @param view - the revision to which the edit is applied (not the output of applying edit: it's the one just before that)
73
- */
74
- revert(edit: Edit<Change>, view: Snapshot): EditId;
75
- private isStableRange;
76
- }
77
- /**
78
- * A distributed tree.
79
- * @public
80
- * @sealed
81
- */
82
- export declare class SharedTree extends GenericSharedTree<Change> {
83
- /**
84
- * Create a new SharedTree. It will contain the default value (see initialTree).
85
- */
86
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree;
87
- /**
88
- * Get a factory for SharedTree to register with the data store.
89
- * @param historySummarizing - determines how history is summarized by the returned `SharedTree`.
90
- * @returns A factory that creates `SharedTree`s and loads them from storage.
91
- */
92
- static getFactory(summarizeHistory?: boolean): SharedTreeFactory;
93
- /**
94
- * Create a new SharedTreeFactory.
95
- * @param runtime - The runtime the SharedTree will be associated with
96
- * @param id - Unique ID for the SharedTree
97
- * @param expensiveValidation - enable expensive asserts
98
- * @param summarizeHistory - Determines if the history is included in summaries.
99
- */
100
- constructor(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation?: boolean, summarizeHistory?: boolean);
101
- private _editor;
102
- /**
103
- * Returns a `SharedTreeEditor` for editing this tree in an imperative fashion. All edits are performed on the current tree view.
104
- */
105
- get editor(): SharedTreeEditor;
106
- /**
107
- * {@inheritDoc GenericSharedTree.generateSummary}
108
- */
109
- protected generateSummary(editLog: OrderedEditSet<Change>): SharedTreeSummaryBase;
110
- }
111
- //# sourceMappingURL=SharedTree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../../src/default-edits/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,S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,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU;IAI9E;;;;OAIG;WACW,UAAU,CAAC,gBAAgB,UAAO,GAAG,iBAAiB;IAIpE;;;;;;OAMG;gBAEF,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,mBAAmB,UAAQ,EAC3B,gBAAgB,UAAO;IAKxB,OAAO,CAAC,OAAO,CAA+B;IAE9C;;OAEG;IACH,IAAW,MAAM,IAAI,gBAAgB,CAMpC;IAED;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,qBAAqB;CAMjF"}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.SharedTree = exports.SharedTreeEditor = void 0;
27
- const generic_1 = require("../generic");
28
- const PersistedTypes_1 = require("./PersistedTypes");
29
- const Factory_1 = require("./Factory");
30
- const HistoryEditFactory = __importStar(require("./HistoryEditFactory"));
31
- const Transaction_1 = require("./Transaction");
32
- const Summary_1 = require("./Summary");
33
- /**
34
- * Wrapper around a `SharedTree` which provides ergonomic imperative editing functionality. All methods apply changes in their own edit.
35
- *
36
- * @example
37
- * // The following two lines of code are equivalent:
38
- * tree.applyEdit(...Insert.create([newNode], StablePlace.before(existingNode)));
39
- * tree.editor.insert(newNode, StablePlace.before(existingNode))
40
- * @public
41
- */
42
- class SharedTreeEditor {
43
- constructor(tree) {
44
- this.tree = tree;
45
- }
46
- insert(nodeOrNodes, destination) {
47
- return this.tree.applyEdit(...PersistedTypes_1.Insert.create(Array.isArray(nodeOrNodes) ? nodeOrNodes : [nodeOrNodes], destination));
48
- }
49
- move(source, destination) {
50
- if (!this.isStableRange(source)) {
51
- return this.tree.applyEdit(...PersistedTypes_1.Move.create(PersistedTypes_1.StableRange.only(source), destination));
52
- }
53
- return this.tree.applyEdit(...PersistedTypes_1.Move.create(source, destination));
54
- }
55
- delete(target) {
56
- if (!this.isStableRange(target)) {
57
- return this.tree.applyEdit(PersistedTypes_1.Delete.create(PersistedTypes_1.StableRange.only(target)));
58
- }
59
- return this.tree.applyEdit(PersistedTypes_1.Delete.create(target));
60
- }
61
- /**
62
- * Reverts a previous edit.
63
- * @param edit - the edit to revert
64
- * @param view - the revision to which the edit is applied (not the output of applying edit: it's the one just before that)
65
- */
66
- revert(edit, view) {
67
- return this.tree.applyEdit(...HistoryEditFactory.revert(edit.changes, view));
68
- }
69
- isStableRange(source) {
70
- return source.start !== undefined && source.end !== undefined;
71
- }
72
- }
73
- exports.SharedTreeEditor = SharedTreeEditor;
74
- /**
75
- * A distributed tree.
76
- * @public
77
- * @sealed
78
- */
79
- class SharedTree extends generic_1.GenericSharedTree {
80
- /**
81
- * Create a new SharedTreeFactory.
82
- * @param runtime - The runtime the SharedTree will be associated with
83
- * @param id - Unique ID for the SharedTree
84
- * @param expensiveValidation - enable expensive asserts
85
- * @param summarizeHistory - Determines if the history is included in summaries.
86
- */
87
- constructor(runtime, id, expensiveValidation = false, summarizeHistory = true) {
88
- super(runtime, id, Transaction_1.Transaction.factory, Factory_1.SharedTreeFactory.Attributes, expensiveValidation, summarizeHistory);
89
- }
90
- /**
91
- * Create a new SharedTree. It will contain the default value (see initialTree).
92
- */
93
- static create(runtime, id) {
94
- return runtime.createChannel(id, Factory_1.SharedTreeFactory.Type);
95
- }
96
- /**
97
- * Get a factory for SharedTree to register with the data store.
98
- * @param historySummarizing - determines how history is summarized by the returned `SharedTree`.
99
- * @returns A factory that creates `SharedTree`s and loads them from storage.
100
- */
101
- static getFactory(summarizeHistory = true) {
102
- return summarizeHistory ? new Factory_1.SharedTreeFactory() : new Factory_1.SharedTreeFactoryNoHistory();
103
- }
104
- /**
105
- * Returns a `SharedTreeEditor` for editing this tree in an imperative fashion. All edits are performed on the current tree view.
106
- */
107
- get editor() {
108
- if (!this._editor) {
109
- this._editor = new SharedTreeEditor(this);
110
- }
111
- return this._editor;
112
- }
113
- /**
114
- * {@inheritDoc GenericSharedTree.generateSummary}
115
- */
116
- generateSummary(editLog) {
117
- if (!this.summarizeHistory) {
118
- return Summary_1.noHistorySummarizer(editLog, this.currentView);
119
- }
120
- return generic_1.fullHistorySummarizer(editLog, this.currentView);
121
- }
122
- }
123
- exports.SharedTree = SharedTree;
124
- //# sourceMappingURL=SharedTree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SharedTree.js","sourceRoot":"","sources":["../../src/default-edits/SharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAKH,wCAAwH;AAExH,qDAA0F;AAC1F,uCAA0E;AAC1E,yEAA2D;AAC3D,+CAA4C;AAC5C,uCAAgD;AAEhD;;;;;;;;GAQG;AACH,MAAa,gBAAgB;IAG5B,YAAmB,IAAgB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAcM,MAAM,CAAC,WAAoC,EAAE,WAAwB;QAC3E,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CACzB,GAAG,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MAAa,UAAW,SAAQ,2BAAyB;IAiBxD;;;;;;OAMG;IACH,YACC,OAA+B,EAC/B,EAAU,EACV,mBAAmB,GAAG,KAAK,EAC3B,gBAAgB,GAAG,IAAI;QAEvB,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,yBAAW,CAAC,OAAO,EAAE,2BAAiB,CAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;IAC9G,CAAC;IA9BD;;OAEG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,2BAAiB,CAAC,IAAI,CAAe,CAAC;IACxE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,gBAAgB,GAAG,IAAI;QAC/C,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,2BAAiB,EAAE,CAAC,CAAC,CAAC,IAAI,oCAA0B,EAAE,CAAC;IACtF,CAAC;IAoBD;;OAEG;IACH,IAAW,MAAM;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED;;OAEG;IACO,eAAe,CAAC,OAA+B;QACxD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC3B,OAAO,6BAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;SACtD;QACD,OAAO,+BAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACzD,CAAC;CACD;AAvDD,gCAuDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';\nimport { EditId, NodeId } from '../Identifiers';\nimport { Snapshot } from '../Snapshot';\nimport { Edit, BuildNode, fullHistorySummarizer, GenericSharedTree, NodeData, SharedTreeSummaryBase } from '../generic';\nimport { OrderedEditSet } from '../EditLog';\nimport { Change, Delete, Insert, Move, StableRange, StablePlace } from './PersistedTypes';\nimport { SharedTreeFactory, SharedTreeFactoryNoHistory } from './Factory';\nimport * as HistoryEditFactory from './HistoryEditFactory';\nimport { Transaction } from './Transaction';\nimport { noHistorySummarizer } from './Summary';\n\n/**\n * Wrapper around a `SharedTree` which provides ergonomic imperative editing functionality. All methods apply changes in their own edit.\n *\n * @example\n * // The following two lines of code are equivalent:\n * tree.applyEdit(...Insert.create([newNode], StablePlace.before(existingNode)));\n * tree.editor.insert(newNode, StablePlace.before(existingNode))\n * @public\n */\nexport class SharedTreeEditor {\n\tprivate readonly tree: SharedTree;\n\n\tpublic constructor(tree: SharedTree) {\n\t\tthis.tree = tree;\n\t}\n\n\t/**\n\t * Inserts a node at a location.\n\t * @param node - Node to insert.\n\t * @param destination - StablePlace at which the insert should take place.\n\t */\n\tpublic insert(node: BuildNode, destination: StablePlace): EditId;\n\t/**\n\t * Inserts nodes at a location.\n\t * @param nodes - Nodes to insert.\n\t * @param destination - StablePlace at which the insert should take place.\n\t */\n\tpublic insert(nodes: BuildNode[], destination: StablePlace): EditId;\n\tpublic insert(nodeOrNodes: BuildNode | BuildNode[], destination: StablePlace): EditId {\n\t\treturn this.tree.applyEdit(\n\t\t\t...Insert.create(Array.isArray(nodeOrNodes) ? nodeOrNodes : [nodeOrNodes], destination)\n\t\t);\n\t}\n\n\t/**\n\t * Moves a node to a specified location.\n\t * @param source - Node to move.\n\t * @param destination - StablePlace to which the node should be moved.\n\t */\n\tpublic move(source: NodeData, destination: StablePlace): EditId;\n\t/**\n\t * Moves a node to a specified location.\n\t * @param source - Node to move.\n\t * @param destination - StablePlace to which the node should be moved.\n\t */\n\tpublic move(source: NodeId, destination: StablePlace): EditId;\n\t/**\n\t * Moves a part of a trait to a specified location.\n\t * @param source - Portion of a trait to move.\n\t * @param destination - StablePlace to which the portion of the trait should be moved.\n\t */\n\tpublic move(source: StableRange, destination: StablePlace): EditId;\n\tpublic move(source: NodeData | NodeId | StableRange, destination: StablePlace): EditId {\n\t\tif (!this.isStableRange(source)) {\n\t\t\treturn this.tree.applyEdit(...Move.create(StableRange.only(source), destination));\n\t\t}\n\n\t\treturn this.tree.applyEdit(...Move.create(source, destination));\n\t}\n\n\t/**\n\t * Deletes a node.\n\t * @param target - Node to delete\n\t */\n\tpublic delete(target: NodeData): EditId;\n\t/**\n\t * Deletes a node.\n\t * @param target - Node to delete\n\t */\n\tpublic delete(target: NodeId): EditId;\n\t/**\n\t * Deletes a portion of a trait.\n\t * @param target - Range of nodes to delete, specified as a `StableRange`\n\t */\n\tpublic delete(target: StableRange): EditId;\n\tpublic delete(target: NodeData | NodeId | StableRange): EditId {\n\t\tif (!this.isStableRange(target)) {\n\t\t\treturn this.tree.applyEdit(Delete.create(StableRange.only(target)));\n\t\t}\n\n\t\treturn this.tree.applyEdit(Delete.create(target));\n\t}\n\n\t/**\n\t * Reverts a previous edit.\n\t * @param edit - the edit to revert\n\t * @param view - the revision to which the edit is applied (not the output of applying edit: it's the one just before that)\n\t */\n\tpublic revert(edit: Edit<Change>, view: Snapshot): EditId {\n\t\treturn this.tree.applyEdit(...HistoryEditFactory.revert(edit.changes, view));\n\t}\n\n\tprivate isStableRange(source: NodeData | NodeId | StableRange): source is StableRange {\n\t\treturn (source as StableRange).start !== undefined && (source as StableRange).end !== undefined;\n\t}\n}\n\n/**\n * A distributed tree.\n * @public\n * @sealed\n */\nexport class SharedTree extends GenericSharedTree<Change> {\n\t/**\n\t * Create a new SharedTree. It will contain the default value (see initialTree).\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree {\n\t\treturn runtime.createChannel(id, SharedTreeFactory.Type) as SharedTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param historySummarizing - determines how history is summarized by the returned `SharedTree`.\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tpublic static getFactory(summarizeHistory = true): SharedTreeFactory {\n\t\treturn summarizeHistory ? new SharedTreeFactory() : new SharedTreeFactoryNoHistory();\n\t}\n\n\t/**\n\t * Create a new SharedTreeFactory.\n\t * @param runtime - The runtime the SharedTree will be associated with\n\t * @param id - Unique ID for the SharedTree\n\t * @param expensiveValidation - enable expensive asserts\n\t * @param summarizeHistory - Determines if the history is included in summaries.\n\t */\n\tpublic constructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\texpensiveValidation = false,\n\t\tsummarizeHistory = true\n\t) {\n\t\tsuper(runtime, id, Transaction.factory, SharedTreeFactory.Attributes, expensiveValidation, summarizeHistory);\n\t}\n\n\tprivate _editor: SharedTreeEditor | undefined;\n\n\t/**\n\t * Returns a `SharedTreeEditor` for editing this tree in an imperative fashion. All edits are performed on the current tree view.\n\t */\n\tpublic get editor(): SharedTreeEditor {\n\t\tif (!this._editor) {\n\t\t\tthis._editor = new SharedTreeEditor(this);\n\t\t}\n\n\t\treturn this._editor;\n\t}\n\n\t/**\n\t * {@inheritDoc GenericSharedTree.generateSummary}\n\t */\n\tprotected generateSummary(editLog: OrderedEditSet<Change>): SharedTreeSummaryBase {\n\t\tif (!this.summarizeHistory) {\n\t\t\treturn noHistorySummarizer(editLog, this.currentView);\n\t\t}\n\t\treturn fullHistorySummarizer(editLog, this.currentView);\n\t}\n}\n"]}
@@ -1,15 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { OrderedEditSet } from '../EditLog';
6
- import { Snapshot } from '../Snapshot';
7
- import { SharedTreeSummary_0_0_2 } from '../SummaryBackCompatibility';
8
- import { Change } from './PersistedTypes';
9
- /**
10
- * Does not preserve (persist) history at all.
11
- * Instead, the history returned in the summary will contain a single change that creates a revision identical to the supplied view.
12
- * @public
13
- */
14
- export declare function noHistorySummarizer(_editLog: OrderedEditSet<Change>, currentView: Snapshot): SharedTreeSummary_0_0_2<Change>;
15
- //# sourceMappingURL=Summary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Summary.d.ts","sourceRoot":"","sources":["../../src/default-edits/Summary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAChC,WAAW,EAAE,QAAQ,GACnB,uBAAuB,CAAC,MAAM,CAAC,CAoBjC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.noHistorySummarizer = void 0;
8
- const Common_1 = require("../Common");
9
- const InitialTree_1 = require("../InitialTree");
10
- const generic_1 = require("../generic");
11
- const EditUtilities_1 = require("./EditUtilities");
12
- /**
13
- * Does not preserve (persist) history at all.
14
- * Instead, the history returned in the summary will contain a single change that creates a revision identical to the supplied view.
15
- * @public
16
- */
17
- function noHistorySummarizer(_editLog, currentView) {
18
- const currentTree = currentView.getChangeNodeTree();
19
- const rootId = currentTree.identifier;
20
- const changes = [];
21
- // Generate a set of changes to set the root node's children to that of the root in the currentTree
22
- Object.entries(currentTree.traits).forEach(([label, children]) => {
23
- changes.push(...EditUtilities_1.setTrait({ parent: rootId, label: label }, children));
24
- });
25
- Common_1.assert(currentTree.payload === undefined, 'setValue not yet supported.');
26
- Common_1.assert(currentTree.identifier === InitialTree_1.initialTree.identifier && currentTree.definition === InitialTree_1.initialTree.definition, 'root definition and identifier should be immutable.');
27
- const edit = generic_1.newEdit(changes);
28
- return {
29
- currentTree,
30
- sequencedEdits: [{ id: edit.id, changes: edit.changes }],
31
- version: generic_1.formatVersion,
32
- };
33
- }
34
- exports.noHistorySummarizer = noHistorySummarizer;
35
- //# sourceMappingURL=Summary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Summary.js","sourceRoot":"","sources":["../../src/default-edits/Summary.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,sCAAmC;AAGnC,gDAA6C;AAE7C,wCAAoD;AAEpD,mDAA2C;AAE3C;;;;GAIG;AACH,SAAgB,mBAAmB,CAClC,QAAgC,EAChC,WAAqB;IAErB,MAAM,WAAW,GAAG,WAAW,CAAC,iBAAiB,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,WAAW,CAAC,UAAU,CAAC;IACtC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,mGAAmG;IACnG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE;QAChE,OAAO,CAAC,IAAI,CAAC,GAAG,wBAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAmB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;IACH,eAAM,CAAC,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,6BAA6B,CAAC,CAAC;IACzE,eAAM,CACL,WAAW,CAAC,UAAU,KAAK,yBAAW,CAAC,UAAU,IAAI,WAAW,CAAC,UAAU,KAAK,yBAAW,CAAC,UAAU,EACtG,qDAAqD,CACrD,CAAC;IACF,MAAM,IAAI,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO;QACN,WAAW;QACX,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QACxD,OAAO,EAAE,uBAAa;KACtB,CAAC;AACH,CAAC;AAvBD,kDAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TraitLabel } from '../Identifiers';\nimport { assert } from '../Common';\nimport { OrderedEditSet } from '../EditLog';\nimport { Snapshot } from '../Snapshot';\nimport { initialTree } from '../InitialTree';\nimport { SharedTreeSummary_0_0_2 } from '../SummaryBackCompatibility';\nimport { formatVersion, newEdit } from '../generic';\nimport { Change } from './PersistedTypes';\nimport { setTrait } from './EditUtilities';\n\n/**\n * Does not preserve (persist) history at all.\n * Instead, the history returned in the summary will contain a single change that creates a revision identical to the supplied view.\n * @public\n */\nexport function noHistorySummarizer(\n\t_editLog: OrderedEditSet<Change>,\n\tcurrentView: Snapshot\n): SharedTreeSummary_0_0_2<Change> {\n\tconst currentTree = currentView.getChangeNodeTree();\n\tconst rootId = currentTree.identifier;\n\tconst changes: Change[] = [];\n\t// Generate a set of changes to set the root node's children to that of the root in the currentTree\n\tObject.entries(currentTree.traits).forEach(([label, children]) => {\n\t\tchanges.push(...setTrait({ parent: rootId, label: label as TraitLabel }, children));\n\t});\n\tassert(currentTree.payload === undefined, 'setValue not yet supported.');\n\tassert(\n\t\tcurrentTree.identifier === initialTree.identifier && currentTree.definition === initialTree.definition,\n\t\t'root definition and identifier should be immutable.'\n\t);\n\tconst edit = newEdit(changes);\n\n\treturn {\n\t\tcurrentTree,\n\t\tsequencedEdits: [{ id: edit.id, changes: edit.changes }],\n\t\tversion: formatVersion,\n\t};\n}\n"]}