@fluidframework/tree 2.116.1 → 2.118.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 (421) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/api-report/tree.alpha.api.md +122 -31
  3. package/api-report/tree.beta.api.md +50 -9
  4. package/api-report/tree.legacy.beta.api.md +50 -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/index.d.ts +1 -1
  37. package/dist/feature-libraries/index.js.map +1 -1
  38. package/dist/feature-libraries/indexing/types.d.ts +1 -1
  39. package/dist/feature-libraries/indexing/types.js.map +1 -1
  40. package/dist/feature-libraries/schemaChecker.d.ts +9 -19
  41. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  42. package/dist/feature-libraries/schemaChecker.js +130 -46
  43. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/packageVersion.d.ts +1 -1
  48. package/dist/packageVersion.js +1 -1
  49. package/dist/packageVersion.js.map +1 -1
  50. package/dist/shared-tree/history.d.ts +22 -0
  51. package/dist/shared-tree/history.d.ts.map +1 -0
  52. package/dist/shared-tree/history.js +66 -0
  53. package/dist/shared-tree/history.js.map +1 -0
  54. package/dist/shared-tree/schematizingTreeView.d.ts +24 -9
  55. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  56. package/dist/shared-tree/schematizingTreeView.js +61 -11
  57. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  58. package/dist/shared-tree/sharedTree.d.ts +3 -2
  59. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  60. package/dist/shared-tree/sharedTree.js +2 -0
  61. package/dist/shared-tree/sharedTree.js.map +1 -1
  62. package/dist/shared-tree/tree.js +1 -1
  63. package/dist/shared-tree/tree.js.map +1 -1
  64. package/dist/shared-tree/treeAlpha.d.ts +8 -20
  65. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  66. package/dist/shared-tree/treeAlpha.js +9 -12
  67. package/dist/shared-tree/treeAlpha.js.map +1 -1
  68. package/dist/shared-tree/treeCheckout.d.ts +16 -9
  69. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  70. package/dist/shared-tree/treeCheckout.js +122 -25
  71. package/dist/shared-tree/treeCheckout.js.map +1 -1
  72. package/dist/shared-tree/unhydratedTreeContext.d.ts +3 -2
  73. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  74. package/dist/shared-tree/unhydratedTreeContext.js +3 -0
  75. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  76. package/dist/shared-tree-core/branch.d.ts +16 -2
  77. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  78. package/dist/shared-tree-core/branch.js +20 -2
  79. package/dist/shared-tree-core/branch.js.map +1 -1
  80. package/dist/shared-tree-core/branchCommitCounter.d.ts +31 -0
  81. package/dist/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  82. package/dist/shared-tree-core/branchCommitCounter.js +79 -0
  83. package/dist/shared-tree-core/branchCommitCounter.js.map +1 -0
  84. package/dist/shared-tree-core/customMetadataCodec.d.ts +9 -0
  85. package/dist/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  86. package/dist/shared-tree-core/customMetadataCodec.js +37 -0
  87. package/dist/shared-tree-core/customMetadataCodec.js.map +1 -0
  88. package/dist/shared-tree-core/customMetadataFormat.d.ts +18 -0
  89. package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  90. package/dist/shared-tree-core/customMetadataFormat.js +15 -0
  91. package/dist/shared-tree-core/customMetadataFormat.js.map +1 -0
  92. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  93. package/dist/shared-tree-core/editManager.js +15 -3
  94. package/dist/shared-tree-core/editManager.js.map +1 -1
  95. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  96. package/dist/shared-tree-core/editManagerCodecs.js +5 -0
  97. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  98. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  99. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  100. package/dist/shared-tree-core/editManagerCodecsCommons.js +17 -5
  101. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  102. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  103. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  104. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  105. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  106. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  107. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  108. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  109. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  110. package/dist/shared-tree-core/editManagerFormatCommons.js +18 -8
  111. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  112. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  113. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  114. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  115. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  116. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  117. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  118. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  119. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  120. package/dist/shared-tree-core/index.d.ts +2 -1
  121. package/dist/shared-tree-core/index.d.ts.map +1 -1
  122. package/dist/shared-tree-core/index.js +3 -1
  123. package/dist/shared-tree-core/index.js.map +1 -1
  124. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  125. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  126. package/dist/shared-tree-core/messageCodecV1ToV4.js +12 -3
  127. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  128. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  129. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  130. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  131. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  132. package/dist/shared-tree-core/messageCodecs.js +5 -0
  133. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  134. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  135. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  136. package/dist/shared-tree-core/messageFormat.js +6 -0
  137. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  138. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  139. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  140. package/dist/shared-tree-core/messageFormatV1ToV4.js +10 -2
  141. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  142. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  143. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  144. package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  145. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  146. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  147. package/dist/shared-tree-core/sharedTreeCore.js +4 -2
  148. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  149. package/dist/shared-tree-core/transaction.d.ts +9 -0
  150. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  151. package/dist/shared-tree-core/transaction.js +26 -4
  152. package/dist/shared-tree-core/transaction.js.map +1 -1
  153. package/dist/simple-tree/api/configuration.d.ts +4 -4
  154. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  155. package/dist/simple-tree/api/configuration.js.map +1 -1
  156. package/dist/simple-tree/api/discrepancies.d.ts +36 -3
  157. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  158. package/dist/simple-tree/api/discrepancies.js +40 -14
  159. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  160. package/dist/simple-tree/api/index.d.ts +3 -2
  161. package/dist/simple-tree/api/index.d.ts.map +1 -1
  162. package/dist/simple-tree/api/index.js +3 -2
  163. package/dist/simple-tree/api/index.js.map +1 -1
  164. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  165. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  166. package/dist/simple-tree/api/schemaCompatibilityTester.js +140 -10
  167. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  168. package/dist/simple-tree/api/transactionTypes.d.ts +28 -2
  169. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  170. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  171. package/dist/simple-tree/api/tree.d.ts +353 -68
  172. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  173. package/dist/simple-tree/api/tree.js.map +1 -1
  174. package/dist/simple-tree/core/toStored.d.ts +7 -0
  175. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  176. package/dist/simple-tree/core/toStored.js.map +1 -1
  177. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  178. package/dist/simple-tree/core/treeNodeValid.js +2 -2
  179. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  180. package/dist/simple-tree/index.d.ts +1 -1
  181. package/dist/simple-tree/index.d.ts.map +1 -1
  182. package/dist/simple-tree/index.js +4 -3
  183. package/dist/simple-tree/index.js.map +1 -1
  184. package/dist/tableSchema.js +10 -10
  185. package/dist/tableSchema.js.map +1 -1
  186. package/docs/main/glossary.md +163 -0
  187. package/lib/codec/codec.d.ts +18 -0
  188. package/lib/codec/codec.d.ts.map +1 -1
  189. package/lib/codec/codec.js +18 -0
  190. package/lib/codec/codec.js.map +1 -1
  191. package/lib/core/index.d.ts +2 -2
  192. package/lib/core/index.d.ts.map +1 -1
  193. package/lib/core/index.js +1 -1
  194. package/lib/core/index.js.map +1 -1
  195. package/lib/core/rebase/index.d.ts +1 -1
  196. package/lib/core/rebase/index.d.ts.map +1 -1
  197. package/lib/core/rebase/index.js +1 -1
  198. package/lib/core/rebase/index.js.map +1 -1
  199. package/lib/core/rebase/types.d.ts +39 -2
  200. package/lib/core/rebase/types.d.ts.map +1 -1
  201. package/lib/core/rebase/types.js +35 -1
  202. package/lib/core/rebase/types.js.map +1 -1
  203. package/lib/core/rebase/utils.d.ts.map +1 -1
  204. package/lib/core/rebase/utils.js +1 -0
  205. package/lib/core/rebase/utils.js.map +1 -1
  206. package/lib/core/revertible.d.ts +62 -6
  207. package/lib/core/revertible.d.ts.map +1 -1
  208. package/lib/core/revertible.js.map +1 -1
  209. package/lib/entrypoints/alpha.d.ts +1 -1
  210. package/lib/entrypoints/alpha.d.ts.map +1 -1
  211. package/lib/entrypoints/alpha.js.map +1 -1
  212. package/lib/entrypoints/beta.d.ts +1 -1
  213. package/lib/entrypoints/beta.d.ts.map +1 -1
  214. package/lib/entrypoints/beta.js.map +1 -1
  215. package/lib/entrypoints/legacy.d.ts +1 -1
  216. package/lib/entrypoints/legacy.d.ts.map +1 -1
  217. package/lib/entrypoints/legacy.js.map +1 -1
  218. package/lib/feature-libraries/index.d.ts +1 -1
  219. package/lib/feature-libraries/index.js.map +1 -1
  220. package/lib/feature-libraries/indexing/types.d.ts +1 -1
  221. package/lib/feature-libraries/indexing/types.js.map +1 -1
  222. package/lib/feature-libraries/schemaChecker.d.ts +9 -19
  223. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  224. package/lib/feature-libraries/schemaChecker.js +133 -49
  225. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  226. package/lib/index.d.ts +2 -2
  227. package/lib/index.d.ts.map +1 -1
  228. package/lib/index.js.map +1 -1
  229. package/lib/packageVersion.d.ts +1 -1
  230. package/lib/packageVersion.js +1 -1
  231. package/lib/packageVersion.js.map +1 -1
  232. package/lib/shared-tree/history.d.ts +22 -0
  233. package/lib/shared-tree/history.d.ts.map +1 -0
  234. package/lib/shared-tree/history.js +62 -0
  235. package/lib/shared-tree/history.js.map +1 -0
  236. package/lib/shared-tree/schematizingTreeView.d.ts +24 -9
  237. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  238. package/lib/shared-tree/schematizingTreeView.js +62 -12
  239. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  240. package/lib/shared-tree/sharedTree.d.ts +3 -2
  241. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  242. package/lib/shared-tree/sharedTree.js +2 -0
  243. package/lib/shared-tree/sharedTree.js.map +1 -1
  244. package/lib/shared-tree/tree.js +1 -1
  245. package/lib/shared-tree/tree.js.map +1 -1
  246. package/lib/shared-tree/treeAlpha.d.ts +8 -20
  247. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  248. package/lib/shared-tree/treeAlpha.js +9 -12
  249. package/lib/shared-tree/treeAlpha.js.map +1 -1
  250. package/lib/shared-tree/treeCheckout.d.ts +16 -9
  251. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  252. package/lib/shared-tree/treeCheckout.js +123 -26
  253. package/lib/shared-tree/treeCheckout.js.map +1 -1
  254. package/lib/shared-tree/unhydratedTreeContext.d.ts +3 -2
  255. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  256. package/lib/shared-tree/unhydratedTreeContext.js +3 -0
  257. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  258. package/lib/shared-tree-core/branch.d.ts +16 -2
  259. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  260. package/lib/shared-tree-core/branch.js +20 -2
  261. package/lib/shared-tree-core/branch.js.map +1 -1
  262. package/lib/shared-tree-core/branchCommitCounter.d.ts +31 -0
  263. package/lib/shared-tree-core/branchCommitCounter.d.ts.map +1 -0
  264. package/lib/shared-tree-core/branchCommitCounter.js +75 -0
  265. package/lib/shared-tree-core/branchCommitCounter.js.map +1 -0
  266. package/lib/shared-tree-core/customMetadataCodec.d.ts +9 -0
  267. package/lib/shared-tree-core/customMetadataCodec.d.ts.map +1 -0
  268. package/lib/shared-tree-core/customMetadataCodec.js +32 -0
  269. package/lib/shared-tree-core/customMetadataCodec.js.map +1 -0
  270. package/lib/shared-tree-core/customMetadataFormat.d.ts +18 -0
  271. package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -0
  272. package/lib/shared-tree-core/customMetadataFormat.js +11 -0
  273. package/lib/shared-tree-core/customMetadataFormat.js.map +1 -0
  274. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  275. package/lib/shared-tree-core/editManager.js +16 -4
  276. package/lib/shared-tree-core/editManager.js.map +1 -1
  277. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  278. package/lib/shared-tree-core/editManagerCodecs.js +5 -0
  279. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  280. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  281. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  282. package/lib/shared-tree-core/editManagerCodecsCommons.js +17 -5
  283. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  284. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  285. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +4 -2
  286. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  287. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  288. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  289. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  290. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +17 -6
  291. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  292. package/lib/shared-tree-core/editManagerFormatCommons.js +18 -8
  293. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  294. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +7 -5
  295. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  296. package/lib/shared-tree-core/editManagerFormatV1toV4.js +4 -3
  297. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  298. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +4 -0
  299. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  300. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +2 -2
  301. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  302. package/lib/shared-tree-core/index.d.ts +2 -1
  303. package/lib/shared-tree-core/index.d.ts.map +1 -1
  304. package/lib/shared-tree-core/index.js +1 -0
  305. package/lib/shared-tree-core/index.js.map +1 -1
  306. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  307. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  308. package/lib/shared-tree-core/messageCodecV1ToV4.js +12 -3
  309. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  310. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  311. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  312. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  313. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  314. package/lib/shared-tree-core/messageCodecs.js +5 -0
  315. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  316. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  317. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  318. package/lib/shared-tree-core/messageFormat.js +6 -0
  319. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  320. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +10 -3
  321. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  322. package/lib/shared-tree-core/messageFormatV1ToV4.js +10 -2
  323. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  324. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -0
  325. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  326. package/lib/shared-tree-core/messageFormatVSharedBranches.js +2 -0
  327. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  328. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  329. package/lib/shared-tree-core/sharedTreeCore.js +5 -3
  330. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  331. package/lib/shared-tree-core/transaction.d.ts +9 -0
  332. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  333. package/lib/shared-tree-core/transaction.js +27 -5
  334. package/lib/shared-tree-core/transaction.js.map +1 -1
  335. package/lib/simple-tree/api/configuration.d.ts +4 -4
  336. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  337. package/lib/simple-tree/api/configuration.js.map +1 -1
  338. package/lib/simple-tree/api/discrepancies.d.ts +36 -3
  339. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  340. package/lib/simple-tree/api/discrepancies.js +40 -14
  341. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  342. package/lib/simple-tree/api/index.d.ts +3 -2
  343. package/lib/simple-tree/api/index.d.ts.map +1 -1
  344. package/lib/simple-tree/api/index.js +1 -1
  345. package/lib/simple-tree/api/index.js.map +1 -1
  346. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  347. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  348. package/lib/simple-tree/api/schemaCompatibilityTester.js +136 -7
  349. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  350. package/lib/simple-tree/api/transactionTypes.d.ts +28 -2
  351. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  352. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  353. package/lib/simple-tree/api/tree.d.ts +353 -68
  354. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  355. package/lib/simple-tree/api/tree.js.map +1 -1
  356. package/lib/simple-tree/core/toStored.d.ts +7 -0
  357. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  358. package/lib/simple-tree/core/toStored.js.map +1 -1
  359. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  360. package/lib/simple-tree/core/treeNodeValid.js +3 -3
  361. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  362. package/lib/simple-tree/index.d.ts +1 -1
  363. package/lib/simple-tree/index.d.ts.map +1 -1
  364. package/lib/simple-tree/index.js +1 -1
  365. package/lib/simple-tree/index.js.map +1 -1
  366. package/lib/tableSchema.js +10 -10
  367. package/lib/tableSchema.js.map +1 -1
  368. package/package.json +22 -22
  369. package/src/codec/codec.ts +19 -0
  370. package/src/core/index.ts +4 -0
  371. package/src/core/rebase/index.ts +2 -0
  372. package/src/core/rebase/types.ts +72 -2
  373. package/src/core/rebase/utils.ts +1 -0
  374. package/src/core/revertible.ts +67 -6
  375. package/src/entrypoints/alpha.ts +11 -0
  376. package/src/entrypoints/beta.ts +3 -0
  377. package/src/entrypoints/legacy.ts +3 -0
  378. package/src/feature-libraries/index.ts +1 -1
  379. package/src/feature-libraries/indexing/types.ts +1 -1
  380. package/src/feature-libraries/schemaChecker.ts +198 -82
  381. package/src/index.ts +11 -0
  382. package/src/packageVersion.ts +1 -1
  383. package/src/shared-tree/history.ts +99 -0
  384. package/src/shared-tree/schematizingTreeView.ts +100 -29
  385. package/src/shared-tree/sharedTree.ts +5 -2
  386. package/src/shared-tree/tree.ts +1 -1
  387. package/src/shared-tree/treeAlpha.ts +17 -35
  388. package/src/shared-tree/treeCheckout.ts +170 -31
  389. package/src/shared-tree/unhydratedTreeContext.ts +6 -2
  390. package/src/shared-tree-core/branch.ts +34 -2
  391. package/src/shared-tree-core/branchCommitCounter.ts +103 -0
  392. package/src/shared-tree-core/customMetadataCodec.ts +42 -0
  393. package/src/shared-tree-core/customMetadataFormat.ts +39 -0
  394. package/src/shared-tree-core/editManager.ts +22 -3
  395. package/src/shared-tree-core/editManagerCodecs.ts +12 -0
  396. package/src/shared-tree-core/editManagerCodecsCommons.ts +41 -15
  397. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +7 -1
  398. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -0
  399. package/src/shared-tree-core/editManagerFormatCommons.ts +46 -12
  400. package/src/shared-tree-core/editManagerFormatV1toV4.ts +13 -5
  401. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -2
  402. package/src/shared-tree-core/index.ts +3 -0
  403. package/src/shared-tree-core/messageCodecV1ToV4.ts +18 -5
  404. package/src/shared-tree-core/messageCodecVSharedBranches.ts +9 -2
  405. package/src/shared-tree-core/messageCodecs.ts +12 -0
  406. package/src/shared-tree-core/messageFormat.ts +6 -0
  407. package/src/shared-tree-core/messageFormatV1ToV4.ts +21 -3
  408. package/src/shared-tree-core/messageFormatVSharedBranches.ts +8 -0
  409. package/src/shared-tree-core/sharedTreeCore.ts +5 -2
  410. package/src/shared-tree-core/transaction.ts +56 -4
  411. package/src/simple-tree/api/configuration.ts +4 -4
  412. package/src/simple-tree/api/discrepancies.ts +100 -5
  413. package/src/simple-tree/api/index.ts +12 -1
  414. package/src/simple-tree/api/schemaCompatibilityTester.ts +185 -11
  415. package/src/simple-tree/api/transactionTypes.ts +29 -2
  416. package/src/simple-tree/api/tree.ts +384 -68
  417. package/src/simple-tree/core/toStored.ts +8 -0
  418. package/src/simple-tree/core/treeNodeValid.ts +3 -1
  419. package/src/simple-tree/index.ts +9 -0
  420. package/src/tableSchema.ts +9 -9
  421. package/docs/main/runtime-schema-upgrade.md +0 -208
