@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
@@ -11,6 +11,7 @@ import { SessionIdSchema } from "../core/index.js";
11
11
 
12
12
  import {
13
13
  EditManagerFormatVersion,
14
+ type EncodedSequencedCommit,
14
15
  type EncodedSummarySessionBranch,
15
16
  SequencedCommit,
16
17
  SummarySessionBranch,
@@ -22,17 +23,21 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
22
23
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
23
24
 
24
25
  export interface EncodedEditManager<TChangeset> {
25
- readonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];
26
+ readonly trunk: readonly Readonly<EncodedSequencedCommit<TChangeset>>[];
26
27
  readonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];
27
28
  readonly version:
28
29
  | typeof EditManagerFormatVersion.v1
29
30
  | typeof EditManagerFormatVersion.v2
30
31
  | typeof EditManagerFormatVersion.v3
31
32
  | typeof EditManagerFormatVersion.v4
32
- | typeof EditManagerFormatVersion.v6;
33
+ | typeof EditManagerFormatVersion.v6
34
+ | typeof EditManagerFormatVersion.v7;
33
35
  }
34
36
 
35
- export const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
37
+ export const EncodedEditManager = <ChangeSchema extends TSchema>(
38
+ tChange: ChangeSchema,
39
+ includeCustomMetadata: boolean,
40
+ ) =>
36
41
  Type.Object(
37
42
  {
38
43
  version: Type.Union([
@@ -41,9 +46,12 @@ export const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: Change
41
46
  Type.Literal(EditManagerFormatVersion.v3),
42
47
  Type.Literal(EditManagerFormatVersion.v4),
43
48
  Type.Literal(EditManagerFormatVersion.v6),
49
+ Type.Literal(EditManagerFormatVersion.v7),
44
50
  ]),
45
- trunk: Type.Array(SequencedCommit(tChange)),
46
- branches: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),
51
+ trunk: Type.Array(SequencedCommit(tChange, includeCustomMetadata)),
52
+ branches: Type.Array(
53
+ Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange, includeCustomMetadata)]),
54
+ ),
47
55
  },
48
56
  noAdditionalProps,
49
57
  );
@@ -28,8 +28,8 @@ export const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: Change
28
28
  {
29
29
  version: Type.Literal(EditManagerFormatVersion.vSharedBranches),
30
30
  originator: SessionIdSchema,
31
- main: EncodedSharedBranch(tChange),
32
- branches: Type.Optional(Type.Array(EncodedSharedBranch(tChange))),
31
+ main: EncodedSharedBranch(tChange, true),
32
+ branches: Type.Optional(Type.Array(EncodedSharedBranch(tChange, true))),
33
33
  },
34
34
  noAdditionalProps,
35
35
  );
@@ -9,8 +9,11 @@ export {
9
9
  type SharedTreeBranchChange,
10
10
  type SharedTreeBranchEvents,
11
11
  type BranchId,
12
+ type BranchTrimmingEvents,
12
13
  } from "./branch.js";
13
14
 
