@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,10 +12,8 @@ import {
12
12
  type ITreeCursorSynchronous,
13
13
  LeafNodeStoredSchema,
14
14
  ObjectNodeStoredSchema,
15
- type StoredSchemaCollection,
16
15
  type TreeFieldStoredSchema,
17
16
  type TreeNodeSchemaIdentifier,
18
- type TreeStoredSchema,
19
17
  type TreeStoredSchemaSubscription,
20
18
  type TreeValue,
21
19
  type Value,
@@ -24,6 +22,7 @@ import {
24
22
  ValueSchema,
25
23
  type TreeChunk,
26
24
  tryGetChunk,
25
+ type SchemaAndPolicy,
27
26
  } from "../../core/index.js";
28
27
  import { getOrCreate } from "../../util/index.js";
29
28
  import type { FullSchemaPolicy } from "../modular-schema/index.js";
@@ -32,6 +31,7 @@ import { isStableNodeIdentifier } from "../node-identifier/index.js";
32
31
  import { BasicChunk } from "./basicChunk.js";
33
32
  import { SequenceChunk } from "./sequenceChunk.js";
34
33
  import { type FieldShape, TreeShape, UniformChunk } from "./uniformChunk.js";
34
+ import type { IncrementalEncodingPolicy } from "./codec/index.js";
35
35
 
36
36
  export interface Disposable {
37
37
  /**
@@ -39,13 +39,13 @@ export interface Disposable {
39
39
  */
40
40
  dispose(): void;
41
41
  }
42
-
43
42
  /**
44
43
  * Creates a ChunkPolicy which responds to schema changes.
45
44
  */
46
45
  export function makeTreeChunker(
47
46
  schema: TreeStoredSchemaSubscription,
48
47
  policy: FullSchemaPolicy,
48
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
49
49
  ): IChunker {
50
50
  return new Chunker(
51
51
  schema,
@@ -53,7 +53,16 @@ export function makeTreeChunker(
53
53
  defaultChunkPolicy.sequenceChunkInlineThreshold,
54
54
  defaultChunkPolicy.sequenceChunkInlineThreshold,
55
55
  defaultChunkPolicy.uniformChunkNodeCount,
56
- tryShapeFromSchema,
56
+ (type: TreeNodeSchemaIdentifier, shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>) =>
57
+ tryShapeFromNodeSchema(
58
+ {
59
+ schema,
60
+ policy,
61
+ shouldEncodeIncrementally,
62
+ shapes,
63
+ },
64
+ type,
65
+ ),
57
66
  );
58
67
  }
59
68
 
@@ -73,7 +82,7 @@ export interface IChunker extends ChunkPolicy, Disposable {
73
82
  *
74
83
  * @remarks
75
84
  * For example, a schema transitively containing a sequence field, optional field, or allowing multiple child types will be Polymorphic.
76
- * See `tryShapeFromSchema` for how to tell if a type is Polymorphic.
85
+ * See `tryShapeFromNodeSchema` for how to tell if a type is Polymorphic.
77
86
  *
78
87
  * TODO: cache some of the possible shapes here.
79
88
  */
@@ -109,9 +118,7 @@ export class Chunker implements IChunker {
109
118
  public readonly sequenceChunkInlineThreshold: number,
110
119
  public readonly uniformChunkNodeCount: number,
111
120
  // eslint-disable-next-line @typescript-eslint/no-shadow
112
- private readonly tryShapeFromSchema: (
113
- schema: TreeStoredSchema,
114
- policy: FullSchemaPolicy,
121
+ private readonly tryShapeFromNodeSchema: (
115
122
  type: TreeNodeSchemaIdentifier,
116
123
  shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
117
124
  ) => ShapeInfo,
@@ -126,7 +133,7 @@ export class Chunker implements IChunker {
126
133
  this.sequenceChunkSplitThreshold,
127
134
  this.sequenceChunkInlineThreshold,
128
135
  this.uniformChunkNodeCount,
129
- this.tryShapeFromSchema,
136
+ this.tryShapeFromNodeSchema,
130
137
  );
131
138
  }
132
139
 
@@ -138,7 +145,7 @@ export class Chunker implements IChunker {
138
145
  this.unregisterSchemaCallback = this.schema.events.on("afterSchemaChange", () =>
139
146
  this.schemaChanged(),
140
147
  );
141
- return this.tryShapeFromSchema(this.schema, this.policy, schema, this.typeShapes);
148
+ return this.tryShapeFromNodeSchema(schema, this.typeShapes);
142
149
  }
143
150
 
144
151
  public dispose(): void {
@@ -226,75 +233,126 @@ export function makePolicy(policy?: Partial<ChunkPolicy>): ChunkPolicy {
226
233
  return withDefaults;
227
234
  }
228
235
 
229
- export function shapesFromSchema(
230
- schema: StoredSchemaCollection,
231
- policy: FullSchemaPolicy,
232
- ): Map<TreeNodeSchemaIdentifier, ShapeInfo> {
233
- const shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo> = new Map();
234
- for (const identifier of schema.nodeSchema.keys()) {
235
- tryShapeFromSchema(schema, policy, identifier, shapes);
236
- }
237
- return shapes;
236
+ export interface ShapeFromSchemaParameters extends SchemaAndPolicy {
237
+ /**
238
+ * Policy function to determine if a field should be encoded incrementally.
239
+ * Incrementally encoding requires the subtree to not start in the middle of a larger uniform chunk.
240
+ * Thus returning true from this callback indicates that shapes should not be produced which could
241
+ *contain the incremental portion as a part of a larger shape.
242
+ */
243
+ readonly shouldEncodeIncrementally: IncrementalEncodingPolicy;
244
+ /**
245
+ * A cache for shapes which may be read and/or updated.
246
+ * As the shape is a function of the other members of `ShapeFromSchemaParameters`,
247
+ * it must be replaced or cleared if any of the properties other than this cache are modified.
248
+ */
249
+ readonly shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>;
250
+ }
251
+
252
+ /**
253
+ * A TreeFieldStoredSchema with some additional context about where it is in the tree.
254
+ */
255
+ export interface FieldSchemaWithContext {
256
+ /**
257
+ * The identifier of the specific field schema to analyze for shape uniformity.
258
+ */
259
+ readonly fieldSchema: TreeFieldStoredSchema;
260
+ /**
261
+ * The identifier of the parent node schema containing this field.
262
+ * If undefined, this is a root field.
263
+ */
264
+ readonly parentNodeSchema?: TreeNodeSchemaIdentifier;
265
+ /**
266
+ * The field key/name used to identify this field within the parent node.
267
+ */
268
+ readonly key: FieldKey;
238
269
  }
239
270
 
240
271
  /**
241
- * If `schema` has only one shape, return it.
272
+ * Analyzes a tree node schema to determine if it has a single, uniform shape that can be optimized for chunking.
273
+ * If the schema defines a tree structure with a deterministic, fixed shape (no optional fields, no sequences,
274
+ * single child types), returns a TreeShape that can be used for efficient uniform chunking. Otherwise,
275
+ * returns Polymorphic to indicate the shape varies and should use basic chunking.
276
+ *
277
+ * @param context - {@link ShapeFromSchemaParameters}.
278
+ * @param nodeSchema - The identifier of the specific node schema to analyze for shape uniformity.
279
+ * @returns TreeShape if the schema has a uniform shape, or Polymorphic if shape varies.
242
280
  *
243
- * Note that this does not tolerate optional or sequence fields, nor does it optimize for patterns of specific values.
281
+ * @remarks
282
+ * The determination here is conservative. `shouldEncodeIncrementally` is used to split up shapes so incrementally
283
+ * encoded schema are not part of larger shapes. It also does not tolerate optional or sequence fields, nor does it
284
+ * optimize for patterns of specific values.
244
285
  */
245
- export function tryShapeFromSchema(
246
- schema: StoredSchemaCollection,
247
- policy: FullSchemaPolicy,
248
- type: TreeNodeSchemaIdentifier,
249
- shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
286
+ export function tryShapeFromNodeSchema(
287
+ context: ShapeFromSchemaParameters,
288
+ nodeSchema: TreeNodeSchemaIdentifier,
250
289
  ): ShapeInfo {
251
- return getOrCreate(shapes, type, () => {
252
- const treeSchema = schema.nodeSchema.get(type) ?? fail(0xaf9 /* missing schema */);
290
+ const { schema, shapes } = context;
291
+ return getOrCreate(shapes, nodeSchema, () => {
292
+ const treeSchema = schema.nodeSchema.get(nodeSchema) ?? fail(0xaf9 /* missing schema */);
253
293
  if (treeSchema instanceof LeafNodeStoredSchema) {
254
294
  // Allow all string values (but only string values) to be compressed by the id compressor.
255
295
  // This allows compressing all compressible identifiers without requiring additional context to know which values could be identifiers.
256
296
  // Attempting to compress other string shouldn't have significant overhead,
257
297
  // and if any of them do end up compressing, that's a benefit not a bug.
258
298
  return treeSchema.leafValue === ValueSchema.String
259
- ? new TreeShape(type, true, [], true)
260
- : new TreeShape(type, true, [], false);
299
+ ? new TreeShape(nodeSchema, true, [], true)
300
+ : new TreeShape(nodeSchema, true, [], false);
261
301
  }
262
302
  if (treeSchema instanceof ObjectNodeStoredSchema) {
263
303
  const fieldsArray: FieldShape[] = [];
264
- for (const [key, field] of treeSchema.objectNodeFields) {
265
- const fieldShape = tryShapeFromFieldSchema(schema, policy, field, key, shapes);
304
+ for (const [key, fieldSchema] of treeSchema.objectNodeFields) {
305
+ const fieldShape = tryShapeFromFieldSchema(context, {
306
+ fieldSchema,
307
+ parentNodeSchema: nodeSchema,
308
+ key,
309
+ });
266
310
  if (fieldShape === undefined) {
267
311
  return polymorphic;
268
312
  }
269
313
  fieldsArray.push(fieldShape);
270
314
  }
271
- return new TreeShape(type, false, fieldsArray);
315
+ return new TreeShape(nodeSchema, false, fieldsArray);
272
316
  }
273
317
  return polymorphic;
274
318
  });
275
319
  }
276
320
 
277
321
  /**
278
- * If `schema` has only one shape, return it.
322
+ * Same as {@link tryShapeFromNodeSchema} but for fields with {@link FieldSchemaWithContext} instead of a nodeSchema.
279
323
  *
280
- * Note that this does not tolerate optional or sequence fields, nor does it optimize for patterns of specific values.
324
+ * @param context - {@link ShapeFromFieldSchemaParameters}.
325
+ * @param fieldSchemaWithContext - {@link FieldSchemaWithContext}.
326
+ * @returns FieldShape if the field has a uniform shape, or undefined if the field is polymorphic.
281
327
  */
282
328
  export function tryShapeFromFieldSchema(
283
- schema: StoredSchemaCollection,
284
- policy: FullSchemaPolicy,
285
- type: TreeFieldStoredSchema,
286
- key: FieldKey,
287
- shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
329
+ context: ShapeFromSchemaParameters,
330
+ fieldSchemaWithContext: FieldSchemaWithContext,
288
331
  ): FieldShape | undefined {
289
- const kind = policy.fieldKinds.get(type.kind) ?? fail(0xafa /* missing FieldKind */);
332
+ const { schema, policy, shouldEncodeIncrementally, shapes } = context;
333
+ const { fieldSchema, parentNodeSchema, key } = fieldSchemaWithContext;
334
+ // If this field should be encoded incrementally, use polymorphic shape so that they
335
+ // are chunked separately and can be re-used across encodings if they do not change.
336
+ if (shouldEncodeIncrementally(parentNodeSchema, key)) {
337
+ return undefined;
338
+ }
339
+ const kind = policy.fieldKinds.get(fieldSchema.kind) ?? fail(0xafa /* missing FieldKind */);
290
340
  if (kind.multiplicity !== Multiplicity.Single) {
291
341
  return undefined;
292
342
  }
293
- if (type.types?.size !== 1) {
343
+ if (fieldSchema.types?.size !== 1) {
294
344
  return undefined;
295
345
  }
296
- const childType = [...type.types][0] ?? oob();
297
- const childShape = tryShapeFromSchema(schema, policy, childType, shapes);
346
+ const childType = [...fieldSchema.types][0] ?? oob();
347
+ const childShape = tryShapeFromNodeSchema(
348
+ {
349
+ schema,
350
+ policy,
351
+ shouldEncodeIncrementally,
352
+ shapes,
353
+ },
354
+ childType,
355
+ );
298
356
  if (childShape instanceof Polymorphic) {
299
357
  return undefined;
300
358
  }
@@ -490,7 +548,16 @@ export function chunkRange(
490
548
  return output;
491
549
  }
492
550
  /**
493
- * @param idCompressor - compressor used to encoded string values that are compressible by the idCompressor for in-memory representation.
551
+ * Extracts values from the current cursor position according to the provided tree shape.
552
+ *
553
+ * Walks through the tree structure defined by the shape, extracting values from leaf nodes
554
+ * and recursively processing child fields. If an ID compressor is provided, compressible
555
+ * string values (stable node identifiers) will be recompressed for optimal storage.
556
+ *
557
+ * @param cursor - Tree cursor positioned at the node to extract values from
558
+ * @param shape - The tree shape defining the structure to extract
559
+ * @param values - Array to append the extracted values to
560
+ * @param idCompressor - Optional compressor used to encode string values that are compressible by the idCompressor for in-memory representation.
494
561
  * If the idCompressor is not provided, the values will be the original uncompressed values.
495
562
  */
496
563
  export function insertValues(
@@ -8,18 +8,15 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
8
8
 
9
9
  import {
10
10
  type CodecTree,
11
- type FluidClientVersion,
12
11
  type ICodecOptions,
13
12
  type IJsonCodec,
14
13
  makeVersionedValidatedCodec,
15
14
  } from "../../../codec/index.js";
16
15
  import {
17
16
  CursorLocationType,
18
- type FieldKey,
19
17
  type ITreeCursorSynchronous,
20
18
  type SchemaAndPolicy,
21
19
  type TreeChunk,
22
- type TreeNodeSchemaIdentifier,
23
20
  } from "../../../core/index.js";
24
21
  import {
25
22
  brandedNumberType,
@@ -37,6 +34,8 @@ import type { FieldBatch } from "./fieldBatch.js";
37
34
  import { EncodedFieldBatch, validVersions, type FieldBatchFormatVersion } from "./format.js";
38
35
  import { schemaCompressedEncode } from "./schemaBasedEncode.js";
39
36
  import { uncompressedEncode } from "./uncompressedEncode.js";
37
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
38
+ import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
40
39
 
41
40
  /**
42
41
  * Reference ID for a chunk that is incrementally encoded.
@@ -55,14 +54,10 @@ const ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, mi
55
54
  */
56
55
  export interface IncrementalEncoder {
57
56
  /**
58
- * Returns whether a field should be incrementally encoded.
59
- * @param nodeIdentifier - The identifier of the node containing the field.
60
- * @param fieldKey - The key of the field to check.
57
+ * Returns whether a node / field should be incrementally encoded.
58
+ * @remarks See {@link IncrementalEncodingPolicy}.
61
59
  */
62
- shouldEncodeFieldIncrementally(
63
- nodeIdentifier: TreeNodeSchemaIdentifier,
64
- fieldKey: FieldKey,
65
- ): boolean;
60
+ shouldEncodeIncrementally: IncrementalEncodingPolicy;
66
61
  /**
67
62
  * Called to encode an incremental field at the cursor.
68
63
  * The chunks for this field are encoded separately from the main buffer.
@@ -120,12 +115,12 @@ export type FieldBatchCodec = IJsonCodec<
120
115
  >;
121
116
 
122
117
  /**
123
- * Get the write version for {@link makeFieldBatchCodec} based on the `oldestCompatibleClient` version.
118
+ * Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.
124
119
  * @privateRemarks
125
120
  * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
126
121
  */
127
122
  export function fluidVersionToFieldBatchCodecWriteVersion(
128
- oldestCompatibleClient: FluidClientVersion,
123
+ minVersionForCollab: MinimumVersionForCollab,
129
124
  ): number {
130
125
  // There is currently on only 1 version.
131
126
  return 1;
@@ -0,0 +1,33 @@
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
+
8
+ /**
9
+ * Policy to determine whether a node / field should be incrementally encoded.
10
+ * @param nodeIdentifier - The identifier of the node containing the field.
11
+ * If undefined, the field is a root field.
12
+ * @param fieldKey - The key of the field to check.
13
+ * @returns whether the node / field should be incrementally encoded.
14
+ * @remarks
15
+ * Incremental encoding has a significant size overhead,
16
+ * but allows reuse of previously encoded unchanged subtrees.
17
+ * Thus it should only be enabled for large subtrees which are modified infrequently.
18
+ * TODO: AB#9068: Measure the actual overhead.
19
+ */
20
+ export type IncrementalEncodingPolicy = (
21
+ nodeIdentifier: TreeNodeSchemaIdentifier | undefined,
22
+ fieldKey: FieldKey,
23
+ ) => boolean;
24
+
25
+ /**
26
+ * Default policy for incremental encoding is to not encode incrementally.
27
+ */
28
+ export const defaultIncrementalEncodingPolicy: IncrementalEncodingPolicy = (
29
+ nodeIdentifier: TreeNodeSchemaIdentifier | undefined,
30
+ fieldKey: FieldKey,
31
+ ): boolean => {
32
+ return false;
33
+ };
@@ -16,3 +16,7 @@ export {
16
16
  type ChunkReferenceId,
17
17
  getCodecTreeForFieldBatchFormat,
18
18
  } from "./codecs.js";
19
+ export {
20
+ type IncrementalEncodingPolicy,
21
+ defaultIncrementalEncodingPolicy,
22
+ } from "./incrementalEncodingPolicy.js";
@@ -16,7 +16,6 @@ import {
16
16
  ValueSchema,
17
17
  Multiplicity,
18
18
  identifierFieldKindIdentifier,
19
- type FieldKey,
20
19
  } from "../../../core/index.js";
21
20
  import type { FullSchemaPolicy } from "../../modular-schema/index.js";
22
21
 
@@ -35,6 +34,7 @@ import type { FieldBatch } from "./fieldBatch.js";
35
34
  import { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from "./format.js";
36
35
  import type { IncrementalEncoder } from "./codecs.js";
37
36
  import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
37
+ import { defaultIncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
38
38
 
39
39
  /**
40
40
  * Encode data from `fieldBatch` in into an `EncodedChunk`.
@@ -134,14 +134,11 @@ export function getNodeEncoder(
134
134
  // consider moving some optional and sequence fields to extra fields if they are commonly empty
135
135
  // to reduce encoded size.
136
136
 
137
- const shouldEncodeFieldIncrementallyLocal = (
138
- nodeIdentifier: TreeNodeSchemaIdentifier,
139
- fieldKey: FieldKey,
140
- ): boolean =>
141
- incrementalEncoder?.shouldEncodeFieldIncrementally(nodeIdentifier, fieldKey) ?? false;
137
+ const shouldEncodeIncrementally =
138
+ incrementalEncoder?.shouldEncodeIncrementally ?? defaultIncrementalEncodingPolicy;
142
139
  const objectNodeFields: KeyedFieldEncoder[] = [];
143
140
  for (const [key, field] of schema.objectNodeFields ?? []) {
144
- const fieldEncoder = shouldEncodeFieldIncrementallyLocal(schemaName, key)
141
+ const fieldEncoder = shouldEncodeIncrementally(schemaName, key)
145
142
  ? incrementalFieldEncoder
146
143
  : fieldBuilder.fieldEncoderFromSchema(field);
147
144
  objectNodeFields.push({
@@ -25,5 +25,7 @@ export {
25
25
  fluidVersionToFieldBatchCodecWriteVersion,
26
26
  type IncrementalEncoderDecoder,
27
27
  type ChunkReferenceId,
28
+ type IncrementalEncodingPolicy,
29
+ defaultIncrementalEncodingPolicy,
28
30
  } from "./codec/index.js";
29
31
  export { emptyChunk } from "./emptyChunk.js";
@@ -262,7 +262,7 @@ export function getCodecTreeForModularChangeFormat(
262
262
  version: ModularChangeFormatVersion,
263
263
  ): CodecTree {
264
264
  const dependencies =
265
- fieldKindConfigurations.get(version) ?? fail("Unknown modular change format");
265
+ fieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);
266
266
  const children: CodecTree[] = Array.from(dependencies.entries()).map(
267
267
  ([key, { formatVersion }]) => ({
268
268
  name: `FieldKind:${key}`,
@@ -398,7 +398,7 @@ export interface FlexTreeOptionalField extends FlexTreeField {
398
398
  export type FlexTreeTypedField<Kind extends FlexFieldKind> =
399
399
  Kind extends typeof FieldKinds.sequence
400
400
  ? FlexTreeSequenceField
401
- : Kind extends typeof FieldKinds.required
401
+ : Kind extends typeof FieldKinds.required | typeof FieldKinds.identifier
402
402
  ? FlexTreeRequiredField
403
403
  : Kind extends typeof FieldKinds.optional
404
404
  ? FlexTreeOptionalField
@@ -23,7 +23,6 @@ import {
23
23
  type ITreeSubscriptionCursor,
24
24
  type RevisionTagCodec,
25
25
  TreeNavigationResult,
26
- type TreeNodeSchemaIdentifier,
27
26
  applyDelta,
28
27
  forEachField,
29
28
  makeDetachedFieldIndex,
@@ -36,7 +35,12 @@ import type {
36
35
  import { idAllocatorFromMaxId, type JsonCompatible } from "../../util/index.js";
37
36
  // eslint-disable-next-line import/no-internal-modules
38
37
  import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
39
- import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
38
+ import {
39
+ defaultIncrementalEncodingPolicy,
40
+ type FieldBatchCodec,
41
+ type FieldBatchEncodingContext,
42
+ type IncrementalEncodingPolicy,
43
+ } from "../chunked-forest/index.js";
40
44
 
41
45
  import { type ForestCodec, makeForestSummarizerCodec } from "./codec.js";
42
46
  import {
@@ -74,23 +78,15 @@ export class ForestSummarizer implements Summarizable {
74
78
  private readonly encoderContext: FieldBatchEncodingContext,
75
79
  options: CodecWriteOptions,
76
80
  private readonly idCompressor: IIdCompressor,
77
- shouldEncodeFieldIncrementally?: (
78
- nodeIdentifier: TreeNodeSchemaIdentifier,
79
- fieldKey: FieldKey,
80
- ) => boolean,
81
+ shouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,
81
82
  ) {
82
83
  // TODO: this should take in CodecWriteOptions, and use it to pick the write version.
83
84
  this.codec = makeForestSummarizerCodec(options, fieldBatchCodec);
84
-
85
- const shouldEncodeFieldIncrementallyLocal = (
86
- nodeIdentifier: TreeNodeSchemaIdentifier,
87
- fieldKey: FieldKey,
88
- ): boolean => shouldEncodeFieldIncrementally?.(nodeIdentifier, fieldKey) ?? false;
89
85
  this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(
90
86
  encoderContext.encodeType ===
91
87
  TreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,
92
88
  (cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),
93
- shouldEncodeFieldIncrementallyLocal,
89
+ shouldEncodeIncrementally,
94
90
  );
95
91
  }
96
92
 
@@ -20,13 +20,10 @@ import type {
20
20
  ChunkReferenceId,
21
21
  EncodedFieldBatch,
22
22
  IncrementalEncoderDecoder,
23
+ IncrementalEncodingPolicy,
23
24
  TreeChunk,
24
25
  } from "../chunked-forest/index.js";
25
- import type {
26
- FieldKey,
27
- ITreeCursorSynchronous,
28
- TreeNodeSchemaIdentifier,
29
- } from "../../core/index.js";
26
+ import type { ITreeCursorSynchronous } from "../../core/index.js";
30
27
  import { SummaryType } from "@fluidframework/driver-definitions";
31
28
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
32
29
  import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
@@ -263,13 +260,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
263
260
  public constructor(
264
261
  private readonly enableIncrementalSummary: boolean,
265
262
  private readonly getChunkAtCursor: (cursor: ITreeCursorSynchronous) => TreeChunk,
266
- /**
267
- * {@link IncrementalEncoder.shouldEncodeFieldIncrementally}
268
- */
269
- public readonly shouldEncodeFieldIncrementally: (
270
- nodeIdentifier: TreeNodeSchemaIdentifier,
271
- fieldKey: FieldKey,
272
- ) => boolean,
263
+ public readonly shouldEncodeIncrementally: IncrementalEncodingPolicy,
273
264
  ) {}
274
265
 
275
266
  /**
@@ -110,6 +110,8 @@ export {
110
110
  fluidVersionToFieldBatchCodecWriteVersion,
111
111
  type FieldBatchEncodingContext,
112
112
  emptyChunk,
113
+ type IncrementalEncodingPolicy,
114
+ defaultIncrementalEncodingPolicy,
113
115
  } from "./chunked-forest/index.js";
114
116
 
115
117
  export {
@@ -7,7 +7,6 @@ import { fail, unreachableCase } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import {
9
9
  type CodecTree,
10
- type FluidClientVersion,
11
10
  type ICodecFamily,
12
11
  type ICodecOptions,
13
12
  type IJsonCodec,
@@ -29,14 +28,15 @@ import { brand, type JsonCompatible } from "../../util/index.js";
29
28
 
30
29
  import { Format as FormatV1 } from "./formatV1.js";
31
30
  import { Format as FormatV2 } from "./formatV2.js";
31
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
32
32
 
33
33
  /**
34
- * Convert a FluidClientVersion to a SchemaVersion.
35
- * @param clientVersion - The FluidClientVersion to convert.
36
- * @returns The SchemaVersion that corresponds to the provided FluidClientVersion.
34
+ * Convert a MinimumVersionForCollab to a SchemaVersion.
35
+ * @param clientVersion - The MinimumVersionForCollab to convert.
36
+ * @returns The SchemaVersion that corresponds to the provided MinimumVersionForCollab.
37
37
  */
38
38
  export function clientVersionToSchemaVersion(
39
- clientVersion: FluidClientVersion,
39
+ clientVersion: MinimumVersionForCollab,
40
40
  ): SchemaVersion {
41
41
  // Only one version of the schema codec is currently supported.
42
42
  return SchemaVersion.v1;
package/src/index.ts CHANGED
@@ -137,6 +137,13 @@ export {
137
137
  type ArrayNodeCustomizableSchemaUnsafe,
138
138
  type MapNodeCustomizableSchemaUnsafe,
139
139
  type TreeRecordNodeUnsafe,
140
+ type UnannotateAllowedTypeUnsafe,
141
+ type AnnotatedAllowedTypeUnsafe,
142
+ type AnnotatedAllowedTypesUnsafe,
143
+ type AllowedTypesFullUnsafe,
144
+ type AllowedTypesFullFromMixedUnsafe,
145
+ type UnannotateAllowedTypesListUnsafe,
146
+ type AnnotateAllowedTypesListUnsafe,
140
147
  // System types (not in Internal types for various reasons, like doc links or cannot be named errors).
141
148
  type typeSchemaSymbol,
142
149
  type TreeNodeSchemaNonClass,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.63.0-359734";
9
+ export const pkgVersion = "2.63.0";
@@ -26,6 +26,7 @@ import {
26
26
  type FieldBatchEncodingContext,
27
27
  defaultSchemaPolicy,
28
28
  TreeCompressionStrategy,
29
+ defaultIncrementalEncodingPolicy,
29
30
  } from "../feature-libraries/index.js";
30
31
  // eslint-disable-next-line import/no-internal-modules
31
32
  import type { Format } from "../feature-libraries/schema-index/formatV1.js";
@@ -67,6 +68,7 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
67
68
  options.forest ?? defaultSharedTreeOptions.forest,
68
69
  schema,
69
70
  idCompressor,
71
+ defaultIncrementalEncodingPolicy,
70
72
  );
71
73
  const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
72
74
  forest,
@@ -144,6 +146,7 @@ export function independentInitializedViewInternal<const TSchema extends Implici
144
146
  options.forest ?? defaultSharedTreeOptions.forest,
145
147
  schemaRepository,
146
148
  idCompressor,
149
+ defaultIncrementalEncodingPolicy,
147
150
  );
148
151
 
149
152
  const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {