@fluidframework/tree 2.116.0 → 2.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/api-report/tree.alpha.api.md +78 -30
  3. package/api-report/tree.beta.api.md +12 -9
  4. package/api-report/tree.legacy.beta.api.md +12 -9
  5. package/dist/codec/codec.d.ts +18 -0
  6. package/dist/codec/codec.d.ts.map +1 -1
  7. package/dist/codec/codec.js +18 -0
  8. package/dist/codec/codec.js.map +1 -1
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +3 -2
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/index.d.ts +1 -1
  14. package/dist/core/rebase/index.d.ts.map +1 -1
  15. package/dist/core/rebase/index.js +2 -1
  16. package/dist/core/rebase/index.js.map +1 -1
  17. package/dist/core/rebase/types.d.ts +39 -2
  18. package/dist/core/rebase/types.d.ts.map +1 -1
  19. package/dist/core/rebase/types.js +37 -2
  20. package/dist/core/rebase/types.js.map +1 -1
  21. package/dist/core/rebase/utils.d.ts.map +1 -1
  22. package/dist/core/rebase/utils.js +1 -0
  23. package/dist/core/rebase/utils.js.map +1 -1
  24. package/dist/core/revertible.d.ts +62 -6
  25. package/dist/core/revertible.d.ts.map +1 -1
  26. package/dist/core/revertible.js.map +1 -1
  27. package/dist/entrypoints/alpha.d.ts +1 -1
  28. package/dist/entrypoints/alpha.d.ts.map +1 -1
  29. package/dist/entrypoints/alpha.js.map +1 -1
  30. package/dist/entrypoints/beta.d.ts +1 -1
  31. package/dist/entrypoints/beta.d.ts.map +1 -1
  32. package/dist/entrypoints/beta.js.map +1 -1
  33. package/dist/entrypoints/legacy.d.ts +1 -1
  34. package/dist/entrypoints/legacy.d.ts.map +1 -1
  35. package/dist/entrypoints/legacy.js.map +1 -1
  36. package/dist/feature-libraries/indexing/types.d.ts +1 -1
  37. package/dist/feature-libraries/indexing/types.js.map +1 -1
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/shared-tree/history.d.ts +22 -0
  45. package/dist/shared-tree/history.d.ts.map +1 -0
  46. package/dist/shared-tree/history.js +66 -0
  47. package/dist/shared-tree/history.js.map +1 -0
  48. package/dist/shared-tree/schematizingTreeView.d.ts +12 -7
  49. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  50. package/dist/shared-tree/schematizingTreeView.js +13 -0
  51. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  52. package/dist/shared-tree/sharedTree.d.ts +3 -2
  53. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  54. package/dist/shared-tree/sharedTree.js +2 -0
  55. package/dist/shared-tree/sharedTree.js.map +1 -1
  56. package/dist/shared-tree/tree.js +1 -1
  57. package/dist/shared-tree/tree.js.map +1 -1
  58. package/dist/shared-tree/treeAlpha.d.ts +8 -20
  59. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  60. package/dist/shared-tree/treeAlpha.js +9 -12
  61. package/dist/shared-tree/treeAlpha.js.map +1 -1
  62. package/dist/shared-tree/treeCheckout.d.ts +16 -9
  63. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  64. package/dist/shared-tree/treeCheckout.js +130 -33
  65. package/dist/shared-tree/treeCheckout.js.map +1 -1
  66. package/dist/shared-tree/unhydratedTreeContext.d.ts +3 -2
  67. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  68. package/dist/shared-tree/unhydratedTreeContext.js +3 -0
  69. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  70. package/dist/shared-tree-core/branch.d.ts +16 -2
  71. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  72. package/dist/shared-tree-core/branch.js +20 -2
  73. package/dist/shared-tree-core/branch.js.map +1 -1
  74. package/dist/shared-tree-core/branchCommitCounter.d.ts +31 -0
  75. package/dist/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  76. package/dist/shared-tree-core/branchCommitCounter.js +79 -0
  77. package/dist/shared-tree-core/branchCommitCounter.js.map +1 -0
  78. package/dist/shared-tree-core/customMetadataCodec.d.ts +9 -0
  79. package/dist/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  80. package/dist/shared-tree-core/customMetadataCodec.js +37 -0
  81. package/dist/shared-tree-core/customMetadataCodec.js.map +1 -0
  82. package/dist/shared-tree-core/customMetadataFormat.d.ts +18 -0
  83. package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  84. package/dist/shared-tree-core/customMetadataFormat.js +15 -0
  85. package/dist/shared-tree-core/customMetadataFormat.js.map +1 -0
  86. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  87. package/dist/shared-tree-core/editManager.js +15 -3
  88. package/dist/shared-tree-core/editManager.js.map +1 -1
  89. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  90. package/dist/shared-tree-core/editManagerCodecs.js +5 -0
  91. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  92. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  93. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  94. package/dist/shared-tree-core/editManagerCodecsCommons.js +17 -5
  95. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  96. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  97. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  98. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  99. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  100. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  101. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  102. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  103. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  104. package/dist/shared-tree-core/editManagerFormatCommons.js +18 -8
  105. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  106. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  107. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  108. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  109. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  110. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  111. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  112. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  113. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  114. package/dist/shared-tree-core/index.d.ts +2 -1
  115. package/dist/shared-tree-core/index.d.ts.map +1 -1
  116. package/dist/shared-tree-core/index.js +3 -1
  117. package/dist/shared-tree-core/index.js.map +1 -1
  118. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  119. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  120. package/dist/shared-tree-core/messageCodecV1ToV4.js +12 -3
  121. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  122. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  123. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  124. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  125. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  126. package/dist/shared-tree-core/messageCodecs.js +5 -0
  127. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  128. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  129. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  130. package/dist/shared-tree-core/messageFormat.js +6 -0
  131. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  132. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  133. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  134. package/dist/shared-tree-core/messageFormatV1ToV4.js +10 -2
  135. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  136. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  137. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  138. package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  139. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  140. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  141. package/dist/shared-tree-core/sharedTreeCore.js +4 -2
  142. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  143. package/dist/shared-tree-core/transaction.d.ts +9 -0
  144. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  145. package/dist/shared-tree-core/transaction.js +26 -4
  146. package/dist/shared-tree-core/transaction.js.map +1 -1
  147. package/dist/simple-tree/api/index.d.ts +1 -1
  148. package/dist/simple-tree/api/index.d.ts.map +1 -1
  149. package/dist/simple-tree/api/index.js.map +1 -1
  150. package/dist/simple-tree/api/transactionTypes.d.ts +28 -2
  151. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  152. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  153. package/dist/simple-tree/api/tree.d.ts +180 -61
  154. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  155. package/dist/simple-tree/api/tree.js.map +1 -1
  156. package/dist/simple-tree/index.d.ts +1 -1
  157. package/dist/simple-tree/index.d.ts.map +1 -1
  158. package/dist/simple-tree/index.js.map +1 -1
  159. package/dist/tableSchema.js +10 -10
  160. package/dist/tableSchema.js.map +1 -1
  161. package/lib/codec/codec.d.ts +18 -0
  162. package/lib/codec/codec.d.ts.map +1 -1
  163. package/lib/codec/codec.js +18 -0
  164. package/lib/codec/codec.js.map +1 -1
  165. package/lib/core/index.d.ts +2 -2
  166. package/lib/core/index.d.ts.map +1 -1
  167. package/lib/core/index.js +1 -1
  168. package/lib/core/index.js.map +1 -1
  169. package/lib/core/rebase/index.d.ts +1 -1
  170. package/lib/core/rebase/index.d.ts.map +1 -1
  171. package/lib/core/rebase/index.js +1 -1
  172. package/lib/core/rebase/index.js.map +1 -1
  173. package/lib/core/rebase/types.d.ts +39 -2
  174. package/lib/core/rebase/types.d.ts.map +1 -1
  175. package/lib/core/rebase/types.js +35 -1
  176. package/lib/core/rebase/types.js.map +1 -1
  177. package/lib/core/rebase/utils.d.ts.map +1 -1
  178. package/lib/core/rebase/utils.js +1 -0
  179. package/lib/core/rebase/utils.js.map +1 -1
  180. package/lib/core/revertible.d.ts +62 -6
  181. package/lib/core/revertible.d.ts.map +1 -1
  182. package/lib/core/revertible.js.map +1 -1
  183. package/lib/entrypoints/alpha.d.ts +1 -1
  184. package/lib/entrypoints/alpha.d.ts.map +1 -1
  185. package/lib/entrypoints/alpha.js.map +1 -1
  186. package/lib/entrypoints/beta.d.ts +1 -1
  187. package/lib/entrypoints/beta.d.ts.map +1 -1
  188. package/lib/entrypoints/beta.js.map +1 -1
  189. package/lib/entrypoints/legacy.d.ts +1 -1
  190. package/lib/entrypoints/legacy.d.ts.map +1 -1
  191. package/lib/entrypoints/legacy.js.map +1 -1
  192. package/lib/feature-libraries/indexing/types.d.ts +1 -1
  193. package/lib/feature-libraries/indexing/types.js.map +1 -1
  194. package/lib/index.d.ts +2 -2
  195. package/lib/index.d.ts.map +1 -1
  196. package/lib/index.js.map +1 -1
  197. package/lib/packageVersion.d.ts +1 -1
  198. package/lib/packageVersion.js +1 -1
  199. package/lib/packageVersion.js.map +1 -1
  200. package/lib/shared-tree/history.d.ts +22 -0
  201. package/lib/shared-tree/history.d.ts.map +1 -0
  202. package/lib/shared-tree/history.js +62 -0
  203. package/lib/shared-tree/history.js.map +1 -0
  204. package/lib/shared-tree/schematizingTreeView.d.ts +12 -7
  205. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  206. package/lib/shared-tree/schematizingTreeView.js +13 -0
  207. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  208. package/lib/shared-tree/sharedTree.d.ts +3 -2
  209. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  210. package/lib/shared-tree/sharedTree.js +2 -0
  211. package/lib/shared-tree/sharedTree.js.map +1 -1
  212. package/lib/shared-tree/tree.js +1 -1
  213. package/lib/shared-tree/tree.js.map +1 -1
  214. package/lib/shared-tree/treeAlpha.d.ts +8 -20
  215. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  216. package/lib/shared-tree/treeAlpha.js +9 -12
  217. package/lib/shared-tree/treeAlpha.js.map +1 -1
  218. package/lib/shared-tree/treeCheckout.d.ts +16 -9
  219. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  220. package/lib/shared-tree/treeCheckout.js +131 -34
  221. package/lib/shared-tree/treeCheckout.js.map +1 -1
  222. package/lib/shared-tree/unhydratedTreeContext.d.ts +3 -2
  223. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  224. package/lib/shared-tree/unhydratedTreeContext.js +3 -0
  225. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  226. package/lib/shared-tree-core/branch.d.ts +16 -2
  227. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  228. package/lib/shared-tree-core/branch.js +20 -2
  229. package/lib/shared-tree-core/branch.js.map +1 -1
  230. package/lib/shared-tree-core/branchCommitCounter.d.ts +31 -0
  231. package/lib/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  232. package/lib/shared-tree-core/branchCommitCounter.js +75 -0
  233. package/lib/shared-tree-core/branchCommitCounter.js.map +1 -0
  234. package/lib/shared-tree-core/customMetadataCodec.d.ts +9 -0
  235. package/lib/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  236. package/lib/shared-tree-core/customMetadataCodec.js +32 -0
  237. package/lib/shared-tree-core/customMetadataCodec.js.map +1 -0
  238. package/lib/shared-tree-core/customMetadataFormat.d.ts +18 -0
  239. package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  240. package/lib/shared-tree-core/customMetadataFormat.js +11 -0
  241. package/lib/shared-tree-core/customMetadataFormat.js.map +1 -0
  242. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  243. package/lib/shared-tree-core/editManager.js +16 -4
  244. package/lib/shared-tree-core/editManager.js.map +1 -1
  245. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  246. package/lib/shared-tree-core/editManagerCodecs.js +5 -0
  247. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  248. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  249. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  250. package/lib/shared-tree-core/editManagerCodecsCommons.js +17 -5
  251. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  252. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  253. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  254. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  255. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  256. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  257. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  258. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  259. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  260. package/lib/shared-tree-core/editManagerFormatCommons.js +18 -8
  261. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  262. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  263. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  264. package/lib/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  265. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  266. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  267. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  268. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  269. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  270. package/lib/shared-tree-core/index.d.ts +2 -1
  271. package/lib/shared-tree-core/index.d.ts.map +1 -1
  272. package/lib/shared-tree-core/index.js +1 -0
  273. package/lib/shared-tree-core/index.js.map +1 -1
  274. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  275. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  276. package/lib/shared-tree-core/messageCodecV1ToV4.js +12 -3
  277. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  278. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  279. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  280. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  281. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  282. package/lib/shared-tree-core/messageCodecs.js +5 -0
  283. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  284. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  285. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  286. package/lib/shared-tree-core/messageFormat.js +6 -0
  287. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  288. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  289. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  290. package/lib/shared-tree-core/messageFormatV1ToV4.js +10 -2
  291. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  292. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  293. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  294. package/lib/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  295. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  296. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  297. package/lib/shared-tree-core/sharedTreeCore.js +5 -3
  298. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  299. package/lib/shared-tree-core/transaction.d.ts +9 -0
  300. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  301. package/lib/shared-tree-core/transaction.js +27 -5
  302. package/lib/shared-tree-core/transaction.js.map +1 -1
  303. package/lib/simple-tree/api/index.d.ts +1 -1
  304. package/lib/simple-tree/api/index.d.ts.map +1 -1
  305. package/lib/simple-tree/api/index.js.map +1 -1
  306. package/lib/simple-tree/api/transactionTypes.d.ts +28 -2
  307. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  308. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  309. package/lib/simple-tree/api/tree.d.ts +180 -61
  310. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  311. package/lib/simple-tree/api/tree.js.map +1 -1
  312. package/lib/simple-tree/index.d.ts +1 -1
  313. package/lib/simple-tree/index.d.ts.map +1 -1
  314. package/lib/simple-tree/index.js.map +1 -1
  315. package/lib/tableSchema.js +10 -10
  316. package/lib/tableSchema.js.map +1 -1
  317. package/package.json +23 -23
  318. package/src/codec/codec.ts +19 -0
  319. package/src/core/index.ts +4 -0
  320. package/src/core/rebase/index.ts +2 -0
  321. package/src/core/rebase/types.ts +72 -2
  322. package/src/core/rebase/utils.ts +1 -0
  323. package/src/core/revertible.ts +67 -6
  324. package/src/entrypoints/alpha.ts +8 -0
  325. package/src/entrypoints/beta.ts +1 -0
  326. package/src/entrypoints/legacy.ts +1 -0
  327. package/src/feature-libraries/indexing/types.ts +1 -1
  328. package/src/index.ts +8 -0
  329. package/src/packageVersion.ts +1 -1
  330. package/src/shared-tree/history.ts +99 -0
  331. package/src/shared-tree/schematizingTreeView.ts +25 -8
  332. package/src/shared-tree/sharedTree.ts +5 -2
  333. package/src/shared-tree/tree.ts +1 -1
  334. package/src/shared-tree/treeAlpha.ts +17 -35
  335. package/src/shared-tree/treeCheckout.ts +178 -39
  336. package/src/shared-tree/unhydratedTreeContext.ts +6 -2
  337. package/src/shared-tree-core/branch.ts +34 -2
  338. package/src/shared-tree-core/branchCommitCounter.ts +103 -0
  339. package/src/shared-tree-core/customMetadataCodec.ts +42 -0
  340. package/src/shared-tree-core/customMetadataFormat.ts +39 -0
  341. package/src/shared-tree-core/editManager.ts +22 -3
  342. package/src/shared-tree-core/editManagerCodecs.ts +12 -0
  343. package/src/shared-tree-core/editManagerCodecsCommons.ts +41 -15
  344. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +7 -1
  345. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -0
  346. package/src/shared-tree-core/editManagerFormatCommons.ts +46 -12
  347. package/src/shared-tree-core/editManagerFormatV1toV4.ts +13 -5
  348. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -2
  349. package/src/shared-tree-core/index.ts +3 -0
  350. package/src/shared-tree-core/messageCodecV1ToV4.ts +18 -5
  351. package/src/shared-tree-core/messageCodecVSharedBranches.ts +9 -2
  352. package/src/shared-tree-core/messageCodecs.ts +12 -0
  353. package/src/shared-tree-core/messageFormat.ts +6 -0
  354. package/src/shared-tree-core/messageFormatV1ToV4.ts +21 -3
  355. package/src/shared-tree-core/messageFormatVSharedBranches.ts +8 -0
  356. package/src/shared-tree-core/sharedTreeCore.ts +5 -2
  357. package/src/shared-tree-core/transaction.ts +56 -4
  358. package/src/simple-tree/api/index.ts +5 -0
  359. package/src/simple-tree/api/transactionTypes.ts +29 -2
  360. package/src/simple-tree/api/tree.ts +199 -60
  361. package/src/simple-tree/index.ts +5 -0
  362. package/src/tableSchema.ts +9 -9