15
+ export { BranchCommitCounter } from "./branchCommitCounter.js";
16
+
14
17
  export {
15
18
  type ChangeProcessor,
16
19
  type OnPop,
@@ -15,10 +15,12 @@ import type {
15
15
  import {
16
16
  type JsonCompatibleReadOnlyObject,
17
17
  JsonCompatibleReadOnlySchema,
18
+ type Mutable,
18
19
  } from "../util/index.js";
19
20
 
20
21
  import type { MessageDecodingContext, MessageEncodingContext } from "./messageCodecs.js";
21
- import type { MessageFormatVersion } from "./messageFormat.js";
22
+ import { MessageFormatVersion } from "./messageFormat.js";
23
+ import { decodeCustomMetadataTree, encodeCustomMetadataTree } from "./customMetadataCodec.js";
22
24
  import { Message } from "./messageFormatV1ToV4.js";
23
25
  import type { DecodedMessage } from "./messageTypes.js";
24
26
 
@@ -35,9 +37,15 @@ export function makeV1ToV4CodecWithVersion<TChangeset>(
35
37
  | typeof MessageFormatVersion.v2
36
38
  | typeof MessageFormatVersion.v3
37
39
  | typeof MessageFormatVersion.v4
38
- | typeof MessageFormatVersion.v6,
40
+ | typeof MessageFormatVersion.v6
41
+ | typeof MessageFormatVersion.v7,
39
42
  ): CodecAndSchema<DecodedMessage<TChangeset>, MessageEncodingContext, MessageDecodingContext> {
40
- const schema = Message(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);
43
+ // Persisted commit metadata was introduced in v7; older formats must not write the field.
44
+ const supportsCustomMetadata = version >= MessageFormatVersion.v7;
45
+ const schema = Message(
46
+ changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema,
47
+ supportsCustomMetadata,
48
+ );
41
49
  return {
42
50
  schema,
43
51
  encode: (
@@ -50,7 +58,7 @@ export function makeV1ToV4CodecWithVersion<TChangeset>(
50
58
  0xc69 /* Only commit messages to main are supported */,
51
59
  );
52
60
  const { commit, sessionId: originatorId } = decoded;
53
- return {
61
+ const encoded: Mutable<Message & JsonCompatibleReadOnlyObject & Versioned> = {
54
62
  revision: revisionTagCodec.encode(commit.revision, {
55
63
  originatorId,
56
64
  idCompressor: context.idCompressor,
@@ -67,12 +75,16 @@ export function makeV1ToV4CodecWithVersion<TChangeset>(
67
75
  }),
68
76
  version,
69
77
  };
78
+ if (supportsCustomMetadata && commit.customMetadata !== undefined) {
79
+ encoded.customMetadata = encodeCustomMetadataTree(commit.customMetadata);
80
+ }
81
+ return encoded;
70
82
  },
71
83
  decode: (
72
84
  encoded: Message & JsonCompatibleReadOnlyObject & Versioned,
73
85
  context: MessageDecodingContext,
74
86
  ): DecodedMessage<TChangeset> => {
75
- const { revision: encodedRevision, originatorId, changeset } = encoded;
87
+ const { revision: encodedRevision, originatorId, changeset, customMetadata } = encoded;
76
88
 
77
89
  const revision = revisionTagCodec.decode(encodedRevision, {
78
90
  originatorId,
@@ -92,6 +104,7 @@ export function makeV1ToV4CodecWithVersion<TChangeset>(
92
104
  idCompressor: context.idCompressor,
93
105
  isSummary: false,
94
106
  }),
107
+ customMetadata: decodeCustomMetadataTree(customMetadata),
95
108
  },
96
109
  sessionId: originatorId,
97
110
  };
@@ -14,9 +14,10 @@ import type {
14
14
  EncodedRevisionTag,
15
15
  RevisionTag,
16
16
  } from "../core/index.js";
17
- import type { JsonCompatibleReadOnlyObject } from "../util/index.js";
17
+ import type { JsonCompatibleReadOnlyObject, Mutable } from "../util/index.js";
18
18
 
19
19
  import { decodeBranchId, encodeBranchId } from "./branchIdCodec.js";
20
+ import { decodeCustomMetadataTree, encodeCustomMetadataTree } from "./customMetadataCodec.js";
20
21
  import type { MessageDecodingContext, MessageEncodingContext } from "./messageCodecs.js";
21
22
  import type { MessageFormatVersion } from "./messageFormat.js";
22
23
  import { Message } from "./messageFormatVSharedBranches.js";
@@ -51,7 +52,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
51
52
  isSummary: false,
52
53
  };
53
54
 
54
- return {
55
+ const encoded: Mutable<Message & JsonCompatibleReadOnlyObject & Versioned> = {
55
56
  revision: revisionTagCodec.encode(message.commit.revision, {
56
57
  originatorId: message.sessionId,
57
58
  idCompressor: context.idCompressor,
@@ -63,6 +64,10 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
63
64
  branchId: encodeBranchId(context.idCompressor, message.branchId),
64
65
  version,
65
66
  };
67
+ if (message.commit.customMetadata !== undefined) {
68
+ encoded.customMetadata = encodeCustomMetadataTree(message.commit.customMetadata);
69
+ }
70
+ return encoded;
66
71
  }
67
72
  case "branch": {
68
73
  return {
@@ -87,6 +92,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
87
92
  changeset,
88
93
  branchId: encodedBranchId,
89
94
  branchName: encodedBranchName,
95
+ customMetadata,
90
96
  } = encoded;
91
97
 
92
98
  const changeContext: ChangeEncodingContext = {
@@ -120,6 +126,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
120
126
  idCompressor: context.idCompressor,
121
127
  isSummary: false,
122
128
  }),
129
+ customMetadata: decodeCustomMetadataTree(customMetadata),
123
130
  },
124
131
  branchId,
125
132
  sessionId: originatorId,
@@ -125,6 +125,18 @@ export function makeMessageCodecBuilder<TChangeset>(): VersionDispatchingCodecBu
125
125
  MessageFormatVersion.v6,
126
126
  ),
127
127
  },
128
+ {
129
+ minVersionForCollab: FluidClientVersion.v2_117,
130
+ formatVersion: MessageFormatVersion.v7,
131
+ codec: (options: MessageCodecBuilderOptions<TChangeset>) =>
132
+ makeV1ToV4CodecWithVersion(
133
+ options.changeCodecs.resolve(
134
+ options.dependentChangeFormatVersion.lookup(MessageFormatVersion.v7),
135
+ ),
136
+ options.revisionTagCodec,
137
+ MessageFormatVersion.v7,
138
+ ),
139
+ },
128
140
  {
129
141
  minVersionForCollab: undefined,
130
142
  formatVersion: MessageFormatVersion.vSharedBranches,
@@ -52,6 +52,11 @@ export const MessageFormatVersion = strictEnum("MessageFormatVersion", {
52
52
  * Adds support for "no change" constraints.
53
53
  */
54
54
  v6: 6,
55
+ /**
56
+ * Introduced and made available for writing in 2.117.0.
57
+ * Adds support for {@link GraphCommit.customMetadata | persisted commit metadata}.
58
+ */
59
+ v7: 7,
55
60
  /**
56
61
  * Not yet released.
57
62
  * Only used for testing shared branches.
@@ -63,5 +68,6 @@ export const supportedMessageFormatVersions: ReadonlySet<MessageFormatVersion> =
63
68
  MessageFormatVersion.v3,
64
69
  MessageFormatVersion.v4,
65
70
  MessageFormatVersion.v6,
71
+ MessageFormatVersion.v7,
66
72
  MessageFormatVersion.vSharedBranches,
67
73
  ]);
@@ -10,6 +10,7 @@ import type { TSchema } from "@sinclair/typebox";
10
10
  import { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from "../core/index.js";
11
11
  import type { JsonCompatibleReadOnly } from "../util/index.js";
12
12
 
13
+ import { EncodedCustomMetadataTree } from "./customMetadataFormat.js";
13
14
  import { MessageFormatVersion } from "./messageFormat.js";
14
15
 
15
16
  /**
@@ -29,6 +30,12 @@ export interface Message {
29
30
  */
30
31
  readonly changeset: JsonCompatibleReadOnly;
31
32
 
33
+ /**
34
+ * Arbitrary, application-defined metadata to persist alongside the commit in this message.
35
+ * @remarks Only written at {@link MessageFormatVersion.v7} and later.
36
+ */
37
+ readonly customMetadata?: EncodedCustomMetadataTree;
38
+
32
39
  /**
33
40
  * The version of the message. This controls how the message is encoded.
34
41
  *
@@ -40,16 +47,25 @@ export interface Message {
40
47
  | typeof MessageFormatVersion.v2
41
48
  | typeof MessageFormatVersion.v3
42
49
  | typeof MessageFormatVersion.v4
43
- | typeof MessageFormatVersion.v6;
50
+ | typeof MessageFormatVersion.v6
51
+ | typeof MessageFormatVersion.v7;
44
52
  }
45
53
 
54
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
46
55
  // Return type is intentionally derived.
47
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
48
- export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
56
+ // Unlike the summary formats, this schema does not set `additionalProperties: false`: the op envelope
57
+ // has always tolerated unknown properties, and tightening it could reject ops from other versions.
58
+ export const Message = <ChangeSchema extends TSchema>(
59
+ tChange: ChangeSchema,
60
+ includeCustomMetadata: boolean,
61
+ ) =>
49
62
  Type.Object({
50
63
  revision: RevisionTagSchema,
51
64
  originatorId: SessionIdSchema,
52
65
  changeset: tChange,
66
+ ...(includeCustomMetadata
67
+ ? { customMetadata: Type.Optional(EncodedCustomMetadataTree) }
68
+ : {}),
53
69
  version: Type.Optional(
54
70
  Type.Union([
55
71
  Type.Literal(MessageFormatVersion.v1),
@@ -57,6 +73,8 @@ export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
57
73
  Type.Literal(MessageFormatVersion.v3),
58
74
  Type.Literal(MessageFormatVersion.v4),
59
75
  Type.Literal(MessageFormatVersion.v6),
76
+ Type.Literal(MessageFormatVersion.v7),
60
77
  ]),
61
78
  ),
62
79
  });
80
+ /* eslint-enable @typescript-eslint/explicit-function-return-type */
@@ -11,6 +11,7 @@ import { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from "../
11
11
  import type { JsonCompatibleReadOnly } from "../util/index.js";
12
12
 
13
13
  import type { EncodedBranchId } from "./branch.js";
14
+ import { EncodedCustomMetadataTree } from "./customMetadataFormat.js";
14
15
  import { MessageFormatVersion } from "./messageFormat.js";
15
16
 
16
17
  /**
@@ -41,6 +42,12 @@ export interface Message {
41
42
  */
42
43
  readonly branchName?: string;
43
44
 
45
+ /**
46
+ * Arbitrary, application-defined metadata to persist alongside the commit in this message.
47
+ * @remarks See {@link GraphCommit.customMetadata}.
48
+ */
49
+ readonly customMetadata?: EncodedCustomMetadataTree;
50
+
44
51
  /**
45
52
  * The version of the message format.
46
53
  */
@@ -56,5 +63,6 @@ export const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
56
63
  changeset: Type.Optional(tChange),
57
64
  branchId: Type.Optional(Type.Number()),
58
65
  branchName: Type.Optional(Type.String()),
66
+ customMetadata: Type.Optional(EncodedCustomMetadataTree),
59
67
  version: Type.Literal(MessageFormatVersion.vSharedBranches),
60
68
  });
@@ -30,6 +30,7 @@ import type { CodecWriteOptions, DependentFormatVersion, IJsonCodec } from "../c
30
30
  import {
31
31
  type ChangeFamily,
32
32
  type ChangeFamilyEditor,
33
+ CommitKind,
33
34
  type GraphCommit,
34
35
  replaceChange,
35
36
  type RevisionTag,
@@ -669,10 +670,12 @@ export class SharedTreeCore<
669
670
  switch (type) {
670
671
  case "commit": {
671
672
  const {
672
- commit: { revision, change },
673
+ commit: { revision, change, customMetadata },
673
674
  branchId,
674
675
  } = message;
675
- this.editManager.getLocalBranch(branchId).apply({ change, revision });
676
+ this.editManager
677
+ .getLocalBranch(branchId)
678
+ .apply({ change, revision }, CommitKind.Default, customMetadata);
676
679
  break;
677
680
  }
678
681
  case "branch": {
@@ -15,15 +15,25 @@ import {
15
15
  mintCommit,
16
16
  rebaseBranch,
17
17
  tagChange,
18
+ CommitKind,
18
19
  type ChangeFamilyEditor,
20
+ type CustomMetadataTree,
19
21
  type GraphCommit,
20
22
  type ProcessChangeFn,
21
23
  type RevisionTag,
22
24
  } from "../core/index.js";
23
- import { getLast, getOrCreate } from "../util/index.js";
25
+ import { getLast, getOrCreate, type JsonCompatibleReadOnlyObject } from "../util/index.js";
24
26
 
25
27
  import type { SharedTreeBranch, SharedTreeBranchEvents } from "./branch.js";
26
28
 
29
+ /**
30
+ * A {@link CustomMetadataTree} under construction.
31
+ */
32
+ interface MutableCustomMetadataTree {
33
+ metadata: JsonCompatibleReadOnlyObject | undefined;
34
+ children: MutableCustomMetadataTree[];
35
+ }
36
+
27
37
  /**
28
38
  * Describes the result of a transaction.
29
39
  * Transactions may either succeed and commit, or fail and abort.
@@ -290,6 +300,15 @@ export interface SquashingTransactionOptions<TChange, TChangeProcessingContext>
290
300
  * {@link ChangeProcessor.applicability | applicability}.
291
301
  */
292
302
  readonly postProcessor?: ChangeProcessor<TChange, TChangeProcessingContext>;
303
+
304
+ /**
305
+ * Arbitrary, application-defined metadata to attach to the commit that this transaction produces.
306
+ *
307
+ * @remarks
308
+ * Each transaction in the stack contributes a node to the resulting {@link CustomMetadataTree}. If
309
+ * the transaction produces no commit, the metadata is discarded.
310
+ */
311
+ readonly customMetadata?: JsonCompatibleReadOnlyObject;
293
312
  }
294
313
 
295
314
  /**
@@ -409,6 +428,15 @@ export class SquashingTransactionStack<
409
428
  startOptions?: SquashingTransactionOptions<TChange, TChangeProcessingContext>,
410
429
  ): Callbacks<SquashingTransactionOptions<TChange, TChangeProcessingContext>> => {
411
430
  postProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));
431
+ // Each transaction in the stack contributes a node to a tree mirroring the nesting, which is
432
+ // attached to the single commit they produce. `openMetadataNode` is the innermost open node.
433
+ const rootMetadataNode: MutableCustomMetadataTree = {
434
+ metadata: startOptions?.customMetadata,
435
+ children: [],
436
+ };
437
+ let openMetadataNode = rootMetadataNode;
438
+ const hasCustomMetadata = (node: CustomMetadataTree): boolean =>
439
+ node.metadata !== undefined || node.children.some(hasCustomMetadata);
412
440
  // Keep track of the commit that each transaction was on when it started
413
441
  const startHead = this.activeBranch.getHead();
414
442
  const changeFamily = this.branch.changeFamily;
@@ -490,19 +518,31 @@ export class SquashingTransactionStack<
490
518
  // change in their place so that the view fully reflects the modified
491
519
  // `change`.
492
520
  transactionBranch.removeAfter(startHead);
493
- transactionBranch.apply(tagChange(change, transactionRevision));
521
+ transactionBranch.apply(
522
+ tagChange(change, transactionRevision),
523
+ CommitKind.Default,
524
+ undefined,
525
+ );
494
526
  }
495
527
 
528
+ const customMetadata = hasCustomMetadata(rootMetadataNode)
529
+ ? rootMetadataNode
530
+ : undefined;
496
531
  if (targetPath.length === 0) {
497
532
  // No changes were made on the original branch since the transaction began
498
533
  // The transaction commit can be applied directly
499
- this.branch.apply(tagChange(change, transactionRevision));
534
+ this.branch.apply(
535
+ tagChange(change, transactionRevision),
536
+ CommitKind.Default,
537
+ customMetadata,
538
+ );
500
539
  // The view is already up-to-date so there's nothing more to do
501
540
  } else {
502
541
  // Some changes were made on `branch` since the transaction began
503
542
  const unrebasedHead = mintCommit(startHead, {
504
543
  change,
505
544
  revision: transactionRevision,
545
+ customMetadata,
506
546
  });
507
547
  // We need to rebase the transaction commit on top of the new changes
508
548
  const rebased = rebaseBranch(
@@ -515,7 +555,7 @@ export class SquashingTransactionStack<
515
555
  rebased.newSourceHead.revision === transactionRevision,
516
556
  0xcd0 /* The transaction commit should be rebased to the tip */,
517
557
  );
518
- this.branch.apply(rebased.newSourceHead);
558
+ this.branch.apply(rebased.newSourceHead, CommitKind.Default, customMetadata);
519
559
  viewUpdate = rebased.sourceChange;
520
560
  }
521
561
  } else {
@@ -546,6 +586,13 @@ export class SquashingTransactionStack<
546
586
  SquashingTransactionOptions<TChange, TChangeProcessingContext>
547
587
  > = (nestedStartOptions) => {
548
588
  postProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));
589
+ const nestedMetadataNode: MutableCustomMetadataTree = {
590
+ metadata: nestedStartOptions?.customMetadata,
591
+ children: [],
592
+ };
593
+ const metadataParent = openMetadataNode;
594
+ metadataParent.children.push(nestedMetadataNode);
595
+ openMetadataNode = nestedMetadataNode;
549
596
  const nestedStartHead = this.activeBranch.getHead();
550
597
  const nestedOuterOnPop = onPush?.();
551
598
  transactionBranch.editor.enterTransaction();
@@ -553,9 +600,12 @@ export class SquashingTransactionStack<
553
600
  // Invoked when a nested transaction ends
554
601
  onPop: (result) => {
555
602
  const nestedPostProcessor = postProcessorStack.pop();
603
+ openMetadataNode = metadataParent;
556
604
  transactionBranch.editor.exitTransaction();
557
605
  switch (result) {
558
606
  case TransactionResult.Abort: {
607
+ // The aborted transaction contributed nothing; its node is necessarily the last child.
608
+ metadataParent.children.pop();
559
609
  // When a transaction is aborted, roll back all the transaction's changes on the current branch
560
610
  transactionBranch.removeAfter(nestedStartHead);
561
611
  break;
@@ -585,6 +635,8 @@ export class SquashingTransactionStack<
585
635
  transactionBranch.removeAfter(nestedStartHead);
586
636
  transactionBranch.apply(
587
637
  tagChange(processedSquash, transactionRevision),
638
+ CommitKind.Default,
639
+ undefined,
588
640
  );
589
641
  }
590
642
  }
@@ -13,6 +13,7 @@ export {
13
13
  TreeViewConfigurationAlpha,
14
14
  } from "./configuration.js";
15
15
  export type {
16
+ CommitRevision,
16
17
  ITree,
17
18
  TreeView,
18
19
  ViewableTree,
@@ -20,9 +21,13 @@ export type {
20
21
  SchemaCompatibilityStatus,
21
22
  TreeViewAlpha,
22
23
  TreeViewBeta,
24
+ UntypedTreeView,
23
25
  TreeBranch,
24
26
  TreeBranchAlpha,
27
+ UntypedTreeViewAlpha,
25
28
  TreeBranchEvents,
29
+ TreeBranchCommitMetadata,
30
+ TreeBranchHistory,
26
31
  TreeContextAlpha,
27
32
  ITreeAlpha,
28
33
  } from "./tree.js";
@@ -6,6 +6,7 @@
6
6
  import type { ErasedType } from "@fluidframework/core-interfaces";
7
7
 
8
8
  import type { TreeNode } from "../core/index.js";
9
+ import type { JsonCompatibleReadOnlyObject } from "../../util/index.js";
9
10
 
10
11
  /**
11
12
  * A special object that signifies when a SharedTree {@link RunTransaction | transaction} should "roll back".
@@ -103,7 +104,7 @@ export type TransactionCallbackStatusAlpha<TSuccessValue, TFailureValue> =
103
104
  };
104
105
 
105
106
  /**
106
- * The result of a {@link TreeBranchAlpha.(runTransaction:2) | transaction} that doesn't return a value.
107
+ * The result of a {@link UntypedTreeViewAlpha.(runTransaction:2) | transaction} that doesn't return a value.
107
108
  * @input
108
109
  * @alpha
109
110
  */
@@ -181,7 +182,7 @@ export interface RunTransactionParamsBeta {
181
182
  /**
182
183
  * A label for this transaction that allows it to be correlated with later edits (e.g. for controlling undo/redo grouping).
183
184
  * @remarks
184
- * If this transaction is applied to a {@link TreeBranchAlpha | branch}, the label will be available in the {@link LocalChangeMetadata.label | metadata} of the {@link TreeBranchEvents.changed | `changed`} event.
185
+ * If this transaction is applied to an {@link UntypedTreeViewAlpha | untyped view}, the label will be available in the {@link LocalChangeMetadata.label | metadata} of the {@link TreeBranchEvents.changed | `changed`} event.
185
186
  *
186
187
  * If there is a nested transaction, only the outermost transaction label will be used.
187
188
  */
@@ -218,4 +219,30 @@ export interface RunTransactionParamsAlpha extends RunTransactionParamsBeta {
218
219
  * reserving the behavior; a real post-processor will be provided in a future change.
219
220
  */
220
221
  readonly postProcessor?: TransactionPostProcessor;
222
+
223
+ /**
224
+ * Arbitrary, application-defined metadata to persist alongside the commit that this transaction produces.
225
+ * @remarks
226
+ * The metadata is replicated to all collaborating clients and persisted in the document, and is readable
227
+ * via {@link TreeBranchCommitMetadata.custom} while walking the branch's
228
+ * {@link UntypedTreeViewAlpha.branchHistory | history}. It shares the lifetime of the commit it is attached
229
+ * to: once that commit is trimmed from the trunk, the metadata goes with it. If the transaction produces no
230
+ * commit — because its body made no changes, or because it was rolled back — the metadata is discarded.
231
+ *
232
+ * Nested transactions all contribute to the single commit they produce, and their metadata is available
233
+ * both flattened via {@link TreeBranchCommitMetadata.custom} and structurally via
234
+ * {@link TreeBranchCommitMetadata.customTree}.
235
+ *
236
+ * To attach metadata to the commit produced by
237
+ * {@link RevertibleAlpha.(revert:3) | reverting}, use {@link RevertOptionsAlpha.customMetadata} instead.
238
+ *
239
+ * The value is snapshotted when the transaction starts and normalized as `JSON.stringify` would. An error is
240
+ * thrown if it cannot be represented as a JSON object at all, such as when it contains a cycle or a
241
+ * `bigint`. Because it is persisted, it should be kept small; it is also bounded by the runtime's maximum
242
+ * op size.
243
+ *
244
+ * Metadata is only written to the document when `minVersionForCollab` is set to `"2.117.0"` or later.
245
+ * Otherwise it is retained in memory for the local session but not persisted or replicated.
246
+ */
247
+ readonly customMetadata?: JsonCompatibleReadOnlyObject;
221
248
  }