@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
@@ -3,8 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
7
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ import {
7
+ appendDebugMessage,
8
+ unreachableCase,
9
+ fail,
10
+ } from "@fluidframework/core-utils/internal";
11
+ import type {
12
+ ITelemetryBaseProperties,
13
+ TelemetryBaseEventPropertyType,
14
+ } from "@fluidframework/core-interfaces";
15
+ import { tagSchemaArtifacts, UsageError } from "@fluidframework/telemetry-utils/internal";
8
16
 
9
17
  import {
10
18
  type TreeFieldStoredSchema,
@@ -13,6 +21,7 @@ import {
13
21
  MapNodeStoredSchema,
14
22
  Multiplicity,
15
23
  type SchemaAndPolicy,
24
+ ValueSchema,
16
25
  } from "../core/index.js";
17
26
  import { iterableHasSome, mapIterable } from "../util/index.js";
18
27
 
@@ -33,83 +42,137 @@ export enum SchemaValidationError {
33
42
  }
34
43
 
35
44
  /**
36
- * Additional context about a schema validation error.
37
- * @remarks
38
- * Not all fields are populated for every error type — only those relevant to the specific error.
45
+ * Information about a schema validation error.
39
46
  */
40
- export interface SchemaValidationErrorContext {
41
- /**
42
- * The type identifier of the node that failed validation.
43
- */
44
- readonly nodeType?: string;
45
- /**
46
- * The set of type identifiers allowed in the field, if applicable.
47
- */
48
- readonly allowedTypes?: ReadonlySet<string>;
49
- /**
50
- * Field keys on the node that were not recognized by its schema.
51
- */
52
- readonly unexpectedFields?: ReadonlySet<string>;
47
+ export interface SchemaValidationErrorDetails {
48
+ readonly error: SchemaValidationError;
49
+ readonly path: readonly (string | number)[];
50
+ readonly telemetryProperties?: ITelemetryBaseProperties;
53
51
  }
54
52
 
55
53
  /**
56
54
  * Throws a UsageError indicating a tree is out of schema.
57
55
  */
58
- export function throwOutOfSchema(
59
- maybeError: SchemaValidationError,
60
- context?: SchemaValidationErrorContext,
61
- ): never {
62
- throw new UsageError(formatSchemaValidationError(maybeError, context));
56
+ export function throwOutOfSchema(details: SchemaValidationErrorDetails): never {
57
+ const message = `Tree does not conform to schema. ${getSchemaValidationErrorMessage(details.error)}`;
58
+ throw new UsageError(
59
+ appendDebugMessage(message, () => getSchemaValidationDebugMessage(details)),
60
+ {
61
+ ...tagSchemaArtifacts({
62
+ schemaValidationError: SchemaValidationError[details.error],
63
+ schemaValidationPath: JSON.stringify(details.path),
64
+ }),
65
+ ...details.telemetryProperties,
66
+ },
67
+ );
63
68
  }
64
69
 
65
- // Not exported: internal helper used by throwOutOfSchema.
66
- function formatSchemaValidationError(
67
- error: SchemaValidationError,
68
- context: SchemaValidationErrorContext | undefined,
69
- ): string {
70
- switch (error) {
70
+ function getTelemetryProperty(
71
+ details: SchemaValidationErrorDetails,
72
+ key: string,
73
+ ): TelemetryBaseEventPropertyType {
74
+ const property = details.telemetryProperties?.[key];
75
+ return typeof property === "object" ? property.value : property;
76
+ }
77
+
78
+ function getSchemaValidationDebugMessage(details: SchemaValidationErrorDetails): string {
79
+ const path = details.path.length === 0 ? "" : ` at path ${JSON.stringify(details.path)}`;
80
+ const nodeType = getTelemetryProperty(details, "nodeType");
81
+ const fieldKind = getTelemetryProperty(details, "fieldKind");
82
+ const childCount = getTelemetryProperty(details, "childCount");
83
+ switch (details.error) {
84
+ case SchemaValidationError.Field_KindNotInSchemaPolicy: {
85
+ return `Field kind ${JSON.stringify(fieldKind)} is not supported by the schema policy${path}.`;
86
+ }
87
+ case SchemaValidationError.Field_MissingRequiredChild: {
88
+ return `A required field of kind ${JSON.stringify(fieldKind)} must contain exactly one child, but found ${childCount}${path}.`;
89
+ }
90
+ case SchemaValidationError.Field_MultipleChildrenNotAllowed: {
91
+ return `A field of kind ${JSON.stringify(fieldKind)} allows at most one child, but found ${childCount}${path}.`;
92
+ }
93
+ case SchemaValidationError.Field_ChildInForbiddenField: {
94
+ return `A forbidden field of kind ${JSON.stringify(fieldKind)} must be empty, but found ${childCount} ${childCount === 1 ? "child" : "children"}${path}.`;
95
+ }
71
96
  case SchemaValidationError.Field_NodeTypeNotAllowed: {
72
- const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
73
- const allowedDesc =
74
- context?.allowedTypes === undefined
75
- ? "unknown"
76
- : `[${[...context.allowedTypes].map((t) => `"${t}"`).join(", ")}]`;
77
- return (
78
- `Tree does not conform to schema. ` +
79
- `A node of type ${nodeDesc} is not allowed in this field. Allowed types: ${allowedDesc}. ` +
80
- `If using a staged allowed type, the stored schema has not been upgraded to include this type yet. ` +
81
- `Either upgrade the schema to enable the staged type or avoid inserting content of this type until the schema is upgraded.`
82
- );
97
+ return `A node of type ${JSON.stringify(nodeType)} is not allowed in this field${path}. Allowed types: ${getTelemetryProperty(details, "allowedTypes")}. If using a staged allowed type, upgrade the stored schema before inserting this content.`;
98
+ }
99
+ case SchemaValidationError.LeafNode_InvalidValue: {
100
+ return `Leaf node ${JSON.stringify(nodeType)} requires a value matching ${JSON.stringify(getTelemetryProperty(details, "expectedValueType"))}, but found ${JSON.stringify(getTelemetryProperty(details, "actualValueType"))}${path}.`;
101
+ }
102
+ case SchemaValidationError.LeafNode_FieldsNotAllowed: {
103
+ return `Leaf node ${JSON.stringify(nodeType)} must not contain fields${path}. Unexpected fields: ${getTelemetryProperty(details, "unexpectedFields")}.`;
104
+ }
105
+ case SchemaValidationError.ObjectNode_FieldNotInSchema: {
106
+ return `A node of type ${JSON.stringify(nodeType)} has fields not defined in its schema${path}. Unexpected fields: ${getTelemetryProperty(details, "unexpectedFields")}.`;
107
+ }
108
+ case SchemaValidationError.NonLeafNode_ValueNotAllowed: {
109
+ return `Non-leaf node ${JSON.stringify(nodeType)} must not have a value, but found ${JSON.stringify(getTelemetryProperty(details, "actualValueType"))}${path}.`;
83
110
  }
84
111
  case SchemaValidationError.Node_MissingSchema: {
85
- const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
86
- return (
87
- `Tree does not conform to schema. ` +
88
- `No schema definition was found for node type ${nodeDesc}. ` +
89
- `Ensure the node's type is included in the schema and that the stored schema has been upgraded if needed.`
90
- );
112
+ return `No schema definition was found for node type ${JSON.stringify(nodeType)}${path}. Ensure the node's type is included in the schema and that the stored schema has been upgraded if needed.`;
113
+ }
114
+ default: {
115
+ return unreachableCase(details.error);
116
+ }
117
+ }
118
+ }
119
+
120
+ function getSchemaValidationErrorMessage(error: SchemaValidationError): string {
121
+ switch (error) {
122
+ case SchemaValidationError.Field_KindNotInSchemaPolicy: {
123
+ return "The field kind is not supported by the schema policy.";
124
+ }
125
+ case SchemaValidationError.Field_MissingRequiredChild: {
126
+ return "A required field is missing its child.";
127
+ }
128
+ case SchemaValidationError.Field_MultipleChildrenNotAllowed: {
129
+ return "A field contains more children than its kind allows.";
130
+ }
131
+ case SchemaValidationError.Field_ChildInForbiddenField: {
132
+ return "A forbidden field contains children.";
133
+ }
134
+ case SchemaValidationError.Field_NodeTypeNotAllowed: {
135
+ return "A node type is not allowed in its field.";
136
+ }
137
+ case SchemaValidationError.LeafNode_InvalidValue: {
138
+ return "A leaf node value does not match its schema.";
139
+ }
140
+ case SchemaValidationError.LeafNode_FieldsNotAllowed: {
141
+ return "A leaf node contains fields.";
91
142
  }
92
143
  case SchemaValidationError.ObjectNode_FieldNotInSchema: {
93
- const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
94
- const fieldsDesc =
95
- context?.unexpectedFields === undefined || context.unexpectedFields.size === 0
96
- ? undefined
97
- : `[${[...context.unexpectedFields].map((f) => `"${f}"`).join(", ")}]`;
98
- const fieldsPart =
99
- fieldsDesc === undefined
100
- ? "The node has fields that are not defined in its schema."
101
- : `Unexpected fields: ${fieldsDesc}.`;
102
- return (
103
- `Tree does not conform to schema. ` +
104
- `A node of type ${nodeDesc} has fields not defined in its schema. ${fieldsPart}`
105
- );
144
+ return "An object node contains fields not defined in its schema.";
145
+ }
146
+ case SchemaValidationError.NonLeafNode_ValueNotAllowed: {
147
+ return "A non-leaf node contains a value.";
148
+ }
149
+ case SchemaValidationError.Node_MissingSchema: {
150
+ return "The node type has no schema definition.";
106
151
  }
107
152
  default: {
108
- return `Tree does not conform to schema: ${SchemaValidationError[error]}.`;
153
+ return unreachableCase(error);
109
154
  }
110
155
  }
111
156
  }
112
157
 
158
+ function schemaValidationError(
159
+ error: SchemaValidationError,
160
+ telemetryProperties?: ITelemetryBaseProperties,
161
+ ): SchemaValidationErrorDetails {
162
+ return { error, path: [], telemetryProperties };
163
+ }
164
+
165
+ function prependPath<T extends NotUndefined>(
166
+ onError: (details: SchemaValidationErrorDetails) => T,
167
+ segment: string | number,
168
+ ): (details: SchemaValidationErrorDetails) => T {
169
+ return (details) => onError({ ...details, path: [segment, ...details.path] });
170
+ }
171
+
172
+ function getValueType(value: unknown): string {
173
+ return value === null ? "null" : typeof value;
174
+ }
175
+
113
176
  type NotUndefined = number | string | boolean | bigint | symbol | object;
114
177
 
115
178
  /**
@@ -122,28 +185,52 @@ type NotUndefined = number | string | boolean | bigint | symbol | object;
122
185
  export function isNodeInSchema<T extends NotUndefined>(
123
186
  node: MinimalMapTreeNodeView,
124
187
  schemaAndPolicy: SchemaAndPolicy,
125
- onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
188
+ onError: (details: SchemaValidationErrorDetails) => T,
126
189
  ): T | undefined {
127
190
  // Validate the schema declared by the node exists
128
191
  const schema = schemaAndPolicy.schema.nodeSchema.get(node.type);
129
192
  if (schema === undefined) {
130
- return onError(SchemaValidationError.Node_MissingSchema, {
131
- nodeType: node.type,
132
- });
193
+ return onError(
194
+ schemaValidationError(
195
+ SchemaValidationError.Node_MissingSchema,
196
+ tagSchemaArtifacts({ nodeType: node.type }),
197
+ ),
198
+ );
133
199
  }
134
200
 
135
201
  // Validate the node is well formed according to its schema
136
202
 
137
203
  if (schema instanceof LeafNodeStoredSchema) {
138
204
  if (iterableHasSome(node.fields)) {
139
- return onError(SchemaValidationError.LeafNode_FieldsNotAllowed);
205
+ const unexpectedFields = [...mapIterable(node.fields, ([key]) => key)].sort();
206
+ return onError(
207
+ schemaValidationError(SchemaValidationError.LeafNode_FieldsNotAllowed, {
208
+ ...tagSchemaArtifacts({
209
+ nodeType: node.type,
210
+ unexpectedFields: JSON.stringify(unexpectedFields),
211
+ }),
212
+ }),
213
+ );
140
214
  }
141
215
  if (!allowsValue(schema.leafValue, node.value)) {
142
- return onError(SchemaValidationError.LeafNode_InvalidValue);
216
+ return onError(
217
+ schemaValidationError(SchemaValidationError.LeafNode_InvalidValue, {
218
+ ...tagSchemaArtifacts({
219
+ nodeType: node.type,
220
+ expectedValueType: ValueSchema[schema.leafValue],
221
+ }),
222
+ actualValueType: getValueType(node.value),
223
+ }),
224
+ );
143
225
  }
144
226
  } else {
145
227
  if (node.value !== undefined) {
146
- return onError(SchemaValidationError.NonLeafNode_ValueNotAllowed);
228
+ return onError(
229
+ schemaValidationError(SchemaValidationError.NonLeafNode_ValueNotAllowed, {
230
+ ...tagSchemaArtifacts({ nodeType: node.type }),
231
+ actualValueType: getValueType(node.value),
232
+ }),
233
+ );
147
234
  }
148
235
 
149
236
  if (schema instanceof ObjectNodeStoredSchema) {
@@ -154,7 +241,7 @@ export function isNodeInSchema<T extends NotUndefined>(
154
241
  nodeField,
155
242
  fieldSchema,
156
243
  schemaAndPolicy,
157
- onError,
244
+ prependPath(onError, fieldKey),
158
245
  );
159
246
  if (fieldInSchemaResult !== undefined) {
160
247
  return fieldInSchemaResult;
@@ -166,18 +253,22 @@ export function isNodeInSchema<T extends NotUndefined>(
166
253
  // Code using this with a stored schema derived from a view schema rather than the document can be problematic because it may be missing unknown fields that the actual document has.
167
254
  // Other schema evolution features like "staged" allowed types will likely cause similar issues elsewhere in this checker.
168
255
  if (uncheckedFieldsFromNode.size > 0) {
169
- return onError(SchemaValidationError.ObjectNode_FieldNotInSchema, {
170
- nodeType: node.type,
171
- unexpectedFields: uncheckedFieldsFromNode,
172
- });
256
+ return onError(
257
+ schemaValidationError(SchemaValidationError.ObjectNode_FieldNotInSchema, {
258
+ ...tagSchemaArtifacts({
259
+ nodeType: node.type,
260
+ unexpectedFields: JSON.stringify([...uncheckedFieldsFromNode].sort()),
261
+ }),
262
+ }),
263
+ );
173
264
  }
174
265
  } else if (schema instanceof MapNodeStoredSchema) {
175
- for (const [_key, field] of node.fields) {
266
+ for (const [key, field] of node.fields) {
176
267
  const fieldInSchemaResult = isFieldInSchema(
177
268
  field,
178
269
  schema.mapFields,
179
270
  schemaAndPolicy,
180
- onError,
271
+ prependPath(onError, key),
181
272
  );
182
273
  if (fieldInSchemaResult !== undefined) {
183
274
  return fieldInSchemaResult;
@@ -202,36 +293,61 @@ export function isFieldInSchema<T extends NotUndefined>(
202
293
  childNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,
203
294
  schema: TreeFieldStoredSchema,
204
295
  schemaAndPolicy: SchemaAndPolicy,
205
- onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
296
+ onError: (details: SchemaValidationErrorDetails) => T,
206
297
  ): T | undefined {
207
298
  // Validate that the field kind is handled by the schema policy
208
299
  const kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);
209
300
  if (kind === undefined) {
210
- return onError(SchemaValidationError.Field_KindNotInSchemaPolicy);
301
+ return onError(
302
+ schemaValidationError(
303
+ SchemaValidationError.Field_KindNotInSchemaPolicy,
304
+ tagSchemaArtifacts({ fieldKind: schema.kind }),
305
+ ),
306
+ );
211
307
  }
212
308
 
213
309
  // Validate that the field doesn't contain more nodes than its type supports
214
310
  {
215
311
  const multiplicityCheck = compliesWithMultiplicity(childNodes.length, kind.multiplicity);
216
312
  if (multiplicityCheck !== undefined) {
217
- return onError(multiplicityCheck);
313
+ return onError(
314
+ schemaValidationError(multiplicityCheck, {
315
+ ...tagSchemaArtifacts({ fieldKind: schema.kind }),
316
+ childCount: childNodes.length,
317
+ }),
318
+ );
218
319
  }
219
320
  }
220
321
 
322
+ let index = 0;
221
323
  for (const node of childNodes) {
222
324
  // Validate the type declared by the node is allowed in this field
223
325
  if (schema.types !== undefined && !schema.types.has(node.type)) {
224
- return onError(SchemaValidationError.Field_NodeTypeNotAllowed, {
225
- nodeType: node.type,
226
- allowedTypes: schema.types,
227
- });
326
+ const allowedTypes = [...schema.types].sort();
327
+ return prependPath(
328
+ onError,
329
+ index,
330
+ )(
331
+ schemaValidationError(
332
+ SchemaValidationError.Field_NodeTypeNotAllowed,
333
+ tagSchemaArtifacts({
334
+ nodeType: node.type,
335
+ allowedTypes: JSON.stringify(allowedTypes),
336
+ }),
337
+ ),
338
+ );
228
339
  }
229
340
 
230
341
  // Validate the node complies with the type it declares to be.
231
- const nodeInSchemaResult = isNodeInSchema(node, schemaAndPolicy, onError);
342
+ const nodeInSchemaResult = isNodeInSchema(
343
+ node,
344
+ schemaAndPolicy,
345
+ prependPath(onError, index),
346
+ );
232
347
  if (nodeInSchemaResult !== undefined) {
233
348
  return nodeInSchemaResult;
234
349
  }
350
+ index += 1;
235
351
  }
236
352
 
237
353
  return undefined;
package/src/index.ts CHANGED
@@ -18,10 +18,13 @@ export {
18
18
  type RemoteChangeMetadata,
19
19
  type ChangeMetadata,
20
20
  type LabelTree,
21
+ type CustomMetadataTree,
21
22
  type TransactionLabels,
22
23
  type RevertibleFactory,
23
24
  type RevertibleAlphaFactory,
24
25
  type RevertibleAlpha,
26
+ type RevertOptionsAlpha,
27
+ type RevertToOptionsAlpha,
25
28
  } from "./core/index.js";
26
29
 
27
30
  import type {
@@ -91,6 +94,7 @@ export {
91
94
  } from "./shared-tree/index.js";
92
95
 
93
96
  export {
97
+ type CommitRevision,
94
98
  TreeArrayNode,
95
99
  type TreeArrayNodeAlpha,
96
100
  type Unhydrated,
@@ -133,6 +137,8 @@ export {
133
137
  type TreeNodeFromImplicitAllowedTypes,
134
138
  type TreeNodeSchemaClass,
135
139
  type SchemaCompatibilityStatus,
140
+ type SchemaCompatibilityStatusBeta,
141
+ type SchemaDiscrepancy,
136
142
  type FieldProps,
137
143
  type FieldPropsAlpha,
138
144
  normalizeFieldSchema,
@@ -194,6 +200,7 @@ export {
194
200
  singletonSchema,
195
201
  type UnsafeUnknownSchema,
196
202
  type TreeViewAlpha,
203
+ type StagedUpgradeStatus,
197
204
  type TreeViewBeta,
198
205
  type InsertableField,
199
206
  type Insertable,
@@ -269,10 +276,14 @@ export {
269
276
  type ReadonlyArrayNode,
270
277
  type InsertableTreeNodeFromAllowedTypes,
271
278
  type Input,
279
+ type UntypedTreeView,
272
280
  type TreeBranch,
273
281
  type TreeBranchAlpha,
282
+ type UntypedTreeViewAlpha,
274
283
  type TreeBranchEvents,
275
284
  asTreeViewAlpha,
285
+ type TreeBranchCommitMetadata,
286
+ type TreeBranchHistory,
276
287
  type NodeSchemaOptions,
277
288
  type NodeSchemaOptionsAlpha,
278
289
  type NodeSchemaMetadata,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.116.1";
9
+ export const pkgVersion = "2.118.0";
@@ -0,0 +1,99 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
8
+
9
+ import type { GraphCommit, CustomMetadataTree } from "../core/index.js";
10
+ import { flattenCustomMetadata } from "../core/index.js";
11
+ import { BranchCommitCounter, type SharedTreeBranch } from "../shared-tree-core/index.js";
12
+ import type { TreeBranchCommitMetadata, TreeBranchHistory } from "../simple-tree/index.js";
13
+ import type { JsonCompatibleReadOnlyObject } from "../util/index.js";
14
+
15
+ import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
16
+ import type { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
17
+
18
+ /**
19
+ * A lazily constructed implementation of {@link TreeBranchCommitMetadata} that wraps a {@link GraphCommit}.
20
+ */
21
+ class LazyTreeBranchCommitMetadata implements TreeBranchCommitMetadata {
22
+ public readonly revision: string;
23
+ private parentCache?: {
24
+ readonly prior: GraphCommit<SharedTreeChange>;
25
+ readonly cached: TreeBranchCommitMetadata;
26
+ };
27
+
28
+ public constructor(
29
+ private readonly commit: GraphCommit<SharedTreeChange>,
30
+ private readonly idCompressor: IIdCompressor,
31
+ ) {
32
+ assert(
33
+ commit.revision !== "root",
34
+ 0xd34 /* Cannot construct metadata for the root commit */,
35
+ );
36
+ this.revision = idCompressor.decompress(commit.revision);
37
+ }
38
+
39
+ public get custom(): JsonCompatibleReadOnlyObject | undefined {
40
+ return flattenCustomMetadata(this.commit.customMetadata);
41
+ }
42
+
43
+ public get customTree(): CustomMetadataTree | undefined {
44
+ return this.commit.customMetadata;
45
+ }
46
+
47
+ public getParent(): TreeBranchCommitMetadata | undefined {
48
+ // The parent of the commit may change over time due to trunk trimming.
49
+ if (this.commit.parent !== this.parentCache?.prior) {
50
+ const { parent } = this.commit;
51
+ this.parentCache =
52
+ parent === undefined || parent.revision === "root"
53
+ ? undefined
54
+ : {
55
+ prior: parent,
56
+ cached: new LazyTreeBranchCommitMetadata(parent, this.idCompressor),
57
+ };
58
+ }
59
+ return this.parentCache?.cached;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * A default implementation of {@link TreeBranchHistory} that wraps a {@link SharedTreeBranch}.
65
+ */
66
+ export class DefaultTreeBranchHistory implements TreeBranchHistory {
67
+ private readonly commitCounter: BranchCommitCounter<
68
+ SharedTreeEditBuilder,
69
+ SharedTreeChange,
70
+ unknown
71
+ >;
72
+
73
+ public constructor(
74
+ private readonly branch: SharedTreeBranch<
75
+ SharedTreeEditBuilder,
76
+ SharedTreeChange,
77
+ unknown
78
+ >,
79
+ private readonly idCompressor: IIdCompressor,
80
+ ) {
81
+ this.commitCounter = new BranchCommitCounter(branch);
82
+ }
83
+
84
+ public dispose(): void {
85
+ this.commitCounter.dispose();
86
+ }
87
+
88
+ public get length(): number {
89
+ return this.commitCounter.count;
90
+ }
91
+
92
+ public getHead(): TreeBranchCommitMetadata | undefined {
93
+ const head = this.branch.getHead();
94
+ if (head.revision === "root") {
95
+ return undefined;
96
+ }
97
+ return new LazyTreeBranchCommitMetadata(head, this.idCompressor);
98
+ }
99
+ }