@fluidframework/tree 2.70.0-361092 → 2.70.0-361788

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 (360) hide show
  1. package/api-report/tree.alpha.api.md +36 -17
  2. package/api-report/tree.beta.api.md +70 -2
  3. package/api-report/tree.legacy.beta.api.md +70 -2
  4. package/dist/alpha.d.ts +15 -11
  5. package/dist/api.d.ts +6 -1
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +9 -1
  8. package/dist/api.js.map +1 -1
  9. package/dist/beta.d.ts +13 -0
  10. package/dist/codec/codec.d.ts +3 -3
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/core/forest/forest.d.ts +3 -4
  13. package/dist/core/forest/forest.d.ts.map +1 -1
  14. package/dist/core/forest/forest.js.map +1 -1
  15. package/dist/core/rebase/changeRebaser.d.ts +1 -1
  16. package/dist/core/rebase/changeRebaser.js.map +1 -1
  17. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  18. package/dist/core/tree/detachedFieldIndex.js +4 -1
  19. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  20. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +6 -0
  21. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  22. package/dist/feature-libraries/chunked-forest/chunkTree.js +11 -2
  23. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  25. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  26. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  27. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +21 -20
  29. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +17 -43
  31. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  33. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  35. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  36. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  37. package/dist/feature-libraries/flex-tree/lazyField.js +2 -1
  38. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  39. package/dist/feature-libraries/flex-tree/utilities.d.ts +1 -1
  40. package/dist/feature-libraries/flex-tree/utilities.js +1 -1
  41. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  42. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  43. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  44. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +42 -47
  45. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  46. package/dist/feature-libraries/incrementalSummarizationUtils.d.ts +1 -1
  47. package/dist/feature-libraries/incrementalSummarizationUtils.js.map +1 -1
  48. package/dist/feature-libraries/index.d.ts +1 -1
  49. package/dist/feature-libraries/index.d.ts.map +1 -1
  50. package/dist/feature-libraries/index.js +2 -1
  51. package/dist/feature-libraries/index.js.map +1 -1
  52. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  53. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  54. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  55. package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
  56. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  57. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  58. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/formatV1.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
  61. package/dist/feature-libraries/sequence-field/formatV2.d.ts +1 -1
  62. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  63. package/dist/feature-libraries/sequence-field/formatV3.d.ts +1 -1
  64. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +4 -2
  68. package/dist/index.js.map +1 -1
  69. package/dist/legacy.d.ts +13 -0
  70. package/dist/packageVersion.d.ts +1 -1
  71. package/dist/packageVersion.js +1 -1
  72. package/dist/packageVersion.js.map +1 -1
  73. package/dist/shared-tree/independentView.d.ts.map +1 -1
  74. package/dist/shared-tree/independentView.js +2 -1
  75. package/dist/shared-tree/independentView.js.map +1 -1
  76. package/dist/shared-tree/schematizingTreeView.d.ts +4 -3
  77. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  78. package/dist/shared-tree/schematizingTreeView.js +1 -1
  79. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  80. package/dist/shared-tree/sharedTree.d.ts +1 -1
  81. package/dist/shared-tree/sharedTree.js +1 -1
  82. package/dist/shared-tree/sharedTree.js.map +1 -1
  83. package/dist/shared-tree/treeAlpha.d.ts +28 -2
  84. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  85. package/dist/shared-tree/treeAlpha.js +12 -0
  86. package/dist/shared-tree/treeAlpha.js.map +1 -1
  87. package/dist/shared-tree/treeCheckout.d.ts +1 -1
  88. package/dist/shared-tree/treeCheckout.js +1 -1
  89. package/dist/shared-tree/treeCheckout.js.map +1 -1
  90. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  91. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  92. package/dist/shared-tree-core/transaction.d.ts +2 -2
  93. package/dist/shared-tree-core/transaction.js.map +1 -1
  94. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +47 -0
  95. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -0
  96. package/dist/simple-tree/api/incrementalAllowedTypes.js +90 -0
  97. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -0
  98. package/dist/simple-tree/api/index.d.ts +2 -1
  99. package/dist/simple-tree/api/index.d.ts.map +1 -1
  100. package/dist/simple-tree/api/index.js +4 -1
  101. package/dist/simple-tree/api/index.js.map +1 -1
  102. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  103. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  104. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  105. package/dist/simple-tree/api/tree.d.ts +51 -37
  106. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  107. package/dist/simple-tree/api/tree.js.map +1 -1
  108. package/dist/simple-tree/core/allowedTypes.d.ts +10 -11
  109. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  110. package/dist/simple-tree/core/allowedTypes.js +1 -1
  111. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  112. package/dist/simple-tree/core/index.d.ts +1 -1
  113. package/dist/simple-tree/core/index.d.ts.map +1 -1
  114. package/dist/simple-tree/core/index.js +2 -1
  115. package/dist/simple-tree/core/index.js.map +1 -1
  116. package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -8
  117. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  118. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  119. package/dist/simple-tree/core/treeNodeValid.d.ts +2 -2
  120. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  121. package/dist/simple-tree/core/treeNodeValid.js +2 -2
  122. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  123. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  124. package/dist/simple-tree/core/walkSchema.js +1 -1
  125. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  126. package/dist/simple-tree/core/withType.d.ts +20 -0
  127. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  128. package/dist/simple-tree/core/withType.js +21 -1
  129. package/dist/simple-tree/core/withType.js.map +1 -1
  130. package/dist/simple-tree/createContext.d.ts.map +1 -1
  131. package/dist/simple-tree/createContext.js +1 -1
  132. package/dist/simple-tree/createContext.js.map +1 -1
  133. package/dist/simple-tree/index.d.ts +2 -2
  134. package/dist/simple-tree/index.d.ts.map +1 -1
  135. package/dist/simple-tree/index.js +5 -2
  136. package/dist/simple-tree/index.js.map +1 -1
  137. package/dist/simple-tree/leafNodeSchema.js +1 -1
  138. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  139. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  140. package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
  141. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -1
  143. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  144. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  145. package/dist/simple-tree/node-kinds/object/objectNode.js +1 -1
  146. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  147. package/dist/simple-tree/node-kinds/record/recordNode.js +1 -1
  148. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  149. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -0
  150. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  151. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +12 -0
  152. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  153. package/dist/util/nestedMap.d.ts +1 -1
  154. package/dist/util/nestedMap.js +1 -1
  155. package/dist/util/nestedMap.js.map +1 -1
  156. package/dist/util/referenceCounting.d.ts +1 -1
  157. package/dist/util/referenceCounting.js.map +1 -1
  158. package/lib/alpha.d.ts +15 -11
  159. package/lib/api.d.ts +6 -1
  160. package/lib/api.d.ts.map +1 -1
  161. package/lib/api.js +7 -0
  162. package/lib/api.js.map +1 -1
  163. package/lib/beta.d.ts +13 -0
  164. package/lib/codec/codec.d.ts +3 -3
  165. package/lib/codec/codec.js.map +1 -1
  166. package/lib/core/forest/forest.d.ts +3 -4
  167. package/lib/core/forest/forest.d.ts.map +1 -1
  168. package/lib/core/forest/forest.js.map +1 -1
  169. package/lib/core/rebase/changeRebaser.d.ts +1 -1
  170. package/lib/core/rebase/changeRebaser.js.map +1 -1
  171. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  172. package/lib/core/tree/detachedFieldIndex.js +4 -1
  173. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  174. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +6 -0
  175. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  176. package/lib/feature-libraries/chunked-forest/chunkTree.js +8 -0
  177. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  178. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  179. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  180. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  181. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +21 -20
  183. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  184. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +17 -43
  185. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  186. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  187. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  188. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  189. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  190. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  191. package/lib/feature-libraries/flex-tree/lazyField.js +2 -1
  192. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  193. package/lib/feature-libraries/flex-tree/utilities.d.ts +1 -1
  194. package/lib/feature-libraries/flex-tree/utilities.js +1 -1
  195. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  196. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  197. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  198. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +42 -47
  199. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  200. package/lib/feature-libraries/incrementalSummarizationUtils.d.ts +1 -1
  201. package/lib/feature-libraries/incrementalSummarizationUtils.js.map +1 -1
  202. package/lib/feature-libraries/index.d.ts +1 -1
  203. package/lib/feature-libraries/index.d.ts.map +1 -1
  204. package/lib/feature-libraries/index.js +1 -1
  205. package/lib/feature-libraries/index.js.map +1 -1
  206. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  207. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  208. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  209. package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
  210. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  211. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  212. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  213. package/lib/feature-libraries/sequence-field/formatV1.d.ts +1 -1
  214. package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
  215. package/lib/feature-libraries/sequence-field/formatV2.d.ts +1 -1
  216. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  217. package/lib/feature-libraries/sequence-field/formatV3.d.ts +1 -1
  218. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  219. package/lib/index.d.ts +2 -2
  220. package/lib/index.d.ts.map +1 -1
  221. package/lib/index.js +2 -2
  222. package/lib/index.js.map +1 -1
  223. package/lib/legacy.d.ts +13 -0
  224. package/lib/packageVersion.d.ts +1 -1
  225. package/lib/packageVersion.js +1 -1
  226. package/lib/packageVersion.js.map +1 -1
  227. package/lib/shared-tree/independentView.d.ts.map +1 -1
  228. package/lib/shared-tree/independentView.js +2 -1
  229. package/lib/shared-tree/independentView.js.map +1 -1
  230. package/lib/shared-tree/schematizingTreeView.d.ts +4 -3
  231. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  232. package/lib/shared-tree/schematizingTreeView.js +2 -2
  233. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  234. package/lib/shared-tree/sharedTree.d.ts +1 -1
  235. package/lib/shared-tree/sharedTree.js +1 -1
  236. package/lib/shared-tree/sharedTree.js.map +1 -1
  237. package/lib/shared-tree/treeAlpha.d.ts +28 -2
  238. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  239. package/lib/shared-tree/treeAlpha.js +13 -1
  240. package/lib/shared-tree/treeAlpha.js.map +1 -1
  241. package/lib/shared-tree/treeCheckout.d.ts +1 -1
  242. package/lib/shared-tree/treeCheckout.js +1 -1
  243. package/lib/shared-tree/treeCheckout.js.map +1 -1
  244. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  245. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  246. package/lib/shared-tree-core/transaction.d.ts +2 -2
  247. package/lib/shared-tree-core/transaction.js.map +1 -1
  248. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +47 -0
  249. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -0
  250. package/lib/simple-tree/api/incrementalAllowedTypes.js +86 -0
  251. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -0
  252. package/lib/simple-tree/api/index.d.ts +2 -1
  253. package/lib/simple-tree/api/index.d.ts.map +1 -1
  254. package/lib/simple-tree/api/index.js +1 -0
  255. package/lib/simple-tree/api/index.js.map +1 -1
  256. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  257. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  258. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  259. package/lib/simple-tree/api/tree.d.ts +51 -37
  260. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  261. package/lib/simple-tree/api/tree.js.map +1 -1
  262. package/lib/simple-tree/core/allowedTypes.d.ts +10 -11
  263. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  264. package/lib/simple-tree/core/allowedTypes.js +1 -1
  265. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  266. package/lib/simple-tree/core/index.d.ts +1 -1
  267. package/lib/simple-tree/core/index.d.ts.map +1 -1
  268. package/lib/simple-tree/core/index.js +1 -1
  269. package/lib/simple-tree/core/index.js.map +1 -1
  270. package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -8
  271. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  272. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  273. package/lib/simple-tree/core/treeNodeValid.d.ts +2 -2
  274. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  275. package/lib/simple-tree/core/treeNodeValid.js +2 -2
  276. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  277. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  278. package/lib/simple-tree/core/walkSchema.js +1 -1
  279. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  280. package/lib/simple-tree/core/withType.d.ts +20 -0
  281. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  282. package/lib/simple-tree/core/withType.js +20 -0
  283. package/lib/simple-tree/core/withType.js.map +1 -1
  284. package/lib/simple-tree/createContext.d.ts.map +1 -1
  285. package/lib/simple-tree/createContext.js +2 -2
  286. package/lib/simple-tree/createContext.js.map +1 -1
  287. package/lib/simple-tree/index.d.ts +2 -2
  288. package/lib/simple-tree/index.d.ts.map +1 -1
  289. package/lib/simple-tree/index.js +2 -2
  290. package/lib/simple-tree/index.js.map +1 -1
  291. package/lib/simple-tree/leafNodeSchema.js +1 -1
  292. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  293. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  294. package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -1
  295. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  296. package/lib/simple-tree/node-kinds/map/mapNode.js +1 -1
  297. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  298. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  299. package/lib/simple-tree/node-kinds/object/objectNode.js +1 -1
  300. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  301. package/lib/simple-tree/node-kinds/record/recordNode.js +1 -1
  302. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  303. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -0
  304. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  305. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +13 -1
  306. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  307. package/lib/util/nestedMap.d.ts +1 -1
  308. package/lib/util/nestedMap.js +1 -1
  309. package/lib/util/nestedMap.js.map +1 -1
  310. package/lib/util/referenceCounting.d.ts +1 -1
  311. package/lib/util/referenceCounting.js.map +1 -1
  312. package/package.json +21 -21
  313. package/src/api.ts +11 -0
  314. package/src/codec/codec.ts +3 -3
  315. package/src/core/forest/forest.ts +3 -4
  316. package/src/core/rebase/changeRebaser.ts +1 -1
  317. package/src/core/tree/detachedFieldIndex.ts +4 -1
  318. package/src/feature-libraries/chunked-forest/chunkTree.ts +9 -0
  319. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  320. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +20 -58
  321. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  322. package/src/feature-libraries/flex-tree/lazyField.ts +3 -1
  323. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  324. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +64 -70
  325. package/src/feature-libraries/incrementalSummarizationUtils.ts +1 -1
  326. package/src/feature-libraries/index.ts +1 -0
  327. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -1
  328. package/src/feature-libraries/object-forest/objectForest.ts +3 -3
  329. package/src/feature-libraries/sequence-field/formatV1.ts +1 -1
  330. package/src/feature-libraries/sequence-field/formatV2.ts +1 -1
  331. package/src/feature-libraries/sequence-field/formatV3.ts +1 -1
  332. package/src/index.ts +4 -1
  333. package/src/packageVersion.ts +1 -1
  334. package/src/shared-tree/independentView.ts +4 -1
  335. package/src/shared-tree/schematizingTreeView.ts +10 -5
  336. package/src/shared-tree/sharedTree.ts +1 -1
  337. package/src/shared-tree/treeAlpha.ts +50 -2
  338. package/src/shared-tree/treeCheckout.ts +1 -1
  339. package/src/shared-tree-core/sharedTreeCore.ts +1 -1
  340. package/src/shared-tree-core/transaction.ts +2 -2
  341. package/src/simple-tree/api/incrementalAllowedTypes.ts +107 -0
  342. package/src/simple-tree/api/index.ts +6 -0
  343. package/src/simple-tree/api/schemaFactoryBeta.ts +6 -2
  344. package/src/simple-tree/api/tree.ts +64 -44
  345. package/src/simple-tree/core/allowedTypes.ts +10 -11
  346. package/src/simple-tree/core/index.ts +6 -1
  347. package/src/simple-tree/core/treeNodeSchema.ts +3 -8
  348. package/src/simple-tree/core/treeNodeValid.ts +3 -3
  349. package/src/simple-tree/core/walkSchema.ts +1 -2
  350. package/src/simple-tree/core/withType.ts +24 -0
  351. package/src/simple-tree/createContext.ts +1 -4
  352. package/src/simple-tree/index.ts +5 -0
  353. package/src/simple-tree/leafNodeSchema.ts +1 -1
  354. package/src/simple-tree/node-kinds/array/arrayNode.ts +5 -2
  355. package/src/simple-tree/node-kinds/map/mapNode.ts +1 -1
  356. package/src/simple-tree/node-kinds/object/objectNode.ts +1 -4
  357. package/src/simple-tree/node-kinds/record/recordNode.ts +1 -1
  358. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +13 -0
  359. package/src/util/nestedMap.ts +1 -1
  360. package/src/util/referenceCounting.ts +1 -1
@@ -13,7 +13,7 @@ export interface CollabWindow {
13
13
  * gives the sequenceNumber of the op currently being processed.
14
14
  * `undefined` if no message has been processed, e.g. for a detached document or document loaded
15
15
  * from summary without any subsequent ops.
16
- * @remarks - Most rebasing is built atop a revision system decoupled from message sequence number.
16
+ * @remarks Most rebasing is built atop a revision system decoupled from message sequence number.
17
17
  * However, this is sometimes necessary to interop with Fluid runtime APIs, e.g. for incremental summarization.
18
18
  */
19
19
  getCurrentSeq: () => number | undefined;
@@ -110,6 +110,7 @@ export {
110
110
  fluidVersionToFieldBatchCodecWriteVersion,
111
111
  type FieldBatchEncodingContext,
112
112
  emptyChunk,
113
+ combineChunks,
113
114
  type IncrementalEncodingPolicy,
114
115
  defaultIncrementalEncodingPolicy,
115
116
  } from "./chunked-forest/index.js";
@@ -2142,7 +2142,7 @@ function deltaFromNodeChange(
2142
2142
  * For example, when rebasing change B from a local branch [A, B, C] over a branch [X, Y], the `baseRevisions` must include
2143
2143
  * revisions [A⁻¹ X, Y, A] if rebasing over the composition of all those changes, or
2144
2144
  * revision [A⁻¹] for the first rebase, then [X], etc. if rebasing over edits individually.
2145
- * @returns - RebaseRevisionMetadata to be passed to `FieldChangeRebaser.rebase`*
2145
+ * @returns RebaseRevisionMetadata to be passed to `FieldChangeRebaser.rebase`*
2146
2146
  */
2147
2147
  export function rebaseRevisionMetadataFromInfo(
2148
2148
  revInfos: readonly RevisionInfo[],
@@ -49,7 +49,7 @@ import {
49
49
  type Breakable,
50
50
  type WithBreakable,
51
51
  } from "../../util/index.js";
52
- import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/index.js";
52
+ import { chunkField, defaultChunkPolicy } from "../chunked-forest/index.js";
53
53
  import { cursorForMapTreeNode, mapTreeFromCursor } from "../mapTreeCursor.js";
54
54
  import { type CursorWithNode, SynchronousCursor } from "../treeCursorUtils.js";
55
55
  import {
@@ -128,8 +128,8 @@ export class ObjectForest implements IEditableForest, WithBreakable {
128
128
  return new ObjectForest(this.breaker, schema, anchors, this.additionalAsserts, this.roots);
129
129
  }
130
130
 
131
- public chunkField(cursor: ITreeCursorSynchronous): TreeChunk {
132
- return chunkFieldSingle(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });
131
+ public chunkField(cursor: ITreeCursorSynchronous): TreeChunk[] {
132
+ return chunkField(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });
133
133
  }
134
134
 
135
135
  public forgetAnchor(anchor: Anchor): void {
@@ -161,7 +161,7 @@ export const Changeset = <Schema extends TSchema>(tNodeChange: Schema) =>
161
161
  Type.Array(Mark(tNodeChange));
162
162
 
163
163
  /**
164
- * @privateRemarks - Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
164
+ * @privateRemarks Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
165
165
  */
166
166
  export namespace Encoded {
167
167
  export type CellCount = Static<typeof CellCount>;
@@ -110,7 +110,7 @@ export const Changeset = <Schema extends TSchema>(tNodeChange: Schema) =>
110
110
  Type.Array(Mark(tNodeChange));
111
111
 
112
112
  /**
113
- * @privateRemarks - Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
113
+ * @privateRemarks Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
114
114
  */
115
115
  export namespace Encoded {
116
116
  export type CellCount = Static<typeof CellCount>;
@@ -39,7 +39,7 @@ export const Changeset = <Schema extends TSchema>(tNodeChange: Schema) =>
39
39
  Type.Array(Mark(tNodeChange));
40
40
 
41
41
  /**
42
- * @privateRemarks - Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
42
+ * @privateRemarks Many of these names are currently used in the sequence-field types. Putting them in a namespace makes codec code more readable.
43
43
  */
44
44
  export namespace Encoded {
45
45
  export type CellCount = EncodedV2.CellCount;
package/src/index.ts CHANGED
@@ -123,6 +123,7 @@ export {
123
123
  type WithType,
124
124
  type NodeChangedData,
125
125
  type SchemaUpgrade,
126
+ contentSchemaSymbol,
126
127
  // Types not really intended for public use, but used in links.
127
128
  // Can not be moved to internalTypes since doing so causes app code to throw errors like:
128
129
  // Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package "@fluidframework/tree" does not have an export "TreeNodeApi"
@@ -164,6 +165,7 @@ export {
164
165
  singletonSchema,
165
166
  type UnsafeUnknownSchema,
166
167
  type TreeViewAlpha,
168
+ type TreeViewBeta,
167
169
  type InsertableField,
168
170
  type Insertable,
169
171
  type InsertableContent,
@@ -234,6 +236,7 @@ export {
234
236
  type InsertableTreeNodeFromAllowedTypes,
235
237
  type Input,
236
238
  type TreeBranch,
239
+ type TreeBranchAlpha,
237
240
  type TreeBranchEvents,
238
241
  asTreeViewAlpha,
239
242
  type NodeSchemaOptions,
@@ -337,4 +340,4 @@ export type { MapNodeInsertableData } from "./simple-tree/index.js";
337
340
  export { JsonAsTree } from "./jsonDomainSchema.js";
338
341
  export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
339
342
  export { TableSchema, type System_TableSchema } from "./tableSchema.js";
340
- export { asAlpha } from "./api.js";
343
+ export { asAlpha, asBeta } from "./api.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.70.0-361092";
9
+ export const pkgVersion = "2.70.0-361788";
@@ -44,6 +44,7 @@ import {
44
44
  import { createTreeCheckout } from "./treeCheckout.js";
45
45
  import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
46
46
  import { initialize, initializerFromChunk } from "./schematizeTree.js";
47
+ import { combineChunks } from "../feature-libraries/index.js";
47
48
 
48
49
  /**
49
50
  * Create an uninitialized {@link TreeView} that is not tied to any {@link ITree} instance.
@@ -158,7 +159,9 @@ export function independentInitializedViewInternal<const TSchema extends Implici
158
159
  initialize(
159
160
  checkout,
160
161
  schema,
161
- initializerFromChunk(checkout, () => checkout.forest.chunkField(rootFieldCursor)),
162
+ initializerFromChunk(checkout, () =>
163
+ combineChunks(checkout.forest.chunkField(rootFieldCursor)),
164
+ ),
162
165
  );
163
166
  return new SchematizingSimpleTreeView<TSchema>(
164
167
  checkout,
@@ -19,6 +19,7 @@ import {
19
19
  cursorForMapTreeField,
20
20
  TreeStatus,
21
21
  Context,
22
+ combineChunks,
22
23
  type FlexTreeOptionalField,
23
24
  type FlexTreeUnknownUnboxed,
24
25
  FieldKinds,
@@ -70,6 +71,7 @@ import {
70
71
 
71
72
  import { canInitialize, initialize, initializerFromChunk } from "./schematizeTree.js";
72
73
  import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
74
+ import type { TreeBranchAlpha } from "../simple-tree/index.js";
73
75
 
74
76
  /**
75
77
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
@@ -227,8 +229,10 @@ export class SchematizingSimpleTreeView<
227
229
  schema,
228
230
  initializerFromChunk(this.checkout, () => {
229
231
  // This must be done after initial schema is set!
230
- return this.checkout.forest.chunkField(
231
- cursorForMapTreeField(mapTree === undefined ? [] : [mapTree]),
232
+ return combineChunks(
233
+ this.checkout.forest.chunkField(
234
+ cursorForMapTreeField(mapTree === undefined ? [] : [mapTree]),
235
+ ),
232
236
  );
233
237
  }),
234
238
  );
@@ -510,15 +514,16 @@ export class SchematizingSimpleTreeView<
510
514
 
511
515
  // #region Branching
512
516
 
513
- public fork(): ReturnType<TreeBranch["fork"]> & SchematizingSimpleTreeView<TRootSchema> {
517
+ public fork(): ReturnType<TreeBranchAlpha["fork"]> &
518
+ SchematizingSimpleTreeView<TRootSchema> {
514
519
  return this.checkout.branch().viewWith(this.config);
515
520
  }
516
521
 
517
- public merge(context: TreeBranch, disposeMerged = true): void {
522
+ public merge(context: TreeBranchAlpha, disposeMerged = true): void {
518
523
  this.checkout.merge(getCheckout(context), disposeMerged);
519
524
  }
520
525
 
521
- public rebaseOnto(context: TreeBranch): void {
526
+ public rebaseOnto(context: TreeBranchAlpha): void {
522
527
  getCheckout(context).rebase(this.checkout);
523
528
  }
524
529
 
@@ -667,7 +667,7 @@ export const SharedTreeFormatVersion = {
667
667
  /**
668
668
  * Requires \@fluidframework/tree \>= 2.0.0.
669
669
  *
670
- * @deprecated - FF does not currently plan on supporting this format long-term.
670
+ * @deprecated FF does not currently plan on supporting this format long-term.
671
671
  * Do not write production documents using this format, as they may not be loadable in the future.
672
672
  */
673
673
  v1: 1,
@@ -58,6 +58,8 @@ import {
58
58
  importConcise,
59
59
  exportConcise,
60
60
  borrowCursorFromTreeNodeOrValue,
61
+ contentSchemaSymbol,
62
+ type TreeNodeSchema,
61
63
  } from "../simple-tree/index.js";
62
64
  import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js";
63
65
  import {
@@ -83,8 +85,10 @@ import {
83
85
  type Observer,
84
86
  withObservation,
85
87
  } from "../feature-libraries/index.js";
88
+ import type { TreeBranchAlpha } from "../simple-tree/index.js";
86
89
  import { independentInitializedView, type ViewContent } from "./independentView.js";
87
90
  import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
91
+ import { isFluidHandle } from "@fluidframework/runtime-utils";
88
92
 
89
93
  const identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined => {
90
94
  const nodeIdentifier = getIdentifierFromNode(node, "uncompressed");
@@ -227,7 +231,7 @@ export interface TreeAlpha {
227
231
  * This does not fork a new branch, but rather retrieves the _existing_ branch for the node.
228
232
  * To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.
229
233
  */
230
- branch(node: TreeNode): TreeBranch | undefined;
234
+ branch(node: TreeNode): TreeBranchAlpha | undefined;
231
235
 
232
236
  /**
233
237
  * Construct tree content that is compatible with the field defined by the provided `schema`.
@@ -519,6 +523,35 @@ export interface TreeAlpha {
519
523
  onInvalidation: () => void,
520
524
  trackDuring: () => TResult,
521
525
  ): ObservationResults<TResult>;
526
+
527
+ /**
528
+ * Ensures that the provided content will be interpreted as the given schema when inserting into the tree.
529
+ * @returns `content`, for convenience.
530
+ * @remarks
531
+ * If applicable, this will tag the given content with a {@link contentSchemaSymbol | special property} that indicates its intended schema.
532
+ * The `content` will be interpreted as the given `schema` when later inserted into the tree.
533
+ *
534
+ * This does not validate that the content actually conforms to the given schema (such validation will be done at insert time).
535
+ * If the content is not compatible with the tagged schema, an error will be thrown when the content is inserted.
536
+ *
537
+ * This is particularly useful when the content's schema cannot be inferred from its structure alone because it is compatible with multiple schemas.
538
+ * @example
539
+ * ```typescript
540
+ * const sf = new SchemaFactory("example");
541
+ * class Dog extends sf.object("Dog", { name: sf.string() }) {}
542
+ * class Cat extends sf.object("Cat", { name: sf.string() }) {}
543
+ * class Root extends sf.object("Root", { pet: [Dog, Cat] }) {}
544
+ * // ...
545
+ * const pet = { name: "Max" };
546
+ * view.root.pet = pet; // Error: ambiguous schema - is it a Dog or a Cat?
547
+ * TreeAlpha.ensureSchema(Dog, pet); // Tags `pet` as a Dog.
548
+ * view.root.pet = pet; // No error - it's a Dog.
549
+ * ```
550
+ */
551
+ tagContentSchema<TSchema extends TreeNodeSchema, TContent extends InsertableField<TSchema>>(
552
+ schema: TSchema,
553
+ content: TContent,
554
+ ): TContent;
522
555
  }
523
556
 
524
557
  /**
@@ -723,7 +756,7 @@ export const TreeAlpha: TreeAlpha = {
723
756
  return result;
724
757
  },
725
758
 
726
- branch(node: TreeNode): TreeBranch | undefined {
759
+ branch(node: TreeNode): TreeBranchAlpha | undefined {
727
760
  const kernel = getKernel(node);
728
761
  if (!kernel.isHydrated()) {
729
762
  return undefined;
@@ -1003,6 +1036,21 @@ export const TreeAlpha: TreeAlpha = {
1003
1036
  }
1004
1037
  return result;
1005
1038
  },
1039
+
1040
+ tagContentSchema<TSchema extends TreeNodeSchema, TNode extends InsertableField<TSchema>>(
1041
+ schema: TSchema,
1042
+ node: TNode,
1043
+ ): TNode {
1044
+ if (typeof node === "object" && node !== null && !isFluidHandle(node)) {
1045
+ Reflect.defineProperty(node, contentSchemaSymbol, {
1046
+ configurable: false,
1047
+ enumerable: false,
1048
+ writable: true,
1049
+ value: schema.identifier,
1050
+ });
1051
+ }
1052
+ return node;
1053
+ },
1006
1054
  };
1007
1055
 
1008
1056
  /**
@@ -636,7 +636,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
636
636
  * @param kind - The {@link CommitKind} that produced this revertible (e.g., Default, Undo, Redo).
637
637
  * @param checkout - The {@link TreeCheckout} instance this revertible belongs to.
638
638
  * @param onRevertibleDisposed - Callback function that will be called when the revertible is disposed.
639
- * @returns - {@link RevertibleAlpha}
639
+ * @returns A {@link RevertibleAlpha} object.
640
640
  */
641
641
  private createRevertible(
642
642
  revision: RevisionTag,
@@ -719,7 +719,7 @@ function scopeStorageService(
719
719
  return service.list(`${scope}${path}`);
720
720
  },
721
721
  getSnapshotTree(): ISnapshotTree | undefined {
722
- const snapshotTree = service.getSnapshotTree?.();
722
+ const snapshotTree = service.getSnapshotTree();
723
723
  if (snapshotTree === undefined) {
724
724
  return undefined;
725
725
  }
@@ -42,7 +42,7 @@ export interface Transactor {
42
42
  * If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
43
43
  * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
44
44
  *
45
- * @remarks - Asynchronous transactions are not supported on the root checkout,
45
+ * @remarks Asynchronous transactions are not supported on the root checkout,
46
46
  * since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate
47
47
  * the transaction) is not visible to the application author.
48
48
  * Instead,
@@ -51,7 +51,7 @@ export interface Transactor {
51
51
  * 2. run the transaction on the fork
52
52
  * 3. merge the fork back into the root checkout
53
53
  *
54
- * @privateRemarks - There is currently no enforcement that asynchronous transactions don't happen on the root checkout.
54
+ * @privateRemarks There is currently no enforcement that asynchronous transactions don't happen on the root checkout.
55
55
  * AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.
56
56
  */
57
57
  start(): void;
@@ -0,0 +1,107 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { FieldKey, TreeNodeSchemaIdentifier } from "../../core/index.js";
7
+ import { getTreeNodeSchemaPrivateData, type AllowedTypesFull } from "../core/index.js";
8
+ import { isObjectNodeSchema } from "../node-kinds/index.js";
9
+ import type { TreeSchema } from "./configuration.js";
10
+ import type { IncrementalEncodingPolicy } from "../../feature-libraries/index.js";
11
+ import { oneFromIterable } from "../../util/index.js";
12
+ import { assert } from "@fluidframework/core-utils/internal";
13
+
14
+ /**
15
+ * A symbol when present in the {@link AnnotatedAllowedTypes.metadata.custom} property as true, opts in the allowed
16
+ * types to incremental summary optimization.
17
+ * These allowed types will be optimized during summary such that if they don't change across summaries,
18
+ * they will not be encoded and their content will not be included in the summary that is uploaded to the service.
19
+ * @remarks
20
+ * See {@link getShouldIncrementallySummarizeAllowedTypes} for more details.
21
+ *
22
+ * Use {@link SchemaStaticsAlpha.types} to add this metadata to allowed types in a schema.
23
+ * @example
24
+ * ```typescript
25
+ * const sf = new SchemaFactoryAlpha("IncrementalSummarization");
26
+ * class Foo extends sf.objectAlpha("foo", {
27
+ * bar: sf.types([{ type: sf.string, metadata: {} }], {
28
+ * custom: { [incrementalSummaryHint]: true },
29
+ * }),
30
+ * }) {}
31
+ * ```
32
+ */
33
+ export const incrementalSummaryHint: unique symbol = Symbol("IncrementalSummaryHint");
34
+
35
+ /**
36
+ * Returns true if the provided allowed types's custom metadata has {@link incrementalSummaryHint} as true.
37
+ */
38
+ function isIncrementalSummaryHintInAllowedTypes(allowedTypes: AllowedTypesFull): boolean {
39
+ const customMetadata = allowedTypes.metadata.custom;
40
+ return (
41
+ customMetadata !== undefined &&
42
+ (customMetadata as Record<symbol, unknown>)[incrementalSummaryHint] === true
43
+ );
44
+ }
45
+
46
+ /**
47
+ * This helper function {@link getShouldIncrementallySummarizeAllowedTypes} can be used to generate a callback function
48
+ * of type {@link IncrementalEncodingPolicy}.
49
+ * This callback can be passed as the value for {@link SharedTreeOptionsInternal.shouldEncodeFieldIncrementally} parameter
50
+ * when creating the tree.
51
+ * It will be called for each {@link AllowedTypes} in the schema to determine if it should be incrementally summarized.
52
+ *
53
+ * @param rootSchema - The schema for the root of the tree.
54
+ * @returns A callback function of type {@link IncrementalEncodingPolicy} which can be used to determine if a field
55
+ * should be incrementally summarized based on whether it is an allowed types with the
56
+ * {@link incrementalAllowedTypesMetadata} metadata.
57
+ *
58
+ * @remarks
59
+ * This only works for forest type {@link ForestTypeOptimized} and compression strategy
60
+ * {@link TreeCompressionStrategyExtended.CompressedIncremental}.
61
+ *
62
+ * The {@link incrementalAllowedTypesMetadata} will be replaced with a specialized metadata property once the
63
+ * incremental summary feature and APIs are stabilized.
64
+ */
65
+ export function getShouldIncrementallySummarizeAllowedTypes(
66
+ rootSchema: TreeSchema,
67
+ ): IncrementalEncodingPolicy {
68
+ return (
69
+ targetNodeIdentifier: TreeNodeSchemaIdentifier | undefined,
70
+ targetFieldKey: FieldKey,
71
+ ) => {
72
+ if (targetNodeIdentifier === undefined) {
73
+ // Root fields cannot be allowed types, so we don't incrementally summarize them.
74
+ return false;
75
+ }
76
+
77
+ const targetNode = rootSchema.definitions.get(targetNodeIdentifier);
78
+ if (targetNode === undefined) {
79
+ // The requested type is unknown to this schema.
80
+ // In this case we have no hints available from the view schema, and fall back to the default behavior of non-incremental encoding.
81
+ // There are two ways this can happen:
82
+ // 1. The view schema being used does not match the stored schema.
83
+ // 2. The view schema is compatible, but there are unknown optional fields which contain new types not described by the view schema.
84
+ return false;
85
+ }
86
+
87
+ if (isObjectNodeSchema(targetNode)) {
88
+ const targetPropertyKey = targetNode.storedKeyToPropertyKey.get(targetFieldKey);
89
+ if (targetPropertyKey !== undefined) {
90
+ const fieldSchema = targetNode.fields.get(targetPropertyKey);
91
+ if (fieldSchema !== undefined) {
92
+ return isIncrementalSummaryHintInAllowedTypes(fieldSchema.allowedTypesFull);
93
+ }
94
+ }
95
+ return false;
96
+ }
97
+
98
+ const allowedTypes = oneFromIterable(
99
+ getTreeNodeSchemaPrivateData(targetNode).childAllowedTypes,
100
+ );
101
+ assert(
102
+ allowedTypes !== undefined,
103
+ "Non object nodes with fields should only have one allowedTypes entry",
104
+ );
105
+ return isIncrementalSummaryHintInAllowedTypes(allowedTypes);
106
+ };
107
+ }
@@ -19,7 +19,9 @@ export type {
19
19
  TreeViewEvents,
20
20
  SchemaCompatibilityStatus,
21
21
  TreeViewAlpha,
22
+ TreeViewBeta,
22
23
  TreeBranch,
24
+ TreeBranchAlpha,
23
25
  TreeBranchEvents,
24
26
  ITreeAlpha,
25
27
  } from "./tree.js";
@@ -161,3 +163,7 @@ export {
161
163
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
162
164
  export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
163
165
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
166
+ export {
167
+ getShouldIncrementallySummarizeAllowedTypes,
168
+ incrementalSummaryHint,
169
+ } from "./incrementalAllowedTypes.js";
@@ -88,7 +88,9 @@ export class SchemaFactoryBeta<
88
88
  TreeObjectNode<T, ScopedSchemaName<TScope, Name>>,
89
89
  object & InsertableObjectFromSchemaRecord<T>,
90
90
  true,
91
- T
91
+ T,
92
+ never,
93
+ TCustomMetadata
92
94
  > {
93
95
  return objectSchema(scoped<TScope, TName, Name>(this, name), fields, true, {
94
96
  ...defaultSchemaFactoryObjectOptions,
@@ -110,7 +112,9 @@ export class SchemaFactoryBeta<
110
112
  System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
111
113
  object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
112
114
  false,
113
- T
115
+ T,
116
+ never,
117
+ TCustomMetadata
114
118
  > {
115
119
  type TScopedName = ScopedSchemaName<TScope, Name>;
116
120
  return this.object(
@@ -126,37 +126,10 @@ export interface ITreeAlpha extends ITree {
126
126
  * A collection of functionality associated with a (version-control-style) branch of a SharedTree.
127
127
  * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.
128
128
  *
129
- * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.
130
- *
131
- * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranch.hasRootSchema | hasRootSchema()}.
132
- *
133
129
  * The branch associated directly with the {@link ITree | SharedTree} is the "main" branch, and all other branches fork (directly or transitively) from that main branch.
134
- * @sealed @alpha
130
+ * @sealed @beta
135
131
  */
136
132
  export interface TreeBranch extends IDisposable {
137
- /**
138
- * Events for the branch
139
- */
140
- readonly events: Listenable<TreeBranchEvents>;
141
-
142
- /**
143
- * Returns true if this branch has the given schema as its root schema.
144
- * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
145
- *
146
- * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.
147
- * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.
148
- * @example
149
- * ```typescript
150
- * if (branch.hasRootSchema(MySchema)) {
151
- * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>
152
- * // ...
153
- * }
154
- * ```
155
- */
156
- hasRootSchema<TSchema extends ImplicitFieldSchema>(
157
- schema: TSchema,
158
- ): this is TreeViewAlpha<TSchema>;
159
-
160
133
  /**
161
134
  * Fork a new branch off of this branch which is based off of this branch's current state.
162
135
  * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch.
@@ -187,6 +160,54 @@ export interface TreeBranch extends IDisposable {
187
160
  */
188
161
  rebaseOnto(branch: TreeBranch): void;
189
162
 
163
+ /**
164
+ * Dispose of this branch, cleaning up any resources associated with it.
165
+ * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
166
+ * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.
167
+ *
168
+ * Disposing branches is important to avoid consuming memory unnecessarily.
169
+ * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.
170
+ *
171
+ * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.
172
+ */
173
+ dispose(error?: Error): void;
174
+ }
175
+
176
+ /**
177
+ * {@link TreeBranch} with alpha-level APIs.
178
+ * @remarks
179
+ * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.
180
+ *
181
+ * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.
182
+ * @sealed @alpha
183
+ */
184
+ export interface TreeBranchAlpha extends TreeBranch {
185
+ /**
186
+ * Events for the branch
187
+ */
188
+ readonly events: Listenable<TreeBranchEvents>;
189
+
190
+ /**
191
+ * Returns true if this branch has the given schema as its root schema.
192
+ * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.
193
+ *
194
+ * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.
195
+ * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.
196
+ * @example
197
+ * ```typescript
198
+ * if (branch.hasRootSchema(MySchema)) {
199
+ * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>
200
+ * // ...
201
+ * }
202
+ * ```
203
+ */
204
+ hasRootSchema<TSchema extends ImplicitFieldSchema>(
205
+ schema: TSchema,
206
+ ): this is TreeViewAlpha<TSchema>;
207
+
208
+ // Override the base fork method to return the alpha variant.
209
+ fork(): TreeBranchAlpha;
210
+
190
211
  /**
191
212
  * Run a transaction which applies one or more edits to the tree as a single atomic unit.
192
213
  * @param transaction - The function to run as the body of the transaction.
@@ -261,18 +282,6 @@ export interface TreeBranch extends IDisposable {
261
282
  transaction: () => VoidTransactionCallbackStatus | void,
262
283
  params?: RunTransactionParams,
263
284
  ): TransactionResult;
264
-
265
- /**
266
- * Dispose of this branch, cleaning up any resources associated with it.
267
- * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.
268
- * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.
269
- *
270
- * Disposing branches is important to avoid consuming memory unnecessarily.
271
- * In particular, the SharedTree retains all sequenced changes made to the tree since the "most-behind" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.
272
- *
273
- * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.
274
- */
275
- dispose(error?: Error): void;
276
285
  }
277
286
 
278
287
  /**
@@ -371,18 +380,29 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
371
380
  */
372
381
  export interface TreeViewAlpha<
373
382
  in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,
374
- > extends Omit<TreeView<ReadSchema<TSchema>>, "root" | "initialize">,
375
- TreeBranch {
383
+ > extends Omit<TreeViewBeta<ReadSchema<TSchema>>, "root" | "initialize" | "fork">,
384
+ TreeBranchAlpha {
376
385
  get root(): ReadableField<TSchema>;
377
386
 
378
387
  set root(newRoot: InsertableField<TSchema>);
379
388
 
389
+ initialize(content: InsertableField<TSchema>): void;
390
+
380
391
  readonly events: Listenable<TreeViewEvents & TreeBranchEvents>;
381
392
 
382
- initialize(content: InsertableField<TSchema>): void;
393
+ // Override the base fork method to return a TreeViewAlpha.
394
+ fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
395
+ }
383
396
 
397
+ /**
398
+ * {@link TreeView} with additional beta APIs.
399
+ * @sealed @beta
400
+ */
401
+ export interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>
402
+ extends TreeView<TSchema>,
403
+ TreeBranch {
384
404
  // Override the base branch method to return a typed view rather than merely a branch.
385
- fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
405
+ fork(): ReturnType<TreeBranch["fork"]> & TreeViewBeta<TSchema>;
386
406
  }
387
407
 
388
408
  /**