@@ -8,8 +8,12 @@ import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/co
8
8
  import type {
9
9
  ChangeMetadata,
10
10
  CommitMetadata,
11
+ CustomMetadataTree,
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
13
+ Revertible,
11
14
  RevertibleAlphaFactory,
12
15
  RevertibleFactory,
16
+ RevertToOptionsAlpha,
13
17
  } from "../../core/index.js";
14
18
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
15
19
  import type { TreeStatus } from "../../feature-libraries/index.js";
@@ -17,7 +21,10 @@ import type {
17
21
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This is referenced by doc comments.
18
22
  TreeAlpha,
19
23
  } from "../../shared-tree/index.js";
20
- import type { JsonCompatibleReadOnly } from "../../util/index.js";
24
+ import type {
25
+ JsonCompatibleReadOnly,
26
+ JsonCompatibleReadOnlyObject,
27
+ } from "../../util/index.js";
21
28
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is referenced by doc comments.
22
29
  import type { Unhydrated } from "../core/index.js";
23
30
  import type {
@@ -144,58 +151,66 @@ export interface ITreeAlpha extends ITree {
144
151
  }
145
152
 
146
153
  /**
147
- * A collection of functionality associated with a (version-control-style) branch of a SharedTree.
148
- * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.
154
+ * An untyped view of a (version-control-style) branch of a SharedTree.
155
+ * @remarks An `UntypedTreeView` allows for the {@link UntypedTreeView.fork | creation of branches} and for those branches to later be {@link UntypedTreeView.merge | merged}.
149
156
  *
150
157
  * The branch associated directly with the {@link ITree | SharedTree} is the "main" branch, and all other branches fork (directly or transitively) from that main branch.
151
158
  *
152
- * See {@link TreeBranchAlpha} for additional APIs that are in an earlier stage of development.
159
+ * See {@link UntypedTreeViewAlpha} for additional APIs that are in an earlier stage of development.
153
160
  * @sealed @beta
154
161
  */
155
- export interface TreeBranch extends IDisposable {
162
+ export interface UntypedTreeView extends IDisposable {
156
163
  /**
157
164
  * Fork a new branch off of this branch which is based off of this branch's current state.
158
- * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch.
159
- * The branch should be disposed when no longer needed, either {@link TreeBranch.dispose | explicitly} or {@link TreeBranch.merge | implicitly when merging} into another branch.
165
+ * @remarks Any changes to the tree on the new view will not apply to this view until the new view is e.g. {@link UntypedTreeView.merge | merged} back into this view.
166
+ * The view should be disposed when no longer needed, either {@link UntypedTreeView.dispose | explicitly} or {@link UntypedTreeView.merge | implicitly when merging} into another view.
160
167
  */
161
- fork(): TreeBranch;
168
+ fork(): UntypedTreeView;
162
169
 
163
170
  /**
164
- * Apply all the new changes on the given branch to this branch.
165
- * @param branch - a branch which was created by a call to `branch()`.
166
- * @param disposeMerged - whether or not to dispose `branch` after the merge completes.
171
+ * Apply all the new changes on the given view to this view.
172
+ * @param view - A view created by {@link UntypedTreeView.fork}.
173
+ * @param disposeMerged - Whether or not to dispose `view` after the merge completes.
167
174
  * Defaults to true.
168
- * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.
169
- * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.
175
+ * The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
176
+ * @remarks All ongoing transactions (if any) in `view` will be committed before the merge.
170
177
  */
171
- merge(branch: TreeBranch, disposeMerged?: boolean): void;
178
+ merge(view: UntypedTreeView, disposeMerged?: boolean): void;
172
179
 
173
180
  /**
174
- * Advance this branch forward such that all new changes on the target branch become part of this branch.
175
- * @param branch - The branch to rebase onto.
176
- * @remarks After rebasing, this branch will be "ahead" of the target branch, that is, its unique changes will have been recreated as if they happened after all changes on the target branch.
177
- * This method may only be called on branches produced via {@link TreeBranch.fork | branch} - attempting to rebase the main branch will throw.
181
+ * Advance this view forward such that all new changes on the target view become part of this view.
182
+ * @param view - The view to rebase onto.
183
+ * @remarks After rebasing, this view will be "ahead" of the target view, that is, its unique changes will have been recreated as if they happened after all changes on the target view.
184
+ * This method may only be called on views produced via {@link UntypedTreeView.fork | fork} - attempting to rebase the main view will throw.
178
185
  *
179
186
  * Rebasing long-lived branches is important to avoid consuming memory unnecessarily.
180
187
  * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last rebased.
181
188
  *
182
- * The {@link TreeBranch | main branch} cannot be rebased onto another branch - attempting to do so will throw an error.
189
+ * The {@link UntypedTreeView | main view} cannot be rebased onto another view - attempting to do so will throw an error.
183
190
  */
184
- rebaseOnto(branch: TreeBranch): void;
191
+ rebaseOnto(view: UntypedTreeView): void;
185
192
 
186
193
  /**
187
- * Dispose of this branch, cleaning up any resources associated with it.
194
+ * Dispose of this view, cleaning up any resources associated with it.
188
195
  * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
189
- * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.
196
+ * @remarks Views can also be automatically disposed when {@link UntypedTreeView.merge | they are merged} into another view.
190
197
  *
191
198
  * Disposing branches is important to avoid consuming memory unnecessarily.
192
- * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.
199
+ * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" view was created or last {@link UntypedTreeView.rebaseOnto | rebased}.
193
200
  *
194
- * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.
201
+ * The {@link UntypedTreeView | main view} cannot be disposed - attempting to do so will have no effect.
195
202
  */
196
203
  dispose(error?: Error): void;
197
204
  }
198
205
 
206
+ /**
207
+ * Compatibility alias for {@link UntypedTreeView}.
208
+ *
209
+ * @deprecated Use {@link UntypedTreeView} instead.
210
+ * @beta
211
+ */
212
+ export type TreeBranch = UntypedTreeView;
213
+
199
214
  /**
200
215
  * Provides additional APIs that may be used to interact with a tree node or a tree node's SharedTree.
201
216
  * @alpha
@@ -223,7 +238,7 @@ export interface TreeContextAlpha {
223
238
  * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
224
239
  *
225
240
  * `runTransaction` may be invoked on the context of a {@link TreeStatus.InDocument | hydrated } or {@link Unhydrated | unhydrated } node.
226
- * Use {@link TreeContextAlpha.isBranch | isBranch() } to check whether this context is associated with a branch and gain {@link TreeBranchAlpha.(runTransaction:1) | access to more transaction capabilities} if so.
241
+ * Use {@link TreeContextAlpha.isView | isView() } to check whether this context is associated with a view and gain {@link UntypedTreeViewAlpha.(runTransaction:1) | access to more transaction capabilities} if so.
227
242
  */
228
243
  runTransaction<TValue>(
229
244
  transaction: () => WithValue<TValue>,
@@ -271,44 +286,130 @@ export interface TreeContextAlpha {
271
286
  ): Promise<TransactionVoidResult>;
272
287
 
273
288
  /**
274
- * True if this context is associated with a {@link TreeBranchAlpha | branch} and false if it is associated with an {@link Unhydrated | unhydrated } node.
275
- * @remarks If this returns true, the context can be safely inferred or cast to {@link TreeBranchAlpha} to access additional branch-specific APIs.
289
+ * True if this context is associated with an {@link UntypedTreeViewAlpha | untyped view} and false if it is associated with an {@link Unhydrated | unhydrated } node.
290
+ * @remarks If this returns true, the context can be safely inferred or cast to {@link UntypedTreeViewAlpha} to access additional view-specific APIs.
276
291
  * @example
277
292
  * ```typescript
278
293
  * const context = tree.context(someNode);
279
- * if (context.isBranch()) {
280
- * assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on TreeBranchAlpha, so this is only accessible if `context` is a branch context.
294
+ * if (context.isView()) {
295
+ * assert(context.hasRootSchema(MySchema)) // `hasRootSchema` is a method on UntypedTreeViewAlpha, so this is only accessible if `context` is a view context.
281
296
  * context.root.foo = "bar"; // Edit the root of the SharedTree that `someNode` belongs to.
282
297
  * }
283
298
  * ```
299
+ * @returns Whether this context is associated with an untyped view.
300
+ */
301
+ isView(): this is UntypedTreeViewAlpha;
302
+
303
+ /**
304
+ * {@inheritDoc TreeContextAlpha.isView}
305
+ * @deprecated Use {@link TreeContextAlpha.isView | isView()} instead.
306
+ */
307
+ isBranch(): this is UntypedTreeViewAlpha;
308
+ }
309
+
310
+ /**
311
+ * An identifier for a commit in a {@link UntypedTreeViewAlpha}'s {@link UntypedTreeViewAlpha.branchHistory | history}.
312
+ * @alpha
313
+ */
314
+ export type CommitRevision = string;
315
+
316
+ /**
317
+ * Metadata describing a single commit in a {@link UntypedTreeViewAlpha}'s history.
318
+ * @sealed @alpha
319
+ */
320
+ export interface TreeBranchCommitMetadata {
321
+ /**
322
+ * The revision UUID that uniquely identifies this commit within the branch's history.
323
+ */
324
+ readonly revision: CommitRevision;
325
+
326
+ /**
327
+ * Arbitrary, application-defined metadata that was {@link RunTransactionParamsAlpha.customMetadata | attached}
328
+ * to this commit when it was created, flattened into a single object.
329
+ *
330
+ * @remarks
331
+ * This is `undefined` for commits that were not annotated.
332
+ *
333
+ * A commit may be produced by nested transactions, each of which may supply metadata. This property combines
334
+ * them: where two of them used the same property, the outermost transaction wins, and between siblings the
335
+ * later one wins. Use {@link TreeBranchCommitMetadata.customTree} to recover which transaction supplied what.
336
+ */
337
+ readonly custom: JsonCompatibleReadOnlyObject | undefined;
338
+
339
+ /**
340
+ * The {@link CustomMetadataTree | tree} of metadata attached to this commit, reflecting the nesting of
341
+ * the transactions that produced it.
342
+ *
343
+ * @remarks
344
+ * The structural counterpart to {@link TreeBranchCommitMetadata.custom}, and `undefined` whenever it is.
345
+ * Prefer `custom` unless you need to know which transaction supplied a particular property.
346
+ */
347
+ readonly customTree: CustomMetadataTree | undefined;
348
+
349
+ /**
350
+ * The metadata for the commit that this commit was based on, or `undefined` if this commit has no parent
351
+ * (i.e. it is the oldest commit in the branch's history).
352
+ *
353
+ * @remarks
354
+ * This method may return a different value over time if the parent commit is trimmed from the branch's history.
284
355
  */
285
- isBranch(): this is TreeBranchAlpha;
356
+ getParent(): TreeBranchCommitMetadata | undefined;
286
357
  }
287
358
 
288
359
  /**
289
- * {@link TreeBranch} with alpha-level APIs.
360
+ * Provides APIs for querying information about the history of a {@link UntypedTreeViewAlpha}.
290
361
  * @remarks
291
- * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.
362
+ * The history of a branch is the sequence of commits leading up to its current state.
363
+ * @sealed @alpha
364
+ */
365
+ export interface TreeBranchHistory {
366
+ /**
367
+ * The number of commits in this branch's history.
368
+ * @remarks
369
+ * This number grows when any of the following occurs:
370
+ * - A new edit is made on this branch (either through editing or by reverting an existing commit on this branch).
371
+ * - A branch that contains commits not already on this branch is merged into this branch.
372
+ * - The branch is rebased onto another branch that contains commits not already on this branch.
373
+ * This number shrinks when past commits are trimmed from the history.
374
+ */
375
+ readonly length: number;
376
+
377
+ /**
378
+ * Returns metadata for the current head commit of this branch.
379
+ * @returns The metadata for the head commit, or `undefined` if the branch has no commits.
380
+ */
381
+ getHead(): TreeBranchCommitMetadata | undefined;
382
+ }
383
+
384
+ /**
385
+ * An untyped view of a {@link UntypedTreeView} with alpha-level APIs.
386
+ * @remarks
387
+ * The untyped view for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.context` and checking {@link TreeContextAlpha.isView | isView()}.
292
388
  *
293
- * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.
389
+ * An untyped view does not necessarily know the schema of its SharedTree. To convert it to a {@link TreeViewAlpha | view with a schema}, use {@link UntypedTreeViewAlpha.hasRootSchema | hasRootSchema()}.
294
390
  * @sealed @alpha
295
391
  */
296
- export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
392
+ export interface UntypedTreeViewAlpha extends UntypedTreeView, TreeContextAlpha {
297
393
  /**
298
- * Events for the branch
394
+ * Events for the view's underlying branch.
299
395
  */
300
396
  readonly events: Listenable<TreeBranchEvents>;
301
397
 
302
398
  /**
303
- * Returns true if this branch has the given schema as its root schema.
304
- * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
399
+ * APIs for querying the history of the branch being viewed.
400
+ */
401
+ readonly branchHistory: TreeBranchHistory;
402
+
403
+ /**
404
+ * Returns true if this view has the given schema as its root schema.
405
+ * @remarks This is a type guard which allows this view to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
305
406
  *
306
407
  * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.
307
408
  * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.
308
409
  * @example
309
410
  * ```typescript
310
- * if (branch.hasRootSchema(MySchema)) {
311
- * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>
411
+ * if (view.hasRootSchema(MySchema)) {
412
+ * const { root } = view; // `view` is now a TreeViewAlpha<MySchema>
312
413
  * // ...
313
414
  * }
314
415
  * ```
@@ -318,10 +419,40 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
318
419
  ): this is TreeViewAlpha<TSchema>;
319
420
 
320
421
  // Override the base fork method to return the alpha variant.
321
- fork(): TreeBranchAlpha;
422
+ fork(): UntypedTreeViewAlpha;
423
+
424
+ /**
425
+ * Switches this view to a new underlying branch with the given commit as the head, updating the view state accordingly.
426
+ *
427
+ * @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to rewind to.
428
+ * Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
429
+ *
430
+ * @remarks
431
+ * Unlike {@link UntypedTreeViewAlpha.revertTo | revertTo}, this does not apply a change to the underlying branch.
432
+ * The original underlying branch will be disposed.
433
+ * Consider {@link UntypedTreeViewAlpha.fork | forking} before rewinding.
434
+ * Not valid to invoke on the main branch or a {@link (ITreeAlpha:interface).createSharedBranch | shared branch}.
435
+ */
436
+ rewindTo(revision: CommitRevision): void;
322
437
 
323
438
  /**
324
- * {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on a branch of the SharedTree.
439
+ * Applies a new change which reverts all changes made since the given `revision`.
440
+ * This is a no-op if the given revision is the head commit of the underlying branch being viewed.
441
+ *
442
+ * @param revision - The {@link TreeBranchCommitMetadata.revision | revision} to restore the state of.
443
+ * Can be obtained by navigating the commits on the {@link UntypedTreeViewAlpha.branchHistory | branch history}.
444
+ * @param options - Optional {@link RevertToOptionsAlpha | options} for the revert.
445
+ *
446
+ * @remarks
447
+ * The generated change is subject to the same merge semantics as the {@link Revertible.(revert:1) | reverts of individual commits}:
448
+ * Concurrent changes that are sequenced before the revert will not be overwritten by the revert if they affect different parts of the document.
449
+ *
450
+ * Unlike {@link UntypedTreeViewAlpha.rewindTo | rewindTo}, this does not switch to a new branch.
451
+ */
452
+ revertTo(revision: CommitRevision, options?: RevertToOptionsAlpha): void;
453
+
454
+ /**
455
+ * {@link TreeContextAlpha.(runTransaction:1) | Run a transaction} on this view of the SharedTree.
325
456
  * @param transaction - The function to run as the body of the transaction, which may optionally return a {@link TransactionCallbackStatusAlpha | value or rollback signal}.
326
457
  * @remarks
327
458
  * If the transaction is rolled back, a corresponding {@link TreeBranchEvents.changed | `changed`} event will also be emitted for the rollback.
@@ -332,7 +463,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
332
463
  ): TransactionValueResult<TSuccessValue, TFailureValue>;
333
464
 
334
465
  /**
335
- * An overload of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction } which does not return a value.
466
+ * An overload of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction } which does not return a value.
336
467
  *
337
468
  * @privateRemarks
338
469
  * TODO: Consider updating these methods to avoid the need for overloads.
@@ -344,7 +475,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
344
475
  ): TransactionVoidResult;
345
476
 
346
477
  /**
347
- * An asynchronous version of {@link TreeBranchAlpha.(runTransaction:1) | runTransaction}.
478
+ * An asynchronous version of {@link UntypedTreeViewAlpha.(runTransaction:1) | runTransaction}.
348
479
  * @remarks See {@link TreeContextAlpha.(runTransactionAsync:1) | runTransactionAsync} for additional information about asynchronous transactions.
349
480
  */
350
481
 
@@ -354,7 +485,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
354
485
  ): Promise<TransactionValueResult<TSuccessValue, TFailureValue>>;
355
486
 
356
487
  /**
357
- * An overload of {@link TreeBranchAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.
488
+ * An overload of {@link UntypedTreeViewAlpha.(runTransactionAsync:1) | runTransactionAsync } which does not return a value.
358
489
  *
359
490
  * @privateRemarks
360
491
  * TODO: Consider updating these methods to avoid the need for overloads.
@@ -379,27 +510,35 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
379
510
  applyChange(change: JsonCompatibleReadOnly): void;
380
511
 
381
512
  /**
382
- * Determines if there are changes on the given branch that are not present on this branch.
383
- * @param branch - The branch to compare to.
513
+ * Determines if there are changes on the given view that are not present on this view.
514
+ * @param view - The view to compare to.
384
515
  *
385
- * The new edits, if any, can be applied to this branch by {@link TreeBranch.rebaseOnto | rebasing this branch onto the given branch}
386
- * or by {@link TreeBranch.merge | merging the given branch into this branch}.
516
+ * The new edits, if any, can be applied to this view by {@link UntypedTreeView.rebaseOnto | rebasing this view onto the given view}
517
+ * or by {@link UntypedTreeView.merge | merging the given view into this view}.
387
518
  *
388
519
  * @throws UsageError if the branches are unrelated.
389
520
  */
390
- isMissingEditsFrom(branch: TreeBranch): boolean;
521
+ isMissingEditsFrom(view: UntypedTreeView): boolean;
391
522
 
392
523
  /**
393
- * Computes the net change that would result if this branch were {@link TreeBranch.rebaseOnto | rebased onto} the given branch.
394
- * Note that this method does not actually perform the rebase and therefore has no effect on this branch.
524
+ * Computes the net change that would result if this view were {@link UntypedTreeView.rebaseOnto | rebased onto} the given view.
525
+ * Note that this method does not actually perform the rebase and therefore has no effect on this view.
395
526
  *
396
- * @param branch - The branch that would be rebased onto.
397
- * @returns The net change that would result if this branch were rebased onto the given branch,
527
+ * @param view - The view that would be rebased onto.
528
+ * @returns The net change that would result if this view were rebased onto the given view,
398
529
  * or `undefined` if rebasing would have no impact.
399
530
  */
400
- computeNetChangeIfRebasedOnto(branch: TreeBranch): JsonCompatibleReadOnly | undefined;
531
+ computeNetChangeIfRebasedOnto(view: UntypedTreeView): JsonCompatibleReadOnly | undefined;
401
532
  }
402
533
 
534
+ /**
535
+ * Compatibility alias for {@link UntypedTreeViewAlpha}.
536
+ *
537
+ * @deprecated Use {@link UntypedTreeViewAlpha} instead.
538
+ * @alpha
539
+ */
540
+ export type TreeBranchAlpha = UntypedTreeViewAlpha;
541
+
403
542
  /**
404
543
  * An editable view of a (version control style) branch of a shared tree based on some schema.
405
544
  *
@@ -410,7 +549,7 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
410
549
  * Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}
411
550
  * and choose a schema compatibility policy that aligns with their application's needs.
412
551
  *
413
- * See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link TreeBranch} for additional APIs that are in earlier stages of development.
552
+ * See also {@link TreeViewAlpha}, {@link TreeViewBeta} and {@link UntypedTreeView} for additional APIs that are in earlier stages of development.
414
553
  *
415
554
  * @privateRemarks
416
555
  * From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.
@@ -542,9 +681,9 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
542
681
  */
543
682
  export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>
544
683
  extends TreeView<TSchema>,
545
- TreeBranch {
684
+ UntypedTreeView {
546
685
  // Override the base branch method to return a typed view rather than merely a branch.
547
- fork(): ReturnType<TreeBranch["fork"]> & TreeViewBeta<TSchema>;
686
+ fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewBeta<TSchema>;
548
687
 
549
688
  /**
550
689
  * Run a synchronous transaction which groups sequential edits to the tree into a single atomic edit if possible.
@@ -622,7 +761,7 @@ export interface TreeViewAlpha<
622
761
  TreeViewBeta<ReadSchema<TSchema>>,
623
762
  "root" | "initialize" | "fork" | "runTransaction" | "runTransactionAsync"
624
763
  >,
625
- TreeBranchAlpha {
764
+ UntypedTreeViewAlpha {
626
765
  get root(): ReadableField<TSchema>;
627
766
 
628
767
  set root(newRoot: InsertableField<TSchema>);
@@ -647,7 +786,7 @@ export interface TreeViewAlpha<
647
786
  readonly events: Listenable<TreeViewEvents & TreeBranchEvents>;
648
787
 
649
788
  // Override the base fork method to return a TreeViewAlpha.
650
- fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
789
+ fork(): ReturnType<UntypedTreeView["fork"]> & TreeViewAlpha<TSchema>;
651
790
  }
652
791
 
653
792
  /**
@@ -744,7 +883,7 @@ export interface SchemaCompatibilityStatus {
744
883
  }
745
884
 
746
885
  /**
747
- * Events for {@link TreeBranch}.
886
+ * Events for {@link UntypedTreeView}.
748
887
  * @sealed @alpha
749
888
  */
750
889
  export interface TreeBranchEvents {
@@ -67,6 +67,7 @@ export {
67
67
  export { walkFieldSchema } from "./walkFieldSchema.js";
68
68
  export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
69
69
  export {
70
+ type CommitRevision,
70
71
  type ITree,
71
72
  type TreeView,
72
73
  type ViewableTree,
@@ -159,9 +160,13 @@ export {
159
160
  type InsertableObjectFromSchemaRecordAlphaUnsafe,
160
161
  type TreeViewAlpha,
161
162
  type TreeViewBeta,
163
+ type UntypedTreeView,
162
164
  type TreeBranch,
163
165
  type TreeBranchAlpha,
166
+ type UntypedTreeViewAlpha,
164
167
  type TreeBranchEvents,
168
+ type TreeBranchCommitMetadata,
169
+ type TreeBranchHistory,
165
170
  getPropertyKeyFromStoredKey,
166
171
  getStoredKey,
167
172
  tryGetSchema,
@@ -1123,19 +1123,14 @@ export namespace System_TableSchema {
1123
1123
  preconditionsOnRevert?: readonly TransactionConstraintAlpha[];
1124
1124
  }): void {
1125
1125
  const { applyEdits, preconditions, preconditionsOnRevert } = options;
1126
- const branch = TreeAlpha.branch(this);
1126
+ const context = TreeAlpha.context(this);
1127
1127
 
1128
1128
  // Ensure events are paused until all of the edits are applied.
1129
1129
  // This ensures that the user sees the corresponding table-level edit as atomic,
1130
1130
  // and ensures they are not spammed with intermediate events.
1131
1131
  withBufferedTreeEvents(() => {
1132
- if (branch === undefined) {
1133
- // If this node does not have a corresponding branch, then it is unhydrated.
1134
- // I.e., it is not part of a collaborative session yet.
1135
- // Therefore, we don't need to run the edits as a transaction.
1136
- applyEdits();
1137
- } else {
1138
- branch.runTransaction(
1132
+ if (context.isView()) {
1133
+ context.runTransaction(
1139
1134
  () => {
1140
1135
  applyEdits();
1141
1136
  if (preconditionsOnRevert !== undefined) {
@@ -1144,6 +1139,11 @@ export namespace System_TableSchema {
1144
1139
  },
1145
1140
  preconditions === undefined ? undefined : { preconditions },
1146
1141
  );
1142
+ } else {
1143
+ // If this node does not have a corresponding view, then it is unhydrated.
1144
+ // I.e., it is not part of a collaborative session yet.
1145
+ // Therefore, we don't need to run the edits as a transaction.
1146
+ applyEdits();
1147
1147
  }
1148
1148
  });
1149
1149
  }
@@ -1168,7 +1168,7 @@ export namespace System_TableSchema {
1168
1168
  #buildColumnInDocumentConstraintsForRows(
1169
1169
  rows: Iterable<RowValueType>,
1170
1170
  ): TransactionConstraintAlpha[] | undefined {
1171
- if (!TreeAlpha.context(this).isBranch()) {
1171
+ if (!TreeAlpha.context(this).isView()) {
1172
1172
  return undefined;
1173
1173
  }
1174
1174