@fluidframework/tree 2.63.0-359734 → 2.63.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 (328) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/api-report/tree.alpha.api.md +42 -8
  3. package/dist/alpha.d.ts +7 -0
  4. package/dist/codec/codec.d.ts +10 -27
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +9 -28
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/versioned/codec.d.ts +6 -5
  9. package/dist/codec/versioned/codec.d.ts.map +1 -1
  10. package/dist/codec/versioned/codec.js +4 -4
  11. package/dist/codec/versioned/codec.js.map +1 -1
  12. package/dist/core/tree/detachedFieldIndex.js +1 -1
  13. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  14. package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
  15. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  16. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
  17. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/chunkTree.js +70 -35
  19. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  20. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -8
  21. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  22. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  23. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
  25. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
  26. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +15 -0
  27. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
  28. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
  29. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/codec/index.js +3 -1
  31. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
  34. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  36. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  38. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  39. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  40. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  41. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -1
  42. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  43. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  44. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
  45. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  46. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -3
  47. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  48. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
  49. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  50. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
  51. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  52. package/dist/feature-libraries/index.d.ts +1 -1
  53. package/dist/feature-libraries/index.d.ts.map +1 -1
  54. package/dist/feature-libraries/index.js +2 -1
  55. package/dist/feature-libraries/index.js.map +1 -1
  56. package/dist/feature-libraries/schema-index/codec.d.ts +6 -5
  57. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/schema-index/codec.js +3 -3
  59. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/packageVersion.d.ts +1 -1
  64. package/dist/packageVersion.d.ts.map +1 -1
  65. package/dist/packageVersion.js +1 -1
  66. package/dist/packageVersion.js.map +1 -1
  67. package/dist/shared-tree/independentView.d.ts.map +1 -1
  68. package/dist/shared-tree/independentView.js +2 -2
  69. package/dist/shared-tree/independentView.js.map +1 -1
  70. package/dist/shared-tree/schematizingTreeView.d.ts +5 -0
  71. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  72. package/dist/shared-tree/schematizingTreeView.js +37 -7
  73. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  74. package/dist/shared-tree/sharedTree.d.ts +6 -8
  75. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  76. package/dist/shared-tree/sharedTree.js +7 -9
  77. package/dist/shared-tree/sharedTree.js.map +1 -1
  78. package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -1
  79. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  80. package/dist/shared-tree/tree.js +1 -1
  81. package/dist/shared-tree/tree.js.map +1 -1
  82. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  83. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  84. package/dist/shared-tree/treeAlpha.js +3 -3
  85. package/dist/shared-tree/treeAlpha.js.map +1 -1
  86. package/dist/shared-tree/treeCheckout.js +1 -1
  87. package/dist/shared-tree/treeCheckout.js.map +1 -1
  88. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  89. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -2
  90. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  91. package/dist/simple-tree/api/index.d.ts +1 -1
  92. package/dist/simple-tree/api/index.d.ts.map +1 -1
  93. package/dist/simple-tree/api/index.js.map +1 -1
  94. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
  95. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  96. package/dist/simple-tree/api/schemaFactoryAlpha.js +34 -14
  97. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  98. package/dist/simple-tree/api/schemaStatics.js +3 -0
  99. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  100. package/dist/simple-tree/api/storedSchema.d.ts +4 -3
  101. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  102. package/dist/simple-tree/api/storedSchema.js +3 -3
  103. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  104. package/dist/simple-tree/api/treeBeta.js +2 -2
  105. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  106. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  107. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  108. package/dist/simple-tree/api/typesUnsafe.d.ts +60 -1
  109. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  110. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  111. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  112. package/dist/simple-tree/core/allowedTypes.js +1 -1
  113. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  114. package/dist/simple-tree/core/index.d.ts +1 -1
  115. package/dist/simple-tree/core/index.d.ts.map +1 -1
  116. package/dist/simple-tree/core/index.js +2 -2
  117. package/dist/simple-tree/core/index.js.map +1 -1
  118. package/dist/simple-tree/core/treeNodeKernel.d.ts +7 -11
  119. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  120. package/dist/simple-tree/core/treeNodeKernel.js +24 -47
  121. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  122. package/dist/simple-tree/getTreeNodeForField.js +1 -1
  123. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  124. package/dist/simple-tree/index.d.ts +2 -2
  125. package/dist/simple-tree/index.d.ts.map +1 -1
  126. package/dist/simple-tree/index.js +2 -2
  127. package/dist/simple-tree/index.js.map +1 -1
  128. package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -2
  129. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  130. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  131. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  132. package/dist/simple-tree/node-kinds/object/objectNode.js +3 -3
  133. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  134. package/dist/simple-tree/node-kinds/record/recordNode.js +6 -6
  135. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  136. package/dist/simple-tree/prepareForInsertion.d.ts +36 -4
  137. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  138. package/dist/simple-tree/prepareForInsertion.js +43 -15
  139. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  140. package/dist/treeFactory.d.ts.map +1 -1
  141. package/dist/treeFactory.js +13 -4
  142. package/dist/treeFactory.js.map +1 -1
  143. package/lib/alpha.d.ts +7 -0
  144. package/lib/codec/codec.d.ts +10 -27
  145. package/lib/codec/codec.d.ts.map +1 -1
  146. package/lib/codec/codec.js +8 -27
  147. package/lib/codec/codec.js.map +1 -1
  148. package/lib/codec/versioned/codec.d.ts +6 -5
  149. package/lib/codec/versioned/codec.d.ts.map +1 -1
  150. package/lib/codec/versioned/codec.js +4 -4
  151. package/lib/codec/versioned/codec.js.map +1 -1
  152. package/lib/core/tree/detachedFieldIndex.js +1 -1
  153. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  154. package/lib/core/tree/detachedFieldIndexCodecs.js +1 -1
  155. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  156. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
  157. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  158. package/lib/feature-libraries/chunked-forest/chunkTree.js +68 -32
  159. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  160. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -8
  161. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  162. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  163. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  164. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
  165. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
  166. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +11 -0
  167. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
  168. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
  169. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  170. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -0
  171. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  172. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  173. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
  174. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  175. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  176. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  177. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  178. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  179. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  180. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  181. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -1
  182. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  183. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  184. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
  185. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  186. package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -3
  187. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  188. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
  189. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  190. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
  191. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  192. package/lib/feature-libraries/index.d.ts +1 -1
  193. package/lib/feature-libraries/index.d.ts.map +1 -1
  194. package/lib/feature-libraries/index.js +1 -1
  195. package/lib/feature-libraries/index.js.map +1 -1
  196. package/lib/feature-libraries/schema-index/codec.d.ts +6 -5
  197. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  198. package/lib/feature-libraries/schema-index/codec.js +3 -3
  199. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  200. package/lib/index.d.ts +1 -1
  201. package/lib/index.d.ts.map +1 -1
  202. package/lib/index.js.map +1 -1
  203. package/lib/packageVersion.d.ts +1 -1
  204. package/lib/packageVersion.d.ts.map +1 -1
  205. package/lib/packageVersion.js +1 -1
  206. package/lib/packageVersion.js.map +1 -1
  207. package/lib/shared-tree/independentView.d.ts.map +1 -1
  208. package/lib/shared-tree/independentView.js +3 -3
  209. package/lib/shared-tree/independentView.js.map +1 -1
  210. package/lib/shared-tree/schematizingTreeView.d.ts +5 -0
  211. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  212. package/lib/shared-tree/schematizingTreeView.js +40 -10
  213. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  214. package/lib/shared-tree/sharedTree.d.ts +6 -8
  215. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  216. package/lib/shared-tree/sharedTree.js +8 -10
  217. package/lib/shared-tree/sharedTree.js.map +1 -1
  218. package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -1
  219. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  220. package/lib/shared-tree/tree.js +2 -2
  221. package/lib/shared-tree/tree.js.map +1 -1
  222. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  223. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  224. package/lib/shared-tree/treeAlpha.js +4 -4
  225. package/lib/shared-tree/treeAlpha.js.map +1 -1
  226. package/lib/shared-tree/treeCheckout.js +1 -1
  227. package/lib/shared-tree/treeCheckout.js.map +1 -1
  228. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  229. package/lib/shared-tree-core/defaultResubmitMachine.js +3 -2
  230. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  231. package/lib/simple-tree/api/index.d.ts +1 -1
  232. package/lib/simple-tree/api/index.d.ts.map +1 -1
  233. package/lib/simple-tree/api/index.js.map +1 -1
  234. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
  235. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  236. package/lib/simple-tree/api/schemaFactoryAlpha.js +34 -14
  237. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  238. package/lib/simple-tree/api/schemaStatics.js +3 -0
  239. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  240. package/lib/simple-tree/api/storedSchema.d.ts +4 -3
  241. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  242. package/lib/simple-tree/api/storedSchema.js +3 -3
  243. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  244. package/lib/simple-tree/api/treeBeta.js +2 -2
  245. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  246. package/lib/simple-tree/api/treeNodeApi.js +4 -4
  247. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  248. package/lib/simple-tree/api/typesUnsafe.d.ts +60 -1
  249. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  250. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  251. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  252. package/lib/simple-tree/core/allowedTypes.js +1 -1
  253. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  254. package/lib/simple-tree/core/index.d.ts +1 -1
  255. package/lib/simple-tree/core/index.d.ts.map +1 -1
  256. package/lib/simple-tree/core/index.js +1 -1
  257. package/lib/simple-tree/core/index.js.map +1 -1
  258. package/lib/simple-tree/core/treeNodeKernel.d.ts +7 -11
  259. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  260. package/lib/simple-tree/core/treeNodeKernel.js +23 -46
  261. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  262. package/lib/simple-tree/getTreeNodeForField.js +1 -1
  263. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  264. package/lib/simple-tree/index.d.ts +2 -2
  265. package/lib/simple-tree/index.d.ts.map +1 -1
  266. package/lib/simple-tree/index.js +1 -1
  267. package/lib/simple-tree/index.js.map +1 -1
  268. package/lib/simple-tree/node-kinds/array/arrayNode.js +3 -3
  269. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  270. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -3
  271. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  272. package/lib/simple-tree/node-kinds/object/objectNode.js +4 -4
  273. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  274. package/lib/simple-tree/node-kinds/record/recordNode.js +7 -7
  275. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  276. package/lib/simple-tree/prepareForInsertion.d.ts +36 -4
  277. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  278. package/lib/simple-tree/prepareForInsertion.js +45 -17
  279. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  280. package/lib/treeFactory.d.ts.map +1 -1
  281. package/lib/treeFactory.js +13 -4
  282. package/lib/treeFactory.js.map +1 -1
  283. package/package.json +21 -20
  284. package/src/codec/codec.ts +11 -29
  285. package/src/codec/versioned/codec.ts +6 -6
  286. package/src/core/tree/detachedFieldIndex.ts +1 -1
  287. package/src/core/tree/detachedFieldIndexCodecs.ts +1 -1
  288. package/src/feature-libraries/chunked-forest/chunkTree.ts +112 -45
  289. package/src/feature-libraries/chunked-forest/codec/codecs.ts +7 -12
  290. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +33 -0
  291. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
  292. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +4 -7
  293. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  294. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  295. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +1 -1
  296. package/src/feature-libraries/forest-summary/forestSummarizer.ts +8 -12
  297. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +3 -12
  298. package/src/feature-libraries/index.ts +2 -0
  299. package/src/feature-libraries/schema-index/codec.ts +5 -5
  300. package/src/index.ts +7 -0
  301. package/src/packageVersion.ts +1 -1
  302. package/src/shared-tree/independentView.ts +3 -0
  303. package/src/shared-tree/schematizingTreeView.ts +63 -8
  304. package/src/shared-tree/sharedTree.ts +34 -21
  305. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -1
  306. package/src/shared-tree/tree.ts +2 -2
  307. package/src/shared-tree/treeAlpha.ts +6 -12
  308. package/src/shared-tree/treeCheckout.ts +1 -1
  309. package/src/shared-tree-core/defaultResubmitMachine.ts +3 -2
  310. package/src/simple-tree/api/index.ts +7 -0
  311. package/src/simple-tree/api/schemaFactoryAlpha.ts +79 -19
  312. package/src/simple-tree/api/schemaStatics.ts +3 -0
  313. package/src/simple-tree/api/storedSchema.ts +5 -4
  314. package/src/simple-tree/api/treeBeta.ts +2 -2
  315. package/src/simple-tree/api/treeNodeApi.ts +4 -4
  316. package/src/simple-tree/api/typesUnsafe.ts +81 -0
  317. package/src/simple-tree/core/TreeNodeBinding.md +14 -70
  318. package/src/simple-tree/core/allowedTypes.ts +4 -1
  319. package/src/simple-tree/core/index.ts +1 -1
  320. package/src/simple-tree/core/treeNodeKernel.ts +25 -59
  321. package/src/simple-tree/getTreeNodeForField.ts +1 -1
  322. package/src/simple-tree/index.ts +8 -1
  323. package/src/simple-tree/node-kinds/array/arrayNode.ts +3 -3
  324. package/src/simple-tree/node-kinds/map/mapNode.ts +3 -3
  325. package/src/simple-tree/node-kinds/object/objectNode.ts +4 -4
  326. package/src/simple-tree/node-kinds/record/recordNode.ts +7 -7
  327. package/src/simple-tree/prepareForInsertion.ts +87 -25
  328. package/src/treeFactory.ts +17 -4
