@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
@@ -55,6 +55,8 @@ import {
55
55
  LeafNodeStoredSchema,
56
56
  diffHistories,
57
57
  type ChangeMetadata,
58
+ type LabelTree,
59
+ type TransactionLabels,
58
60
  type ChangeEncodingContext,
59
61
  type ReadOnlyDetachedFieldIndex,
60
62
  makeAnonChange,
@@ -67,9 +69,9 @@ import {
67
69
  buildForest,
68
70
  createNodeIdentifierManager,
69
71
  defaultSchemaPolicy,
72
+ fieldBatchCodecBuilder,
70
73
  intoDelta,
71
74
  jsonableTreeFromCursor,
72
- makeFieldBatchCodec,
73
75
  } from "../feature-libraries/index.js";
74
76
  import {
75
77
  SquashingTransactionStack,
@@ -108,6 +110,36 @@ import { SharedTreeChangeFamily, hasSchemaChange } from "./sharedTreeChangeFamil
108
110
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
109
111
  import type { ISharedTreeEditor, SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
110
112
 
113
+ /**
114
+ * Yields all defined (non-`undefined`) labels from a {@link LabelTree}, depth-first.
115
+ */
116
+ function* collectTreeLabels(node: LabelTree): IterableIterator<unknown> {
117
+ if (node.label !== undefined) {
118
+ yield node.label;
119
+ }
120
+ for (const child of node.sublabels) {
121
+ yield* collectTreeLabels(child);
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Builds the labels set for a change event from the label tree.
127
+ * If the tree exists and contains at least one defined label, returns a set of all
128
+ * values with the tree attached. Otherwise returns an empty set.
129
+ */
130
+ function buildLabelsSet(labelTreeNode: LabelTree | undefined): TransactionLabels {
131
+ const set: Set<unknown> & { tree?: LabelTree } = new Set<unknown>();
132
+ if (labelTreeNode !== undefined) {
133
+ for (const value of collectTreeLabels(labelTreeNode)) {
134
+ set.add(value);
135
+ }
136
+ if (set.size > 0) {
137
+ set.tree = labelTreeNode;
138
+ }
139
+ }
140
+ return set;
141
+ }
142
+
111
143
  /**
112
144
  * Events for {@link ITreeCheckout}.
113
145
  */
@@ -322,7 +354,7 @@ export function createTreeCheckout(
322
354
  args?.changeFamily ??
323
355
  new SharedTreeChangeFamily(
324
356
  revisionTagCodec,
325
- args?.fieldBatchCodec ?? makeFieldBatchCodec(codecOptions),
357
+ args?.fieldBatchCodec ?? fieldBatchCodecBuilder.build(codecOptions),
326
358
  codecOptions,
327
359
  args?.chunkCompressionStrategy,
328
360
  idCompressor,
@@ -389,12 +421,22 @@ export class TreeCheckout implements ITreeCheckoutFork {
389
421
  private editLock: EditLock;
390
422
 
391
423
  /**
392
- * User-defined label associated with the transaction whose commit is currently being produced for this checkout.
424
+ * Root of the mutable label tree tracking transaction nesting.
393
425
  *
394
426
  * @remarks
395
- * This label is used to implement {@link TreeCheckout.runWithTransactionLabel}.
427
+ * The label tree is always isomorphic to the actual transaction tree — every transaction
428
+ * (whether labeled or not) gets its own node. To find the "current" (deepest open) node,
429
+ * walk down the right side of the tree, stopping at {@link TreeCheckout.mostRecentlyClosedLabelNode}.
430
+ *
431
+ * Cleared by {@link TreeCheckout.runWithTransactionLabel} after the commit event is emitted.
432
+ */
433
+ private labelTreeNode: LabelTree | undefined;
434
+
435
+ /**
436
+ * Points to the most recently closed (committed) label node.
437
+ * Used by {@link TreeCheckout.currentLabelNode} to stop descending past committed nodes.
396
438
  */
397
- private transactionLabel?: unknown;
439
+ private mostRecentlyClosedLabelNode: LabelTree | undefined;
398
440
 
399
441
  private readonly views = new Set<TreeView<ImplicitFieldSchema>>();
400
442
 
@@ -447,6 +489,82 @@ export class TreeCheckout implements ITreeCheckoutFork {
447
489
  this.registerForBranchEvents();
448
490
  }
449
491
 
492
+ /**
493
+ * Pushes a new label node for a transaction nesting level.
494
+ *
495
+ * @param label - The label for this transaction level.
496
+ *
497
+ * @remarks
498
+ * Called at the start of each transaction (including nested ones).
499
+ * Creates a new {@link LabelTree} node as a child of the current deepest node (if any),
500
+ * or as the root if this is the outermost transaction.
501
+ */
502
+ public pushLabelFrame(label: unknown): void {
503
+ const node: LabelTree = { label, sublabels: [] };
504
+ if (this.labelTreeNode === undefined) {
505
+ this.labelTreeNode = node;
506
+ } else {
507
+ const current = this.currentLabelNode();
508
+ assert(current !== undefined, 0xcdb /* Expected current label node to exist */);
509
+ current.sublabels.push(node);
510
+ }
511
+ }
512
+
513
+ /**
514
+ * Returns the deepest open node on the right side of the label tree, which corresponds
515
+ * to the current (most recently pushed, not yet committed or aborted) transaction.
516
+ * Returns `undefined` when {@link TreeCheckout.labelTreeNode} is not set.
517
+ */
518
+ private currentLabelNode(): LabelTree | undefined {
519
+ if (this.labelTreeNode === undefined) {
520
+ return undefined;
521
+ }
522
+ // Walk down the right spine of the tree. Only one closed node is ever reachable
523
+ // during this traversal, so a single pointer (mostRecentlyClosedLabelNode) suffices
524
+ // to stop descending past committed nodes.
525
+ let node: LabelTree = this.labelTreeNode;
526
+ while (node.sublabels.length > 0) {
527
+ const lastChild = node.sublabels[node.sublabels.length - 1];
528
+ assert(lastChild !== undefined, 0xcdc /* Expected label tree node to have children */);
529
+ if (lastChild === this.mostRecentlyClosedLabelNode) {
530
+ break;
531
+ }
532
+ node = lastChild;
533
+ }
534
+ return node;
535
+ }
536
+
537
+ /**
538
+ * Pops the current label frame from the label tree.
539
+ * @param aborted - If true, the node is removed from the tree (transaction was aborted).
540
+ * If false, the node is kept in the tree but marked as closed (transaction was committed).
541
+ */
542
+ public popLabelFrame(aborted: boolean): void {
543
+ const node = this.currentLabelNode();
544
+ if (node === undefined) {
545
+ return;
546
+ }
547
+
548
+ if (aborted) {
549
+ if (node === this.labelTreeNode) {
550
+ this.labelTreeNode = undefined;
551
+ this.mostRecentlyClosedLabelNode = undefined;
552
+ } else {
553
+ // Temporarily mark node as closed so currentLabelNode() returns its parent.
554
+ this.mostRecentlyClosedLabelNode = node;
555
+ const parent = this.currentLabelNode();
556
+ assert(parent !== undefined, 0xcdd /* Expected parent label node to exist */);
557
+ parent.sublabels.pop();
558
+ // Point to the parent's new last child (guaranteed closed if it exists),
559
+ // or undefined if the parent has no more children.
560
+ const newLastChild = parent.sublabels[parent.sublabels.length - 1];
561
+ this.mostRecentlyClosedLabelNode = newLastChild;
562
+ }
563
+ } else {
564
+ this.mostRecentlyClosedLabelNode = node;
565
+ }
566
+ }
567
+
450
568
  /**
451
569
  * Helper method for {@link SchematizingSimpleTreeView.runTransaction} to properly clear transaction labels once the function completes.
452
570
  *
@@ -463,15 +581,16 @@ export class TreeCheckout implements ITreeCheckoutFork {
463
581
  fn: (label?: TLabel) => TResult,
464
582
  label: TLabel | undefined,
465
583
  ): TResult {
466
- // If a transaction label is already set, nesting is occurring, so we should not override it.
467
- if (this.transactionLabel !== undefined) {
468
- return fn(this.transactionLabel as TLabel);
469
- }
470
- this.transactionLabel = label;
471
584
  try {
472
- return fn(this.transactionLabel as TLabel);
585
+ return fn(label);
473
586
  } finally {
474
- this.transactionLabel = undefined;
587
+ // Only clear the label tree when the outermost transaction has completed.
588
+ // Inner transactions' commits don't fire the "changed" event, so the label tree
589
+ // must remain intact until the outermost commit reads it.
590
+ if (this.transaction.size === 0) {
591
+ this.labelTreeNode = undefined;
592
+ this.mostRecentlyClosedLabelNode = undefined;
593
+ }
475
594
  }
476
595
  }
477
596
 
@@ -514,7 +633,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
514
633
  if (viewUpdate !== undefined) {
515
634
  this.applyChange(viewUpdate, newHead.revision);
516
635
  }
517
- if (!this.transaction.isInProgress()) {
636
+ if (this.transaction.size === 0) {
518
637
  // The changes in a transaction squash commit have already applied to the checkout and are known to be valid, so we can validate the squash commit automatically.
519
638
  this.validateCommit(newHead);
520
639
  }
@@ -611,7 +730,8 @@ export class TreeCheckout implements ITreeCheckoutFork {
611
730
  } satisfies SerializedChange;
612
731
  },
613
732
  getRevertible: (onDisposed) => getRevertible?.(onDisposed),
614
- label: this.transactionLabel,
733
+ label: this.labelTreeNode?.label,
734
+ labels: buildLabelsSet(this.labelTreeNode),
615
735
  };
616
736
 
617
737
  this.#events.emit("changed", metadata, getRevertible);
@@ -622,6 +742,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
622
742
  this.#events.emit("changed", {
623
743
  isLocal: false,
624
744
  kind: CommitKind.Default,
745
+ labels: new Set<unknown>(),
625
746
  });
626
747
  }
627
748
  };
@@ -870,7 +991,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
870
991
  "The parent branch has already been disposed and can no longer create new branches.",
871
992
  );
872
993
  // Branching after an unfinished transaction would expose the application to a state where its invariants may be violated.
873
- if (this.transaction.isInProgress()) {
994
+ if (this.transaction.size > 0) {
874
995
  throw new UsageError("A view cannot be forked while it has a pending transaction.");
875
996
  }
876
997
 
@@ -902,7 +1023,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
902
1023
  ): void {
903
1024
  // TODO: Dispose old branch, if necessary
904
1025
  assert(
905
- !this.#transaction.isInProgress(),
1026
+ this.#transaction.size === 0,
906
1027
  0xc55 /* Cannot switch branches during a transaction */,
907
1028
  );
908
1029
  const diff = diffHistories(
@@ -932,12 +1053,12 @@ export class TreeCheckout implements ITreeCheckoutFork {
932
1053
  );
933
1054
  this.editLock.checkUnlocked("Rebasing");
934
1055
 
935
- if (this.transaction.isInProgress()) {
1056
+ if (this.transaction.size > 0) {
936
1057
  throw new UsageError(
937
1058
  "Views cannot be rebased onto a view that has a pending transaction.",
938
1059
  );
939
1060
  }
940
- if (checkout.transaction.isInProgress()) {
1061
+ if (checkout.transaction.size > 0) {
941
1062
  throw new UsageError("A view cannot be rebased while it has a pending transaction.");
942
1063
  }
943
1064
 
@@ -966,12 +1087,12 @@ export class TreeCheckout implements ITreeCheckoutFork {
966
1087
  "The source of the branch merge has been disposed and cannot be merged.",
967
1088
  );
968
1089
  this.editLock.checkUnlocked("Merging");
969
- if (this.transaction.isInProgress()) {
1090
+ if (this.transaction.size > 0) {
970
1091
  throw new UsageError(
971
1092
  "Views cannot be merged into a view while it has a pending transaction.",
972
1093
  );
973
1094
  }
974
- if (checkout.transaction.isInProgress()) {
1095
+ if (checkout.transaction.size > 0) {
975
1096
  throw new UsageError(
976
1097
  "Views with an open transaction cannot be merged into another view.",
977
1098
  );
@@ -1057,7 +1178,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
1057
1178
 
1058
1179
  private revertRevertible(revision: RevisionTag, kind: CommitKind): RevertMetrics {
1059
1180
  this.editLock.checkUnlocked("Reverting a commit");
1060
- if (this.transaction.isInProgress()) {
1181
+ if (this.transaction.size > 0) {
1061
1182
  throw new UsageError("Undo is not yet supported during transactions.");
1062
1183
  }
1063
1184
 
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
+
8
+ import type {
9
+ TreeContextAlpha,
10
+ TreeBranchAlpha,
11
+ RunTransactionParams,
12
+ TransactionResult,
13
+ TransactionResultExt,
14
+ WithValue,
15
+ } from "../simple-tree/index.js";
16
+
17
+ import { assertValidConstraint } from "./schematizingTreeView.js";
18
+
19
+ /**
20
+ * A {@link TreeContextAlpha | tree context} that can be used for e.g. unhydrated nodes.
21
+ */
22
+ export class UnhydratedTreeContext implements TreeContextAlpha {
23
+ public static instance = new UnhydratedTreeContext();
24
+ private transactionCount = 0;
25
+ private constructor() {}
26
+
27
+ public isBranch(): this is TreeBranchAlpha {
28
+ return false;
29
+ }
30
+
31
+ public runTransaction<TValue>(
32
+ t: () => WithValue<TValue>,
33
+ params?: RunTransactionParams,
34
+ ): TransactionResultExt<TValue, TValue>;
35
+ public runTransaction(t: () => void, _params?: RunTransactionParams): TransactionResult;
36
+ public runTransaction(
37
+ t: () => WithValue<unknown> | void,
38
+ params?: RunTransactionParams,
39
+ ): TransactionResultExt<unknown, unknown> | TransactionResult {
40
+ for (const constraint of params?.preconditions ?? []) {
41
+ assertValidConstraint(constraint, false);
42
+ }
43
+ this.transactionCount += 1;
44
+ try {
45
+ return UnhydratedTreeContext.wrapTransactionResult(t());
46
+ } finally {
47
+ this.transactionCount -= 1;
48
+ }
49
+ }
50
+
51
+ public runTransactionAsync<TValue>(
52
+ t: () => Promise<WithValue<TValue>>,
53
+ params?: RunTransactionParams,
54
+ ): Promise<TransactionResultExt<TValue, TValue>>;
55
+ public runTransactionAsync(
56
+ t: () => Promise<void>,
57
+ params?: RunTransactionParams,
58
+ ): Promise<TransactionResult>;
59
+ public async runTransactionAsync(
60
+ t: () => Promise<WithValue<unknown> | void>,
61
+ params?: RunTransactionParams,
62
+ ): Promise<TransactionResultExt<unknown, unknown> | TransactionResult> {
63
+ if (this.transactionCount > 0) {
64
+ throw new UsageError(
65
+ "An asynchronous transaction cannot be started while another transaction is already in progress.",
66
+ );
67
+ }
68
+ for (const constraint of params?.preconditions ?? []) {
69
+ assertValidConstraint(constraint, false);
70
+ }
71
+ this.transactionCount += 1;
72
+ try {
73
+ return UnhydratedTreeContext.wrapTransactionResult(await t());
74
+ } finally {
75
+ this.transactionCount -= 1;
76
+ }
77
+ }
78
+
79
+ private static wrapTransactionResult<TValue>(
80
+ value: WithValue<TValue> | void,
81
+ ): TransactionResultExt<TValue, TValue> | TransactionResult {
82
+ if (value?.value !== undefined) {
83
+ return { success: true, value: value.value };
84
+ }
85
+ return { success: true };
86
+ }
87
+ }
@@ -44,27 +44,14 @@ export enum TransactionResult {
44
44
  export interface Transactor {
45
45
  /**
46
46
  * Start a new transaction.
47
+ * @remarks
47
48
  * If a transaction is already in progress when this new transaction starts, then this transaction will be "nested" inside of it,
48
49
  * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.
49
- * @param isAsync - Whether the transaction is asynchronous.
50
- * An error will be thrown if an asynchronous transaction is started while a synchronous transaction is in progress.
51
- *
52
- * @remarks Asynchronous transactions are not supported on the root checkout,
53
- * since it is always kept up-to-date with the latest remote edits and the results of this rebasing (which might invalidate
54
- * the transaction) is not visible to the application author.
55
- * Instead,
56
- *
57
- * 1. fork the root checkout
58
- * 2. run the transaction on the fork
59
- * 3. merge the fork back into the root checkout
60
- *
61
- * @privateRemarks There is currently no enforcement that asynchronous transactions don't happen on the root checkout.
62
- * AB#6488 tracks adding some enforcement to make it more clear to application authors that this is not supported.
63
50
  */
64
- start(isAsync: boolean): void;
51
+ start(): void;
65
52
  /**
66
53
  * Close this transaction by squashing its edits and committing them as a single edit.
67
- * If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
54
+ * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.
68
55
  */
69
56
  commit(): void;
70
57
  /**
@@ -72,9 +59,10 @@ export interface Transactor {
72
59
  */
73
60
  abort(): void;
74
61
  /**
75
- * True if there is at least one transaction currently in progress on this view, otherwise false.
62
+ * The number of transactions currently in progress, including any nested transactions.
63
+ * @remarks This is 0 when no transaction is in progress, 1 when a single transaction is in progress, 2 when a transaction is nested inside another, etc.
76
64
  */
77
- isInProgress(): boolean;
65
+ size: number;
78
66
  /**
79
67
  * Provides events for changes in transaction progress.
80
68
  */
@@ -84,17 +72,17 @@ export interface Transactor {
84
72
  export interface TransactionEvents {
85
73
  /**
86
74
  * Raised just after a transaction has begun.
87
- * @remarks When this event fires, {@link Transactor.isInProgress} will be true because the transaction has already begun.
75
+ * @remarks When this event fires, {@link Transactor.size} will be greater than 0 because the transaction has already begun.
88
76
  */
89
77
  started(): void;
90
78
  /**
91
79
  * Raised just before a transaction is aborted.
92
- * @remarks When this event fires, {@link Transactor.isInProgress} will still be true because the transaction has not yet ended.
80
+ * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.
93
81
  */
94
82
  aborting(): void;
95
83
  /**
96
84
  * Raised just before a transaction is committed.
97
- * @remarks When this event fires, {@link Transactor.isInProgress} will still be true because the transaction has not yet ended.
85
+ * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.
98
86
  */
99
87
  committing(): void;
100
88
  }
@@ -122,13 +110,13 @@ export interface Callbacks {
122
110
  /**
123
111
  * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.
124
112
  * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.
125
- * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.isInProgress} will be false during its execution.
113
+ * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
126
114
  */
127
115
  export type OnPush = () => Callbacks | void;
128
116
 
129
117
  /**
130
118
  * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.
131
- * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.isInProgress} will be false during its execution.
119
+ * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
132
120
  */
133
121
  export type OnPop = (result: TransactionResult) => void;
134
122
 
@@ -138,8 +126,6 @@ export type OnPop = (result: TransactionResult) => void;
138
126
  interface TransactionStackFrame {
139
127
  /** The callbacks provided when this transaction frame was pushed onto the stack. */
140
128
  readonly callbacks: Callbacks;
141
- /** Whether this transaction frame is asynchronous. */
142
- readonly isAsync: boolean;
143
129
  }
144
130
 
145
131
  /**
@@ -168,31 +154,25 @@ export class TransactionStack implements Transactor, IDisposable {
168
154
  this.#onPush = onPush;
169
155
  }
170
156
 
171
- public isInProgress(): boolean {
157
+ public get size(): number {
172
158
  this.ensureNotDisposed();
173
- return this.#stack.length > 0;
159
+ return this.#stack.length;
174
160
  }
175
161
 
176
- public start(isAsync: boolean): void {
162
+ public start(): void {
177
163
  this.ensureNotDisposed();
178
164
  const last = getLast(this.#stack);
179
- if (last !== undefined && !last.isAsync && isAsync) {
180
- throw new UsageError(
181
- "An asynchronous transaction cannot be started while a synchronous transaction is in progress.",
182
- );
183
- }
184
165
  const onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;
185
166
  const { onPush, onPop } = onPushCurrent?.() ?? {};
186
167
  this.#stack.push({
187
168
  callbacks: { onPop, onPush: onPush ?? onPushCurrent },
188
- isAsync,
189
169
  });
190
170
  this.#events.emit("started");
191
171
  }
192
172
 
193
173
  public commit(): void {
194
174
  this.ensureNotDisposed();
195
- if (!this.isInProgress()) {
175
+ if (this.size === 0) {
196
176
  throw new UsageError("No transaction to commit");
197
177
  }
198
178
  this.#events.emit("committing");
@@ -201,7 +181,7 @@ export class TransactionStack implements Transactor, IDisposable {
201
181
 
202
182
  public abort(): void {
203
183
  this.ensureNotDisposed();
204
- if (!this.isInProgress()) {
184
+ if (this.size === 0) {
205
185
  throw new UsageError("No transaction to abort");
206
186
  }
207
187
  this.#events.emit("aborting");
@@ -210,7 +190,7 @@ export class TransactionStack implements Transactor, IDisposable {
210
190
 
211
191
  public dispose(): void {
212
192
  this.ensureNotDisposed();
213
- while (this.isInProgress()) {
193
+ while (this.size > 0) {
214
194
  this.abort();
215
195
  }
216
196
  this.#disposed = true;
@@ -225,7 +205,7 @@ export class TransactionStack implements Transactor, IDisposable {
225
205
 
226
206
  /**
227
207
  * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.
228
- * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.isInProgress} will be false during its execution.
208
+ * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.
229
209
  * @param result - The result of the transaction.
230
210
  * @param viewUpdate - The change that needs to be applied to the view to keep it up-to-date with the branch after the transaction ends.
231
211
  * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.
@@ -328,7 +308,7 @@ export class SquashingTransactionStack<
328
308
 
329
309
  // Invoked when an outer transaction ends
330
310
  const onOuterTransactionPop: OnPop = (result) => {
331
- assert(!this.isInProgress(), 0xcae /* The outer transaction should be ending */);
311
+ assert(this.size === 0, 0xcae /* The outer transaction should be ending */);
332
312
  transactionBranch.editor.exitTransaction();
333
313
 
334
314
  const sourcePath: GraphCommit<TChange>[] = [];
@@ -147,6 +147,10 @@ export interface ITreeViewConfiguration<
147
147
  > extends ITreeConfigurationOptions {
148
148
  /**
149
149
  * The schema which the application wants to view the tree with.
150
+ * @remarks
151
+ * Use {@link SchemaFactory} to construct the schema.
152
+ * Changes to this schema between different versions have important compatibility implications.
153
+ * See the {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution | documentation on schema evolution} for more details.
150
154
  */
151
155
  readonly schema: TSchema;
152
156
  }
@@ -5,13 +5,13 @@
5
5
 
6
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
 
8
- import type { TreeIndexKey } from "../../feature-libraries/index.js";
8
+ import type { TreeIndex } from "../../feature-libraries/index.js";
9
9
  import type { TreeNode } from "../core/index.js";
10
10
  import { FieldKind, type ImplicitFieldSchema } from "../fieldSchema.js";
11
11
  import { ObjectNodeSchema } from "../node-kinds/index.js";
12
12
  import { walkFieldSchema } from "../walkFieldSchema.js";
13
13
 
14
- import { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
14
+ import { createTreeIndex, type TreeIndexKey } from "./simpleTreeIndex.js";
15
15
  import type { TreeView } from "./tree.js";
16
16
 
17
17
  /**
@@ -19,7 +19,7 @@ import type { TreeView } from "./tree.js";
19
19
  *
20
20
  * @alpha
21
21
  */
22
- export type IdentifierIndex = SimpleTreeIndex<string, TreeNode>;
22
+ export type IdentifierIndex = TreeIndex<string, TreeNode>;
23
23
 
24
24
  function isStringKey(key: TreeIndexKey): key is string {
25
25
  return typeof key === "string";
@@ -49,7 +49,7 @@ export function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(
49
49
  },
50
50
  });
51
51
 
52
- return createSimpleTreeIndex(
52
+ return createTreeIndex(
53
53
  view,
54
54
  (schemus) => identifierFields.get(schemus.identifier),
55
55
  (nodes) => {
@@ -22,6 +22,7 @@ export type {
22
22
  TreeBranch,
23
23
  TreeBranchAlpha,
24
24
  TreeBranchEvents,
25
+ TreeContextAlpha,
25
26
  ITreeAlpha,
26
27
  } from "./tree.js";
27
28
  export { asTreeViewAlpha } from "./tree.js";
@@ -141,7 +142,7 @@ export {
141
142
  TreeBeta,
142
143
  type TreeChangeEventsBeta,
143
144
  } from "./treeBeta.js";
144
- export { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
145
+ export { createTreeIndex, type TreeIndexKey } from "./simpleTreeIndex.js";
145
146
  export {
146
147
  createIdentifierIndex,
147
148
  type IdentifierIndex,
@@ -164,6 +165,7 @@ export {
164
165
  type TransactionResultExt,
165
166
  type TransactionResultSuccess,
166
167
  type TransactionResultFailed,
168
+ type WithValue,
167
169
  rollback,
168
170
  } from "./transactionTypes.js";
169
171
 
@@ -226,12 +226,13 @@ export const SchemaFactory_base = classWithStatics(schemaStaticsPublic);
226
226
  * @remarks
227
227
  * For details related to inputting data constrained by schema (including via assignment), and how non-exact schema types are handled in general refer to {@link Input}.
228
228
  * For information about recursive schema support, see methods postfixed with "recursive" and {@link ValidateRecursiveSchema}.
229
- * To apply schema defined with this factory to a tree, see {@link ViewableTree.viewWith} and {@link TreeViewConfiguration}.
229
+ * To apply schema defined with this factory to a tree, see {@link TreeViewConfiguration} and {@link ViewableTree.viewWith}.
230
+ * See the {@link https://fluidframework.com/docs/data-structures/tree/schema-evolution | documentation on schema evolution} for how to handle changes to schema over time.
230
231
  *
231
232
  * All schema produced by this factory get a {@link TreeNodeSchemaCore.identifier|unique identifier} by combining the {@link SchemaFactory.scope} with the schema's `Name`.
232
233
  * The `Name` part may be explicitly provided as a parameter, or inferred as a structural combination of the provided types.
233
234
  * The APIs which use this second approach, structural naming, also deduplicate all equivalent calls.
234
- * Therefor two calls to `array(allowedTypes)` with the same allowedTypes will return the same {@link TreeNodeSchema} instance.
235
+ * Therefore two calls to `array(allowedTypes)` with the same allowedTypes will return the same {@link TreeNodeSchema} instance.
235
236
  * On the other hand, two calls to `array(name, allowedTypes)` will always return different {@link TreeNodeSchema} instances
236
237
  * and it is an error to use both in the same tree (since their identifiers are not unique).
237
238
  *