@@ -17,6 +17,7 @@ import { BTree } from "@tylerbu/sorted-btree-es6";
17
17
  import {
18
18
  type ChangeFamily,
19
19
  type ChangeFamilyEditor,
20
+ CommitKind,
20
21
  type GraphCommit,
21
22
  type RevisionTag,
22
23
  findAncestor,
@@ -134,6 +135,7 @@ export class EditManager<
134
135
  this.trunkBase = {
135
136
  revision: rootRevision,
136
137
  change: changeFamily.rebaser.compose([]),
138
+ customMetadata: undefined,
137
139
  };
138
140
 
139
141
  if (logger !== undefined) {
@@ -348,6 +350,11 @@ export class EditManager<
348
350
  // so rebase them accordingly. This is necessary to prevent peer branches from referencing any evicted commits.
349
351
  mainBranch.trimHistory(latestEvicted, sequenceId);
350
352
 
353
+ // Custom metadata shares the lifetime of its commit, so it must be dropped when the commit is
354
+ // trimmed. The new trunk base stays reachable as the sentinel for the remaining history, so its
355
+ // metadata is cleared rather than trapped; fully evicted commits get the throwing trap below.
356
+ (newTrunkBase as Mutable<typeof newTrunkBase>).customMetadata = undefined;
357
+
351
358
  // Only the last trimmed commit, which is the new trunk base, should remain accessible.
352
359
  for (const commit of trimmedCommits.slice(0, -1)) {
353
360
  Reflect.defineProperty(commit, "change", {
@@ -363,6 +370,10 @@ export class EditManager<
363
370
  Reflect.defineProperty(commit, "parent", {
364
371
  get: () => fail(0xa60 /* Should not access 'parent' property of an evicted commit */),
365
372
  });
373
+ Reflect.defineProperty(commit, "customMetadata", {
374
+ get: () =>
375
+ fail(0xd36 /* Should not access 'customMetadata' property of an evicted commit */),
376
+ });
366
377
  }
367
378
 
368
379
  // Dropping the parent field removes (transitively) all references to the evicted commits so they can be garbage collected.
@@ -386,11 +397,13 @@ export class EditManager<
386
397
  // Trimming the trunk before serializing ensures that the trunk data in the summary is as minimal as possible.
387
398
  this.trimHistory();
388
399
 
400
+ const mainBranch = this.getSharedBranch("main");
389
401
  const minSeqNumberToSummarize: SequenceId = {
390
402
  sequenceNumber: brand(this.minimumSequenceNumber + 1),
391
403
  };
392
- let minBaseSeqId: SequenceId = minSeqNumberToSummarize;
393
- const mainBranch = this.getSharedBranch("main");
404
+ let minBaseSeqId: SequenceId = this.retainHistory
405
+ ? (mainBranch.sequenceIdToCommit.minKey() ?? minimumPossibleSequenceId)
406
+ : minSeqNumberToSummarize;
394
407
  const branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();
395
408
  for (const [branchId, branch] of this.sharedBranches) {
396
409
  if (branchId !== "main") {
@@ -822,7 +835,11 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset, TChangeProces
822
835
  } else {
823
836
  // Otherwise, push the changes to the peer local branch and merge the branch into the trunk.
824
837
  for (const newCommit of newCommits) {
825
- peerLocalBranch.apply(tagChange(newCommit.change, newCommit.revision));
838
+ peerLocalBranch.apply(
839
+ tagChange(newCommit.change, newCommit.revision),
840
+ CommitKind.Default,
841
+ newCommit.customMetadata,
842
+ );
826
843
  }
827
844
  const result = this.trunk.merge(peerLocalBranch);
828
845
  if (result !== undefined) {
@@ -1089,6 +1106,7 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset, TChangeProces
1089
1106
  revision: c.revision,
1090
1107
  sequenceNumber: metadata.sequenceId.sequenceNumber,
1091
1108
  sessionId: metadata.sessionId,
1109
+ customMetadata: c.customMetadata,
1092
1110
  };
1093
1111
  if (metadata.sequenceId.indexInBatch !== undefined) {
1094
1112
  commit.indexInBatch = metadata.sequenceId.indexInBatch;
@@ -1114,6 +1132,7 @@ class SharedBranch<TEditor extends ChangeFamilyEditor, TChangeset, TChangeProces
1114
1132
  change: c.change,
1115
1133
  revision: c.revision,
1116
1134
  sessionId,
1135
+ customMetadata: c.customMetadata,
1117
1136
  };
1118
1137
  return commit;
1119
1138
  }),
@@ -108,6 +108,18 @@ export function makeEditManagerCodecBuilder<TChangeset>(): VersionDispatchingCod
108
108
  EditManagerFormatVersion.v6,
109
109
  ),
110
110
  },
111
+ {
112
+ minVersionForCollab: FluidClientVersion.v2_117,
113
+ formatVersion: EditManagerFormatVersion.v7,
114
+ codec: (options: EditManagerCodecOptions<TChangeset>) =>
115
+ makeV1toV4andV6CodecWithVersion(
116
+ options.changeCodecs.resolve(
117
+ options.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v7),
118
+ ),
119
+ options.revisionTagCodec,
120
+ EditManagerFormatVersion.v7,
121
+ ),
122
+ },
111
123
  {
112
124
  minVersionForCollab: undefined,
113
125
  formatVersion: EditManagerFormatVersion.vSharedBranches,
@@ -22,6 +22,7 @@ import {
22
22
  } from "../util/index.js";
23
23
 
24
24
  import { decodeBranchId, encodeBranchId } from "./branchIdCodec.js";
25
+ import { decodeCustomMetadataTree, encodeCustomMetadataTree } from "./customMetadataCodec.js";
25
26
  import type { SharedBranchSummaryData } from "./editManager.js";
26
27
  import type {
27
28
  Commit,
@@ -71,8 +72,9 @@ function encodeCommit<TChangeset, T extends Commit<TChangeset>>(
71
72
  >,
72
73
  commit: T,
73
74
  context: ChangeEncodingContext,
75
+ includeCustomMetadata: boolean,
74
76
  ) {
75
- return {
77
+ const encoded = {
76
78
  ...commit,
77
79
  revision: revisionTagCodec.encode(commit.revision, {
78
80
  originatorId: commit.sessionId,
@@ -82,6 +84,16 @@ function encodeCommit<TChangeset, T extends Commit<TChangeset>>(
82
84
  }),
83
85
  change: changeCodec.encode(commit.change, { ...context, revision: commit.revision }),
84
86
  };
87
+ // Rebuilt rather than spread through, both to convert it to the persisted form and so that a client
88
+ // writing an older format never emits a field that format does not define.
89
+ if (encoded.customMetadata === undefined) {
90
+ const { customMetadata: _, ...withoutMetadata } = encoded;
91
+ return withoutMetadata;
92
+ }
93
+ const { customMetadata, ...rest } = encoded;
94
+ return includeCustomMetadata
95
+ ? { ...rest, customMetadata: encodeCustomMetadataTree(customMetadata) }
96
+ : rest;
85
97
  }
86
98
 
87
99
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -112,6 +124,7 @@ function decodeCommit<TChangeset, T extends EncodedCommit<JsonCompatibleReadOnly
112
124
  ...commit,
113
125
  revision,
114
126
  change: changeCodec.decode(commit.change, { ...context, revision }),
127
+ customMetadata: decodeCustomMetadataTree(commit.customMetadata),
115
128
  };
116
129
  }
117
130
 
@@ -131,16 +144,23 @@ export function encodeSharedBranch<TChangeset>(
131
144
  data: SharedBranchSummaryData<TChangeset>,
132
145
  context: EditManagerEncodingContext,
133
146
  originatorId: SessionId | undefined,
147
+ includeCustomMetadata: boolean,
134
148
  ): EncodedSharedBranch<TChangeset> {
135
149
  const json: Mutable<EncodedSharedBranch<TChangeset>> = {
136
150
  trunk: data.trunk.map((commit) =>
137
- encodeCommit(changeCodec, revisionTagCodec, commit, {
138
- originatorId: commit.sessionId,
139
- idCompressor: context.idCompressor,
140
- schema: context.schema,
141
- revision: undefined,
142
- isSummary: context.isSummary,
143
- }),
151
+ encodeCommit(
152
+ changeCodec,
153
+ revisionTagCodec,
154
+ commit,
155
+ {
156
+ originatorId: commit.sessionId,
157
+ idCompressor: context.idCompressor,
158
+ schema: context.schema,
159
+ revision: undefined,
160
+ isSummary: context.isSummary,
161
+ },
162
+ includeCustomMetadata,
163
+ ),
144
164
  ),
145
165
  peers: Array.from(data.peerLocalBranches.entries(), ([sessionId, branch]) => [
146
166
  sessionId,
@@ -152,13 +172,19 @@ export function encodeSharedBranch<TChangeset>(
152
172
  isSummary: context.isSummary,
153
173
  }),
154
174
  commits: branch.commits.map((commit) =>
155
- encodeCommit(changeCodec, revisionTagCodec, commit, {
156
- originatorId: commit.sessionId,
157
- idCompressor: context.idCompressor,
158
- schema: context.schema,
159
- revision: undefined,
160
- isSummary: context.isSummary,
161
- }),
175
+ encodeCommit(
176
+ changeCodec,
177
+ revisionTagCodec,
178
+ commit,
179
+ {
180
+ originatorId: commit.sessionId,
181
+ idCompressor: context.idCompressor,
182
+ schema: context.schema,
183
+ revision: undefined,
184
+ isSummary: context.isSummary,
185
+ },
186
+ includeCustomMetadata,
187
+ ),
162
188
  ),
163
189
  },
164
190
  ]),
@@ -19,6 +19,7 @@ import {
19
19
  type EditManagerEncodingContext,
20
20
  } from "./editManagerCodecsCommons.js";
21
21
  import { EncodedEditManager } from "./editManagerFormatV1toV4.js";
22
+ import { EditManagerFormatVersion } from "./editManagerFormatCommons.js";
22
23
 
23
24
  /**
24
25
  * Create the provided version of the {@link EditManager} codec (which encodes it's {@link SummaryData}).
@@ -47,7 +48,11 @@ export function makeV1toV4andV6CodecWithVersion<TChangeset>(
47
48
  EditManagerEncodingContext,
48
49
  EditManagerDecodingContext
49
50
  > {
50
- const schema = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);
51
+ const includeCustomMetadata = version >= EditManagerFormatVersion.v7;
52
+ const schema = EncodedEditManager(
53
+ changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema,
54
+ includeCustomMetadata,
55
+ );
51
56
 
52
57
  const codec: CodecAndSchema<
53
58
  SummaryData<TChangeset>,
@@ -65,6 +70,7 @@ export function makeV1toV4andV6CodecWithVersion<TChangeset>(
65
70
  data.main,
66
71
  context,
67
72
  data.originator,
73
+ includeCustomMetadata,
68
74
  );
69
75
  const encoded: EncodedEditManager<TChangeset> = {
70
76
  trunk: mainBranch.trunk,
@@ -59,6 +59,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
59
59
  data.main,
60
60
  context,
61
61
  data.originator,
62
+ true,
62
63
  );
63
64
  assert(
64
65
  data.originator !== undefined,
@@ -79,6 +80,7 @@ export function makeSharedBranchesCodecWithVersion<TChangeset>(
79
80
  branch,
80
81
  context,
81
82
  data.originator,
83
+ true,
82
84
  ),
83
85
  );
84
86
  }
@@ -8,6 +8,7 @@ import * as Type from "@sinclair/typebox";
8
8
  import type { ObjectOptions, Static, TSchema } from "@sinclair/typebox";
9
9
 
10
10
  import {
11
+ type CustomMetadataTree,
11
12
  type EncodedRevisionTag,
12
13
  type RevisionTag,
13
14
  RevisionTagSchema,
@@ -16,6 +17,7 @@ import {
16
17
  import { type Brand, brandedNumberType, strictEnum, type Values } from "../util/index.js";
17
18
 
18
19
  import type { EncodedBranchId } from "./branch.js";
20
+ import { EncodedCustomMetadataTree } from "./customMetadataFormat.js";
19
21
 
20
22
  /**
21
23
  * Contains a single change to the `SharedTree` and associated metadata.
@@ -28,6 +30,8 @@ export interface Commit<TChangeset> {
28
30
  readonly change: TChangeset;
29
31
  /** An identifier representing the session/user/client that made this commit */
30
32
  readonly sessionId: SessionId;
33
+ /** Arbitrary, application-defined metadata stored alongside this commit */
34
+ readonly customMetadata: CustomMetadataTree | undefined;
31
35
  }
32
36
 
33
37
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -35,6 +39,7 @@ export type EncodedCommit<TChangeset> = {
35
39
  readonly revision: EncodedRevisionTag;
36
40
  readonly change: TChangeset;
37
41
  readonly sessionId: SessionId;
42
+ readonly customMetadata?: EncodedCustomMetadataTree;
38
43
  };
39
44
 
40
45
  const noAdditionalProps: ObjectOptions = { additionalProperties: false };
@@ -42,18 +47,27 @@ const noAdditionalProps: ObjectOptions = { additionalProperties: false };
42
47
  // Many of the return types in this module are intentionally derived, rather than explicitly specified.
43
48
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
44
49
 
45
- const CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
50
+ const CommitBase = <ChangeSchema extends TSchema>(
51
+ tChange: ChangeSchema,
52
+ includeCustomMetadata: boolean,
53
+ ) =>
46
54
  Type.Object({
47
55
  revision: RevisionTagSchema,
48
56
  change: tChange,
49
57
  sessionId: SessionIdSchema,
58
+ ...(includeCustomMetadata
59
+ ? { customMetadata: Type.Optional(EncodedCustomMetadataTree) }
60
+ : {}),
50
61
  });
62
+
51
63
  /**
52
64
  * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.
53
65
  * This `noAdditionalProps` is especially important in that light.
54
66
  */
55
- const Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
56
- Type.Composite([CommitBase(tChange)], noAdditionalProps);
67
+ const Commit = <ChangeSchema extends TSchema>(
68
+ tChange: ChangeSchema,
69
+ includeCustomMetadata: boolean,
70
+ ) => Type.Composite([CommitBase(tChange, includeCustomMetadata)], noAdditionalProps);
57
71
 
58
72
  export type SeqNumber = Brand<number, "edit-manager.SeqNumber">;
59
73
  const SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });
@@ -70,8 +84,14 @@ export type SequenceId = Static<typeof SequenceId>;
70
84
  */
71
85
  export interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}
72
86
 
73
- export const SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
74
- Type.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);
87
+ /** The persisted counterpart of {@link SequencedCommit}. */
88
+ export type EncodedSequencedCommit<TChangeset> = EncodedCommit<TChangeset> & SequenceId;
89
+
90
+ export const SequencedCommit = <ChangeSchema extends TSchema>(
91
+ tChange: ChangeSchema,
92
+ includeCustomMetadata: boolean,
93
+ ) =>
94
+ Type.Composite([CommitBase(tChange, includeCustomMetadata), SequenceId], noAdditionalProps);
75
95
 
76
96
  /**
77
97
  * A branch off of the trunk for use in summaries.
@@ -86,14 +106,17 @@ export interface SummarySessionBranch<TChangeset> {
86
106
 
87
107
  export interface EncodedSummarySessionBranch<TChangeset> {
88
108
  readonly base: EncodedRevisionTag;
89
- readonly commits: Commit<TChangeset>[];
109
+ readonly commits: EncodedCommit<TChangeset>[];
90
110
  }
91
111
 
92
- export const SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
112
+ export const SummarySessionBranch = <ChangeSchema extends TSchema>(
113
+ tChange: ChangeSchema,
114
+ includeCustomMetadata: boolean,
115
+ ) =>
93
116
  Type.Object(
94
117
  {
95
118
  base: RevisionTagSchema,
96
- commits: Type.Array(Commit(tChange)),
119
+ commits: Type.Array(Commit(tChange, includeCustomMetadata)),
97
120
  },
98
121
  noAdditionalProps,
99
122
  );
@@ -104,11 +127,14 @@ export interface EncodedSharedBranch<TChangeset> {
104
127
  readonly author?: string;
105
128
  readonly session?: SessionId;
106
129
  readonly base?: EncodedRevisionTag;
107
- readonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];
130
+ readonly trunk: readonly Readonly<EncodedSequencedCommit<TChangeset>>[];
108
131
  readonly peers: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];
109
132
  }
110
133
 
111
- export const EncodedSharedBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>
134
+ export const EncodedSharedBranch = <ChangeSchema extends TSchema>(
135
+ tChange: ChangeSchema,
136
+ includeCustomMetadata: boolean,
137
+ ) =>
112
138
  Type.Object(
113
139
  {
114
140
  id: Type.Optional(Type.Number()),
@@ -116,8 +142,10 @@ export const EncodedSharedBranch = <ChangeSchema extends TSchema>(tChange: Chang
116
142
  session: Type.Optional(SessionIdSchema),
117
143
  author: Type.Optional(Type.String()),
118
144
  base: Type.Optional(RevisionTagSchema),
119
- trunk: Type.Array(SequencedCommit(tChange)),
120
- peers: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),
145
+ trunk: Type.Array(SequencedCommit(tChange, includeCustomMetadata)),
146
+ peers: Type.Array(
147
+ Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange, includeCustomMetadata)]),
148
+ ),
121
149
  },
122
150
  noAdditionalProps,
123
151
  );
@@ -163,6 +191,11 @@ export const EditManagerFormatVersion = strictEnum("editManager.FormatVersion",
163
191
  * Adds support for "no change" constraints.
164
192
  */
165
193
  v6: 6,
194
+ /**
195
+ * Introduced and made available for writing in 2.117.0.
196
+ * Adds support for {@link GraphCommit.customMetadata | persisted commit metadata}.
197
+ */
198
+ v7: 7,
166
199
  /**
167
200
  * Not yet released.
168
201
  * Only used for testing shared branches.
@@ -175,6 +208,7 @@ export const supportedEditManagerFormatVersions: ReadonlySet<EditManagerFormatVe
175
208
  EditManagerFormatVersion.v3,
176
209
  EditManagerFormatVersion.v4,
177
210
  EditManagerFormatVersion.v6,
211
+ EditManagerFormatVersion.v7,
178
212
  EditManagerFormatVersion.vSharedBranches,
179
213
  ]);
180
214
  export const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set(
@@ -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
  ]);