@@ -12,13 +12,17 @@ import type {
12
12
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
13
13
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
14
14
 
15
- import { anchorSlot } from "../core/index.js";
15
+ import { anchorSlot, rootFieldKey } from "../core/index.js";
16
16
  import {
17
17
  type NodeIdentifierManager,
18
18
  defaultSchemaPolicy,
19
19
  cursorForMapTreeField,
20
20
  TreeStatus,
21
21
  Context,
22
+ type FlexTreeOptionalField,
23
+ type FlexTreeUnknownUnboxed,
24
+ FieldKinds,
25
+ type FlexTreeRequiredField,
22
26
  } from "../feature-libraries/index.js";
23
27
  import {
24
28
  type ImplicitFieldSchema,
@@ -38,7 +42,7 @@ import {
38
42
  type UnsafeUnknownSchema,
39
43
  type TreeBranch,
40
44
  type TreeBranchEvents,
41
- getOrCreateInnerNode,
45
+ getInnerNode,
42
46
  getKernel,
43
47
  type VoidTransactionCallbackStatus,
44
48
  type TransactionCallbackStatus,
@@ -117,6 +121,11 @@ export class SchematizingSimpleTreeView<
117
121
  */
118
122
  private midUpgrade = false;
119
123
 
124
+ /**
125
+ * Hydration work deferred until Context has been created.
126
+ */
127
+ private pendingHydration?: () => void;
128
+
120
129
  private readonly rootFieldSchema: FieldSchema;
121
130
  public readonly breaker: Breakable;
122
131
 
@@ -174,6 +183,13 @@ export class SchematizingSimpleTreeView<
174
183
 
175
184
  this.runSchemaEdit(() => {
176
185
  const schema = toInitialSchema(this.config.schema);
186
+ // This has to be the contextless version, since when "initialize" is called (right after this),
187
+ // it will do a schema change which would dispose of the current context (see inside `update`).
188
+ // Thus using the current context (if any) would hydrate nodes then
189
+ // immediately dispose them instead of having them actually be useable after initialize.
190
+ // For this to work,
191
+ // the hydration must be deferred until after the content is inserted into the tree and the final schema change is done (for required roots),
192
+ // but before any user event could could run.
177
193
  const mapTree = prepareForInsertionContextless(
178
194
  content as InsertableContent | undefined,
179
195
  this.rootFieldSchema,
@@ -183,6 +199,25 @@ export class SchematizingSimpleTreeView<
183
199
  },
184
200
  this,
185
201
  schema.rootFieldSchema,
202
+ (batches, doHydration) => {
203
+ assert(
204
+ this.pendingHydration === undefined,
205
+ 0xc74 /* pendingHydration already set */,
206
+ );
207
+ this.pendingHydration = () => {
208
+ assert(
209
+ batches.length <= 1,
210
+ 0xc75 /* initialize should at most one hydration batch */,
211
+ );
212
+ for (const batch of batches) {
213
+ doHydration(batch, {
214
+ parent: undefined,
215
+ parentField: rootFieldKey,
216
+ parentIndex: 0,
217
+ });
218
+ }
219
+ };
220
+ },
186
221
  );
187
222
 
188
223
  this.checkout.transaction.start();
@@ -350,7 +385,10 @@ export class SchematizingSimpleTreeView<
350
385
  // TODO: provide a better event: this.view.flexTree.on(????) and/or integrate with with the normal event code paths.
351
386
 
352
387
  // Track what the root was before to be able to detect changes.
353
- let lastRoot: ReadableField<TRootSchema> = this.root;
388
+ // This uses the flex tree root to avoid demanding the simple-tree TreeNode when it might not be hydrated yet.
389
+ let lastRoot: FlexTreeUnknownUnboxed | undefined = (
390
+ this.flexTreeContext.root as FlexTreeOptionalField
391
+ ).content;
354
392
 
355
393
  this.flexTreeViewUnregisterCallbacks.add(
356
394
  this.checkout.events.on("afterBatch", () => {
@@ -359,8 +397,8 @@ export class SchematizingSimpleTreeView<
359
397
  // - The rootChanged event will already be raised at the end of the current upgrade
360
398
  // - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade
361
399
  // completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)
362
- if (!this.midUpgrade && lastRoot !== this.root) {
363
- lastRoot = this.root;
400
+ if (!this.midUpgrade && lastRoot !== this.flexRoot.content) {
401
+ lastRoot = this.flexRoot.content;
364
402
  this.events.emit("rootChanged");
365
403
  }
366
404
  }),
@@ -374,6 +412,10 @@ export class SchematizingSimpleTreeView<
374
412
  );
375
413
 
376
414
  if (!this.midUpgrade) {
415
+ assert(
416
+ this.pendingHydration === undefined,
417
+ 0xc76 /* no nodes should be pending hydration when triggering events that could access nodes */,
418
+ );
377
419
  this.events.emit("schemaChanged");
378
420
  this.events.emit("rootChanged");
379
421
  }
@@ -386,6 +428,9 @@ export class SchematizingSimpleTreeView<
386
428
  } finally {
387
429
  this.midUpgrade = false;
388
430
  }
431
+ // Ensure hydration is flushed before events run which could access nodes.
432
+ this.pendingHydration?.();
433
+ this.pendingHydration = undefined;
389
434
  this.events.emit("schemaChanged");
390
435
  this.events.emit("rootChanged");
391
436
  }
@@ -426,7 +471,7 @@ export class SchematizingSimpleTreeView<
426
471
  }
427
472
  }
428
473
 
429
- public get root(): ReadableField<TRootSchema> {
474
+ private get flexRoot(): FlexTreeOptionalField | FlexTreeRequiredField {
430
475
  this.breaker.use();
431
476
  if (!this.compatibility.canView) {
432
477
  throw new UsageError(
@@ -434,7 +479,17 @@ export class SchematizingSimpleTreeView<
434
479
  );
435
480
  }
436
481
  const view = this.getFlexTreeContext();
437
- return tryGetTreeNodeForField(view.root) as ReadableField<TRootSchema>;
482
+ assert(
483
+ view.root.is(FieldKinds.optional) ||
484
+ view.root.is(FieldKinds.required) ||
485
+ view.root.is(FieldKinds.identifier),
486
+ 0xc77 /* unexpected root field kind */,
487
+ );
488
+ return view.root;
489
+ }
490
+
491
+ public get root(): ReadableField<TRootSchema> {
492
+ return tryGetTreeNodeForField(this.flexRoot) as ReadableField<TRootSchema>;
438
493
  }
439
494
 
440
495
  public set root(newRoot: InsertableField<TRootSchema>) {
@@ -499,7 +554,7 @@ export function addConstraintsToTransaction(
499
554
  for (const constraint of constraints) {
500
555
  switch (constraint.type) {
501
556
  case "nodeInDocument": {
502
- const node = getOrCreateInnerNode(constraint.node);
557
+ const node = getInnerNode(constraint.node);
503
558
  const nodeStatus = getKernel(constraint.node).getStatus();
504
559
  if (nodeStatus !== TreeStatus.InDocument) {
505
560
  const revertText = constraintsOnRevert ? " on revert" : "";
@@ -38,7 +38,6 @@ import {
38
38
  type SchemaFormatVersion,
39
39
  SchemaVersion,
40
40
  type TreeFieldStoredSchema,
41
- type TreeNodeSchemaIdentifier,
42
41
  type TreeNodeStoredSchema,
43
42
  type TreeStoredSchema,
44
43
  TreeStoredSchemaRepository,
@@ -55,6 +54,7 @@ import {
55
54
  TreeCompressionStrategy,
56
55
  buildChunkedForest,
57
56
  buildForest,
57
+ defaultIncrementalEncodingPolicy,
58
58
  defaultSchemaPolicy,
59
59
  getCodecTreeForFieldBatchFormat,
60
60
  getCodecTreeForForestFormat,
@@ -64,6 +64,7 @@ import {
64
64
  makeMitigatedChangeFamily,
65
65
  makeSchemaCodec,
66
66
  makeTreeChunker,
67
+ type IncrementalEncodingPolicy,
67
68
  type FieldBatchFormatVersion,
68
69
  type ForestFormatVersion,
69
70
  type TreeCompressionStrategyPrivate,
@@ -305,7 +306,13 @@ export class SharedTreeKernel
305
306
  const options = { ...defaultSharedTreeOptions, ...optionsParam };
306
307
  const codecVersions = getCodecVersions(options.formatVersion);
307
308
  const schema = new TreeStoredSchemaRepository();
308
- const forest = buildConfiguredForest(breaker, options.forest, schema, idCompressor);
309
+ const forest = buildConfiguredForest(
310
+ breaker,
311
+ options.forest,
312
+ schema,
313
+ idCompressor,
314
+ options.shouldEncodeIncrementally,
315
+ );
309
316
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
310
317
  const removedRoots = makeDetachedFieldIndex(
311
318
  "repair",
@@ -339,7 +346,7 @@ export class SharedTreeKernel
339
346
  encoderContext,
340
347
  options,
341
348
  idCompressor,
342
- options.shouldEncodeFieldIncrementally,
349
+ options.shouldEncodeIncrementally,
343
350
  );
344
351
  const removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);
345
352
  const innerChangeFamily = new SharedTreeChangeFamily(
@@ -794,16 +801,11 @@ export interface SharedTreeOptionsInternal
794
801
  Partial<SharedTreeFormatOptionsInternal> {
795
802
  disposeForksAfterTransaction?: boolean;
796
803
  /**
797
- * Returns whether a field should be incrementally encoded.
798
- * @param nodeIdentifier - The identifier of the node containing the field.
799
- * @param fieldKey - The key of the field to check.
804
+ * Returns whether a node / field should be incrementally encoded.
800
805
  * @remarks
801
- * The policy for which fields should get incremental encoding should eventually be specified some other way.
806
+ * See {@link IncrementalEncodingPolicy}.
802
807
  */
803
- shouldEncodeFieldIncrementally?(
804
- nodeIdentifier: TreeNodeSchemaIdentifier,
805
- fieldKey: FieldKey,
806
- ): boolean;
808
+ shouldEncodeIncrementally?: IncrementalEncodingPolicy;
807
809
  }
808
810
  /**
809
811
  * Configuration options for SharedTree's internal tree storage.
@@ -882,8 +884,17 @@ export const ForestTypeReference = toForestType(
882
884
  * @beta
883
885
  */
884
886
  export const ForestTypeOptimized = toForestType(
885
- (breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>
886
- buildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),
887
+ (
888
+ breaker: Breakable,
889
+ schema: TreeStoredSchemaSubscription,
890
+ idCompressor: IIdCompressor,
891
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
892
+ ) =>
893
+ buildChunkedForest(
894
+ makeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),
895
+ undefined,
896
+ idCompressor,
897
+ ),
887
898
  );
888
899
 
889
900
  /**
@@ -904,6 +915,7 @@ type ForestFactory = (
904
915
  breaker: Breakable,
905
916
  schema: TreeStoredSchemaSubscription,
906
917
  idCompressor: IIdCompressor,
918
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
907
919
  ) => IEditableForest;
908
920
 
909
921
  function toForestType(factory: ForestFactory): ForestType {
@@ -918,23 +930,24 @@ export function buildConfiguredForest(
918
930
  factory: ForestType,
919
931
  schema: TreeStoredSchemaSubscription,
920
932
  idCompressor: IIdCompressor,
933
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
921
934
  ): IEditableForest {
922
- return (factory as unknown as ForestFactory)(breaker, schema, idCompressor);
935
+ return (factory as unknown as ForestFactory)(
936
+ breaker,
937
+ schema,
938
+ idCompressor,
939
+ shouldEncodeIncrementally,
940
+ );
923
941
  }
924
942
 
925
943
  export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
926
944
  jsonValidator: FormatValidatorNoOp,
927
- oldestCompatibleClient: FluidClientVersion.v2_0,
945
+ minVersionForCollab: FluidClientVersion.v2_0,
928
946
  forest: ForestTypeReference,
929
947
  treeEncodeType: TreeCompressionStrategy.Compressed,
930
948
  formatVersion: SharedTreeFormatVersion.v3,
931
949
  disposeForksAfterTransaction: true,
932
- shouldEncodeFieldIncrementally: (
933
- nodeIdentifier: TreeNodeSchemaIdentifier,
934
- fieldKey: FieldKey,
935
- ): boolean => {
936
- return false;
937
- },
950
+ shouldEncodeIncrementally: defaultIncrementalEncodingPolicy,
938
951
  };
939
952
 
940
953
  function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {
@@ -94,7 +94,7 @@ export function getCodecTreeForChangeFormat(
94
94
  version: SharedTreeChangeFormatVersion,
95
95
  ): CodecTree {
96
96
  const { modularChange, schemaChange } =
97
- dependenciesForChangeFormat.get(version) ?? fail("Unknown change format");
97
+ dependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);
98
98
  return {
99
99
  name: "SharedTreeChange",
100
100
  version,
@@ -11,7 +11,7 @@ import {
11
11
  type TreeNode,
12
12
  type TreeNodeApi,
13
13
  type TreeView,
14
- getOrCreateInnerNode,
14
+ getInnerNode,
15
15
  treeNodeApi,
16
16
  rollback,
17
17
  type TransactionConstraint,
@@ -447,7 +447,7 @@ export function runTransaction<
447
447
  } else {
448
448
  const node = treeOrNode as TNode;
449
449
  const t = transaction as (node: TNode) => TResult | typeof rollback;
450
- const context = getOrCreateInnerNode(node).context;
450
+ const context = getInnerNode(node).context;
451
451
  if (context.isHydrated() === false) {
452
452
  throw new UsageError(
453
453
  "Transactions cannot be run on Unhydrated nodes. Transactions apply to a TreeView and Unhydrated nodes are not part of a TreeView.",
@@ -44,7 +44,7 @@ import {
44
44
  unhydratedFlexTreeFromInsertable,
45
45
  getOrCreateNodeFromInnerNode,
46
46
  getOrCreateNodeFromInnerUnboxedNode,
47
- getOrCreateInnerNode,
47
+ getInnerNode,
48
48
  NodeKind,
49
49
  tryGetTreeNodeForField,
50
50
  isObjectNodeSchema,
@@ -331,10 +331,7 @@ export interface TreeAlpha {
331
331
  */
332
332
  exportCompressed(
333
333
  tree: TreeNode | TreeLeafValue,
334
- options: { idCompressor?: IIdCompressor } & Pick<
335
- CodecWriteOptions,
336
- "oldestCompatibleClient"
337
- >,
334
+ options: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, "minVersionForCollab">,
338
335
  ): JsonCompatible<IFluidHandle>;
339
336
 
340
337
  /**
@@ -812,13 +809,10 @@ export const TreeAlpha: TreeAlpha = {
812
809
 
813
810
  exportCompressed(
814
811
  node: TreeNode | TreeLeafValue,
815
- options: { idCompressor?: IIdCompressor } & Pick<
816
- CodecWriteOptions,
817
- "oldestCompatibleClient"
818
- >,
812
+ options: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, "minVersionForCollab">,
819
813
  ): JsonCompatible<IFluidHandle> {
820
814
  const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
821
- const format = fluidVersionToFieldBatchCodecWriteVersion(options.oldestCompatibleClient);
815
+ const format = fluidVersionToFieldBatchCodecWriteVersion(options.minVersionForCollab);
822
816
  const codec = makeFieldBatchCodec({ jsonValidator: FormatValidatorNoOp }, format);
823
817
  const cursor = borrowFieldCursorFromTreeNodeOrValue(node);
824
818
  const batch: FieldBatch = [cursor];
@@ -881,7 +875,7 @@ export const TreeAlpha: TreeAlpha = {
881
875
  node: TreeNode,
882
876
  propertyKey: string | number,
883
877
  ): TreeNode | TreeLeafValue | undefined => {
884
- const flexNode = getOrCreateInnerNode(node);
878
+ const flexNode = getInnerNode(node);
885
879
  debugAssert(
886
880
  () => !flexNode.context.isDisposed() || "The provided tree node has been disposed.",
887
881
  );
@@ -951,7 +945,7 @@ export const TreeAlpha: TreeAlpha = {
951
945
  },
952
946
 
953
947
  children(node: TreeNode): [propertyKey: string | number, child: TreeNode | TreeLeafValue][] {
954
- const flexNode = getOrCreateInnerNode(node);
948
+ const flexNode = getInnerNode(node);
955
949
  debugAssert(
956
950
  () => !flexNode.context.isDisposed() || "The provided tree node has been disposed.",
957
951
  );
@@ -298,7 +298,7 @@ export function createTreeCheckout(
298
298
  const forest = args?.forest ?? buildForest(breaker, schema);
299
299
  const defaultCodecOptions = {
300
300
  jsonValidator: FormatValidatorNoOp,
301
- oldestCompatibleClient: FluidClientVersion.v2_0,
301
+ minVersionForCollab: FluidClientVersion.v2_0,
302
302
  };
303
303
  const defaultFieldBatchVersion = 1;
304
304
  const changeFamily =
@@ -70,7 +70,7 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
70
70
  const localCommits = getLocalCommits();
71
71
  assert(
72
72
  localCommits[0]?.revision === revision,
73
- "Expected local commits to start with specified revision",
73
+ 0xc79 /* Expected local commits to start with specified revision */,
74
74
  );
75
75
 
76
76
  // Some in-flight commits have stale enrichments, so we recompute them.
@@ -128,7 +128,8 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
128
128
 
129
129
  private getPendingChange(revision: RevisionTag): PendingChange<TChange> {
130
130
  return (
131
- this.pendingChanges.get(revision) ?? fail("No pending change stored for this revision")
131
+ this.pendingChanges.get(revision) ??
132
+ fail(0xc7a /* No pending change stored for this revision */)
132
133
  );
133
134
  }
134
135
 
@@ -90,6 +90,13 @@ export type {
90
90
  MapNodeCustomizableSchemaUnsafe,
91
91
  System_Unsafe,
92
92
  TreeRecordNodeUnsafe,
93
+ UnannotateAllowedTypeUnsafe,
94
+ AnnotatedAllowedTypeUnsafe,
95
+ AnnotatedAllowedTypesUnsafe,
96
+ AllowedTypesFullUnsafe,
97
+ AllowedTypesFullFromMixedUnsafe,
98
+ UnannotateAllowedTypesListUnsafe,
99
+ AnnotateAllowedTypesListUnsafe,
93
100
  } from "./typesUnsafe.js";
94
101
 
95
102
  export {
@@ -40,10 +40,14 @@ import {
40
40
  AnnotatedAllowedTypesInternal,
41
41
  } from "../core/index.js";
42
42
  import type {
43
+ AllowedTypesFullFromMixedUnsafe,
44
+ AnnotatedAllowedTypeUnsafe,
43
45
  ArrayNodeCustomizableSchemaUnsafe,
44
46
  MapNodeCustomizableSchemaUnsafe,
45
47
  System_Unsafe,
46
48
  TreeRecordNodeUnsafe,
49
+ UnannotateAllowedTypeUnsafe,
50
+ Unenforced,
47
51
  } from "./typesUnsafe.js";
48
52
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
49
53
  import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
@@ -113,28 +117,64 @@ export interface SchemaStaticsAlpha {
113
117
  t: T,
114
118
  metadata?: AllowedTypesMetadata,
115
119
  ) => AllowedTypesFullFromMixed<T>;
120
+
121
+ /**
122
+ * {@link SchemaStaticsAlpha.staged} except tweaked to work better for recursive types.
123
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
124
+ * @remarks
125
+ * This version of {@link SchemaStaticsAlpha.staged} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
126
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
127
+ */
128
+ stagedRecursive: <
129
+ const T extends Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>,
130
+ >(
131
+ t: T,
132
+ ) => AnnotatedAllowedTypeUnsafe<UnannotateAllowedTypeUnsafe<T>>;
133
+
134
+ /**
135
+ * {@link SchemaStaticsAlpha.types} except tweaked to work better for recursive types.
136
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
137
+ * @remarks
138
+ * This version of {@link SchemaStaticsAlpha.types} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
139
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
140
+ * @privateRemarks
141
+ * If all inputs (at least recursive ones) were required to be annotated, this could be typed more strongly.
142
+ * In that case it could use `T extends readonly (AnnotatedAllowedTypeUnsafe | LazyItem<System_Unsafe.TreeNodeSchemaUnsafe>)[]`.
143
+ */
144
+ readonly typesRecursive: <
145
+ const T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],
146
+ >(
147
+ t: T,
148
+ metadata?: AllowedTypesMetadata,
149
+ ) => AllowedTypesFullFromMixedUnsafe<T>;
116
150
  }
117
151
 
152
+ const staged = <const T extends LazyItem<TreeNodeSchema>>(
153
+ t: T | AnnotatedAllowedType<T>,
154
+ ): AnnotatedAllowedType<T> => {
155
+ const annotatedType = normalizeToAnnotatedAllowedType(t);
156
+ return {
157
+ type: annotatedType.type,
158
+ metadata: {
159
+ ...annotatedType.metadata,
160
+ stagedSchemaUpgrade: createSchemaUpgrade(),
161
+ },
162
+ };
163
+ };
164
+
165
+ const types = <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(
166
+ t: T,
167
+ metadata: AllowedTypesMetadata = {},
168
+ ): AllowedTypesFullFromMixed<T> => {
169
+ return AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);
170
+ };
171
+
118
172
  const schemaStaticsAlpha: SchemaStaticsAlpha = {
119
- staged: <const T extends LazyItem<TreeNodeSchema>>(
120
- t: T | AnnotatedAllowedType<T>,
121
- ): AnnotatedAllowedType<T> => {
122
- const annotatedType = normalizeToAnnotatedAllowedType(t);
123
- return {
124
- type: annotatedType.type,
125
- metadata: {
126
- ...annotatedType.metadata,
127
- stagedSchemaUpgrade: createSchemaUpgrade(),
128
- },
129
- };
130
- },
173
+ staged,
174
+ types,
131
175
 
132
- types: <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(
133
- t: T,
134
- metadata: AllowedTypesMetadata = {},
135
- ): AllowedTypesFullFromMixed<T> => {
136
- return AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);
137
- },
176
+ stagedRecursive: staged as SchemaStaticsAlpha["stagedRecursive"],
177
+ typesRecursive: types as unknown as SchemaStaticsAlpha["typesRecursive"],
138
178
  };
139
179
 
140
180
  /**
@@ -310,6 +350,16 @@ export class SchemaFactoryAlpha<
310
350
  */
311
351
  public staged = schemaStaticsAlpha.staged;
312
352
 
353
+ /**
354
+ * {@inheritDoc SchemaStaticsAlpha.stagedRecursive}
355
+ */
356
+ public static stagedRecursive = schemaStaticsAlpha.stagedRecursive;
357
+
358
+ /**
359
+ * {@inheritDoc SchemaStaticsAlpha.stagedRecursive}
360
+ */
361
+ public stagedRecursive = schemaStaticsAlpha.stagedRecursive;
362
+
313
363
  /**
314
364
  * {@inheritDoc SchemaStaticsAlpha.types}
315
365
  */
@@ -320,6 +370,16 @@ export class SchemaFactoryAlpha<
320
370
  */
321
371
  public types = schemaStaticsAlpha.types;
322
372
 
373
+ /**
374
+ * {@inheritDoc SchemaStaticsAlpha.typesRecursive}
375
+ */
376
+ public static typesRecursive = schemaStaticsAlpha.typesRecursive;
377
+
378
+ /**
379
+ * {@inheritDoc SchemaStaticsAlpha.typesRecursive}
380
+ */
381
+ public typesRecursive = schemaStaticsAlpha.typesRecursive;
382
+
323
383
  /**
324
384
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
325
385
  *
@@ -405,7 +465,7 @@ export class SchemaFactoryAlpha<
405
465
  }
406
466
 
407
467
  /**
408
- * {@inheritDoc SchemaFactory.objectRecursive}
468
+ * {@link SchemaFactory.arrayRecursive} but with support for some alpha features.
409
469
  */
410
470
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
411
471
  public override arrayRecursive<
@@ -228,6 +228,9 @@ export const schemaStatics = {
228
228
  },
229
229
  } as const;
230
230
 
231
+ /**
232
+ * {@link Unenforced} version of {@link createFieldSchema}.
233
+ */
231
234
  function createFieldSchemaUnsafe<
232
235
  Kind extends FieldKind,
233
236
  Types extends System_Unsafe.ImplicitAllowedTypesUnsafe,
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { FluidClientVersion, ICodecOptions } from "../../codec/index.js";
6
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
7
+ import type { ICodecOptions } from "../../codec/index.js";
7
8
  import { SchemaVersion } from "../../core/index.js";
8
9
  import { encodeTreeSchema, makeSchemaCodec } from "../../feature-libraries/index.js";
9
10
  import {
@@ -24,7 +25,7 @@ import type { SchemaCompatibilityStatus } from "./tree.js";
24
25
  * Dumps the "persisted" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.
25
26
  *
26
27
  * @param schema - The schema to dump.
27
- * @param oldestCompatibleClient - The oldest client version which can read the schema: impacts the format used.
28
+ * @param minVersionForCollab - The oldest client version which can read the schema: impacts the format used.
28
29
  * @param includeStaged - filter for selecting which staged allowed types to include in the output.
29
30
  *
30
31
  * @remarks
@@ -54,11 +55,11 @@ import type { SchemaCompatibilityStatus } from "./tree.js";
54
55
  */
55
56
  export function extractPersistedSchema(
56
57
  schema: ImplicitFieldSchema,
57
- oldestCompatibleClient: FluidClientVersion,
58
+ minVersionForCollab: MinimumVersionForCollab,
58
59
  includeStaged: (upgrade: SchemaUpgrade) => boolean,
59
60
  ): JsonCompatible {
60
61
  const stored = toStoredSchema(schema, { includeStaged });
61
- const schemaWriteVersion = clientVersionToSchemaVersion(oldestCompatibleClient);
62
+ const schemaWriteVersion = clientVersionToSchemaVersion(minVersionForCollab);
62
63
  return encodeTreeSchema(stored, schemaWriteVersion);
63
64
  }
64
65
 
@@ -238,7 +238,7 @@ export function borrowCursorFromTreeNodeOrValue(
238
238
  return cursorFromVerbose(node, {});
239
239
  }
240
240
  const kernel = getKernel(node);
241
- const cursor = kernel.getOrCreateInnerNode().borrowCursor();
241
+ const cursor = kernel.getInnerNode().borrowCursor();
242
242
  return cursor;
243
243
  }
244
244
 
@@ -339,7 +339,7 @@ export const TreeBeta: TreeBeta = {
339
339
  }
340
340
 
341
341
  const kernel = getKernel(node);
342
- const cursor = kernel.getOrCreateInnerNode().borrowCursor();
342
+ const cursor = kernel.getInnerNode().borrowCursor();
343
343
 
344
344
  // To handle when the node transitively contains unknown optional fields,
345
345
  // derive the context from the source node's stored schema which has stored schema for any such fields and their contents.
@@ -28,7 +28,7 @@ import {
28
28
  tryGetTreeNodeSchema,
29
29
  getOrCreateNodeFromInnerNode,
30
30
  typeSchemaSymbol,
31
- getOrCreateInnerNode,
31
+ getInnerNode,
32
32
  type TreeLeafValue,
33
33
  type ImplicitAllowedTypes,
34
34
  type TreeNodeFromImplicitAllowedTypes,
@@ -141,7 +141,7 @@ export interface TreeNodeApi {
141
141
  */
142
142
  export const treeNodeApi: TreeNodeApi = {
143
143
  parent(node: TreeNode): TreeNode | undefined {
144
- const editNode = getOrCreateInnerNode(node).parentField.parent.parent;
144
+ const editNode = getInnerNode(node).parentField.parent.parent;
145
145
  if (editNode === undefined) {
146
146
  return undefined;
147
147
  }
@@ -306,7 +306,7 @@ export function getIdentifierFromNode(
306
306
  return undefined;
307
307
  }
308
308
 
309
- const flexNode = getOrCreateInnerNode(node);
309
+ const flexNode = getInnerNode(node);
310
310
  const identifierFieldKeys = schema.identifierFieldKeys;
311
311
 
312
312
  switch (identifierFieldKeys.length) {
@@ -361,7 +361,7 @@ export function getIdentifierFromNode(
361
361
  export function getStoredKey(node: TreeNode): string | number {
362
362
  // Note: the flex domain strictly works with "stored keys", and knows nothing about the developer-facing
363
363
  // "property keys".
364
- const parentField = getOrCreateInnerNode(node).parentField;
364
+ const parentField = getInnerNode(node).parentField;
365
365
  if (parentField.parent.schema === FieldKinds.sequence.identifier) {
366
366
  // The parent of `node` is an array node
367
367
  assert(