@fluidframework/tree 2.83.0 → 2.90.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 (412) hide show
  1. package/.vscode/settings.json +6 -5
  2. package/CHANGELOG.md +95 -0
  3. package/README.md +1 -1
  4. package/api-report/tree.alpha.api.md +63 -24
  5. package/api-report/tree.beta.api.md +30 -0
  6. package/api-report/tree.legacy.beta.api.md +30 -0
  7. package/dist/alpha.d.ts +10 -6
  8. package/dist/beta.d.ts +4 -1
  9. package/dist/codec/codec.d.ts +2 -0
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +4 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/index.d.ts +1 -1
  14. package/dist/codec/index.d.ts.map +1 -1
  15. package/dist/codec/index.js +2 -1
  16. package/dist/codec/index.js.map +1 -1
  17. package/dist/codec/versioned/codec.d.ts +13 -1
  18. package/dist/codec/versioned/codec.d.ts.map +1 -1
  19. package/dist/codec/versioned/codec.js +18 -3
  20. package/dist/codec/versioned/codec.js.map +1 -1
  21. package/dist/codec/versioned/format.d.ts +22 -1
  22. package/dist/codec/versioned/format.d.ts.map +1 -1
  23. package/dist/codec/versioned/format.js +16 -3
  24. package/dist/codec/versioned/format.js.map +1 -1
  25. package/dist/codec/versioned/index.d.ts +1 -1
  26. package/dist/codec/versioned/index.d.ts.map +1 -1
  27. package/dist/codec/versioned/index.js +2 -1
  28. package/dist/codec/versioned/index.js.map +1 -1
  29. package/dist/core/index.d.ts +1 -2
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +1 -3
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/rebase/index.d.ts +1 -1
  34. package/dist/core/rebase/index.d.ts.map +1 -1
  35. package/dist/core/rebase/index.js.map +1 -1
  36. package/dist/core/rebase/types.d.ts +78 -0
  37. package/dist/core/rebase/types.d.ts.map +1 -1
  38. package/dist/core/rebase/types.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -7
  40. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/codecs.js +22 -44
  42. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/format.js +11 -0
  45. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +3 -2
  47. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -4
  49. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  51. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/index.js +2 -4
  53. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  54. package/dist/feature-libraries/flex-tree/observer.d.ts +17 -0
  55. package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -1
  56. package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
  57. package/dist/feature-libraries/forest-summary/codec.d.ts +5 -12
  58. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  59. package/dist/feature-libraries/forest-summary/codec.js +33 -33
  60. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  63. package/dist/feature-libraries/forest-summary/forestSummarizer.js +6 -7
  64. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  65. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -4
  66. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  67. package/dist/feature-libraries/forest-summary/formatCommon.js +13 -11
  68. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  69. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -14
  70. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  71. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +31 -48
  72. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  73. package/dist/feature-libraries/forest-summary/index.d.ts +1 -1
  74. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  75. package/dist/feature-libraries/forest-summary/index.js +2 -2
  76. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  77. package/dist/feature-libraries/index.d.ts +3 -3
  78. package/dist/feature-libraries/index.d.ts.map +1 -1
  79. package/dist/feature-libraries/index.js +4 -5
  80. package/dist/feature-libraries/index.js.map +1 -1
  81. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -3
  82. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  83. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  84. package/dist/feature-libraries/indexing/index.d.ts +1 -1
  85. package/dist/feature-libraries/indexing/index.d.ts.map +1 -1
  86. package/dist/feature-libraries/indexing/index.js.map +1 -1
  87. package/dist/feature-libraries/indexing/types.d.ts +15 -13
  88. package/dist/feature-libraries/indexing/types.d.ts.map +1 -1
  89. package/dist/feature-libraries/indexing/types.js.map +1 -1
  90. package/dist/index.d.ts +3 -3
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +2 -2
  93. package/dist/index.js.map +1 -1
  94. package/dist/legacy.d.ts +4 -1
  95. package/dist/packageVersion.d.ts +1 -1
  96. package/dist/packageVersion.js +1 -1
  97. package/dist/packageVersion.js.map +1 -1
  98. package/dist/shared-tree/independentView.js +2 -2
  99. package/dist/shared-tree/independentView.js.map +1 -1
  100. package/dist/shared-tree/schematizingTreeView.d.ts +5 -0
  101. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  102. package/dist/shared-tree/schematizingTreeView.js +35 -7
  103. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  104. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  105. package/dist/shared-tree/sharedTree.js +7 -7
  106. package/dist/shared-tree/sharedTree.js.map +1 -1
  107. package/dist/shared-tree/tree.js +1 -1
  108. package/dist/shared-tree/tree.js.map +1 -1
  109. package/dist/shared-tree/treeAlpha.d.ts +8 -1
  110. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  111. package/dist/shared-tree/treeAlpha.js +48 -8
  112. package/dist/shared-tree/treeAlpha.js.map +1 -1
  113. package/dist/shared-tree/treeCheckout.d.ts +35 -3
  114. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  115. package/dist/shared-tree/treeCheckout.js +123 -17
  116. package/dist/shared-tree/treeCheckout.js.map +1 -1
  117. package/dist/shared-tree/unhydratedTreeContext.d.ts +20 -0
  118. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -0
  119. package/dist/shared-tree/unhydratedTreeContext.js +56 -0
  120. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -0
  121. package/dist/shared-tree-core/transaction.d.ts +15 -27
  122. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  123. package/dist/shared-tree-core/transaction.js +7 -11
  124. package/dist/shared-tree-core/transaction.js.map +1 -1
  125. package/dist/simple-tree/api/configuration.d.ts +4 -0
  126. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  127. package/dist/simple-tree/api/configuration.js.map +1 -1
  128. package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
  129. package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -1
  130. package/dist/simple-tree/api/identifierIndex.js +1 -1
  131. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  132. package/dist/simple-tree/api/index.d.ts +3 -3
  133. package/dist/simple-tree/api/index.d.ts.map +1 -1
  134. package/dist/simple-tree/api/index.js +2 -2
  135. package/dist/simple-tree/api/index.js.map +1 -1
  136. package/dist/simple-tree/api/schemaFactory.d.ts +3 -2
  137. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  138. package/dist/simple-tree/api/schemaFactory.js +3 -2
  139. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  140. package/dist/simple-tree/api/simpleTreeIndex.d.ts +15 -13
  141. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  142. package/dist/simple-tree/api/simpleTreeIndex.js +4 -4
  143. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  144. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +4 -4
  145. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  146. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  147. package/dist/simple-tree/api/transactionTypes.d.ts +22 -25
  148. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  149. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  150. package/dist/simple-tree/api/tree.d.ts +69 -132
  151. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  152. package/dist/simple-tree/api/tree.js.map +1 -1
  153. package/dist/simple-tree/index.d.ts +1 -1
  154. package/dist/simple-tree/index.d.ts.map +1 -1
  155. package/dist/simple-tree/index.js +2 -2
  156. package/dist/simple-tree/index.js.map +1 -1
  157. package/dist/text/textDomain.d.ts +27 -9
  158. package/dist/text/textDomain.d.ts.map +1 -1
  159. package/dist/text/textDomain.js +43 -7
  160. package/dist/text/textDomain.js.map +1 -1
  161. package/dist/text/textDomainFormatted.d.ts +14 -8
  162. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  163. package/dist/text/textDomainFormatted.js +97 -25
  164. package/dist/text/textDomainFormatted.js.map +1 -1
  165. package/dist/util/rangeMap.d.ts +1 -0
  166. package/dist/util/rangeMap.d.ts.map +1 -1
  167. package/dist/util/rangeMap.js +5 -6
  168. package/dist/util/rangeMap.js.map +1 -1
  169. package/lib/alpha.d.ts +10 -6
  170. package/lib/beta.d.ts +4 -1
  171. package/lib/codec/codec.d.ts +2 -0
  172. package/lib/codec/codec.d.ts.map +1 -1
  173. package/lib/codec/codec.js +4 -3
  174. package/lib/codec/codec.js.map +1 -1
  175. package/lib/codec/index.d.ts +1 -1
  176. package/lib/codec/index.d.ts.map +1 -1
  177. package/lib/codec/index.js +1 -1
  178. package/lib/codec/index.js.map +1 -1
  179. package/lib/codec/versioned/codec.d.ts +13 -1
  180. package/lib/codec/versioned/codec.d.ts.map +1 -1
  181. package/lib/codec/versioned/codec.js +18 -3
  182. package/lib/codec/versioned/codec.js.map +1 -1
  183. package/lib/codec/versioned/format.d.ts +22 -1
  184. package/lib/codec/versioned/format.d.ts.map +1 -1
  185. package/lib/codec/versioned/format.js +15 -2
  186. package/lib/codec/versioned/format.js.map +1 -1
  187. package/lib/codec/versioned/index.d.ts +1 -1
  188. package/lib/codec/versioned/index.d.ts.map +1 -1
  189. package/lib/codec/versioned/index.js +1 -1
  190. package/lib/codec/versioned/index.js.map +1 -1
  191. package/lib/core/index.d.ts +1 -2
  192. package/lib/core/index.d.ts.map +1 -1
  193. package/lib/core/index.js +0 -1
  194. package/lib/core/index.js.map +1 -1
  195. package/lib/core/rebase/index.d.ts +1 -1
  196. package/lib/core/rebase/index.d.ts.map +1 -1
  197. package/lib/core/rebase/index.js.map +1 -1
  198. package/lib/core/rebase/types.d.ts +78 -0
  199. package/lib/core/rebase/types.d.ts.map +1 -1
  200. package/lib/core/rebase/types.js.map +1 -1
  201. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -7
  202. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  203. package/lib/feature-libraries/chunked-forest/codec/codecs.js +25 -45
  204. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  205. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  206. package/lib/feature-libraries/chunked-forest/codec/format.js +11 -0
  207. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  208. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +3 -2
  209. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  210. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  211. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  212. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  213. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  214. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  215. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  216. package/lib/feature-libraries/flex-tree/observer.d.ts +17 -0
  217. package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -1
  218. package/lib/feature-libraries/flex-tree/observer.js.map +1 -1
  219. package/lib/feature-libraries/forest-summary/codec.d.ts +5 -12
  220. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  221. package/lib/feature-libraries/forest-summary/codec.js +35 -32
  222. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  223. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -2
  224. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  225. package/lib/feature-libraries/forest-summary/forestSummarizer.js +7 -8
  226. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  227. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -4
  228. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  229. package/lib/feature-libraries/forest-summary/formatCommon.js +7 -4
  230. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  231. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +19 -14
  232. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  233. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +30 -47
  234. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  235. package/lib/feature-libraries/forest-summary/index.d.ts +1 -1
  236. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  237. package/lib/feature-libraries/forest-summary/index.js +1 -1
  238. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  239. package/lib/feature-libraries/index.d.ts +3 -3
  240. package/lib/feature-libraries/index.d.ts.map +1 -1
  241. package/lib/feature-libraries/index.js +2 -2
  242. package/lib/feature-libraries/index.js.map +1 -1
  243. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +3 -3
  244. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  245. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  246. package/lib/feature-libraries/indexing/index.d.ts +1 -1
  247. package/lib/feature-libraries/indexing/index.d.ts.map +1 -1
  248. package/lib/feature-libraries/indexing/index.js.map +1 -1
  249. package/lib/feature-libraries/indexing/types.d.ts +15 -13
  250. package/lib/feature-libraries/indexing/types.d.ts.map +1 -1
  251. package/lib/feature-libraries/indexing/types.js.map +1 -1
  252. package/lib/index.d.ts +3 -3
  253. package/lib/index.d.ts.map +1 -1
  254. package/lib/index.js +1 -1
  255. package/lib/index.js.map +1 -1
  256. package/lib/legacy.d.ts +4 -1
  257. package/lib/packageVersion.d.ts +1 -1
  258. package/lib/packageVersion.js +1 -1
  259. package/lib/packageVersion.js.map +1 -1
  260. package/lib/shared-tree/independentView.js +3 -3
  261. package/lib/shared-tree/independentView.js.map +1 -1
  262. package/lib/shared-tree/schematizingTreeView.d.ts +5 -0
  263. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  264. package/lib/shared-tree/schematizingTreeView.js +33 -6
  265. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  266. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  267. package/lib/shared-tree/sharedTree.js +8 -8
  268. package/lib/shared-tree/sharedTree.js.map +1 -1
  269. package/lib/shared-tree/tree.js +1 -1
  270. package/lib/shared-tree/tree.js.map +1 -1
  271. package/lib/shared-tree/treeAlpha.d.ts +8 -1
  272. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  273. package/lib/shared-tree/treeAlpha.js +49 -9
  274. package/lib/shared-tree/treeAlpha.js.map +1 -1
  275. package/lib/shared-tree/treeCheckout.d.ts +35 -3
  276. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  277. package/lib/shared-tree/treeCheckout.js +124 -18
  278. package/lib/shared-tree/treeCheckout.js.map +1 -1
  279. package/lib/shared-tree/unhydratedTreeContext.d.ts +20 -0
  280. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -0
  281. package/lib/shared-tree/unhydratedTreeContext.js +52 -0
  282. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -0
  283. package/lib/shared-tree-core/transaction.d.ts +15 -27
  284. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  285. package/lib/shared-tree-core/transaction.js +7 -11
  286. package/lib/shared-tree-core/transaction.js.map +1 -1
  287. package/lib/simple-tree/api/configuration.d.ts +4 -0
  288. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  289. package/lib/simple-tree/api/configuration.js.map +1 -1
  290. package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
  291. package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -1
  292. package/lib/simple-tree/api/identifierIndex.js +2 -2
  293. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  294. package/lib/simple-tree/api/index.d.ts +3 -3
  295. package/lib/simple-tree/api/index.d.ts.map +1 -1
  296. package/lib/simple-tree/api/index.js +1 -1
  297. package/lib/simple-tree/api/index.js.map +1 -1
  298. package/lib/simple-tree/api/schemaFactory.d.ts +3 -2
  299. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  300. package/lib/simple-tree/api/schemaFactory.js +3 -2
  301. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  302. package/lib/simple-tree/api/simpleTreeIndex.d.ts +15 -13
  303. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  304. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  305. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  306. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +4 -4
  307. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  308. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  309. package/lib/simple-tree/api/transactionTypes.d.ts +22 -25
  310. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  311. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  312. package/lib/simple-tree/api/tree.d.ts +69 -132
  313. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  314. package/lib/simple-tree/api/tree.js.map +1 -1
  315. package/lib/simple-tree/index.d.ts +1 -1
  316. package/lib/simple-tree/index.d.ts.map +1 -1
  317. package/lib/simple-tree/index.js +1 -1
  318. package/lib/simple-tree/index.js.map +1 -1
  319. package/lib/text/textDomain.d.ts +27 -9
  320. package/lib/text/textDomain.d.ts.map +1 -1
  321. package/lib/text/textDomain.js +45 -9
  322. package/lib/text/textDomain.js.map +1 -1
  323. package/lib/text/textDomainFormatted.d.ts +14 -8
  324. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  325. package/lib/text/textDomainFormatted.js +80 -8
  326. package/lib/text/textDomainFormatted.js.map +1 -1
  327. package/lib/util/rangeMap.d.ts +1 -0
  328. package/lib/util/rangeMap.d.ts.map +1 -1
  329. package/lib/util/rangeMap.js +5 -6
  330. package/lib/util/rangeMap.js.map +1 -1
  331. package/package.json +24 -24
  332. package/src/codec/codec.ts +5 -4
  333. package/src/codec/index.ts +1 -0
  334. package/src/codec/versioned/codec.ts +32 -6
  335. package/src/codec/versioned/format.ts +17 -2
  336. package/src/codec/versioned/index.ts +1 -1
  337. package/src/core/index.ts +2 -6
  338. package/src/core/rebase/index.ts +2 -0
  339. package/src/core/rebase/types.ts +80 -0
  340. package/src/feature-libraries/chunked-forest/codec/codecs.ts +59 -78
  341. package/src/feature-libraries/chunked-forest/codec/format.ts +11 -0
  342. package/src/feature-libraries/chunked-forest/codec/index.ts +3 -3
  343. package/src/feature-libraries/chunked-forest/index.ts +2 -3
  344. package/src/feature-libraries/flex-tree/observer.ts +17 -0
  345. package/src/feature-libraries/forest-summary/codec.ts +46 -56
  346. package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -14
  347. package/src/feature-libraries/forest-summary/formatCommon.ts +14 -19
  348. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +44 -74
  349. package/src/feature-libraries/forest-summary/index.ts +1 -1
  350. package/src/feature-libraries/index.ts +2 -4
  351. package/src/feature-libraries/indexing/anchorTreeIndex.ts +3 -5
  352. package/src/feature-libraries/indexing/index.ts +1 -1
  353. package/src/feature-libraries/indexing/types.ts +15 -17
  354. package/src/index.ts +6 -3
  355. package/src/packageVersion.ts +1 -1
  356. package/src/shared-tree/independentView.ts +3 -3
  357. package/src/shared-tree/schematizingTreeView.ts +43 -10
  358. package/src/shared-tree/sharedTree.ts +8 -10
  359. package/src/shared-tree/tree.ts +1 -1
  360. package/src/shared-tree/treeAlpha.ts +64 -11
  361. package/src/shared-tree/treeCheckout.ts +142 -21
  362. package/src/shared-tree/unhydratedTreeContext.ts +87 -0
  363. package/src/shared-tree-core/transaction.ts +19 -39
  364. package/src/simple-tree/api/configuration.ts +4 -0
  365. package/src/simple-tree/api/identifierIndex.ts +4 -4
  366. package/src/simple-tree/api/index.ts +3 -1
  367. package/src/simple-tree/api/schemaFactory.ts +3 -2
  368. package/src/simple-tree/api/simpleTreeIndex.ts +26 -20
  369. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +4 -4
  370. package/src/simple-tree/api/transactionTypes.ts +24 -26
  371. package/src/simple-tree/api/tree.ts +92 -131
  372. package/src/simple-tree/index.ts +4 -2
  373. package/src/text/textDomain.ts +91 -12
  374. package/src/text/textDomainFormatted.ts +127 -15
  375. package/src/util/rangeMap.ts +5 -11
  376. package/dist/core/schema-view/index.d.ts +0 -6
  377. package/dist/core/schema-view/index.d.ts.map +0 -1
  378. package/dist/core/schema-view/index.js +0 -10
  379. package/dist/core/schema-view/index.js.map +0 -1
  380. package/dist/core/schema-view/view.d.ts +0 -31
  381. package/dist/core/schema-view/view.d.ts.map +0 -1
  382. package/dist/core/schema-view/view.js +0 -18
  383. package/dist/core/schema-view/view.js.map +0 -1
  384. package/dist/feature-libraries/forest-summary/formatV1.d.ts +0 -12
  385. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +0 -1
  386. package/dist/feature-libraries/forest-summary/formatV1.js +0 -10
  387. package/dist/feature-libraries/forest-summary/formatV1.js.map +0 -1
  388. package/dist/feature-libraries/forest-summary/formatV2.d.ts +0 -12
  389. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +0 -1
  390. package/dist/feature-libraries/forest-summary/formatV2.js +0 -10
  391. package/dist/feature-libraries/forest-summary/formatV2.js.map +0 -1
  392. package/lib/core/schema-view/index.d.ts +0 -6
  393. package/lib/core/schema-view/index.d.ts.map +0 -1
  394. package/lib/core/schema-view/index.js +0 -6
  395. package/lib/core/schema-view/index.js.map +0 -1
  396. package/lib/core/schema-view/view.d.ts +0 -31
  397. package/lib/core/schema-view/view.d.ts.map +0 -1
  398. package/lib/core/schema-view/view.js +0 -14
  399. package/lib/core/schema-view/view.js.map +0 -1
  400. package/lib/feature-libraries/forest-summary/formatV1.d.ts +0 -12
  401. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +0 -1
  402. package/lib/feature-libraries/forest-summary/formatV1.js +0 -7
  403. package/lib/feature-libraries/forest-summary/formatV1.js.map +0 -1
  404. package/lib/feature-libraries/forest-summary/formatV2.d.ts +0 -12
  405. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +0 -1
  406. package/lib/feature-libraries/forest-summary/formatV2.js +0 -7
  407. package/lib/feature-libraries/forest-summary/formatV2.js.map +0 -1
  408. package/src/core/schema-view/README.md +0 -9
  409. package/src/core/schema-view/index.ts +0 -10
  410. package/src/core/schema-view/view.ts +0 -38
  411. package/src/feature-libraries/forest-summary/formatV1.ts +0 -11
  412. package/src/feature-libraries/forest-summary/formatV2.ts +0 -11
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@ export {
12
12
  type LocalChangeMetadata,
13
13
  type RemoteChangeMetadata,
14
14
  type ChangeMetadata,
15
+ type LabelTree,
16
+ type TransactionLabels,
15
17
  type RevertibleFactory,
16
18
  type RevertibleAlphaFactory,
17
19
  type RevertibleAlpha,
@@ -53,7 +55,6 @@ export {
53
55
  TreeStatus,
54
56
  TreeCompressionStrategy,
55
57
  type TreeIndex,
56
- type TreeIndexKey,
57
58
  type TreeIndexNodes,
58
59
  type IncrementalEncodingPolicy,
59
60
  } from "./feature-libraries/index.js";
@@ -160,13 +161,13 @@ export {
160
161
  type ValidateRecursiveSchema,
161
162
  type FixRecursiveArraySchema,
162
163
  // Index APIs
163
- type SimpleTreeIndex,
164
164
  type IdentifierIndex,
165
- createSimpleTreeIndex,
165
+ createTreeIndex,
166
166
  createIdentifierIndex,
167
167
  type DirtyTreeStatus,
168
168
  trackDirtyNodes,
169
169
  type DirtyTreeMap,
170
+ type TreeIndexKey,
170
171
  // experimental @alpha APIs:
171
172
  adaptEnum,
172
173
  enumFromStrings,
@@ -305,6 +306,8 @@ export {
305
306
  type SnapshotSchemaCompatibilityOptions,
306
307
  type ArrayPlaceAnchor,
307
308
  createArrayInsertionAnchor,
309
+ type WithValue,
310
+ type TreeContextAlpha,
308
311
  } from "./simple-tree/index.js";
309
312
  export {
310
313
  SharedTree,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.83.0";
9
+ export const pkgVersion = "2.90.0";
@@ -23,7 +23,7 @@ import {
23
23
  } from "../core/index.js";
24
24
  import {
25
25
  createNodeIdentifierManager,
26
- makeFieldBatchCodec,
26
+ fieldBatchCodecBuilder,
27
27
  makeSchemaCodec,
28
28
  type FieldBatchEncodingContext,
29
29
  defaultSchemaPolicy,
@@ -236,14 +236,14 @@ export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSc
236
236
  });
237
237
 
238
238
  if (options?.content !== undefined) {
239
- // Any version can be passed down to `makeSchemaCodec` and `makeFieldBatchCodec` here.
239
+ // Any version can be passed down to `makeSchemaCodec` and `fieldBatchCodecBuilder.build` here.
240
240
  // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not `minVersionForCollab`.
241
241
  const writeOptions: CodecWriteOptions = {
242
242
  ...options,
243
243
  minVersionForCollab: FluidClientVersion.v2_0,
244
244
  };
245
245
  const schemaCodec = makeSchemaCodec(writeOptions, SchemaFormatVersion.v1);
246
- const fieldBatchCodec = makeFieldBatchCodec(writeOptions);
246
+ const fieldBatchCodec = fieldBatchCodecBuilder.build(writeOptions);
247
247
  const newSchema = schemaCodec.decode(options.content.schema as Format);
248
248
 
249
249
  const context: FieldBatchEncodingContext = {
@@ -166,6 +166,10 @@ export class SchematizingSimpleTreeView<
166
166
  );
167
167
  }
168
168
 
169
+ public isBranch(): this is TreeBranchAlpha {
170
+ return true;
171
+ }
172
+
169
173
  public applyChange(change: JsonCompatibleReadOnly): void {
170
174
  this.checkout.applySerializedChange(change);
171
175
  }
@@ -328,8 +332,13 @@ export class SchematizingSimpleTreeView<
328
332
  private mountTransaction(params: RunTransactionParams | undefined, isAsync: boolean): void {
329
333
  this.ensureUndisposed();
330
334
  const { checkout } = this;
331
-
332
- checkout.transaction.start(isAsync);
335
+ if (isAsync && checkout.transaction.size > 0) {
336
+ throw new UsageError(
337
+ "An asynchronous transaction cannot be started while another transaction is already in progress.",
338
+ );
339
+ }
340
+ checkout.pushLabelFrame(params?.label);
341
+ checkout.transaction.start();
333
342
 
334
343
  // Validate preconditions before running the transaction callback.
335
344
  addConstraintsToTransaction(
@@ -344,7 +353,7 @@ export class SchematizingSimpleTreeView<
344
353
  | TransactionCallbackStatus<TSuccessValue, TFailureValue>
345
354
  | VoidTransactionCallbackStatus
346
355
  | void,
347
- params?: RunTransactionParams,
356
+ params: RunTransactionParams | undefined,
348
357
  ): TransactionResultExt<TSuccessValue, TFailureValue> | TransactionResult {
349
358
  this.ensureUndisposed();
350
359
  const { checkout } = this;
@@ -354,6 +363,7 @@ export class SchematizingSimpleTreeView<
354
363
  )?.value;
355
364
 
356
365
  if (rollback === true) {
366
+ checkout.popLabelFrame(true);
357
367
  checkout.transaction.abort();
358
368
  return value === undefined
359
369
  ? { success: false }
@@ -367,6 +377,7 @@ export class SchematizingSimpleTreeView<
367
377
  transactionCallbackStatus?.preconditionsOnRevert,
368
378
  );
369
379
 
380
+ checkout.popLabelFrame(false);
370
381
  checkout.runWithTransactionLabel(() => {
371
382
  checkout.transaction.commit();
372
383
  }, params?.label);
@@ -611,17 +622,11 @@ export function addConstraintsToTransaction(
611
622
  constraints: readonly TransactionConstraintAlpha[] = [],
612
623
  ): void {
613
624
  for (const constraint of constraints) {
625
+ assertValidConstraint(constraint, constraintsOnRevert);
614
626
  const constraintType = constraint.type;
615
627
  switch (constraintType) {
616
628
  case "nodeInDocument": {
617
629
  const node = getInnerNode(constraint.node);
618
- const nodeStatus = getKernel(constraint.node).getStatus();
619
- if (nodeStatus !== TreeStatus.InDocument) {
620
- const revertText = constraintsOnRevert ? " on revert" : "";
621
- throw new UsageError(
622
- `Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
623
- );
624
- }
625
630
  assert(node.isHydrated(), 0xbc2 /* In document node must be hydrated. */);
626
631
  if (constraintsOnRevert) {
627
632
  checkout.editor.addNodeExistsConstraintOnRevert(node.anchorNode);
@@ -644,3 +649,31 @@ export function addConstraintsToTransaction(
644
649
  }
645
650
  }
646
651
  }
652
+
653
+ /**
654
+ * Throws if the given {@link TransactionConstraintAlpha | transaction constraint} is not currently satisfied.
655
+ */
656
+ export function assertValidConstraint(
657
+ constraint: TransactionConstraintAlpha,
658
+ onRevert: boolean,
659
+ ): void {
660
+ switch (constraint.type) {
661
+ case "nodeInDocument": {
662
+ const nodeStatus = getKernel(constraint.node).getStatus();
663
+ if (nodeStatus !== TreeStatus.InDocument) {
664
+ const revertText = onRevert ? " on revert" : "";
665
+ throw new UsageError(
666
+ `Attempted to add a "nodeInDocument" constraint${revertText}, but the node is not currently in the document. Node status: ${nodeStatus}`,
667
+ );
668
+ }
669
+ break;
670
+ }
671
+ case "noChange": {
672
+ // This constraint is always satisfied at the time of checking, since it just requires that no changes have been made since the transaction callback returned.
673
+ break;
674
+ }
675
+ default: {
676
+ unreachableCase(constraint);
677
+ }
678
+ }
679
+ }
@@ -56,10 +56,9 @@ import {
56
56
  buildForest,
57
57
  defaultIncrementalEncodingPolicy,
58
58
  defaultSchemaPolicy,
59
- getCodecTreeForFieldBatchFormat,
60
- getCodecTreeForForestFormat,
59
+ fieldBatchCodecBuilder,
60
+ forestCodecBuilder,
61
61
  jsonableTreeFromFieldCursor,
62
- makeFieldBatchCodec,
63
62
  makeMitigatedChangeFamily,
64
63
  makeSchemaCodec,
65
64
  makeTreeChunker,
@@ -241,7 +240,7 @@ export class SharedTreeKernel
241
240
  schemaCodec,
242
241
  options.minVersionForCollab,
243
242
  );
244
- const fieldBatchCodec = makeFieldBatchCodec(options);
243
+ const fieldBatchCodec = fieldBatchCodecBuilder.build(options);
245
244
 
246
245
  const encoderContext = {
247
246
  schema: {
@@ -255,7 +254,6 @@ export class SharedTreeKernel
255
254
  const forestSummarizer = new ForestSummarizer(
256
255
  forest,
257
256
  revisionTagCodec,
258
- fieldBatchCodec,
259
257
  encoderContext,
260
258
  options,
261
259
  idCompressor,
@@ -420,7 +418,7 @@ export class SharedTreeKernel
420
418
 
421
419
  public override didAttach(): void {
422
420
  for (const checkout of this.checkouts.values()) {
423
- if (checkout.transaction.isInProgress()) {
421
+ if (checkout.transaction.size > 0) {
424
422
  // Attaching during a transaction is not currently supported.
425
423
  // At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.
426
424
  throw new UsageError(
@@ -438,7 +436,7 @@ export class SharedTreeKernel
438
436
  ): void {
439
437
  for (const checkout of this.checkouts.values()) {
440
438
  assert(
441
- !checkout.transaction.isInProgress(),
439
+ checkout.transaction.size === 0,
442
440
  0x674 /* Unexpected transaction is open while applying stashed ops */,
443
441
  );
444
442
  }
@@ -453,7 +451,7 @@ export class SharedTreeKernel
453
451
  ): void {
454
452
  const checkout = this.getCheckout(branchId);
455
453
  assert(
456
- !checkout.transaction.isInProgress(),
454
+ checkout.transaction.size === 0,
457
455
  0xaa6 /* Cannot submit a commit while a transaction is in progress */,
458
456
  );
459
457
  if (isResubmit) {
@@ -596,12 +594,12 @@ export function getCodecTreeForSharedTreeFormat(
596
594
  clientVersion: MinimumVersionForCollab,
597
595
  ): CodecTree {
598
596
  const children: CodecTree[] = [];
599
- children.push(getCodecTreeForForestFormat(clientVersion));
597
+ children.push(forestCodecBuilder.getCodecTree(clientVersion));
600
598
  children.push(schemaCodecBuilder.getCodecTree(clientVersion));
601
599
  children.push(detachedFieldIndexCodecBuilder.getCodecTree(clientVersion));
602
600
  children.push(getCodecTreeForEditManagerFormat(clientVersion));
603
601
  children.push(getCodecTreeForMessageFormat(clientVersion));
604
- children.push(getCodecTreeForFieldBatchFormat(clientVersion));
602
+ children.push(fieldBatchCodecBuilder.getCodecTree(clientVersion));
605
603
  return {
606
604
  name: "SharedTree",
607
605
  version: undefined, // SharedTree does not have a version of its own.
@@ -467,7 +467,7 @@ function runTransactionInCheckout<TResult>(
467
467
  transaction: () => TResult | typeof rollback,
468
468
  preconditions: readonly TransactionConstraint[],
469
469
  ): TResult | typeof rollback {
470
- checkout.transaction.start(false);
470
+ checkout.transaction.start();
471
471
  addConstraintsToTransaction(checkout, false, preconditions);
472
472
 
473
473
  let result: ReturnType<typeof transaction>;
@@ -26,7 +26,7 @@ import {
26
26
  cursorForMapTreeField,
27
27
  defaultSchemaPolicy,
28
28
  isTreeValue,
29
- makeFieldBatchCodec,
29
+ fieldBatchCodecBuilder,
30
30
  mapTreeFromCursor,
31
31
  TreeCompressionStrategy,
32
32
  type FieldBatch,
@@ -80,6 +80,7 @@ import {
80
80
  exportConcise,
81
81
  borrowCursorFromTreeNodeOrValue,
82
82
  contentSchemaSymbol,
83
+ type TreeContextAlpha,
83
84
  type TreeNodeSchema,
84
85
  getUnhydratedContext,
85
86
  type TreeBranchAlpha,
@@ -88,6 +89,7 @@ import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js"
88
89
 
89
90
  import { independentInitializedView, type ViewContent } from "./independentView.js";
90
91
  import { SchematizingSimpleTreeView, ViewSlot } from "./schematizingTreeView.js";
92
+ import { UnhydratedTreeContext } from "./unhydratedTreeContext.js";
91
93
 
92
94
  const identifier: TreeIdentifierUtils = (node: TreeNode): string | undefined => {
93
95
  return getIdentifierFromNode(node, "uncompressed");
@@ -237,9 +239,17 @@ export interface TreeAlpha {
237
239
  *
238
240
  * This does not fork a new branch, but rather retrieves the _existing_ branch for the node.
239
241
  * To create a new branch, use e.g. {@link TreeBranch.fork | `myBranch.fork()`}.
242
+ *
243
+ * @deprecated To obtain a {@link TreeBranchAlpha | branch }, use `TreeAlpha.context(node)` to obtain a {@link TreeContextAlpha | context} and then check {@link TreeContextAlpha.isBranch | isBranch()}.
240
244
  */
241
245
  branch(node: TreeNode): TreeBranchAlpha | undefined;
242
246
 
247
+ /**
248
+ * Retrieve the {@link TreeContextAlpha | context} for the given node.
249
+ * @param node - The node to query
250
+ */
251
+ context(node: TreeNode): TreeContextAlpha;
252
+
243
253
  /**
244
254
  * Construct tree content that is compatible with the field defined by the provided `schema`.
245
255
  * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.
@@ -587,9 +597,10 @@ export interface ObservationResults<TResult> {
587
597
  class NodeSubscription {
588
598
  /**
589
599
  * If undefined, subscribes to all keys.
600
+ * If "deep", subscribes to all changes in the subtree.
590
601
  * Otherwise only subscribes to the keys in the set.
591
602
  */
592
- private keys: Set<FieldKey> | undefined;
603
+ private keys: Set<FieldKey> | undefined | "deep";
593
604
  private readonly unsubscribe: () => void;
594
605
  private constructor(
595
606
  private readonly onInvalidation: () => void,
@@ -600,6 +611,9 @@ class NodeSubscription {
600
611
  assert(node instanceof TreeNode, 0xc54 /* Unexpected leaf value */);
601
612
 
602
613
  const handler = (data: NodeChangedData): void => {
614
+ if (this.keys === "deep") {
615
+ return;
616
+ }
603
617
  if (this.keys === undefined || data.changedProperties === undefined) {
604
618
  this.onInvalidation();
605
619
  } else {
@@ -620,7 +634,18 @@ class NodeSubscription {
620
634
  }
621
635
  }
622
636
  };
623
- this.unsubscribe = TreeBeta.on(node, "nodeChanged", handler);
637
+
638
+ // TODO:Performance: It would be better to defer subscribing to events so that this can subscribe to the correct one instead of both.
639
+ const shallow = TreeBeta.on(node, "nodeChanged", handler);
640
+ const deep = TreeBeta.on(node, "treeChanged", () => {
641
+ if (this.keys === "deep") {
642
+ this.onInvalidation();
643
+ }
644
+ });
645
+ this.unsubscribe = () => {
646
+ shallow();
647
+ deep();
648
+ };
624
649
  }
625
650
 
626
651
  /**
@@ -632,18 +657,39 @@ class NodeSubscription {
632
657
  ): { observer: Observer; unsubscribe: () => void } {
633
658
  const subscriptions = new Map<FlexTreeNode, NodeSubscription>();
634
659
  const observer: Observer = {
660
+ observeNodeDeep(flexNode: FlexTreeNode): void {
661
+ if (flexNode.value !== undefined) {
662
+ // Leaf value: the set of fields (and thus their content) is always empty, and cannot change, so no need to subscribe.
663
+ return;
664
+ }
665
+
666
+ const subscription = subscriptions.get(flexNode);
667
+ if (subscription === undefined) {
668
+ const newSubscription = new NodeSubscription(invalidate, flexNode);
669
+ newSubscription.keys = "deep";
670
+ subscriptions.set(flexNode, newSubscription);
671
+ } else {
672
+ // Already subscribed to this node.
673
+ subscription.keys = "deep"; // Now subscribed to subtree changes (deep observation).
674
+ }
675
+ },
635
676
  observeNodeFields(flexNode: FlexTreeNode): void {
636
677
  if (flexNode.value !== undefined) {
637
- // Leaf value, nothing to observe.
678
+ // Leaf value: the set of fields is always empty, and cannot change, so no need to subscribe.
638
679
  return;
639
680
  }
681
+
682
+ // Subscribe to any change to any field to ensure that any change which empties or fills a field will invalidate.
683
+ // This could be more targeted by detecting specifically edits which change the emptiness of fields if desired.
640
684
  const subscription = subscriptions.get(flexNode);
641
685
  if (subscription === undefined) {
642
686
  const newSubscription = new NodeSubscription(invalidate, flexNode);
643
687
  subscriptions.set(flexNode, newSubscription);
644
688
  } else {
645
689
  // Already subscribed to this node.
646
- subscription.keys = undefined; // Now subscribed to all keys.
690
+ if (subscription.keys instanceof Set) {
691
+ subscription.keys = undefined; // Now subscribed to all keys.
692
+ }
647
693
  }
648
694
  },
649
695
  observeNodeField(flexNode: FlexTreeNode, key: FieldKey): void {
@@ -657,10 +703,12 @@ class NodeSubscription {
657
703
  newSubscription.keys = new Set([key]);
658
704
  subscriptions.set(flexNode, newSubscription);
659
705
  } else {
660
- // Already subscribed to this node: if not subscribed to all keys, subscribe to this one.
661
- // TODO:Performance: due to how JavaScript set ordering works,
662
- // it might be faster to check `has` and only add if not present in case the same field is viewed many times.
663
- subscription.keys?.add(key);
706
+ // Already subscribed to this node: if not subscribed to all keys or "deep", subscribe to this one.
707
+ if (subscription.keys instanceof Set) {
708
+ // TODO:Performance: due to how JavaScript set ordering works,
709
+ // it might be faster to check `has` and only add if not present in case the same field is viewed many times.
710
+ subscription.keys.add(key);
711
+ }
664
712
  }
665
713
  },
666
714
  observeParentOf(node: FlexTreeNode): void {
@@ -763,6 +811,10 @@ export const TreeAlpha: TreeAlpha = {
763
811
  return result;
764
812
  },
765
813
 
814
+ context(node: TreeNode): TreeContextAlpha {
815
+ return this.branch(node) ?? UnhydratedTreeContext.instance;
816
+ },
817
+
766
818
  branch(node: TreeNode): TreeBranchAlpha | undefined {
767
819
  const kernel = getKernel(node);
768
820
  if (!kernel.isHydrated()) {
@@ -852,7 +904,7 @@ export const TreeAlpha: TreeAlpha = {
852
904
  options: { idCompressor?: IIdCompressor } & Pick<CodecWriteOptions, "minVersionForCollab">,
853
905
  ): JsonCompatible<IFluidHandle> {
854
906
  const schema = tryGetSchema(node) ?? fail(0xacf /* invalid input */);
855
- const codec = makeFieldBatchCodec({
907
+ const codec = fieldBatchCodecBuilder.build({
856
908
  jsonValidator: FormatValidatorNoOp,
857
909
  minVersionForCollab: options.minVersionForCollab,
858
910
  });
@@ -874,7 +926,8 @@ export const TreeAlpha: TreeAlpha = {
874
926
  schema: { schema: storedSchema, policy: defaultSchemaPolicy },
875
927
  };
876
928
  const result = codec.encode(batch, context);
877
- return result;
929
+ // TODO: codecs should better track which ones can contain handles, and which cannot. When done properly, casts like this can be removed.
930
+ return result as JsonCompatible<IFluidHandle>;
878
931
  },
879
932
 
880
933
  importCompressed<const TSchema extends ImplicitFieldSchema>(