@fluid-experimental/tree 0.58.2002 → 0.59.1000

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 (817) hide show
  1. package/README.md +159 -46
  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 -105
  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 +61 -32
  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 +129 -85
  59. package/dist/LogViewer.d.ts.map +1 -1
  60. package/dist/LogViewer.js +111 -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 +105 -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 +439 -0
  90. package/dist/SharedTree.d.ts.map +1 -0
  91. package/dist/SharedTree.js +1109 -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 +52 -0
  114. package/dist/Transaction.d.ts.map +1 -0
  115. package/dist/Transaction.js +72 -0
  116. package/dist/Transaction.js.map +1 -0
  117. package/dist/TransactionInternal.d.ts +540 -0
  118. package/dist/TransactionInternal.d.ts.map +1 -0
  119. package/dist/TransactionInternal.js +626 -0
  120. package/dist/TransactionInternal.js.map +1 -0
  121. package/dist/TreeCompressor.d.ts +36 -0
  122. package/dist/TreeCompressor.d.ts.map +1 -0
  123. package/dist/TreeCompressor.js +137 -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 +218 -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/docs/Write-Format.md +19 -0
  190. package/lib/ChangeCompression.d.ts +39 -0
  191. package/lib/ChangeCompression.d.ts.map +1 -0
  192. package/lib/ChangeCompression.js +111 -0
  193. package/lib/ChangeCompression.js.map +1 -0
  194. package/{dist/default-edits/PersistedTypes.d.ts → lib/ChangeTypes.d.ts} +58 -105
  195. package/lib/ChangeTypes.d.ts.map +1 -0
  196. package/lib/{default-edits/PersistedTypes.js → ChangeTypes.js} +15 -68
  197. package/lib/ChangeTypes.js.map +1 -0
  198. package/lib/Checkout.d.ts +39 -27
  199. package/lib/Checkout.d.ts.map +1 -1
  200. package/lib/Checkout.js +53 -24
  201. package/lib/Checkout.js.map +1 -1
  202. package/lib/Common.d.ts +175 -38
  203. package/lib/Common.d.ts.map +1 -1
  204. package/lib/Common.js +226 -101
  205. package/lib/Common.js.map +1 -1
  206. package/lib/EagerCheckout.d.ts +24 -0
  207. package/lib/EagerCheckout.d.ts.map +1 -0
  208. package/lib/{BasicCheckout.js → EagerCheckout.js} +7 -4
  209. package/lib/EagerCheckout.js.map +1 -0
  210. package/lib/EditLog.d.ts +77 -63
  211. package/lib/EditLog.d.ts.map +1 -1
  212. package/lib/EditLog.js +83 -47
  213. package/lib/EditLog.js.map +1 -1
  214. package/lib/EditUtilities.d.ts +168 -0
  215. package/lib/EditUtilities.d.ts.map +1 -0
  216. package/lib/EditUtilities.js +353 -0
  217. package/lib/EditUtilities.js.map +1 -0
  218. package/lib/EventTypes.d.ts +73 -0
  219. package/lib/EventTypes.d.ts.map +1 -0
  220. package/lib/EventTypes.js +75 -0
  221. package/lib/EventTypes.js.map +1 -0
  222. package/lib/Forest.d.ts +29 -7
  223. package/lib/Forest.d.ts.map +1 -1
  224. package/lib/Forest.js +58 -35
  225. package/lib/Forest.js.map +1 -1
  226. package/lib/HistoryEditFactory.d.ts +20 -0
  227. package/lib/HistoryEditFactory.d.ts.map +1 -0
  228. package/lib/{default-edits/HistoryEditFactory.js → HistoryEditFactory.js} +78 -39
  229. package/lib/HistoryEditFactory.js.map +1 -0
  230. package/lib/IdConversion.d.ts +12 -0
  231. package/lib/IdConversion.d.ts.map +1 -0
  232. package/lib/IdConversion.js +91 -0
  233. package/lib/IdConversion.js.map +1 -0
  234. package/lib/Identifiers.d.ts +89 -2
  235. package/lib/Identifiers.d.ts.map +1 -1
  236. package/lib/Identifiers.js +8 -1
  237. package/lib/Identifiers.js.map +1 -1
  238. package/lib/InitialTree.d.ts +2 -2
  239. package/lib/InitialTree.d.ts.map +1 -1
  240. package/lib/InitialTree.js +2 -1
  241. package/lib/InitialTree.js.map +1 -1
  242. package/lib/LazyCheckout.d.ts +28 -0
  243. package/lib/LazyCheckout.d.ts.map +1 -0
  244. package/lib/LazyCheckout.js +40 -0
  245. package/lib/LazyCheckout.js.map +1 -0
  246. package/lib/LogViewer.d.ts +129 -85
  247. package/lib/LogViewer.d.ts.map +1 -1
  248. package/lib/LogViewer.js +103 -77
  249. package/lib/LogViewer.js.map +1 -1
  250. package/lib/MergeHealth.d.ts +221 -0
  251. package/lib/MergeHealth.d.ts.map +1 -0
  252. package/lib/MergeHealth.js +258 -0
  253. package/lib/MergeHealth.js.map +1 -0
  254. package/lib/NodeIdUtilities.d.ts +105 -0
  255. package/lib/NodeIdUtilities.d.ts.map +1 -0
  256. package/lib/NodeIdUtilities.js +53 -0
  257. package/lib/NodeIdUtilities.js.map +1 -0
  258. package/lib/PayloadUtilities.d.ts +42 -0
  259. package/lib/PayloadUtilities.d.ts.map +1 -0
  260. package/lib/PayloadUtilities.js +110 -0
  261. package/lib/PayloadUtilities.js.map +1 -0
  262. package/lib/ReconciliationPath.d.ts +18 -13
  263. package/lib/ReconciliationPath.d.ts.map +1 -1
  264. package/lib/ReconciliationPath.js.map +1 -1
  265. package/lib/RevisionValueCache.d.ts +11 -2
  266. package/lib/RevisionValueCache.d.ts.map +1 -1
  267. package/lib/RevisionValueCache.js +2 -3
  268. package/lib/RevisionValueCache.js.map +1 -1
  269. package/lib/RevisionView.d.ts +83 -0
  270. package/lib/RevisionView.d.ts.map +1 -0
  271. package/lib/RevisionView.js +175 -0
  272. package/lib/RevisionView.js.map +1 -0
  273. package/lib/SerializationUtilities.d.ts +36 -0
  274. package/lib/SerializationUtilities.d.ts.map +1 -0
  275. package/lib/SerializationUtilities.js +95 -0
  276. package/lib/SerializationUtilities.js.map +1 -0
  277. package/lib/SharedTree.d.ts +439 -0
  278. package/lib/SharedTree.d.ts.map +1 -0
  279. package/lib/SharedTree.js +1104 -0
  280. package/lib/SharedTree.js.map +1 -0
  281. package/lib/SharedTreeEncoder.d.ts +102 -0
  282. package/lib/SharedTreeEncoder.d.ts.map +1 -0
  283. package/lib/SharedTreeEncoder.js +308 -0
  284. package/lib/SharedTreeEncoder.js.map +1 -0
  285. package/lib/StringInterner.d.ts +46 -0
  286. package/lib/StringInterner.d.ts.map +1 -0
  287. package/lib/StringInterner.js +57 -0
  288. package/lib/StringInterner.js.map +1 -0
  289. package/lib/Summary.d.ts +40 -0
  290. package/lib/Summary.d.ts.map +1 -0
  291. package/lib/Summary.js +19 -0
  292. package/lib/Summary.js.map +1 -0
  293. package/lib/SummaryBackCompatibility.d.ts +22 -22
  294. package/lib/SummaryBackCompatibility.d.ts.map +1 -1
  295. package/lib/SummaryBackCompatibility.js +29 -32
  296. package/lib/SummaryBackCompatibility.js.map +1 -1
  297. package/lib/SummaryTestUtilities.d.ts +31 -0
  298. package/lib/SummaryTestUtilities.d.ts.map +1 -0
  299. package/lib/SummaryTestUtilities.js +32 -0
  300. package/lib/SummaryTestUtilities.js.map +1 -0
  301. package/lib/Transaction.d.ts +52 -0
  302. package/lib/Transaction.d.ts.map +1 -0
  303. package/lib/Transaction.js +68 -0
  304. package/lib/Transaction.js.map +1 -0
  305. package/lib/TransactionInternal.d.ts +540 -0
  306. package/lib/TransactionInternal.d.ts.map +1 -0
  307. package/lib/TransactionInternal.js +622 -0
  308. package/lib/TransactionInternal.js.map +1 -0
  309. package/lib/TreeCompressor.d.ts +36 -0
  310. package/lib/TreeCompressor.d.ts.map +1 -0
  311. package/lib/TreeCompressor.js +133 -0
  312. package/lib/TreeCompressor.js.map +1 -0
  313. package/lib/TreeNodeHandle.d.ts +12 -18
  314. package/lib/TreeNodeHandle.d.ts.map +1 -1
  315. package/lib/TreeNodeHandle.js +14 -24
  316. package/lib/TreeNodeHandle.js.map +1 -1
  317. package/lib/TreeView.d.ts +166 -0
  318. package/lib/TreeView.d.ts.map +1 -0
  319. package/lib/TreeView.js +214 -0
  320. package/lib/TreeView.js.map +1 -0
  321. package/lib/TreeViewUtilities.d.ts +21 -0
  322. package/lib/TreeViewUtilities.d.ts.map +1 -0
  323. package/lib/TreeViewUtilities.js +71 -0
  324. package/lib/TreeViewUtilities.js.map +1 -0
  325. package/lib/{default-edits/UndoRedoHandler.d.ts → UndoRedoHandler.d.ts} +2 -2
  326. package/lib/UndoRedoHandler.d.ts.map +1 -0
  327. package/lib/{default-edits/UndoRedoHandler.js → UndoRedoHandler.js} +3 -7
  328. package/lib/UndoRedoHandler.js.map +1 -0
  329. package/lib/id-compressor/AppendOnlySortedMap.d.ts +127 -0
  330. package/lib/id-compressor/AppendOnlySortedMap.d.ts.map +1 -0
  331. package/lib/id-compressor/AppendOnlySortedMap.js +278 -0
  332. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -0
  333. package/lib/id-compressor/IdCompressor.d.ts +389 -0
  334. package/lib/id-compressor/IdCompressor.d.ts.map +1 -0
  335. package/lib/id-compressor/IdCompressor.js +1343 -0
  336. package/lib/id-compressor/IdCompressor.js.map +1 -0
  337. package/lib/id-compressor/IdRange.d.ts +11 -0
  338. package/lib/id-compressor/IdRange.d.ts.map +1 -0
  339. package/lib/id-compressor/IdRange.js +25 -0
  340. package/lib/id-compressor/IdRange.js.map +1 -0
  341. package/lib/id-compressor/NumericUuid.d.ts +63 -0
  342. package/lib/id-compressor/NumericUuid.d.ts.map +1 -0
  343. package/lib/id-compressor/NumericUuid.js +365 -0
  344. package/lib/id-compressor/NumericUuid.js.map +1 -0
  345. package/lib/id-compressor/index.d.ts +12 -0
  346. package/lib/id-compressor/index.d.ts.map +1 -0
  347. package/lib/id-compressor/index.js +12 -0
  348. package/lib/id-compressor/index.js.map +1 -0
  349. package/lib/id-compressor/persisted-types/0.0.1.d.ts +156 -0
  350. package/lib/id-compressor/persisted-types/0.0.1.d.ts.map +1 -0
  351. package/lib/{test/Snapshot.tests.d.ts → id-compressor/persisted-types/0.0.1.js} +1 -1
  352. package/lib/id-compressor/persisted-types/0.0.1.js.map +1 -0
  353. package/lib/id-compressor/persisted-types/index.d.ts +6 -0
  354. package/lib/id-compressor/persisted-types/index.d.ts.map +1 -0
  355. package/lib/id-compressor/persisted-types/index.js +6 -0
  356. package/lib/id-compressor/persisted-types/index.js.map +1 -0
  357. package/lib/index.d.ts +29 -9
  358. package/lib/index.d.ts.map +1 -1
  359. package/lib/index.js +23 -6
  360. package/lib/index.js.map +1 -1
  361. package/lib/persisted-types/0.0.2.d.ts +385 -0
  362. package/lib/persisted-types/0.0.2.d.ts.map +1 -0
  363. package/lib/persisted-types/0.0.2.js +110 -0
  364. package/lib/persisted-types/0.0.2.js.map +1 -0
  365. package/lib/persisted-types/0.1.1.d.ts +314 -0
  366. package/lib/persisted-types/0.1.1.d.ts.map +1 -0
  367. package/lib/persisted-types/0.1.1.js +150 -0
  368. package/lib/persisted-types/0.1.1.js.map +1 -0
  369. package/lib/persisted-types/index.d.ts +7 -0
  370. package/lib/persisted-types/index.d.ts.map +1 -0
  371. package/lib/persisted-types/index.js +8 -0
  372. package/lib/persisted-types/index.js.map +1 -0
  373. package/lib/test/AppendOnlySortedMap.tests.d.ts +6 -0
  374. package/lib/test/AppendOnlySortedMap.tests.d.ts.map +1 -0
  375. package/lib/test/AppendOnlySortedMap.tests.js +169 -0
  376. package/lib/test/AppendOnlySortedMap.tests.js.map +1 -0
  377. package/lib/test/{SnapshotUtilities.tests.d.ts → ChangeCompression.tests.d.ts} +1 -1
  378. package/lib/test/ChangeCompression.tests.d.ts.map +1 -0
  379. package/lib/test/ChangeCompression.tests.js +145 -0
  380. package/lib/test/ChangeCompression.tests.js.map +1 -0
  381. package/lib/test/Checkout.tests.d.ts +2 -3
  382. package/lib/test/Checkout.tests.d.ts.map +1 -1
  383. package/lib/test/Checkout.tests.js +126 -69
  384. package/lib/test/Checkout.tests.js.map +1 -1
  385. package/lib/test/Common.tests.js +60 -2
  386. package/lib/test/Common.tests.js.map +1 -1
  387. package/lib/test/{BasicCheckout.tests.d.ts → EagerCheckout.tests.d.ts} +1 -1
  388. package/lib/test/EagerCheckout.tests.d.ts.map +1 -0
  389. package/lib/test/EagerCheckout.tests.js +20 -0
  390. package/lib/test/EagerCheckout.tests.js.map +1 -0
  391. package/lib/test/Edit.tests.js +22 -14
  392. package/lib/test/Edit.tests.js.map +1 -1
  393. package/lib/test/{Anchors.glassBox.tests.d.ts → EditLog.perf.tests.d.ts} +1 -1
  394. package/lib/test/EditLog.perf.tests.d.ts.map +1 -0
  395. package/lib/test/EditLog.perf.tests.js +30 -0
  396. package/lib/test/EditLog.perf.tests.js.map +1 -0
  397. package/lib/test/EditLog.tests.js +10 -6
  398. package/lib/test/EditLog.tests.js.map +1 -1
  399. package/lib/test/EditUtilities.tests.d.ts +6 -0
  400. package/lib/test/EditUtilities.tests.d.ts.map +1 -0
  401. package/lib/test/EditUtilities.tests.js +503 -0
  402. package/lib/test/EditUtilities.tests.js.map +1 -0
  403. package/lib/test/Forest.perf.tests.d.ts +6 -0
  404. package/lib/test/Forest.perf.tests.d.ts.map +1 -0
  405. package/lib/test/Forest.perf.tests.js +133 -0
  406. package/lib/test/Forest.perf.tests.js.map +1 -0
  407. package/lib/test/Forest.tests.js +54 -27
  408. package/lib/test/Forest.tests.js.map +1 -1
  409. package/lib/test/GenericTransaction.tests.js +12 -3
  410. package/lib/test/GenericTransaction.tests.js.map +1 -1
  411. package/lib/test/HistoryEditFactory.tests.d.ts +6 -0
  412. package/lib/test/HistoryEditFactory.tests.d.ts.map +1 -0
  413. package/lib/test/HistoryEditFactory.tests.js +90 -0
  414. package/lib/test/HistoryEditFactory.tests.js.map +1 -0
  415. package/lib/test/IdCompressor.perf.tests.d.ts +6 -0
  416. package/lib/test/IdCompressor.perf.tests.d.ts.map +1 -0
  417. package/lib/test/IdCompressor.perf.tests.js +304 -0
  418. package/lib/test/IdCompressor.perf.tests.js.map +1 -0
  419. package/lib/test/IdCompressor.tests.d.ts +6 -0
  420. package/lib/test/IdCompressor.tests.d.ts.map +1 -0
  421. package/lib/test/IdCompressor.tests.js +1075 -0
  422. package/lib/test/IdCompressor.tests.js.map +1 -0
  423. package/lib/test/IdConversion.tests.d.ts +6 -0
  424. package/lib/test/IdConversion.tests.d.ts.map +1 -0
  425. package/lib/test/IdConversion.tests.js +36 -0
  426. package/lib/test/IdConversion.tests.js.map +1 -0
  427. package/lib/test/LazyCheckout.tests.d.ts +6 -0
  428. package/lib/test/LazyCheckout.tests.d.ts.map +1 -0
  429. package/lib/test/LazyCheckout.tests.js +22 -0
  430. package/lib/test/LazyCheckout.tests.js.map +1 -0
  431. package/lib/test/LogViewer.tests.js +276 -191
  432. package/lib/test/LogViewer.tests.js.map +1 -1
  433. package/lib/test/{SharedTreeWithAnchors.tests.d.ts → MergeHealthTelemetryHeartbeat.tests.d.ts} +1 -1
  434. package/lib/test/MergeHealthTelemetryHeartbeat.tests.d.ts.map +1 -0
  435. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +342 -0
  436. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -0
  437. package/lib/test/NumericUuid.perf.tests.d.ts +6 -0
  438. package/lib/test/NumericUuid.perf.tests.d.ts.map +1 -0
  439. package/lib/test/NumericUuid.perf.tests.js +68 -0
  440. package/lib/test/NumericUuid.perf.tests.js.map +1 -0
  441. package/lib/test/NumericUuid.tests.d.ts +6 -0
  442. package/lib/test/NumericUuid.tests.d.ts.map +1 -0
  443. package/lib/test/NumericUuid.tests.js +191 -0
  444. package/lib/test/NumericUuid.tests.js.map +1 -0
  445. package/lib/test/RevisionView.tests.d.ts +6 -0
  446. package/lib/test/RevisionView.tests.d.ts.map +1 -0
  447. package/lib/test/RevisionView.tests.js +133 -0
  448. package/lib/test/RevisionView.tests.js.map +1 -0
  449. package/lib/test/SharedTree.perf.tests.d.ts +6 -0
  450. package/lib/test/SharedTree.perf.tests.d.ts.map +1 -0
  451. package/lib/test/SharedTree.perf.tests.js +39 -0
  452. package/lib/test/SharedTree.perf.tests.js.map +1 -0
  453. package/lib/test/SharedTree.tests.js +15 -3
  454. package/lib/test/SharedTree.tests.js.map +1 -1
  455. package/lib/test/StringInterner.tests.d.ts +6 -0
  456. package/lib/test/StringInterner.tests.d.ts.map +1 -0
  457. package/lib/test/StringInterner.tests.js +71 -0
  458. package/lib/test/StringInterner.tests.js.map +1 -0
  459. package/lib/test/Summary.tests.d.ts +8 -0
  460. package/lib/test/Summary.tests.d.ts.map +1 -0
  461. package/lib/test/Summary.tests.js +407 -0
  462. package/lib/test/Summary.tests.js.map +1 -0
  463. package/lib/test/Transaction.tests.js +76 -330
  464. package/lib/test/Transaction.tests.js.map +1 -1
  465. package/lib/test/TransactionInternal.tests.d.ts +6 -0
  466. package/lib/test/TransactionInternal.tests.d.ts.map +1 -0
  467. package/lib/test/TransactionInternal.tests.js +568 -0
  468. package/lib/test/TransactionInternal.tests.js.map +1 -0
  469. package/lib/test/TreeCompression.tests.d.ts +6 -0
  470. package/lib/test/TreeCompression.tests.d.ts.map +1 -0
  471. package/lib/test/TreeCompression.tests.js +292 -0
  472. package/lib/test/TreeCompression.tests.js.map +1 -0
  473. package/lib/test/TreeView.tests.d.ts +6 -0
  474. package/lib/test/TreeView.tests.d.ts.map +1 -0
  475. package/lib/test/TreeView.tests.js +176 -0
  476. package/lib/test/TreeView.tests.js.map +1 -0
  477. package/lib/test/UndoRedoHandler.tests.js +2 -2
  478. package/lib/test/UndoRedoHandler.tests.js.map +1 -1
  479. package/lib/test/Virtualization.tests.js +146 -62
  480. package/lib/test/Virtualization.tests.js.map +1 -1
  481. package/lib/test/fuzz/Generators.d.ts +19 -0
  482. package/lib/test/fuzz/Generators.d.ts.map +1 -0
  483. package/lib/test/fuzz/Generators.js +420 -0
  484. package/lib/test/fuzz/Generators.js.map +1 -0
  485. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts +20 -0
  486. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -0
  487. package/lib/test/fuzz/SharedTreeFuzzTests.js +217 -0
  488. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -0
  489. package/lib/test/fuzz/Types.d.ts +133 -0
  490. package/lib/test/fuzz/Types.d.ts.map +1 -0
  491. package/lib/test/{GenericTransactionWithAnchors.tests.d.ts → fuzz/Types.js} +2 -2
  492. package/lib/test/fuzz/Types.js.map +1 -0
  493. package/lib/test/utilities/IdCompressorTestUtilities.d.ts +180 -0
  494. package/lib/test/utilities/IdCompressorTestUtilities.d.ts.map +1 -0
  495. package/lib/test/utilities/IdCompressorTestUtilities.js +528 -0
  496. package/lib/test/utilities/IdCompressorTestUtilities.js.map +1 -0
  497. package/lib/test/utilities/MockTransaction.d.ts +26 -7
  498. package/lib/test/utilities/MockTransaction.d.ts.map +1 -1
  499. package/lib/test/utilities/MockTransaction.js +40 -11
  500. package/lib/test/utilities/MockTransaction.js.map +1 -1
  501. package/lib/test/utilities/PendingLocalStateTests.d.ts +12 -0
  502. package/lib/test/utilities/PendingLocalStateTests.d.ts.map +1 -0
  503. package/lib/test/utilities/PendingLocalStateTests.js +105 -0
  504. package/lib/test/utilities/PendingLocalStateTests.js.map +1 -0
  505. package/lib/test/utilities/SharedTreeTests.d.ts +3 -4
  506. package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
  507. package/lib/test/utilities/SharedTreeTests.js +696 -439
  508. package/lib/test/utilities/SharedTreeTests.js.map +1 -1
  509. package/lib/test/utilities/SharedTreeVersioningTests.d.ts +11 -0
  510. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -0
  511. package/lib/test/utilities/SharedTreeVersioningTests.js +370 -0
  512. package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -0
  513. package/lib/test/utilities/SummaryLoadPerfTests.d.ts +10 -0
  514. package/lib/test/utilities/SummaryLoadPerfTests.d.ts.map +1 -0
  515. package/lib/test/utilities/SummaryLoadPerfTests.js +102 -0
  516. package/lib/test/utilities/SummaryLoadPerfTests.js.map +1 -0
  517. package/lib/test/utilities/SummarySizeTests.d.ts +11 -0
  518. package/lib/test/utilities/SummarySizeTests.d.ts.map +1 -0
  519. package/lib/test/utilities/SummarySizeTests.js +158 -0
  520. package/lib/test/utilities/SummarySizeTests.js.map +1 -0
  521. package/lib/test/utilities/TestCommon.d.ts +9 -0
  522. package/lib/test/utilities/TestCommon.d.ts.map +1 -0
  523. package/lib/test/utilities/TestCommon.js +13 -0
  524. package/lib/test/utilities/TestCommon.js.map +1 -0
  525. package/lib/test/utilities/TestNode.d.ts +140 -0
  526. package/lib/test/utilities/TestNode.d.ts.map +1 -0
  527. package/lib/test/utilities/TestNode.js +292 -0
  528. package/lib/test/utilities/TestNode.js.map +1 -0
  529. package/lib/test/utilities/TestUtilities.d.ts +84 -70
  530. package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
  531. package/lib/test/utilities/TestUtilities.js +218 -143
  532. package/lib/test/utilities/TestUtilities.js.map +1 -1
  533. package/lib/test/utilities/UndoRedoTests.d.ts +4 -5
  534. package/lib/test/utilities/UndoRedoTests.d.ts.map +1 -1
  535. package/lib/test/utilities/UndoRedoTests.js +138 -149
  536. package/lib/test/utilities/UndoRedoTests.js.map +1 -1
  537. package/package.json +22 -17
  538. package/src/ChangeCompression.ts +159 -0
  539. package/src/{default-edits/PersistedTypes.ts → ChangeTypes.ts} +62 -125
  540. package/src/Checkout.ts +82 -53
  541. package/src/Common.ts +317 -117
  542. package/src/EagerCheckout.ts +38 -0
  543. package/src/EditLog.ts +153 -100
  544. package/src/EditUtilities.ts +559 -0
  545. package/src/EventTypes.ts +74 -0
  546. package/src/Forest.ts +81 -73
  547. package/src/{default-edits/HistoryEditFactory.ts → HistoryEditFactory.ts} +103 -53
  548. package/src/IdConversion.ts +125 -0
  549. package/src/Identifiers.ts +101 -1
  550. package/src/InitialTree.ts +5 -4
  551. package/src/LazyCheckout.ts +51 -0
  552. package/src/LogViewer.ts +242 -166
  553. package/src/MergeHealth.ts +447 -0
  554. package/src/NodeIdUtilities.ts +156 -0
  555. package/src/PayloadUtilities.ts +124 -0
  556. package/src/ReconciliationPath.ts +18 -13
  557. package/src/RevisionValueCache.ts +14 -5
  558. package/src/RevisionView.ts +252 -0
  559. package/src/SerializationUtilities.ts +130 -0
  560. package/src/SharedTree.ts +1501 -0
  561. package/src/SharedTreeEncoder.ts +493 -0
  562. package/src/StringInterner.ts +72 -0
  563. package/src/Summary.ts +48 -0
  564. package/src/SummaryBackCompatibility.ts +47 -57
  565. package/src/SummaryTestUtilities.ts +54 -0
  566. package/src/Transaction.ts +89 -0
  567. package/src/TransactionInternal.ts +1087 -0
  568. package/src/TreeCompressor.ts +213 -0
  569. package/src/TreeNodeHandle.ts +19 -32
  570. package/src/TreeView.ts +322 -0
  571. package/src/TreeViewUtilities.ts +77 -0
  572. package/src/{default-edits/UndoRedoHandler.ts → UndoRedoHandler.ts} +8 -13
  573. package/src/id-compressor/AppendOnlySortedMap.ts +325 -0
  574. package/src/id-compressor/IdCompressor.md +3 -0
  575. package/src/id-compressor/IdCompressor.ts +1848 -0
  576. package/src/id-compressor/IdRange.ts +33 -0
  577. package/src/id-compressor/NumericUuid.ts +414 -0
  578. package/src/id-compressor/index.ts +13 -0
  579. package/src/id-compressor/persisted-types/0.0.1.ts +179 -0
  580. package/src/id-compressor/persisted-types/README.md +3 -0
  581. package/src/id-compressor/persisted-types/index.ts +6 -0
  582. package/src/index.ts +118 -59
  583. package/src/persisted-types/0.0.2.ts +442 -0
  584. package/src/persisted-types/0.1.1.ts +476 -0
  585. package/src/persisted-types/README.md +22 -0
  586. package/src/persisted-types/index.ts +9 -0
  587. package/.mocharc.js +0 -41
  588. package/api/tree.api.md +0 -729
  589. package/dist/BasicCheckout.d.ts +0 -23
  590. package/dist/BasicCheckout.d.ts.map +0 -1
  591. package/dist/BasicCheckout.js.map +0 -1
  592. package/dist/Snapshot.d.ts +0 -198
  593. package/dist/Snapshot.d.ts.map +0 -1
  594. package/dist/Snapshot.js +0 -267
  595. package/dist/Snapshot.js.map +0 -1
  596. package/dist/SnapshotUtilities.d.ts +0 -29
  597. package/dist/SnapshotUtilities.d.ts.map +0 -1
  598. package/dist/SnapshotUtilities.js +0 -73
  599. package/dist/SnapshotUtilities.js.map +0 -1
  600. package/dist/anchored-edits/AnchorResolution.d.ts +0 -144
  601. package/dist/anchored-edits/AnchorResolution.d.ts.map +0 -1
  602. package/dist/anchored-edits/AnchorResolution.js +0 -162
  603. package/dist/anchored-edits/AnchorResolution.js.map +0 -1
  604. package/dist/anchored-edits/Factory.d.ts +0 -56
  605. package/dist/anchored-edits/Factory.d.ts.map +0 -1
  606. package/dist/anchored-edits/Factory.js +0 -79
  607. package/dist/anchored-edits/Factory.js.map +0 -1
  608. package/dist/anchored-edits/PersistedTypes.d.ts +0 -245
  609. package/dist/anchored-edits/PersistedTypes.d.ts.map +0 -1
  610. package/dist/anchored-edits/PersistedTypes.js +0 -131
  611. package/dist/anchored-edits/PersistedTypes.js.map +0 -1
  612. package/dist/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
  613. package/dist/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
  614. package/dist/anchored-edits/SharedTreeWithAnchors.js +0 -115
  615. package/dist/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
  616. package/dist/anchored-edits/TransactionWithAnchors.d.ts +0 -28
  617. package/dist/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
  618. package/dist/anchored-edits/TransactionWithAnchors.js +0 -36
  619. package/dist/anchored-edits/TransactionWithAnchors.js.map +0 -1
  620. package/dist/anchored-edits/index.d.ts +0 -10
  621. package/dist/anchored-edits/index.d.ts.map +0 -1
  622. package/dist/anchored-edits/index.js +0 -34
  623. package/dist/anchored-edits/index.js.map +0 -1
  624. package/dist/default-edits/EditUtilities.d.ts +0 -57
  625. package/dist/default-edits/EditUtilities.d.ts.map +0 -1
  626. package/dist/default-edits/EditUtilities.js +0 -192
  627. package/dist/default-edits/EditUtilities.js.map +0 -1
  628. package/dist/default-edits/Factory.d.ts +0 -56
  629. package/dist/default-edits/Factory.d.ts.map +0 -1
  630. package/dist/default-edits/Factory.js +0 -79
  631. package/dist/default-edits/Factory.js.map +0 -1
  632. package/dist/default-edits/HistoryEditFactory.d.ts +0 -19
  633. package/dist/default-edits/HistoryEditFactory.d.ts.map +0 -1
  634. package/dist/default-edits/HistoryEditFactory.js +0 -187
  635. package/dist/default-edits/HistoryEditFactory.js.map +0 -1
  636. package/dist/default-edits/PersistedTypes.d.ts.map +0 -1
  637. package/dist/default-edits/PersistedTypes.js.map +0 -1
  638. package/dist/default-edits/SharedTree.d.ts +0 -111
  639. package/dist/default-edits/SharedTree.d.ts.map +0 -1
  640. package/dist/default-edits/SharedTree.js +0 -124
  641. package/dist/default-edits/SharedTree.js.map +0 -1
  642. package/dist/default-edits/Summary.d.ts +0 -15
  643. package/dist/default-edits/Summary.d.ts.map +0 -1
  644. package/dist/default-edits/Summary.js +0 -35
  645. package/dist/default-edits/Summary.js.map +0 -1
  646. package/dist/default-edits/Transaction.d.ts +0 -41
  647. package/dist/default-edits/Transaction.d.ts.map +0 -1
  648. package/dist/default-edits/Transaction.js +0 -225
  649. package/dist/default-edits/Transaction.js.map +0 -1
  650. package/dist/default-edits/UndoRedoHandler.d.ts.map +0 -1
  651. package/dist/default-edits/UndoRedoHandler.js.map +0 -1
  652. package/dist/default-edits/index.d.ts +0 -13
  653. package/dist/default-edits/index.d.ts.map +0 -1
  654. package/dist/default-edits/index.js +0 -41
  655. package/dist/default-edits/index.js.map +0 -1
  656. package/dist/generic/GenericEditUtilities.d.ts +0 -26
  657. package/dist/generic/GenericEditUtilities.d.ts.map +0 -1
  658. package/dist/generic/GenericEditUtilities.js +0 -45
  659. package/dist/generic/GenericEditUtilities.js.map +0 -1
  660. package/dist/generic/GenericSharedTree.d.ts +0 -221
  661. package/dist/generic/GenericSharedTree.d.ts.map +0 -1
  662. package/dist/generic/GenericSharedTree.js +0 -447
  663. package/dist/generic/GenericSharedTree.js.map +0 -1
  664. package/dist/generic/GenericTransaction.d.ts +0 -87
  665. package/dist/generic/GenericTransaction.d.ts.map +0 -1
  666. package/dist/generic/GenericTransaction.js +0 -144
  667. package/dist/generic/GenericTransaction.js.map +0 -1
  668. package/dist/generic/PersistedTypes.d.ts +0 -194
  669. package/dist/generic/PersistedTypes.d.ts.map +0 -1
  670. package/dist/generic/PersistedTypes.js +0 -42
  671. package/dist/generic/PersistedTypes.js.map +0 -1
  672. package/dist/generic/Summary.d.ts +0 -63
  673. package/dist/generic/Summary.d.ts.map +0 -1
  674. package/dist/generic/Summary.js +0 -64
  675. package/dist/generic/Summary.js.map +0 -1
  676. package/dist/generic/index.d.ts +0 -10
  677. package/dist/generic/index.d.ts.map +0 -1
  678. package/dist/generic/index.js +0 -26
  679. package/dist/generic/index.js.map +0 -1
  680. package/docs/Future.md +0 -155
  681. package/lib/BasicCheckout.d.ts +0 -23
  682. package/lib/BasicCheckout.d.ts.map +0 -1
  683. package/lib/BasicCheckout.js.map +0 -1
  684. package/lib/Snapshot.d.ts +0 -198
  685. package/lib/Snapshot.d.ts.map +0 -1
  686. package/lib/Snapshot.js +0 -263
  687. package/lib/Snapshot.js.map +0 -1
  688. package/lib/SnapshotUtilities.d.ts +0 -29
  689. package/lib/SnapshotUtilities.d.ts.map +0 -1
  690. package/lib/SnapshotUtilities.js +0 -67
  691. package/lib/SnapshotUtilities.js.map +0 -1
  692. package/lib/anchored-edits/AnchorResolution.d.ts +0 -144
  693. package/lib/anchored-edits/AnchorResolution.d.ts.map +0 -1
  694. package/lib/anchored-edits/AnchorResolution.js +0 -152
  695. package/lib/anchored-edits/AnchorResolution.js.map +0 -1
  696. package/lib/anchored-edits/Factory.d.ts +0 -56
  697. package/lib/anchored-edits/Factory.d.ts.map +0 -1
  698. package/lib/anchored-edits/Factory.js +0 -74
  699. package/lib/anchored-edits/Factory.js.map +0 -1
  700. package/lib/anchored-edits/PersistedTypes.d.ts +0 -245
  701. package/lib/anchored-edits/PersistedTypes.d.ts.map +0 -1
  702. package/lib/anchored-edits/PersistedTypes.js +0 -128
  703. package/lib/anchored-edits/PersistedTypes.js.map +0 -1
  704. package/lib/anchored-edits/SharedTreeWithAnchors.d.ts +0 -120
  705. package/lib/anchored-edits/SharedTreeWithAnchors.d.ts.map +0 -1
  706. package/lib/anchored-edits/SharedTreeWithAnchors.js +0 -110
  707. package/lib/anchored-edits/SharedTreeWithAnchors.js.map +0 -1
  708. package/lib/anchored-edits/TransactionWithAnchors.d.ts +0 -28
  709. package/lib/anchored-edits/TransactionWithAnchors.d.ts.map +0 -1
  710. package/lib/anchored-edits/TransactionWithAnchors.js +0 -32
  711. package/lib/anchored-edits/TransactionWithAnchors.js.map +0 -1
  712. package/lib/anchored-edits/index.d.ts +0 -10
  713. package/lib/anchored-edits/index.d.ts.map +0 -1
  714. package/lib/anchored-edits/index.js +0 -11
  715. package/lib/anchored-edits/index.js.map +0 -1
  716. package/lib/default-edits/EditUtilities.d.ts +0 -57
  717. package/lib/default-edits/EditUtilities.d.ts.map +0 -1
  718. package/lib/default-edits/EditUtilities.js +0 -181
  719. package/lib/default-edits/EditUtilities.js.map +0 -1
  720. package/lib/default-edits/Factory.d.ts +0 -56
  721. package/lib/default-edits/Factory.d.ts.map +0 -1
  722. package/lib/default-edits/Factory.js +0 -74
  723. package/lib/default-edits/Factory.js.map +0 -1
  724. package/lib/default-edits/HistoryEditFactory.d.ts +0 -19
  725. package/lib/default-edits/HistoryEditFactory.d.ts.map +0 -1
  726. package/lib/default-edits/HistoryEditFactory.js.map +0 -1
  727. package/lib/default-edits/PersistedTypes.d.ts.map +0 -1
  728. package/lib/default-edits/PersistedTypes.js.map +0 -1
  729. package/lib/default-edits/SharedTree.d.ts +0 -111
  730. package/lib/default-edits/SharedTree.d.ts.map +0 -1
  731. package/lib/default-edits/SharedTree.js +0 -100
  732. package/lib/default-edits/SharedTree.js.map +0 -1
  733. package/lib/default-edits/Summary.d.ts +0 -15
  734. package/lib/default-edits/Summary.d.ts.map +0 -1
  735. package/lib/default-edits/Summary.js +0 -31
  736. package/lib/default-edits/Summary.js.map +0 -1
  737. package/lib/default-edits/Transaction.d.ts +0 -41
  738. package/lib/default-edits/Transaction.d.ts.map +0 -1
  739. package/lib/default-edits/Transaction.js +0 -221
  740. package/lib/default-edits/Transaction.js.map +0 -1
  741. package/lib/default-edits/UndoRedoHandler.d.ts.map +0 -1
  742. package/lib/default-edits/UndoRedoHandler.js.map +0 -1
  743. package/lib/default-edits/index.d.ts +0 -13
  744. package/lib/default-edits/index.d.ts.map +0 -1
  745. package/lib/default-edits/index.js +0 -14
  746. package/lib/default-edits/index.js.map +0 -1
  747. package/lib/generic/GenericEditUtilities.d.ts +0 -26
  748. package/lib/generic/GenericEditUtilities.d.ts.map +0 -1
  749. package/lib/generic/GenericEditUtilities.js +0 -38
  750. package/lib/generic/GenericEditUtilities.js.map +0 -1
  751. package/lib/generic/GenericSharedTree.d.ts +0 -221
  752. package/lib/generic/GenericSharedTree.d.ts.map +0 -1
  753. package/lib/generic/GenericSharedTree.js +0 -443
  754. package/lib/generic/GenericSharedTree.js.map +0 -1
  755. package/lib/generic/GenericTransaction.d.ts +0 -87
  756. package/lib/generic/GenericTransaction.d.ts.map +0 -1
  757. package/lib/generic/GenericTransaction.js +0 -140
  758. package/lib/generic/GenericTransaction.js.map +0 -1
  759. package/lib/generic/PersistedTypes.d.ts +0 -194
  760. package/lib/generic/PersistedTypes.d.ts.map +0 -1
  761. package/lib/generic/PersistedTypes.js +0 -39
  762. package/lib/generic/PersistedTypes.js.map +0 -1
  763. package/lib/generic/Summary.d.ts +0 -63
  764. package/lib/generic/Summary.d.ts.map +0 -1
  765. package/lib/generic/Summary.js +0 -58
  766. package/lib/generic/Summary.js.map +0 -1
  767. package/lib/generic/index.d.ts +0 -10
  768. package/lib/generic/index.d.ts.map +0 -1
  769. package/lib/generic/index.js +0 -11
  770. package/lib/generic/index.js.map +0 -1
  771. package/lib/test/Anchors.glassBox.tests.d.ts.map +0 -1
  772. package/lib/test/Anchors.glassBox.tests.js +0 -410
  773. package/lib/test/Anchors.glassBox.tests.js.map +0 -1
  774. package/lib/test/BasicCheckout.tests.d.ts.map +0 -1
  775. package/lib/test/BasicCheckout.tests.js +0 -8
  776. package/lib/test/BasicCheckout.tests.js.map +0 -1
  777. package/lib/test/GenericTransactionWithAnchors.tests.d.ts.map +0 -1
  778. package/lib/test/GenericTransactionWithAnchors.tests.js +0 -25
  779. package/lib/test/GenericTransactionWithAnchors.tests.js.map +0 -1
  780. package/lib/test/SharedTreeWithAnchors.tests.d.ts.map +0 -1
  781. package/lib/test/SharedTreeWithAnchors.tests.js +0 -420
  782. package/lib/test/SharedTreeWithAnchors.tests.js.map +0 -1
  783. package/lib/test/Snapshot.tests.d.ts.map +0 -1
  784. package/lib/test/Snapshot.tests.js +0 -96
  785. package/lib/test/Snapshot.tests.js.map +0 -1
  786. package/lib/test/SnapshotUtilities.tests.d.ts.map +0 -1
  787. package/lib/test/SnapshotUtilities.tests.js +0 -168
  788. package/lib/test/SnapshotUtilities.tests.js.map +0 -1
  789. package/lib/test/undoRedoStackManager.d.ts +0 -26
  790. package/lib/test/undoRedoStackManager.d.ts.map +0 -1
  791. package/lib/test/undoRedoStackManager.js +0 -176
  792. package/lib/test/undoRedoStackManager.js.map +0 -1
  793. package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts +0 -13
  794. package/lib/test/utilities/SummaryFormatCompatibilityTests.d.ts.map +0 -1
  795. package/lib/test/utilities/SummaryFormatCompatibilityTests.js +0 -154
  796. package/lib/test/utilities/SummaryFormatCompatibilityTests.js.map +0 -1
  797. package/src/BasicCheckout.ts +0 -34
  798. package/src/Snapshot.ts +0 -363
  799. package/src/SnapshotUtilities.ts +0 -88
  800. package/src/anchored-edits/AnchorResolution.ts +0 -442
  801. package/src/anchored-edits/Factory.ts +0 -94
  802. package/src/anchored-edits/PersistedTypes.ts +0 -310
  803. package/src/anchored-edits/SharedTreeWithAnchors.ts +0 -200
  804. package/src/anchored-edits/TransactionWithAnchors.ts +0 -39
  805. package/src/anchored-edits/index.ts +0 -21
  806. package/src/default-edits/EditUtilities.ts +0 -220
  807. package/src/default-edits/Factory.ts +0 -94
  808. package/src/default-edits/SharedTree.ts +0 -174
  809. package/src/default-edits/Summary.ts +0 -44
  810. package/src/default-edits/Transaction.ts +0 -262
  811. package/src/default-edits/index.ts +0 -29
  812. package/src/generic/GenericEditUtilities.ts +0 -46
  813. package/src/generic/GenericSharedTree.ts +0 -593
  814. package/src/generic/GenericTransaction.ts +0 -194
  815. package/src/generic/PersistedTypes.ts +0 -221
  816. package/src/generic/Summary.ts +0 -113
  817. package/src/generic/index.ts +0 -41
@@ -1 +1 @@
1
- {"version":3,"file":"EditLog.js","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,+DAAyD;AAEzD,qCAA2E;AAG3E,2DAA2D;AAoJ3D;;GAEG;AACH,SAAgB,iBAAiB,CAAU,IAAmB;IAC7D,MAAM,aAAa,mCAAQ,IAAI,KAAE,EAAE,EAAE,SAAS,GAAE,CAAC;IACjD,OAAO,aAAa,CAAC,EAAE,CAAC;IACxB,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC;AAJD,8CAIC;AAED,SAAS,aAAa,CAAU,EAAU,EAAE,IAA4B;IACvE,uBAAS,EAAE,IAAK,IAAI,EAAG;AACxB,CAAC;AAED;;;;KAIK;AACL,MAAM,oBAAoB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAStD;;;;;;GAMG;AACH,MAAa,OAAO;IAoCnB;;;;OAIG;IACH,YACC,U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EO,aAAa,CAAC,MAAc;QACnC,6FAA6F;QAC7F,IAAI,MAAM,IAAI,IAAI,CAAC,qBAAqB,EAAE;YACzC,sFAAsF;YACtF,IAAI,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAEnC,qEAAqE;YACrE,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,oBAAoB,EAAE;gBACxD,MAAM,YAAY,GAAG,2BAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;gBACvE,MAAM,YAAY,GAAG,2BAAkB,CACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EACjC,mEAAmE,CACnE,CAAC;gBACF,YAAY,CAAC,KAAK,GAAG,SAAS,CAAC;aAC/B;SACD;IACF,CAAC;CACD;AArcD,0BAqcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport { IsoBuffer } from '@fluidframework/common-utils';\nimport { ITelemetryLogger } from '@fluidframework/common-definitions';\nimport { assert, assertNotUndefined, compareArrays, fail } from './Common';\nimport { Edit, EditWithoutId } from './generic';\nimport { EditId } from './Identifiers';\nimport { compareFiniteNumbers } from './SnapshotUtilities';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * Edits are virtualized, however, edits added during the current session are guaranteed to be available\n * synchronously.\n * @public\n * @sealed\n */\nexport interface OrderedEditSet<TChange> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n\n\t/**\n\t * @param useHandles - By default, false. If true, returns handles instead of edit chunks where possible.\n\t * \t\t\t\t\t TODO:#49901: This parameter is used for testing and should be removed once format version 0.1.0 is written.\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tgetEditLogSummary(useHandles?: boolean): EditLogSummary<TChange>;\n}\n\n/**\n * Information used to populate an edit log.\n * @internal\n */\nexport interface EditLogSummary<TChange> {\n\t/**\n\t * A of list of serialized chunks and their corresponding keys.\n\t * Start revision is the index of the first edit in the chunk in relation to the edit log.\n\t */\n\treadonly editChunks: readonly { readonly startRevision: number; readonly chunk: EditChunkOrHandle<TChange> }[];\n\n\t/**\n\t * A list of edits IDs for all sequenced edits.\n\t */\n\treadonly editIds: readonly EditId[];\n}\n\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * Can be satisfied by IFluidHandle<ArrayBufferLike>.\n * @internal\n */\nexport interface EditHandle {\n\treadonly get: () => Promise<ArrayBufferLike>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\ninterface EditChunk<TChange> {\n\thandle?: EditHandle;\n\tedits?: EditWithoutId<TChange>[];\n}\n\n/**\n * Either a chunk of edits or a handle that can be used to load that chunk.\n * @internal\n */\nexport type EditChunkOrHandle<TChange> = EditHandle | readonly EditWithoutId<TChange>[];\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): { id: EditId; editWithoutId: EditWithoutId<TChange> } {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\nfunction joinEditAndId<TChange>(id: EditId, edit: EditWithoutId<TChange>): Edit<TChange> {\n\treturn { id, ...edit };\n}\n\n/**\n * The number of blobs to be loaded in memory at any time.\n * TODO:#49901: Change cache size once the virtualized history summary format is being written.\n * \t\t This is so the summarizer doesn't have to reload every edit to generate summaries.\n * */\nconst loadedChunkCacheSize = Number.POSITIVE_INFINITY;\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n */\nexport class EditLog<TChange> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEditIds: EditId[];\n\tprivate readonly editChunks: BTree<number, EditChunk<TChange>>;\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\n\tprivate readonly loadedChunkCache: number[] = [];\n\tprivate readonly indexOfFirstEditInSession: number;\n\tprivate readonly maximumEvictableIndex: number;\n\n\tprivate readonly allEditIds: Map<EditId, OrderedEditId> = new Map();\n\tprivate readonly editAddedHandlers: EditAddedHandler<TChange>[] = [];\n\n\tprivate readonly logger?: ITelemetryLogger;\n\n\t/**\n\t * The number of edits associated with each blob.\n\t */\n\tpublic readonly editsPerChunk: number;\n\n\t/**\n\t * @returns The index of the earliest edit available through `getEditInSessionAtIndex`.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this.maximumEvictableIndex + 1;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange> = { editIds: [], editChunks: [] },\n\t\tlogger?: ITelemetryLogger,\n\t\teditsPerChunk = 100\n\t) {\n\t\tconst { editChunks, editIds } = summary;\n\t\tthis.logger = logger;\n\t\tthis.editsPerChunk = editsPerChunk;\n\n\t\tthis.editChunks = new BTree<number, EditChunk<TChange>>(undefined, compareFiniteNumbers);\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (Array.isArray(chunk)) {\n\t\t\t\tthis.editChunks.set(startRevision, { edits: chunk });\n\t\t\t} else {\n\t\t\t\tthis.editChunks.set(startRevision, {\n\t\t\t\t\t// This typecast should not be required,\n\t\t\t\t\t// however typescript fails to infer types correctly in the case of readonly arrays guarded by Array.isArray\n\t\t\t\t\t// See https://github.com/microsoft/TypeScript/issues/17002\n\t\t\t\t\thandle: chunk as EditHandle,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis.sequencedEditIds = editIds.slice();\n\n\t\tthis.indexOfFirstEditInSession = this.numberOfSequencedEdits;\n\t\tthis.maximumEvictableIndex = this.indexOfFirstEditInSession - 1;\n\n\t\tthis.sequencedEditIds.forEach((id, index) => {\n\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\tassert(encounteredEditId === undefined, 'Duplicate acked edit.');\n\t\t\tthis.allEditIds.set(id, { isLocal: false, index });\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): void {\n\t\tthis.editAddedHandlers.push(handler);\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEditIds.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEditIds.concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry !== undefined && entry.isLocal;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a local revision (not sequenced).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEditIds.length;\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = assertNotUndefined(this.allEditIds.get(this.localEdits[0].id));\n\t\t\tassert(firstLocal.isLocal);\n\t\t\treturn this.numberOfSequencedEdits + orderedEdit.localSequence - firstLocal.localSequence;\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn assertNotUndefined(this.allEditIds.get(editId), 'All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.idOf}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEditIds[index];\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.getAtIndex}\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\tif (index < this.numberOfSequencedEdits) {\n\t\t\tconst [startRevision, editChunk] = assertNotUndefined(this.editChunks.nextLowerPair(index + 1));\n\t\t\tconst { handle, edits } = editChunk;\n\n\t\t\tif (edits === undefined) {\n\t\t\t\tassert(handle !== undefined, 'An edit chunk should include at least a handle or edits.');\n\t\t\t\tconst edits = JSON.parse(IsoBuffer.from(await handle.get()).toString())\n\t\t\t\t\t.edits as EditWithoutId<TChange>[];\n\n\t\t\t\t// Make sure the loaded edit chunk is the correct size. If a higher starting revison is set, the length is the difference of both.\n\t\t\t\t// Otherwise, it means that there are no sequenced edits in memory so the length is the difference of the number of\n\t\t\t\t// sequenced edits and the starting revision.\n\t\t\t\tconst nextKey = this.editChunks.nextHigherKey(index);\n\t\t\t\tconst expectedEditLength =\n\t\t\t\t\t(nextKey === undefined ? this.numberOfSequencedEdits : nextKey) - startRevision;\n\t\t\t\tassert(edits.length === expectedEditLength, 'The chunk does not contain the correct number of edits.');\n\n\t\t\t\teditChunk.edits = edits;\n\n\t\t\t\tthis.addKeyToCache(startRevision);\n\t\t\t\treturn joinEditAndId(this.getIdAtIndex(index), edits[index - startRevision]);\n\t\t\t}\n\n\t\t\treturn joinEditAndId(this.getIdAtIndex(index), edits[index - startRevision]);\n\t\t}\n\n\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.getAtIndexSynchronous}\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\tassert(\n\t\t\tindex > this.maximumEvictableIndex,\n\t\t\t'Edit to retrieve must have been added to the log during the current session.'\n\t\t);\n\n\t\tif (index < this.numberOfSequencedEdits) {\n\t\t\tconst [startRevision, editChunk] = assertNotUndefined(this.editChunks.nextLowerPair(index + 1));\n\t\t\tconst { edits } = editChunk;\n\n\t\t\treturn joinEditAndId(\n\t\t\t\tthis.getIdAtIndex(index),\n\t\t\t\tassertNotUndefined(edits, 'Edits should not have been evicted.')[index - startRevision]\n\t\t\t);\n\t\t}\n\n\t\tassert(index - this.numberOfSequencedEdits < this.localEdits.length, 'Edit to retrieve must be in the log.');\n\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.tryGetEdit}\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\ttry {\n\t\t\tconst index = this.getIndexOfId(editId);\n\t\t\treturn await this.getEditAtIndex(index);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * @returns The edits of edit chunks that do not have associated edit handles, does not include the last edit chunk if it is not full.\n\t */\n\tpublic *getEditChunksReadyForUpload(): Iterable<[number, readonly EditWithoutId<TChange>[]]> {\n\t\tconst maxStartRevision = this.editChunks.maxKey();\n\n\t\tif (maxStartRevision === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [startRevision, chunk] of this.editChunks.entries(undefined, [])) {\n\t\t\tif (chunk.handle === undefined) {\n\t\t\t\tconst edits = assertNotUndefined(chunk.edits);\n\n\t\t\t\t// If there is no handle, the chunk should either not be the last chunk or should be full if it is.\n\t\t\t\tif (maxStartRevision !== startRevision || edits.length >= this.editsPerChunk) {\n\t\t\t\t\tyield [startRevision, edits];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Assigns provided handles to edit chunks based on chunk index specified.\n\t */\n\tpublic processEditChunkHandle(chunkHandle: EditHandle, startRevision: number): void {\n\t\tconst chunk = this.editChunks.get(startRevision);\n\t\tif (chunk !== undefined) {\n\t\t\tassertNotUndefined(\n\t\t\t\tchunk.edits,\n\t\t\t\t'A chunk handle op should not be received before the edit ops it corresponds to.'\n\t\t\t);\n\t\t\tchunk.handle = chunkHandle;\n\t\t\tthis.addKeyToCache(startRevision);\n\t\t} else {\n\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedHistoryChunk' });\n\t\t}\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tconst { id, editWithoutId } = separateEditAndId(edit);\n\n\t\tassert(\n\t\t\tminSequenceNumber >= this.minSequenceNumber,\n\t\t\t'Sequenced edits should carry a monotonically increasing min number'\n\t\t);\n\t\t// The new minSequenceNumber indicates that no future edit will require information from edits with a smaller or equal seq number\n\t\t// for its resolution.\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\t\t// TODO:#57176: Increment maximumEvictableIndex to reflect the fact we can now evict edits with a sequenceNumber lower or equal to\n\t\t// it. Note that this will change the meaning of our 'InSession' APIs so we should make sure to rename them at the same time.\n\t\t// The code might look like this:\n\t\t// while (this.maximumEvictableIndex + 1 < this.indexOfFirstEditInSession) {\n\t\t// \tconst nextEdit = this.getEditInSessionAtIndex(this.maximumEvictableIndex + 1);\n\t\t// \tconst nextEditInfo = this.getOrderedEditId(nextEdit.id) as SequencedOrderedEditId;\n\t\t// \tif (\n\t\t// \t\tnextEditInfo.sequenceInfo !== undefined &&\n\t\t// \t\tnextEditInfo.sequenceInfo.sequenceNumber > minSequenceNumber\n\t\t// \t) {\n\t\t// \t\tbreak;\n\t\t// \t}\n\t\t// \t++this.maximumEvictableIndex;\n\t\t// }\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 'Duplicate acked edit.');\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = assertNotUndefined(this.localEdits.shift(), 'Local edit should exist').id;\n\t\t\tassert(oldLocalEditId === id, 'Causal ordering should be upheld');\n\t\t}\n\n\t\t// The starting revision for a newly created chunk.\n\t\tconst startRevision = this.numberOfSequencedEdits;\n\t\t// The initial edits for a newly created chunk.\n\t\tconst edits: EditWithoutId<TChange>[] = [editWithoutId];\n\n\t\tconst lastPair = this.editChunks.nextLowerPair(undefined);\n\t\tif (lastPair === undefined) {\n\t\t\tthis.editChunks.set(startRevision, { edits });\n\t\t} else {\n\t\t\t// Add to the last edit chunk if it has room and hasn't already been uploaded, otherwise create a new chunk.\n\t\t\t// If the chunk has a corresponding handle, create a new chunk.\n\t\t\tconst { edits: lastEditChunk, handle } = lastPair[1];\n\t\t\tif (handle === undefined && lastEditChunk !== undefined && lastEditChunk.length < this.editsPerChunk) {\n\t\t\t\tlastEditChunk.push(editWithoutId);\n\t\t\t} else {\n\t\t\t\tassert(\n\t\t\t\t\thandle !== undefined || lastEditChunk !== undefined,\n\t\t\t\t\t'An edit chunk must have either a handle or a list of edits.'\n\t\t\t\t);\n\t\t\t\tthis.editChunks.set(startRevision, { edits });\n\t\t\t}\n\t\t}\n\n\t\tthis.sequencedEditIds.push(id);\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex: this.numberOfSequencedEdits - 1,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\t}\n\n\t/**\n\t * @returns The last edit chunk i.e. the chunk which the most recent sequenced edits have been placed into, as well as its starting revision.\n\t * Returns undefined iff there are no sequenced edits.\n\t * When defined, this chunk is guaranteed to contain at least one edit\n\t * (though it may be necessary to load the chunk via its handle to use it)\n\t */\n\tpublic getLastEditChunk(): [startRevision: number, edits: EditChunk<TChange>] | undefined {\n\t\treturn this.editChunks.nextLowerPair(undefined);\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = { localSequence: this.localEditSequence++, isLocal: true };\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this.editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypes>(other: EditLog<TOtherChangeTypes>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * {@inheritDoc @intentional/shared-tree#OrderedEditSet.getEditLogSummary}\n\t */\n\tpublic getEditLogSummary(useHandles = false): EditLogSummary<TChange> {\n\t\tif (useHandles) {\n\t\t\treturn {\n\t\t\t\teditChunks: this.editChunks.toArray().map(([startRevision, { handle, edits }]) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstartRevision,\n\t\t\t\t\t\tchunk: handle ?? edits ?? fail('An edit chunk must have either a handle or a list of edits.'),\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t\teditIds: this.sequencedEditIds,\n\t\t\t};\n\t\t}\n\n\t\t// TODO:#49901: When writing format version 0.1.0, change to prefer sending the handle when not undefined.\n\t\t// For now, no chunks are evicted so edits are sent as is to be aggregated during summary write.\n\t\treturn {\n\t\t\teditChunks: this.editChunks.toArray().map(([startRevision, { edits }]) => {\n\t\t\t\treturn { startRevision, chunk: assertNotUndefined(edits) };\n\t\t\t}),\n\t\t\teditIds: this.sequencedEditIds,\n\t\t};\n\t}\n\n\tprivate addKeyToCache(newKey: number): void {\n\t\t// Indices are only added to the cache if they are not higher than the maximum evicted index.\n\t\tif (newKey <= this.maximumEvictableIndex) {\n\t\t\t// If the new index is already in the cache, remove it first to update its last usage.\n\t\t\tif (newKey in this.loadedChunkCache) {\n\t\t\t\tthis.loadedChunkCache.splice(this.loadedChunkCache.indexOf(newKey), 1);\n\t\t\t}\n\n\t\t\tthis.loadedChunkCache.push(newKey);\n\n\t\t\t// If the cache is out of space, evict the oldest index in the cache.\n\t\t\tif (this.loadedChunkCache.length > loadedChunkCacheSize) {\n\t\t\t\tconst indexToEvict = assertNotUndefined(this.loadedChunkCache.shift());\n\t\t\t\tconst chunkToEvict = assertNotUndefined(\n\t\t\t\t\tthis.editChunks.get(indexToEvict),\n\t\t\t\t\t'Chunk start revision added to cache should exist in the edit log.'\n\t\t\t\t);\n\t\t\t\tchunkToEvict.edits = undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"EditLog.js","sourceRoot":"","sources":["../src/EditLog.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gEAAiC;AACjC,+DAAiE;AAEjE,qCAAiG;AAGjG,uDAAwG;AACxG,6CAAyD;AAmIzD;;GAEG;AACH,SAAgB,iBAAiB,CAAU,IAAmB;IAI7D,MAAM,aAAa,mCAAQ,IAAI,KAAE,EAAE,EAAE,SAAS,GAAE,CAAC;IACjD,OAAO,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AAE,IAAI,CAAC,gBAAgB;aAC9B,CAAC;SACF;IACF,CAAC;IAEO,aAAa,CAAC,MAAc;QACnC,6FAA6F;QAC7F,IAAI,MAAM,IAAI,IAAI,CAAC,qBAAqB,EAAE;YACzC,sFAAsF;YACtF,IAAI,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACpC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;aACvE;YAED,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAEnC,qEAAqE;YACrE,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,oBAAoB,EAAE;gBACxD,MAAM,YAAY,GAAG,2BAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;gBACvE,MAAM,YAAY,GAAG,2BAAkB,CACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EACjC,mEAAmE,CACnE,CAAC;gBACF,YAAY,CAAC,KAAK,GAAG,SAAS,CAAC;aAC/B;SACD;IACF,CAAC;CACD;AAxeD,0BAweC;AAED,SAAS,YAAY,CACpB,KAA8D;IAE9D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport BTree from 'sorted-btree';\nimport { TypedEventEmitter } from '@fluidframework/common-utils';\nimport type { IEvent, ITelemetryLogger } from '@fluidframework/common-definitions';\nimport { assert, assertNotUndefined, compareArrays, compareFiniteNumbers, fail } from './Common';\nimport type { EditId } from './Identifiers';\nimport type { StringInterner } from './StringInterner';\nimport { Edit, EditLogSummary, editsPerChunk, EditWithoutId, FluidEditHandle } from './persisted-types';\nimport { SharedTreeDiagnosticEvent } from './EventTypes';\nimport type { ChangeCompressor } from './ChangeCompression';\n\n/**\n * An ordered set of Edits associated with a SharedTree.\n * Supports fast lookup of edits by ID and enforces idempotence.\n * Edits are virtualized, however, edits added during the current session are guaranteed to be available\n * synchronously.\n * @public\n * @sealed\n */\nexport interface OrderedEditSet<TChange = unknown> {\n\t/**\n\t * The length of this `OrderedEditSet`.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The edit IDs of all edits in the log.\n\t */\n\treadonly editIds: readonly EditId[];\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`.\n\t */\n\tgetIndexOfId(editId: EditId): number;\n\n\t/**\n\t * @returns the id of the edit at the given index within this 'OrderedEditSet'.\n\t */\n\tgetIdAtIndex(index: number): EditId;\n\n\t/**\n\t * @returns the index of the edit with the given editId within this `OrderedEditSet`, or `undefined` if no such edit exists.\n\t */\n\ttryGetIndexOfId(editId: EditId): number | undefined;\n\n\t/**\n\t * @returns the edit at the given index within this `OrderedEditSet`.\n\t */\n\tgetEditAtIndex(index: number): Promise<Edit<TChange>>;\n\n\t/**\n\t * @returns the edit at the given index. Must have been added to the log during the current session.\n\t */\n\tgetEditInSessionAtIndex(index: number): Edit<TChange>;\n\n\t/**\n\t * @returns the Edit associated with the EditId or undefined if there is no such edit in the set.\n\t */\n\ttryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined>;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface EditSequencingInfo {\n\t/**\n\t * The server-assigned sequence number of the op.\n\t */\n\treadonly sequenceNumber: number;\n\t/**\n\t * Last known sequenced edit at the time this op was issued.\n\t */\n\treadonly referenceSequenceNumber: number;\n}\n\n/**\n * Server-provided metadata for edits that have been sequenced.\n */\nexport interface MessageSequencingInfo extends EditSequencingInfo {\n\t/**\n\t * Last sequenced edit that all clients are guaranteed to be aware of.\n\t * If not specified, then some clients have not seen any edits yet.\n\t */\n\treadonly minimumSequenceNumber?: number;\n}\n\n/**\n * Metadata for a sequenced edit.\n */\nexport interface SequencedOrderedEditId {\n\treadonly isLocal: false;\n\treadonly index: number;\n\t/**\n\t * Information about the edit's relationship to other sequenced edits.\n\t * Undefined iff the edit was loaded from a summary.\n\t */\n\treadonly sequenceInfo?: EditSequencingInfo;\n}\n\n/**\n * Metadata for a local edit.\n */\nexport interface LocalOrderedEditId {\n\treadonly isLocal: true;\n\treadonly localSequence: number;\n}\n\n/**\n * Metadata for an edit.\n */\nexport type OrderedEditId = SequencedOrderedEditId | LocalOrderedEditId;\n\n/**\n * Compressor+interner pair used for encoding an {@link EditLog} into a summary.\n * @internal\n */\nexport interface EditLogEncoder {\n\tcompressor: ChangeCompressor;\n\tinterner: StringInterner;\n}\n\n/**\n * A sequence of edits that may or may not need to be downloaded into the EditLog from an external service\n */\nexport interface EditChunk<TChange> {\n\thandle?: EditHandle<TChange>;\n\tedits?: EditWithoutId<TChange>[];\n}\n\n/**\n * EditHandles are used to load edit chunks stored outside of the EditLog.\n * This is typically implemented by a wrapper around an IFluidHandle<ArrayBufferLike>.\n * @public\n */\nexport interface EditHandle<TChange> {\n\treadonly get: () => Promise<EditWithoutId<TChange>[]>;\n\treadonly baseHandle: FluidEditHandle;\n}\n\n/**\n * Returns an object that separates an Edit into two fields, id and editWithoutId.\n */\nexport function separateEditAndId<TChange>(edit: Edit<TChange>): {\n\tid: EditId;\n\teditWithoutId: EditWithoutId<TChange>;\n} {\n\tconst editWithoutId = { ...edit, id: undefined };\n\tdelete editWithoutId.id;\n\treturn { id: edit.id, editWithoutId };\n}\n\nfunction joinEditAndId<TChange>(id: EditId, edit: EditWithoutId<TChange>): Edit<TChange> {\n\treturn { id, ...edit };\n}\n\n/**\n * @param summary - The edit log summary to parse.\n * @returns the number of handles saved to the provided edit log summary.\n */\nexport function getNumberOfHandlesFromEditLogSummary(summary: EditLogSummary<unknown, unknown>): number {\n\tconst { editChunks } = summary;\n\n\tlet numberOfHandles = 0;\n\teditChunks.forEach(({ chunk }) => {\n\t\tif (!Array.isArray(chunk)) {\n\t\t\tnumberOfHandles++;\n\t\t}\n\t});\n\n\treturn numberOfHandles;\n}\n\n/**\n * The number of blobs to be loaded in memory at any time.\n * TODO:#49901: Change cache size once the virtualized history summary format is being written.\n * \t\t This is so the summarizer doesn't have to reload every edit to generate summaries.\n * */\nconst loadedChunkCacheSize = Number.POSITIVE_INFINITY;\n\n/**\n * Event fired when an edit is added to an `EditLog`.\n * @param edit - The edit that was added to the log\n * @param isLocal - true iff this edit was generated locally\n */\nexport type EditAddedHandler<TChange> = (edit: Edit<TChange>, isLocal: boolean, wasLocal: boolean) => void;\n\n/**\n * Events which may be emitted by `EditLog`.\n * @public\n */\nexport interface IEditLogEvents extends IEvent {\n\t(event: 'unexpectedHistoryChunk', listener: () => void);\n}\n\n/**\n * The edit history log for SharedTree.\n * Contains only completed edits (no in-progress edits).\n * Ordered first by locality (acked or local), then by time of insertion.\n * May not contain more than one edit with the same ID.\n * @sealed\n */\nexport class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {\n\tprivate localEditSequence = 0;\n\tprivate _minSequenceNumber = 0;\n\n\tprivate readonly sequencedEditIds: EditId[];\n\tprivate readonly editChunks: BTree<number, EditChunk<TChange>>;\n\tprivate readonly localEdits: Edit<TChange>[] = [];\n\tprivate readonly loadedChunkCache: number[] = [];\n\tprivate readonly indexOfFirstEditInSession: number;\n\tprivate readonly maximumEvictableIndex: number;\n\n\tprivate readonly allEditIds: Map<EditId, OrderedEditId> = new Map();\n\tprivate readonly _editAddedHandlers: Set<EditAddedHandler<TChange>> = new Set();\n\n\tprivate readonly logger?: ITelemetryLogger;\n\n\t/**\n\t * The number of edits associated with each blob.\n\t */\n\tpublic readonly editsPerChunk: number;\n\n\t/**\n\t * @returns The index of the earliest edit available through `getEditInSessionAtIndex`.\n\t */\n\tpublic get earliestAvailableEditIndex(): number {\n\t\treturn this.maximumEvictableIndex + 1;\n\t}\n\n\t/**\n\t * @returns The sequence number of the latest edit known by all nodes.\n\t */\n\tpublic get minSequenceNumber(): number {\n\t\treturn this._minSequenceNumber;\n\t}\n\n\t/**\n\t * Construct an `EditLog` using the given options.\n\t * @param summary - An edit log summary used to populate the edit log.\n\t * @param logger - An optional logger to record telemetry/errors\n\t */\n\tpublic constructor(\n\t\tsummary: EditLogSummary<TChange, EditHandle<TChange>> = { editIds: [], editChunks: [] },\n\t\tlogger?: ITelemetryLogger,\n\t\teditAddedHandlers: readonly EditAddedHandler<TChange>[] = [],\n\t\tindexOfFirstEditInSession = summary.editIds.length\n\t) {\n\t\tsuper();\n\t\tconst { editChunks, editIds } = summary;\n\t\tthis.logger = logger;\n\t\tthis.editsPerChunk = editsPerChunk;\n\n\t\tfor (const handler of editAddedHandlers) {\n\t\t\tthis.registerEditAddedHandler(handler);\n\t\t}\n\n\t\tthis.editChunks = new BTree<number, EditChunk<TChange>>(undefined, compareFiniteNumbers);\n\n\t\teditChunks.forEach((editChunkOrHandle) => {\n\t\t\tconst { startRevision, chunk } = editChunkOrHandle;\n\n\t\t\tif (isEditHandle(chunk)) {\n\t\t\t\tthis.editChunks.set(startRevision, { handle: chunk });\n\t\t\t} else {\n\t\t\t\tthis.editChunks.set(startRevision, { edits: chunk as EditWithoutId<TChange>[] });\n\t\t\t}\n\t\t});\n\n\t\tthis.sequencedEditIds = editIds.slice();\n\n\t\tthis.indexOfFirstEditInSession = indexOfFirstEditInSession;\n\t\tthis.maximumEvictableIndex = this.indexOfFirstEditInSession - 1;\n\n\t\tthis.sequencedEditIds.forEach((id, index) => {\n\t\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\t\tassert(encounteredEditId === undefined, 'Duplicate acked edit.');\n\t\t\tthis.allEditIds.set(id, { isLocal: false, index });\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler for when an edit is added to this `EditLog`.\n\t * @returns A callback which can be invoked to unregister this handler.\n\t */\n\tpublic registerEditAddedHandler(handler: EditAddedHandler<TChange>): () => void {\n\t\tthis._editAddedHandlers.add(handler);\n\t\treturn () => this._editAddedHandlers.delete(handler);\n\t}\n\n\t/**\n\t * @returns the `EditAddedHandler`s registered on this `EditLog`.\n\t */\n\tpublic get editAddedHandlers(): readonly EditAddedHandler<TChange>[] {\n\t\treturn Array.from(this._editAddedHandlers);\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.length}\n\t */\n\tpublic get length(): number {\n\t\treturn this.numberOfSequencedEdits + this.numberOfLocalEdits;\n\t}\n\n\t/**\n\t * The number of sequenced (acked) edits in the log.\n\t */\n\tpublic get numberOfSequencedEdits(): number {\n\t\treturn this.sequencedEditIds.length;\n\t}\n\n\t/**\n\t * The number of local (unacked) edits in the log.\n\t */\n\tpublic get numberOfLocalEdits(): number {\n\t\treturn this.localEdits.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.editIds}\n\t */\n\tpublic get editIds(): EditId[] {\n\t\treturn this.sequencedEditIds.concat(this.localEdits.map(({ id }) => id));\n\t}\n\n\t/**\n\t * @returns true iff the edit is contained in this 'EditLog' and it is a local edit (not sequenced).\n\t */\n\tpublic isLocalEdit(editId: EditId): boolean {\n\t\tconst entry = this.allEditIds.get(editId);\n\t\treturn entry !== undefined && entry.isLocal;\n\t}\n\n\t/**\n\t * @returns true iff the revision is a sequenced revision (not local).\n\t */\n\tpublic isSequencedRevision(revision: number): boolean {\n\t\treturn revision <= this.sequencedEditIds.length;\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetIndexOfId}\n\t */\n\tpublic tryGetIndexOfId(editId: EditId): number | undefined {\n\t\tconst orderedEdit = this.allEditIds.get(editId);\n\t\tif (orderedEdit === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (orderedEdit.isLocal) {\n\t\t\tconst firstLocal = assertNotUndefined(this.allEditIds.get(this.localEdits[0].id));\n\t\t\tassert(firstLocal.isLocal);\n\t\t\treturn this.numberOfSequencedEdits + orderedEdit.localSequence - firstLocal.localSequence;\n\t\t}\n\t\treturn orderedEdit.index;\n\t}\n\n\t/**\n\t * @returns Edit metadata for the edit with the given `editId`.\n\t */\n\tpublic getOrderedEditId(editId: EditId): OrderedEditId {\n\t\treturn assertNotUndefined(this.allEditIds.get(editId), 'All edits should exist in this map');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIndexOfId}\n\t */\n\tpublic getIndexOfId(editId: EditId): number {\n\t\treturn this.tryGetIndexOfId(editId) ?? fail('edit not found');\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getIdAtIndex}\n\t */\n\tpublic getIdAtIndex(index: number): EditId {\n\t\tif (this.numberOfSequencedEdits <= index) {\n\t\t\treturn this.localEdits[index - this.numberOfSequencedEdits].id;\n\t\t}\n\n\t\treturn this.sequencedEditIds[index];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getEditAtIndex}\n\t */\n\tpublic async getEditAtIndex(index: number): Promise<Edit<TChange>> {\n\t\tif (index < this.numberOfSequencedEdits) {\n\t\t\tconst [startRevision, editChunk] = assertNotUndefined(this.editChunks.getPairOrNextLower(index));\n\t\t\tconst { handle, edits } = editChunk;\n\n\t\t\tif (edits === undefined) {\n\t\t\t\tassert(handle !== undefined, 'An edit chunk should include at least a handle or edits.');\n\t\t\t\tconst edits = await handle.get();\n\n\t\t\t\t// Make sure the loaded edit chunk is the correct size. If a higher starting revison is set, the length is the difference of both.\n\t\t\t\t// Otherwise, it means that there are no sequenced edits in memory so the length is the difference of the number of\n\t\t\t\t// sequenced edits and the starting revision.\n\t\t\t\tconst nextKey = this.editChunks.nextHigherKey(index);\n\t\t\t\tconst expectedEditLength =\n\t\t\t\t\t(nextKey === undefined ? this.numberOfSequencedEdits : nextKey) - startRevision;\n\t\t\t\tassert(edits.length === expectedEditLength, 'The chunk does not contain the correct number of edits.');\n\n\t\t\t\teditChunk.edits = edits;\n\n\t\t\t\tthis.addKeyToCache(startRevision);\n\t\t\t\treturn joinEditAndId(this.getIdAtIndex(index), edits[index - startRevision]);\n\t\t\t}\n\n\t\t\treturn joinEditAndId(this.getIdAtIndex(index), edits[index - startRevision]);\n\t\t}\n\n\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.getEditInSessionAtIndex}\n\t */\n\tpublic getEditInSessionAtIndex(index: number): Edit<TChange> {\n\t\tassert(\n\t\t\tindex > this.maximumEvictableIndex,\n\t\t\t'Edit to retrieve must have been added to the log during the current session.'\n\t\t);\n\n\t\tif (index < this.numberOfSequencedEdits) {\n\t\t\tconst [startRevision, editChunk] = assertNotUndefined(this.editChunks.getPairOrNextLower(index));\n\t\t\tconst { edits } = editChunk;\n\n\t\t\treturn joinEditAndId(\n\t\t\t\tthis.getIdAtIndex(index),\n\t\t\t\tassertNotUndefined(edits, 'Edits should not have been evicted.')[index - startRevision]\n\t\t\t);\n\t\t}\n\n\t\tassert(index - this.numberOfSequencedEdits < this.localEdits.length, 'Edit to retrieve must be in the log.');\n\t\treturn this.localEdits[index - this.numberOfSequencedEdits];\n\t}\n\n\t/**\n\t * {@inheritDoc OrderedEditSet.tryGetEdit}\n\t */\n\tpublic async tryGetEdit(editId: EditId): Promise<Edit<TChange> | undefined> {\n\t\ttry {\n\t\t\tconst index = this.getIndexOfId(editId);\n\t\t\treturn await this.getEditAtIndex(index);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * @returns The edits of edit chunks that do not have associated edit handles, does not include the last edit chunk if it is not full.\n\t */\n\tpublic *getEditChunksReadyForUpload(): Iterable<[number, readonly EditWithoutId<TChange>[]]> {\n\t\tconst maxStartRevision = this.editChunks.maxKey();\n\n\t\tif (maxStartRevision === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [startRevision, chunk] of this.editChunks.entries(undefined, [])) {\n\t\t\tif (chunk.handle === undefined) {\n\t\t\t\tconst edits = assertNotUndefined(chunk.edits);\n\n\t\t\t\t// If there is no handle, the chunk should either not be the last chunk or should be full if it is.\n\t\t\t\tif (maxStartRevision !== startRevision || edits.length >= this.editsPerChunk) {\n\t\t\t\t\tyield [startRevision, edits];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Assigns provided handles to edit chunks based on chunk index specified.\n\t */\n\tpublic processEditChunkHandle(chunkHandle: EditHandle<TChange>, startRevision: number): void {\n\t\tconst chunk = this.editChunks.get(startRevision);\n\t\tif (chunk !== undefined) {\n\t\t\tassertNotUndefined(\n\t\t\t\tchunk.edits,\n\t\t\t\t'A chunk handle op should not be received before the edit ops it corresponds to.'\n\t\t\t);\n\t\t\tchunk.handle = chunkHandle;\n\t\t\tthis.addKeyToCache(startRevision);\n\t\t} else {\n\t\t\tthis.logger?.sendErrorEvent({ eventName: 'UnexpectedHistoryChunk' });\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);\n\t\t}\n\t}\n\n\t/**\n\t * Sequences all local edits.\n\t */\n\tpublic sequenceLocalEdits(): void {\n\t\tthis.localEdits.slice().forEach((edit) => this.addSequencedEditInternal(edit));\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t *\n\t */\n\tpublic addSequencedEdit(edit: Edit<TChange>, message: MessageSequencingInfo): void {\n\t\tthis.addSequencedEditInternal(edit, message, message.minimumSequenceNumber);\n\t}\n\n\t/**\n\t * Returns all local edits from this EditLog\n\t * This is useful for op format upgrades, which might warrant re-submission of these ops using the new format.\n\t * See the breaking change documentation for more information.\n\t */\n\tpublic *getLocalEdits(): Iterable<Edit<TChange>> {\n\t\tfor (const edit of this.localEdits) {\n\t\t\tyield edit;\n\t\t}\n\t}\n\n\t/**\n\t * Adds a sequenced (non-local) edit to the edit log.\n\t * If the id of the supplied edit matches a local edit already present in the log, the local edit will be replaced.\n\t */\n\tprivate addSequencedEditInternal(\n\t\tedit: Edit<TChange>,\n\t\tinfo?: EditSequencingInfo,\n\t\tminSequenceNumber: number = 0\n\t): void {\n\t\tconst { id, editWithoutId } = separateEditAndId(edit);\n\n\t\tassert(\n\t\t\tminSequenceNumber >= this.minSequenceNumber,\n\t\t\t'Sequenced edits should carry a monotonically increasing min number'\n\t\t);\n\t\t// The new minSequenceNumber indicates that no future edit will require information from edits with a smaller or equal seq number\n\t\t// for its resolution.\n\t\tthis._minSequenceNumber = minSequenceNumber;\n\t\t// TODO:#57176: Increment maximumEvictableIndex to reflect the fact we can now evict edits with a sequenceNumber lower or equal to\n\t\t// it. Note that this will change the meaning of our 'InSession' APIs so we should make sure to rename them at the same time.\n\t\t// The code might look like this:\n\t\t// while (this.maximumEvictableIndex + 1 < this.indexOfFirstEditInSession) {\n\t\t// \tconst nextEdit = this.getEditInSessionAtIndex(this.maximumEvictableIndex + 1);\n\t\t// \tconst nextEditInfo = this.getOrderedEditId(nextEdit.id) as SequencedOrderedEditId;\n\t\t// \tif (\n\t\t// \t\tnextEditInfo.sequenceInfo !== undefined &&\n\t\t// \t\tnextEditInfo.sequenceInfo.sequenceNumber > minSequenceNumber\n\t\t// \t) {\n\t\t// \t\tbreak;\n\t\t// \t}\n\t\t// \t++this.maximumEvictableIndex;\n\t\t// }\n\n\t\t// Remove the edit from local edits if it exists.\n\t\tconst encounteredEditId = this.allEditIds.get(id);\n\t\tif (encounteredEditId !== undefined) {\n\t\t\t// New edit already exits: it must have been a local edit.\n\t\t\tassert(encounteredEditId.isLocal, 'Duplicate acked edit.');\n\t\t\t// Remove it from localEdits. Due to ordering requirements, it must be first.\n\t\t\tconst oldLocalEditId = assertNotUndefined(this.localEdits.shift(), 'Local edit should exist').id;\n\t\t\tassert(oldLocalEditId === id, 'Causal ordering should be upheld');\n\t\t}\n\n\t\t// The starting revision for a newly created chunk.\n\t\tconst startRevision = this.numberOfSequencedEdits;\n\t\t// The initial edits for a newly created chunk.\n\t\tconst edits: EditWithoutId<TChange>[] = [editWithoutId];\n\n\t\tconst lastPair = this.editChunks.nextLowerPair(undefined);\n\t\tif (lastPair === undefined) {\n\t\t\tthis.editChunks.set(startRevision, { edits });\n\t\t} else {\n\t\t\t// Add to the last edit chunk if it has room and hasn't already been uploaded, otherwise create a new chunk.\n\t\t\t// If the chunk has a corresponding handle, create a new chunk.\n\t\t\tconst { edits: lastEditChunk, handle } = lastPair[1];\n\t\t\tif (handle === undefined && lastEditChunk !== undefined && lastEditChunk.length < this.editsPerChunk) {\n\t\t\t\tlastEditChunk.push(editWithoutId);\n\t\t\t} else {\n\t\t\t\tassert(\n\t\t\t\t\thandle !== undefined || lastEditChunk !== undefined,\n\t\t\t\t\t'An edit chunk must have either a handle or a list of edits.'\n\t\t\t\t);\n\t\t\t\tthis.editChunks.set(startRevision, { edits });\n\t\t\t}\n\t\t}\n\n\t\tthis.sequencedEditIds.push(id);\n\t\tconst sequencedEditId: SequencedOrderedEditId = {\n\t\t\tindex: this.numberOfSequencedEdits - 1,\n\t\t\tisLocal: false,\n\t\t\tsequenceInfo: info,\n\t\t};\n\t\tthis.allEditIds.set(id, sequencedEditId);\n\t\tthis.emitAdd(edit, false, encounteredEditId !== undefined);\n\t}\n\n\t/**\n\t * @returns The last edit chunk i.e. the chunk which the most recent sequenced edits have been placed into, as well as its starting revision.\n\t * Returns undefined iff there are no sequenced edits.\n\t * When defined, this chunk is guaranteed to contain at least one edit\n\t * (though it may be necessary to load the chunk via its handle to use it)\n\t */\n\tpublic getLastEditChunk(): [startRevision: number, edits: EditChunk<TChange>] | undefined {\n\t\treturn this.editChunks.nextLowerPair(undefined);\n\t}\n\n\t/**\n\t * Adds a non-sequenced (local) edit to the edit log.\n\t * Duplicate edits are ignored.\n\t */\n\tpublic addLocalEdit(edit: Edit<TChange>): void {\n\t\tthis.localEdits.push(edit);\n\t\tconst localEditId: LocalOrderedEditId = { localSequence: this.localEditSequence++, isLocal: true };\n\t\tthis.allEditIds.set(edit.id, localEditId);\n\t\tthis.emitAdd(edit, true, false);\n\t}\n\n\tprivate emitAdd(editAdded: Edit<TChange>, isLocal: boolean, wasLocal: boolean): void {\n\t\tfor (const handler of this._editAddedHandlers) {\n\t\t\thandler(editAdded, isLocal, wasLocal);\n\t\t}\n\t}\n\n\t/**\n\t * @returns true iff this `EditLog` and `other` are equivalent, regardless of locality.\n\t */\n\tpublic equals<TOtherChangeTypesInternal>(other: EditLog<TOtherChangeTypesInternal>): boolean {\n\t\t// TODO #45414: We should also be deep comparing the list of changes in the edit. This is not straightforward.\n\t\t// We can use our edit validation code when we write it since it will need to do deep walks of the changes.\n\t\treturn compareArrays(this.editIds, other.editIds);\n\t}\n\n\t/**\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary(): EditLogSummary<TChange, FluidEditHandle>;\n\t/**\n\t * @param compressEdit - a function which compresses edits\n\t * @returns the summary of this `OrderedEditSet` that can be used to reconstruct the edit set.\n\t * @internal\n\t */\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TCompressedChange, FluidEditHandle>;\n\tpublic getEditLogSummary<TCompressedChange>(\n\t\tcompressEdit?: (edit: Pick<Edit<TChange>, 'changes'>) => Pick<Edit<TCompressedChange>, 'changes'>\n\t): EditLogSummary<TChange, FluidEditHandle> | EditLogSummary<TCompressedChange, FluidEditHandle> {\n\t\tif (compressEdit !== undefined) {\n\t\t\treturn {\n\t\t\t\teditChunks: this.editChunks.toArray().map(([startRevision, { handle, edits }]) => ({\n\t\t\t\t\tstartRevision,\n\t\t\t\t\tchunk:\n\t\t\t\t\t\thandle?.baseHandle ??\n\t\t\t\t\t\tedits?.map((edit) => compressEdit(edit)) ??\n\t\t\t\t\t\tfail('An edit chunk must have either a handle or a list of edits.'),\n\t\t\t\t})),\n\t\t\t\teditIds: this.sequencedEditIds,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\teditChunks: this.editChunks.toArray().map(([startRevision, { handle, edits }]) => ({\n\t\t\t\t\tstartRevision,\n\t\t\t\t\tchunk:\n\t\t\t\t\t\thandle?.baseHandle ??\n\t\t\t\t\t\tedits ??\n\t\t\t\t\t\tfail('An edit chunk must have either a handle or a list of edits.'),\n\t\t\t\t})),\n\t\t\t\teditIds: this.sequencedEditIds,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate addKeyToCache(newKey: number): void {\n\t\t// Indices are only added to the cache if they are not higher than the maximum evicted index.\n\t\tif (newKey <= this.maximumEvictableIndex) {\n\t\t\t// If the new index is already in the cache, remove it first to update its last usage.\n\t\t\tif (newKey in this.loadedChunkCache) {\n\t\t\t\tthis.loadedChunkCache.splice(this.loadedChunkCache.indexOf(newKey), 1);\n\t\t\t}\n\n\t\t\tthis.loadedChunkCache.push(newKey);\n\n\t\t\t// If the cache is out of space, evict the oldest index in the cache.\n\t\t\tif (this.loadedChunkCache.length > loadedChunkCacheSize) {\n\t\t\t\tconst indexToEvict = assertNotUndefined(this.loadedChunkCache.shift());\n\t\t\t\tconst chunkToEvict = assertNotUndefined(\n\t\t\t\t\tthis.editChunks.get(indexToEvict),\n\t\t\t\t\t'Chunk start revision added to cache should exist in the edit log.'\n\t\t\t\t);\n\t\t\t\tchunkToEvict.edits = undefined;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isEditHandle<TChange>(\n\tchunk: EditHandle<TChange> | readonly EditWithoutId<unknown>[]\n): chunk is EditHandle<TChange> {\n\treturn !Array.isArray(chunk);\n}\n"]}
@@ -0,0 +1,168 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { EditId, NodeId, StableNodeId } from './Identifiers';
6
+ import { NodeIdContext, NodeIdConverter } from './NodeIdUtilities';
7
+ import { BuildNodeInternal, ChangeInternal, ChangeNode, ChangeNode_0_0_2, Edit, HasTraits, NodeData, Side, StablePlaceInternal, StableRangeInternal, TraitLocationInternal, TreeNode, TreeNodeSequence } from './persisted-types';
8
+ import { TraitLocation, TreeView } from './TreeView';
9
+ import { BuildNode, BuildTreeNode, Change, HasVariadicTraits, StablePlace, StableRange } from './ChangeTypes';
10
+ import { TransactionView } from './RevisionView';
11
+ /**
12
+ * Functions for constructing and comparing Edits.
13
+ */
14
+ /**
15
+ * Returns true if the provided Edits have equivalent properties.
16
+ */
17
+ export declare function compareEdits(editIdA: EditId, editIdB: EditId): boolean;
18
+ /**
19
+ * Generates a new edit object from the supplied changes.
20
+ */
21
+ export declare function newEdit<TEdit>(changes: readonly TEdit[]): Edit<TEdit>;
22
+ /**
23
+ * Generates a new edit object from the supplied changes.
24
+ */
25
+ export declare function newEditId(): EditId;
26
+ /**
27
+ * A node type that does not require its children to be specified
28
+ */
29
+ export declare type NoTraits<TChild extends HasVariadicTraits<unknown>> = Omit<TChild, keyof HasVariadicTraits<TChild>>;
30
+ /**
31
+ * Transform an input tree into an isomorphic output tree
32
+ * @param tree - the input tree
33
+ * @param convert - a conversion function that will run on each node in the input tree to produce the output tree.
34
+ */
35
+ export declare function convertTreeNodes<TIn extends HasVariadicTraits<TIn>, TOut extends HasTraits<TOut>>(root: TIn, convert: (node: TIn) => NoTraits<TOut>): TOut;
36
+ /**
37
+ * Transform an input tree into an isomorphic output tree
38
+ * @param tree - the input tree
39
+ * @param convert - a conversion function that will run on each (non-placeholder) node in the input tree to produce the output tree.
40
+ * @param isPlaceholder - a predicate which determines if a node is a placeholder
41
+ */
42
+ export declare function convertTreeNodes<TIn extends HasVariadicTraits<TIn | TPlaceholder>, TOut extends HasTraits<TOut | TPlaceholder>, TPlaceholder>(root: TIn | TPlaceholder, convert: (node: TIn) => NoTraits<TOut>, isPlaceholder: (node: TIn | TPlaceholder) => node is TPlaceholder): TOut | TPlaceholder;
43
+ /**
44
+ * Visits an input tree in a depth-first pre-order traversal.
45
+ * @param tree - the input tree
46
+ * @param visitor - callback invoked for each node in the tree.
47
+ */
48
+ export declare function walkTree<TIn extends HasVariadicTraits<TIn>>(tree: TIn, visitor: (node: TIn) => void): void;
49
+ /**
50
+ * Visits an input tree containing placeholders in a depth-first pre-order traversal.
51
+ * @param tree - the input tree
52
+ * @param visitor - callback invoked for each node in the tree. Must return true if the given node is a TPlaceholder.
53
+ */
54
+ export declare function walkTree<TIn extends HasVariadicTraits<TIn | TPlaceholder>, TPlaceholder = never>(tree: TIn | TPlaceholder, visitors: ((node: TIn) => void) | {
55
+ nodeVisitor?: (node: TIn) => void;
56
+ placeholderVisitor?: (placeholder: TPlaceholder) => void;
57
+ }, isPlaceholder: (node: TIn | TPlaceholder) => node is TPlaceholder): void;
58
+ /**
59
+ * Check if two trees are equivalent, meaning they have the same descendants with the same properties.
60
+ *
61
+ * See {@link comparePayloads} for payload comparison semantics.
62
+ */
63
+ export declare function deepCompareNodes(a: ChangeNode | ChangeNode_0_0_2, b: ChangeNode | ChangeNode_0_0_2, comparator?: (a: NodeData<NodeId> | NodeData<StableNodeId>, b: NodeData<NodeId> | NodeData<StableNodeId>) => boolean): boolean;
64
+ export declare function compareNodes(a: NodeData<NodeId> | NodeData<StableNodeId>, b: NodeData<NodeId> | NodeData<StableNodeId>): boolean;
65
+ /**
66
+ * Compare two views such that semantically equivalent node IDs are considered equal.
67
+ */
68
+ export declare function areRevisionViewsSemanticallyEqual(treeViewA: TreeView, idConverterA: NodeIdConverter, treeViewB: TreeView, idConverterB: NodeIdConverter): boolean;
69
+ /**
70
+ * Create a sequence of changes that resets the contents of `trait`.
71
+ * @public
72
+ */
73
+ export declare function setTrait(trait: TraitLocation, nodes: BuildNode | TreeNodeSequence<BuildNode>): Change[];
74
+ /**
75
+ * Create a sequence of changes that resets the contents of `trait`.
76
+ * @internal
77
+ */
78
+ export declare function setTraitInternal(trait: TraitLocationInternal, nodes: TreeNodeSequence<BuildNodeInternal>): ChangeInternal[];
79
+ /**
80
+ * Check the validity of the given `StablePlace`
81
+ * @param view - the `TreeView` within which to validate the given place
82
+ * @param place - the `StablePlace` to check
83
+ */
84
+ export declare function validateStablePlace(view: TreeView, place: StablePlaceInternal): {
85
+ result: PlaceValidationResult.Valid;
86
+ side: Side;
87
+ referenceSibling: NodeId;
88
+ referenceTrait?: never;
89
+ } | {
90
+ result: PlaceValidationResult.Valid;
91
+ side: Side;
92
+ referenceSibling?: never;
93
+ referenceTrait: TraitLocation;
94
+ } | {
95
+ result: Exclude<PlaceValidationResult, PlaceValidationResult.Valid>;
96
+ };
97
+ /**
98
+ * The result of validating a place.
99
+ */
100
+ export declare enum PlaceValidationResult {
101
+ Valid = "Valid",
102
+ Malformed = "Malformed",
103
+ SiblingIsRootOrDetached = "SiblingIsRootOrDetached",
104
+ MissingSibling = "MissingSibling",
105
+ MissingParent = "MissingParent"
106
+ }
107
+ /**
108
+ * The result of validating a bad place.
109
+ */
110
+ export declare type BadPlaceValidationResult = Exclude<PlaceValidationResult, PlaceValidationResult.Valid>;
111
+ /**
112
+ * Check the validity of the given `StableRange`
113
+ * @param view - the `TreeView` within which to validate the given range
114
+ * @param range - the `StableRange` to check
115
+ */
116
+ export declare function validateStableRange(view: TreeView, range: StableRangeInternal): {
117
+ result: RangeValidationResultKind.Valid;
118
+ start: StablePlaceInternal;
119
+ end: StablePlaceInternal;
120
+ } | {
121
+ result: Exclude<RangeValidationResult, RangeValidationResultKind.Valid>;
122
+ };
123
+ /**
124
+ * The kinds of result of validating a range.
125
+ */
126
+ export declare enum RangeValidationResultKind {
127
+ Valid = "Valid",
128
+ BadPlace = "BadPlace",
129
+ PlacesInDifferentTraits = "PlacesInDifferentTraits",
130
+ Inverted = "Inverted"
131
+ }
132
+ /**
133
+ * The result of validating a range.
134
+ */
135
+ export declare type RangeValidationResult = RangeValidationResultKind.Valid | RangeValidationResultKind.PlacesInDifferentTraits | RangeValidationResultKind.Inverted | {
136
+ kind: RangeValidationResultKind.BadPlace;
137
+ place: StablePlaceInternal;
138
+ placeFailure: BadPlaceValidationResult;
139
+ };
140
+ /**
141
+ * The result of validating a bad range.
142
+ */
143
+ export declare type BadRangeValidationResult = Exclude<RangeValidationResult, RangeValidationResultKind.Valid>;
144
+ /**
145
+ * Parents a set of nodes in a specified location within a trait.
146
+ * @param nodesToInsert - the nodes to parent in the specified place. The nodes must already be present in the TreeView.
147
+ * @param placeToInsert - the location to insert the nodes.
148
+ */
149
+ export declare function insertIntoTrait(view: TransactionView, nodesToInsert: readonly NodeId[], placeToInsert: StablePlace): TransactionView;
150
+ /**
151
+ * Detaches a range of nodes from their parent. The detached nodes remain in the TreeView.
152
+ * @param rangeToDetach - the range of nodes to detach
153
+ */
154
+ export declare function detachRange(view: TransactionView, rangeToDetach: StableRange): {
155
+ view: TransactionView;
156
+ detached: readonly NodeId[];
157
+ };
158
+ /**
159
+ * Deeply clone the given StablePlace
160
+ */
161
+ export declare function deepCloneStablePlace(place: StablePlace): StablePlace;
162
+ /**
163
+ * Deeply clone the given StableRange
164
+ */
165
+ export declare function deepCloneStableRange(range: StableRange): StableRange;
166
+ /** Convert a node used in a Build change into its internal representation */
167
+ export declare function internalizeBuildNode(nodeData: BuildTreeNode, nodeIdContext: NodeIdContext): Omit<TreeNode<BuildNodeInternal, NodeId>, 'traits'>;
168
+ //# sourceMappingURL=EditUtilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditUtilities.d.ts","sourceRoot":"","sources":["../src/EditUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAkC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAc,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EAErB,QAAQ,EACR,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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