@fluidframework/tree 2.23.0 → 2.31.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 (1027) hide show
  1. package/CHANGELOG.md +1636 -1466
  2. package/api-extractor/api-extractor.current.json +0 -3
  3. package/api-report/tree.alpha.api.md +261 -100
  4. package/api-report/tree.beta.api.md +86 -61
  5. package/api-report/tree.legacy.alpha.api.md +86 -61
  6. package/api-report/tree.legacy.public.api.md +86 -61
  7. package/api-report/tree.public.api.md +86 -61
  8. package/dist/alpha.d.ts +32 -1
  9. package/dist/beta.d.ts +5 -1
  10. package/dist/codec/codec.d.ts +1 -1
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +3 -4
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  15. package/dist/codec/discriminatedUnions.js +1 -1
  16. package/dist/codec/discriminatedUnions.js.map +1 -1
  17. package/dist/core/forest/editableForest.d.ts +1 -14
  18. package/dist/core/forest/editableForest.d.ts.map +1 -1
  19. package/dist/core/forest/editableForest.js +1 -28
  20. package/dist/core/forest/editableForest.js.map +1 -1
  21. package/dist/core/forest/forest.d.ts +16 -3
  22. package/dist/core/forest/forest.d.ts.map +1 -1
  23. package/dist/core/forest/forest.js +4 -1
  24. package/dist/core/forest/forest.js.map +1 -1
  25. package/dist/core/forest/index.d.ts +1 -1
  26. package/dist/core/forest/index.d.ts.map +1 -1
  27. package/dist/core/forest/index.js +1 -2
  28. package/dist/core/forest/index.js.map +1 -1
  29. package/dist/core/index.d.ts +2 -2
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +3 -3
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/rebase/utils.js +1 -1
  34. package/dist/core/rebase/utils.js.map +1 -1
  35. package/dist/core/schema-stored/schema.d.ts +4 -1
  36. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  37. package/dist/core/schema-stored/schema.js +8 -4
  38. package/dist/core/schema-stored/schema.js.map +1 -1
  39. package/dist/core/tree/anchorSet.d.ts +8 -3
  40. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  41. package/dist/core/tree/anchorSet.js +16 -9
  42. package/dist/core/tree/anchorSet.js.map +1 -1
  43. package/dist/core/tree/delta.d.ts +8 -23
  44. package/dist/core/tree/delta.d.ts.map +1 -1
  45. package/dist/core/tree/delta.js.map +1 -1
  46. package/dist/core/tree/deltaUtil.d.ts +3 -3
  47. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  48. package/dist/core/tree/deltaUtil.js +2 -2
  49. package/dist/core/tree/deltaUtil.js.map +1 -1
  50. package/dist/core/tree/index.d.ts +2 -2
  51. package/dist/core/tree/index.d.ts.map +1 -1
  52. package/dist/core/tree/index.js +2 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/core/tree/pathTree.d.ts +54 -1
  55. package/dist/core/tree/pathTree.d.ts.map +1 -1
  56. package/dist/core/tree/pathTree.js +8 -1
  57. package/dist/core/tree/pathTree.js.map +1 -1
  58. package/dist/core/tree/treeTextFormat.js +2 -2
  59. package/dist/core/tree/treeTextFormat.js.map +1 -1
  60. package/dist/core/tree/visitDelta.d.ts +7 -5
  61. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  62. package/dist/core/tree/visitDelta.js +19 -9
  63. package/dist/core/tree/visitDelta.js.map +1 -1
  64. package/dist/core/tree/visitorUtils.d.ts +5 -23
  65. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  66. package/dist/core/tree/visitorUtils.js +8 -5
  67. package/dist/core/tree/visitorUtils.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  69. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/basicChunk.js +9 -9
  71. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  73. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkTree.js +12 -9
  75. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  79. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
  81. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  83. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -4
  86. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  90. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  91. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +4 -5
  92. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  93. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  94. package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
  95. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  97. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/uniformChunk.js +7 -6
  99. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  100. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  101. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  102. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  103. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  104. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  105. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
  106. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  107. package/dist/feature-libraries/default-schema/index.d.ts +1 -0
  108. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/default-schema/index.js +3 -1
  110. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  111. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  112. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  113. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
  114. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  115. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  116. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
  117. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  118. package/dist/feature-libraries/deltaUtils.js +1 -1
  119. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  120. package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
  121. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  122. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  123. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  124. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  125. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  126. package/dist/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  127. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  128. package/dist/feature-libraries/flex-tree/lazyField.js +12 -9
  129. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  130. package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
  131. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  132. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  133. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
  134. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  135. package/dist/feature-libraries/index.d.ts +2 -1
  136. package/dist/feature-libraries/index.d.ts.map +1 -1
  137. package/dist/feature-libraries/index.js +9 -7
  138. package/dist/feature-libraries/index.js.map +1 -1
  139. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  140. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  141. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  142. package/dist/feature-libraries/initializeForest.d.ts +18 -0
  143. package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
  144. package/dist/feature-libraries/initializeForest.js +35 -0
  145. package/dist/feature-libraries/initializeForest.js.map +1 -0
  146. package/dist/feature-libraries/modular-schema/comparison.js +4 -4
  147. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  148. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
  150. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  153. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  155. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  156. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +13 -19
  157. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  158. package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
  159. package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
  160. package/dist/feature-libraries/node-identifier/index.js +16 -0
  161. package/dist/feature-libraries/node-identifier/index.js.map +1 -0
  162. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  163. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  164. package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
  165. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  166. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  167. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  168. package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
  169. package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  170. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  171. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  172. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
  173. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  174. package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
  175. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  176. package/dist/feature-libraries/object-forest/objectForest.js +7 -3
  177. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  178. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  179. package/dist/feature-libraries/schema-index/codec.js +2 -1
  180. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  181. package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
  182. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  183. package/dist/feature-libraries/sequence-field/compose.js +16 -17
  184. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  185. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  186. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  187. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  188. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  189. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  190. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  191. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  192. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  193. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  194. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  195. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  196. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  197. package/dist/feature-libraries/treeCursorUtils.js +5 -6
  198. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  199. package/dist/index.d.ts +5 -4
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +15 -3
  202. package/dist/index.js.map +1 -1
  203. package/dist/jsonDomainSchema.d.ts +15 -16
  204. package/dist/jsonDomainSchema.d.ts.map +1 -1
  205. package/dist/jsonDomainSchema.js +10 -5
  206. package/dist/jsonDomainSchema.js.map +1 -1
  207. package/dist/legacy.d.ts +5 -1
  208. package/dist/packageVersion.d.ts +1 -1
  209. package/dist/packageVersion.js +1 -1
  210. package/dist/packageVersion.js.map +1 -1
  211. package/dist/public.d.ts +5 -1
  212. package/dist/serializableDomainSchema.d.ts +8 -14
  213. package/dist/serializableDomainSchema.d.ts.map +1 -1
  214. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  215. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  216. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  217. package/dist/shared-tree/independentView.d.ts.map +1 -1
  218. package/dist/shared-tree/independentView.js +3 -18
  219. package/dist/shared-tree/independentView.js.map +1 -1
  220. package/dist/shared-tree/index.d.ts +1 -1
  221. package/dist/shared-tree/index.d.ts.map +1 -1
  222. package/dist/shared-tree/index.js +2 -1
  223. package/dist/shared-tree/index.js.map +1 -1
  224. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  225. package/dist/shared-tree/schematizeTree.js +4 -3
  226. package/dist/shared-tree/schematizeTree.js.map +1 -1
  227. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  228. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  229. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  230. package/dist/shared-tree/sharedTree.d.ts +1 -0
  231. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  232. package/dist/shared-tree/sharedTree.js +27 -19
  233. package/dist/shared-tree/sharedTree.js.map +1 -1
  234. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  235. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  236. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  237. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  238. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  239. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  240. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  241. package/dist/shared-tree/treeApiAlpha.d.ts +9 -30
  242. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  243. package/dist/shared-tree/treeApiAlpha.js +22 -34
  244. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  245. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  246. package/dist/shared-tree/treeCheckout.js +2 -2
  247. package/dist/shared-tree/treeCheckout.js.map +1 -1
  248. package/dist/shared-tree-core/branch.d.ts +4 -3
  249. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  250. package/dist/shared-tree-core/branch.js +2 -2
  251. package/dist/shared-tree-core/branch.js.map +1 -1
  252. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  253. package/dist/shared-tree-core/editManager.js +37 -31
  254. package/dist/shared-tree-core/editManager.js.map +1 -1
  255. package/dist/sharedTreeAttributes.d.ts +18 -0
  256. package/dist/sharedTreeAttributes.d.ts.map +1 -0
  257. package/dist/sharedTreeAttributes.js +25 -0
  258. package/dist/sharedTreeAttributes.js.map +1 -0
  259. package/dist/simple-tree/api/conciseTree.d.ts +8 -2
  260. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  261. package/dist/simple-tree/api/conciseTree.js +10 -1
  262. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  263. package/dist/simple-tree/api/create.d.ts +3 -3
  264. package/dist/simple-tree/api/create.d.ts.map +1 -1
  265. package/dist/simple-tree/api/create.js.map +1 -1
  266. package/dist/simple-tree/api/customTree.d.ts +42 -12
  267. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  268. package/dist/simple-tree/api/customTree.js +33 -5
  269. package/dist/simple-tree/api/customTree.js.map +1 -1
  270. package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
  271. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  272. package/dist/simple-tree/api/getJsonSchema.js +10 -0
  273. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  274. package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
  275. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  276. package/dist/simple-tree/api/getSimpleSchema.js +13 -43
  277. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  278. package/dist/simple-tree/api/index.d.ts +7 -6
  279. package/dist/simple-tree/api/index.d.ts.map +1 -1
  280. package/dist/simple-tree/api/index.js +8 -1
  281. package/dist/simple-tree/api/index.js.map +1 -1
  282. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  283. package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
  284. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  285. package/dist/simple-tree/api/schemaFactory.d.ts +112 -67
  286. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  287. package/dist/simple-tree/api/schemaFactory.js +80 -158
  288. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  289. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  290. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  291. package/dist/simple-tree/api/schemaFactoryAlpha.js +26 -1
  292. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  293. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  294. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  295. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  296. package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
  297. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  298. package/dist/simple-tree/api/schemaFromSimple.js +71 -0
  299. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
  300. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  301. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  302. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
  303. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  304. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  305. package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
  306. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  307. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  308. package/dist/simple-tree/api/tree.d.ts +12 -6
  309. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  310. package/dist/simple-tree/api/tree.js +17 -8
  311. package/dist/simple-tree/api/tree.js.map +1 -1
  312. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  313. package/dist/simple-tree/api/treeNodeApi.js +5 -20
  314. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  315. package/dist/simple-tree/api/typesUnsafe.d.ts +102 -36
  316. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  317. package/dist/simple-tree/api/typesUnsafe.js +0 -1
  318. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  319. package/dist/simple-tree/api/verboseTree.d.ts +16 -25
  320. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  321. package/dist/simple-tree/api/verboseTree.js +19 -14
  322. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  323. package/dist/simple-tree/api/view.d.ts.map +1 -1
  324. package/dist/simple-tree/api/view.js +16 -17
  325. package/dist/simple-tree/api/view.js.map +1 -1
  326. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  327. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  328. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
  329. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  330. package/dist/simple-tree/arrayNode.d.ts +5 -4
  331. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  332. package/dist/simple-tree/arrayNode.js +13 -9
  333. package/dist/simple-tree/arrayNode.js.map +1 -1
  334. package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
  335. package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  336. package/dist/simple-tree/arrayNodeTypes.js +30 -0
  337. package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
  338. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  339. package/dist/simple-tree/core/getOrCreateNode.js +1 -11
  340. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  341. package/dist/simple-tree/core/index.d.ts +1 -2
  342. package/dist/simple-tree/core/index.d.ts.map +1 -1
  343. package/dist/simple-tree/core/index.js +2 -3
  344. package/dist/simple-tree/core/index.js.map +1 -1
  345. package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
  346. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  347. package/dist/simple-tree/core/treeNodeKernel.js +36 -20
  348. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  349. package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
  350. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  351. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  352. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  353. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  354. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  355. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  356. package/dist/simple-tree/flexList.d.ts +4 -5
  357. package/dist/simple-tree/flexList.d.ts.map +1 -1
  358. package/dist/simple-tree/flexList.js +1 -14
  359. package/dist/simple-tree/flexList.js.map +1 -1
  360. package/dist/simple-tree/index.d.ts +9 -2
  361. package/dist/simple-tree/index.d.ts.map +1 -1
  362. package/dist/simple-tree/index.js +15 -2
  363. package/dist/simple-tree/index.js.map +1 -1
  364. package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
  365. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  366. package/dist/simple-tree/leafNodeSchema.js +2 -0
  367. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  368. package/dist/simple-tree/mapNode.d.ts +3 -2
  369. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  370. package/dist/simple-tree/mapNode.js +5 -1
  371. package/dist/simple-tree/mapNode.js.map +1 -1
  372. package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
  373. package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
  374. package/dist/simple-tree/mapNodeTypes.js +30 -0
  375. package/dist/simple-tree/mapNodeTypes.js.map +1 -0
  376. package/dist/simple-tree/objectNode.d.ts +10 -3
  377. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  378. package/dist/simple-tree/objectNode.js +12 -5
  379. package/dist/simple-tree/objectNode.js.map +1 -1
  380. package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
  381. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  382. package/dist/simple-tree/objectNodeTypes.js +3 -0
  383. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  384. package/dist/simple-tree/proxies.js +2 -1
  385. package/dist/simple-tree/proxies.js.map +1 -1
  386. package/dist/simple-tree/schemaTypes.d.ts +81 -8
  387. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  388. package/dist/simple-tree/schemaTypes.js +94 -5
  389. package/dist/simple-tree/schemaTypes.js.map +1 -1
  390. package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  391. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  392. package/dist/simple-tree/simpleSchema.js.map +1 -0
  393. package/dist/simple-tree/toMapTree.d.ts +4 -4
  394. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  395. package/dist/simple-tree/toMapTree.js +3 -3
  396. package/dist/simple-tree/toMapTree.js.map +1 -1
  397. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  398. package/dist/simple-tree/toStoredSchema.js +2 -6
  399. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  400. package/dist/simple-tree/treeNodeValid.d.ts +7 -1
  401. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  402. package/dist/simple-tree/treeNodeValid.js +17 -10
  403. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  404. package/dist/treeFactory.d.ts +0 -12
  405. package/dist/treeFactory.d.ts.map +1 -1
  406. package/dist/treeFactory.js +5 -21
  407. package/dist/treeFactory.js.map +1 -1
  408. package/dist/util/cloneWithReplacements.d.ts +21 -0
  409. package/dist/util/cloneWithReplacements.d.ts.map +1 -0
  410. package/dist/util/cloneWithReplacements.js +38 -0
  411. package/dist/util/cloneWithReplacements.js.map +1 -0
  412. package/dist/util/idAllocator.d.ts.map +1 -1
  413. package/dist/util/idAllocator.js +1 -2
  414. package/dist/util/idAllocator.js.map +1 -1
  415. package/dist/util/index.d.ts +2 -1
  416. package/dist/util/index.d.ts.map +1 -1
  417. package/dist/util/index.js +4 -3
  418. package/dist/util/index.js.map +1 -1
  419. package/dist/util/referenceCounting.d.ts +18 -0
  420. package/dist/util/referenceCounting.d.ts.map +1 -1
  421. package/dist/util/referenceCounting.js.map +1 -1
  422. package/dist/util/typeCheck.d.ts +7 -0
  423. package/dist/util/typeCheck.d.ts.map +1 -1
  424. package/dist/util/typeCheck.js.map +1 -1
  425. package/dist/util/utils.d.ts +0 -1
  426. package/dist/util/utils.d.ts.map +1 -1
  427. package/dist/util/utils.js +1 -4
  428. package/dist/util/utils.js.map +1 -1
  429. package/lib/alpha.d.ts +32 -1
  430. package/lib/beta.d.ts +5 -1
  431. package/lib/codec/codec.d.ts +1 -1
  432. package/lib/codec/codec.d.ts.map +1 -1
  433. package/lib/codec/codec.js +1 -2
  434. package/lib/codec/codec.js.map +1 -1
  435. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  436. package/lib/codec/discriminatedUnions.js +2 -2
  437. package/lib/codec/discriminatedUnions.js.map +1 -1
  438. package/lib/core/forest/editableForest.d.ts +1 -14
  439. package/lib/core/forest/editableForest.d.ts.map +1 -1
  440. package/lib/core/forest/editableForest.js +0 -26
  441. package/lib/core/forest/editableForest.js.map +1 -1
  442. package/lib/core/forest/forest.d.ts +16 -3
  443. package/lib/core/forest/forest.d.ts.map +1 -1
  444. package/lib/core/forest/forest.js +4 -1
  445. package/lib/core/forest/forest.js.map +1 -1
  446. package/lib/core/forest/index.d.ts +1 -1
  447. package/lib/core/forest/index.d.ts.map +1 -1
  448. package/lib/core/forest/index.js +1 -1
  449. package/lib/core/forest/index.js.map +1 -1
  450. package/lib/core/index.d.ts +2 -2
  451. package/lib/core/index.d.ts.map +1 -1
  452. package/lib/core/index.js +2 -2
  453. package/lib/core/index.js.map +1 -1
  454. package/lib/core/rebase/utils.js +1 -1
  455. package/lib/core/rebase/utils.js.map +1 -1
  456. package/lib/core/schema-stored/schema.d.ts +4 -1
  457. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  458. package/lib/core/schema-stored/schema.js +6 -2
  459. package/lib/core/schema-stored/schema.js.map +1 -1
  460. package/lib/core/tree/anchorSet.d.ts +8 -3
  461. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  462. package/lib/core/tree/anchorSet.js +14 -7
  463. package/lib/core/tree/anchorSet.js.map +1 -1
  464. package/lib/core/tree/delta.d.ts +8 -23
  465. package/lib/core/tree/delta.d.ts.map +1 -1
  466. package/lib/core/tree/delta.js.map +1 -1
  467. package/lib/core/tree/deltaUtil.d.ts +3 -3
  468. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  469. package/lib/core/tree/deltaUtil.js +2 -2
  470. package/lib/core/tree/deltaUtil.js.map +1 -1
  471. package/lib/core/tree/index.d.ts +2 -2
  472. package/lib/core/tree/index.d.ts.map +1 -1
  473. package/lib/core/tree/index.js +1 -1
  474. package/lib/core/tree/index.js.map +1 -1
  475. package/lib/core/tree/pathTree.d.ts +54 -1
  476. package/lib/core/tree/pathTree.d.ts.map +1 -1
  477. package/lib/core/tree/pathTree.js +6 -0
  478. package/lib/core/tree/pathTree.js.map +1 -1
  479. package/lib/core/tree/treeTextFormat.js +1 -1
  480. package/lib/core/tree/treeTextFormat.js.map +1 -1
  481. package/lib/core/tree/visitDelta.d.ts +7 -5
  482. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  483. package/lib/core/tree/visitDelta.js +19 -9
  484. package/lib/core/tree/visitDelta.js.map +1 -1
  485. package/lib/core/tree/visitorUtils.d.ts +5 -23
  486. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  487. package/lib/core/tree/visitorUtils.js +8 -5
  488. package/lib/core/tree/visitorUtils.js.map +1 -1
  489. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  490. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/basicChunk.js +3 -3
  492. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  494. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  495. package/lib/feature-libraries/chunked-forest/chunkTree.js +12 -9
  496. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  497. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  498. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  500. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
  502. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  504. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  505. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  506. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  507. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  508. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  509. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  510. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  511. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  512. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +2 -3
  513. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  514. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  515. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
  516. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  517. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  518. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  519. package/lib/feature-libraries/chunked-forest/uniformChunk.js +5 -4
  520. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  521. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  522. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  523. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  524. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  525. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  526. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  527. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  528. package/lib/feature-libraries/default-schema/index.d.ts +1 -0
  529. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  530. package/lib/feature-libraries/default-schema/index.js +1 -0
  531. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  532. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  533. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  534. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
  535. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  536. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  537. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
  538. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  539. package/lib/feature-libraries/deltaUtils.js +1 -1
  540. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  541. package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
  542. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  543. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  544. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  545. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  546. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  547. package/lib/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  548. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  549. package/lib/feature-libraries/flex-tree/lazyField.js +13 -10
  550. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  551. package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
  552. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  553. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  554. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
  555. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  556. package/lib/feature-libraries/index.d.ts +2 -1
  557. package/lib/feature-libraries/index.d.ts.map +1 -1
  558. package/lib/feature-libraries/index.js +2 -1
  559. package/lib/feature-libraries/index.js.map +1 -1
  560. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  561. package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
  562. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  563. package/lib/feature-libraries/initializeForest.d.ts +18 -0
  564. package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
  565. package/lib/feature-libraries/initializeForest.js +31 -0
  566. package/lib/feature-libraries/initializeForest.js.map +1 -0
  567. package/lib/feature-libraries/modular-schema/comparison.js +2 -2
  568. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  569. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  570. package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
  571. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  572. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  573. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  574. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  575. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  576. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  577. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -18
  578. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  579. package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
  580. package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
  581. package/lib/feature-libraries/node-identifier/index.js +8 -0
  582. package/lib/feature-libraries/node-identifier/index.js.map +1 -0
  583. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  584. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  585. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +45 -0
  586. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  587. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  588. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  589. package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
  590. package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  591. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  592. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  593. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
  594. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  595. package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
  596. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  597. package/lib/feature-libraries/object-forest/objectForest.js +8 -4
  598. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  599. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  600. package/lib/feature-libraries/schema-index/codec.js +2 -1
  601. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  602. package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
  603. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  604. package/lib/feature-libraries/sequence-field/compose.js +1 -2
  605. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  606. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  607. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  608. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  609. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  610. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
  611. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  612. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  613. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
  614. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  615. package/lib/feature-libraries/sequence-field/utils.js +2 -2
  616. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  617. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  618. package/lib/feature-libraries/treeCursorUtils.js +2 -3
  619. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  620. package/lib/index.d.ts +5 -4
  621. package/lib/index.d.ts.map +1 -1
  622. package/lib/index.js +5 -3
  623. package/lib/index.js.map +1 -1
  624. package/lib/jsonDomainSchema.d.ts +15 -16
  625. package/lib/jsonDomainSchema.d.ts.map +1 -1
  626. package/lib/jsonDomainSchema.js +11 -6
  627. package/lib/jsonDomainSchema.js.map +1 -1
  628. package/lib/legacy.d.ts +5 -1
  629. package/lib/packageVersion.d.ts +1 -1
  630. package/lib/packageVersion.js +1 -1
  631. package/lib/packageVersion.js.map +1 -1
  632. package/lib/public.d.ts +5 -1
  633. package/lib/serializableDomainSchema.d.ts +8 -14
  634. package/lib/serializableDomainSchema.d.ts.map +1 -1
  635. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  636. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  637. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  638. package/lib/shared-tree/independentView.d.ts.map +1 -1
  639. package/lib/shared-tree/independentView.js +5 -20
  640. package/lib/shared-tree/independentView.js.map +1 -1
  641. package/lib/shared-tree/index.d.ts +1 -1
  642. package/lib/shared-tree/index.d.ts.map +1 -1
  643. package/lib/shared-tree/index.js +1 -1
  644. package/lib/shared-tree/index.js.map +1 -1
  645. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  646. package/lib/shared-tree/schematizeTree.js +5 -4
  647. package/lib/shared-tree/schematizeTree.js.map +1 -1
  648. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  649. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  650. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  651. package/lib/shared-tree/sharedTree.d.ts +1 -0
  652. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  653. package/lib/shared-tree/sharedTree.js +23 -16
  654. package/lib/shared-tree/sharedTree.js.map +1 -1
  655. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  656. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  657. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  658. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  659. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  660. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  661. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  662. package/lib/shared-tree/treeApiAlpha.d.ts +9 -30
  663. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  664. package/lib/shared-tree/treeApiAlpha.js +12 -24
  665. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  666. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  667. package/lib/shared-tree/treeCheckout.js +4 -4
  668. package/lib/shared-tree/treeCheckout.js.map +1 -1
  669. package/lib/shared-tree-core/branch.d.ts +4 -3
  670. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  671. package/lib/shared-tree-core/branch.js +2 -2
  672. package/lib/shared-tree-core/branch.js.map +1 -1
  673. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  674. package/lib/shared-tree-core/editManager.js +35 -29
  675. package/lib/shared-tree-core/editManager.js.map +1 -1
  676. package/lib/sharedTreeAttributes.d.ts +18 -0
  677. package/lib/sharedTreeAttributes.d.ts.map +1 -0
  678. package/lib/sharedTreeAttributes.js +22 -0
  679. package/lib/sharedTreeAttributes.js.map +1 -0
  680. package/lib/simple-tree/api/conciseTree.d.ts +8 -2
  681. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  682. package/lib/simple-tree/api/conciseTree.js +9 -1
  683. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  684. package/lib/simple-tree/api/create.d.ts +3 -3
  685. package/lib/simple-tree/api/create.d.ts.map +1 -1
  686. package/lib/simple-tree/api/create.js.map +1 -1
  687. package/lib/simple-tree/api/customTree.d.ts +42 -12
  688. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  689. package/lib/simple-tree/api/customTree.js +30 -3
  690. package/lib/simple-tree/api/customTree.js.map +1 -1
  691. package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
  692. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  693. package/lib/simple-tree/api/getJsonSchema.js +10 -0
  694. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  695. package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
  696. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  697. package/lib/simple-tree/api/getSimpleSchema.js +13 -43
  698. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  699. package/lib/simple-tree/api/index.d.ts +7 -6
  700. package/lib/simple-tree/api/index.d.ts.map +1 -1
  701. package/lib/simple-tree/api/index.js +5 -3
  702. package/lib/simple-tree/api/index.js.map +1 -1
  703. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  704. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  705. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  706. package/lib/simple-tree/api/schemaFactory.d.ts +112 -67
  707. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  708. package/lib/simple-tree/api/schemaFactory.js +78 -155
  709. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  710. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  711. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  712. package/lib/simple-tree/api/schemaFactoryAlpha.js +27 -2
  713. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  714. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  715. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  716. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  717. package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
  718. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  719. package/lib/simple-tree/api/schemaFromSimple.js +67 -0
  720. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
  721. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  722. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  723. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  724. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  725. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  726. package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
  727. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  728. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  729. package/lib/simple-tree/api/tree.d.ts +12 -6
  730. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  731. package/lib/simple-tree/api/tree.js +14 -5
  732. package/lib/simple-tree/api/tree.js.map +1 -1
  733. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  734. package/lib/simple-tree/api/treeNodeApi.js +5 -20
  735. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  736. package/lib/simple-tree/api/typesUnsafe.d.ts +102 -36
  737. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  738. package/lib/simple-tree/api/typesUnsafe.js +0 -1
  739. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  740. package/lib/simple-tree/api/verboseTree.d.ts +16 -25
  741. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  742. package/lib/simple-tree/api/verboseTree.js +16 -12
  743. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  744. package/lib/simple-tree/api/view.d.ts.map +1 -1
  745. package/lib/simple-tree/api/view.js +1 -2
  746. package/lib/simple-tree/api/view.js.map +1 -1
  747. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  748. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  749. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
  750. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  751. package/lib/simple-tree/arrayNode.d.ts +5 -4
  752. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  753. package/lib/simple-tree/arrayNode.js +7 -3
  754. package/lib/simple-tree/arrayNode.js.map +1 -1
  755. package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
  756. package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  757. package/lib/simple-tree/arrayNodeTypes.js +26 -0
  758. package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
  759. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  760. package/lib/simple-tree/core/getOrCreateNode.js +2 -12
  761. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  762. package/lib/simple-tree/core/index.d.ts +1 -2
  763. package/lib/simple-tree/core/index.d.ts.map +1 -1
  764. package/lib/simple-tree/core/index.js +1 -2
  765. package/lib/simple-tree/core/index.js.map +1 -1
  766. package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
  767. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  768. package/lib/simple-tree/core/treeNodeKernel.js +28 -14
  769. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  770. package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
  771. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  772. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  773. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  774. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  775. package/lib/simple-tree/core/unhydratedFlexTree.js +2 -2
  776. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  777. package/lib/simple-tree/flexList.d.ts +4 -5
  778. package/lib/simple-tree/flexList.d.ts.map +1 -1
  779. package/lib/simple-tree/flexList.js +0 -12
  780. package/lib/simple-tree/flexList.js.map +1 -1
  781. package/lib/simple-tree/index.d.ts +9 -2
  782. package/lib/simple-tree/index.d.ts.map +1 -1
  783. package/lib/simple-tree/index.js +5 -2
  784. package/lib/simple-tree/index.js.map +1 -1
  785. package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
  786. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  787. package/lib/simple-tree/leafNodeSchema.js +2 -0
  788. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  789. package/lib/simple-tree/mapNode.d.ts +3 -2
  790. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  791. package/lib/simple-tree/mapNode.js +5 -1
  792. package/lib/simple-tree/mapNode.js.map +1 -1
  793. package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
  794. package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
  795. package/lib/simple-tree/mapNodeTypes.js +26 -0
  796. package/lib/simple-tree/mapNodeTypes.js.map +1 -0
  797. package/lib/simple-tree/objectNode.d.ts +10 -3
  798. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  799. package/lib/simple-tree/objectNode.js +12 -5
  800. package/lib/simple-tree/objectNode.js.map +1 -1
  801. package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
  802. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  803. package/lib/simple-tree/objectNodeTypes.js +3 -0
  804. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  805. package/lib/simple-tree/proxies.js +2 -1
  806. package/lib/simple-tree/proxies.js.map +1 -1
  807. package/lib/simple-tree/schemaTypes.d.ts +81 -8
  808. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  809. package/lib/simple-tree/schemaTypes.js +91 -6
  810. package/lib/simple-tree/schemaTypes.js.map +1 -1
  811. package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  812. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  813. package/lib/simple-tree/simpleSchema.js.map +1 -0
  814. package/lib/simple-tree/toMapTree.d.ts +4 -4
  815. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  816. package/lib/simple-tree/toMapTree.js +2 -2
  817. package/lib/simple-tree/toMapTree.js.map +1 -1
  818. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  819. package/lib/simple-tree/toStoredSchema.js +4 -8
  820. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  821. package/lib/simple-tree/treeNodeValid.d.ts +7 -1
  822. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  823. package/lib/simple-tree/treeNodeValid.js +14 -7
  824. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  825. package/lib/treeFactory.d.ts +0 -12
  826. package/lib/treeFactory.d.ts.map +1 -1
  827. package/lib/treeFactory.js +1 -17
  828. package/lib/treeFactory.js.map +1 -1
  829. package/lib/tsdoc-metadata.json +1 -1
  830. package/lib/util/cloneWithReplacements.d.ts +21 -0
  831. package/lib/util/cloneWithReplacements.d.ts.map +1 -0
  832. package/lib/util/cloneWithReplacements.js +34 -0
  833. package/lib/util/cloneWithReplacements.js.map +1 -0
  834. package/lib/util/idAllocator.d.ts.map +1 -1
  835. package/lib/util/idAllocator.js +1 -2
  836. package/lib/util/idAllocator.js.map +1 -1
  837. package/lib/util/index.d.ts +2 -1
  838. package/lib/util/index.d.ts.map +1 -1
  839. package/lib/util/index.js +2 -1
  840. package/lib/util/index.js.map +1 -1
  841. package/lib/util/referenceCounting.d.ts +18 -0
  842. package/lib/util/referenceCounting.d.ts.map +1 -1
  843. package/lib/util/referenceCounting.js.map +1 -1
  844. package/lib/util/typeCheck.d.ts +7 -0
  845. package/lib/util/typeCheck.d.ts.map +1 -1
  846. package/lib/util/typeCheck.js.map +1 -1
  847. package/lib/util/utils.d.ts +0 -1
  848. package/lib/util/utils.d.ts.map +1 -1
  849. package/lib/util/utils.js +0 -2
  850. package/lib/util/utils.js.map +1 -1
  851. package/package.json +37 -27
  852. package/src/codec/codec.ts +2 -2
  853. package/src/codec/discriminatedUnions.ts +2 -2
  854. package/src/core/forest/editableForest.ts +1 -52
  855. package/src/core/forest/forest.ts +17 -2
  856. package/src/core/forest/index.ts +0 -1
  857. package/src/core/index.ts +4 -2
  858. package/src/core/rebase/utils.ts +1 -1
  859. package/src/core/schema-stored/schema.ts +6 -2
  860. package/src/core/tree/anchorSet.ts +42 -12
  861. package/src/core/tree/delta.ts +8 -25
  862. package/src/core/tree/deltaUtil.ts +5 -5
  863. package/src/core/tree/index.ts +4 -1
  864. package/src/core/tree/pathTree.ts +72 -1
  865. package/src/core/tree/treeTextFormat.ts +1 -1
  866. package/src/core/tree/visitDelta.ts +38 -17
  867. package/src/core/tree/visitorUtils.ts +22 -36
  868. package/src/feature-libraries/chunked-forest/basicChunk.ts +3 -3
  869. package/src/feature-libraries/chunked-forest/chunkTree.ts +20 -9
  870. package/src/feature-libraries/chunked-forest/chunkedForest.ts +10 -6
  871. package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
  872. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
  873. package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
  874. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
  875. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  876. package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +1 -2
  877. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
  878. package/src/feature-libraries/chunked-forest/uniformChunk.ts +5 -4
  879. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
  880. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  881. package/src/feature-libraries/default-schema/index.ts +2 -0
  882. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
  883. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
  884. package/src/feature-libraries/deltaUtils.ts +1 -1
  885. package/src/feature-libraries/flex-tree/context.ts +4 -4
  886. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
  887. package/src/feature-libraries/flex-tree/lazyField.ts +21 -12
  888. package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
  889. package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
  890. package/src/feature-libraries/index.ts +10 -8
  891. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -4
  892. package/src/feature-libraries/initializeForest.ts +55 -0
  893. package/src/feature-libraries/modular-schema/comparison.ts +2 -2
  894. package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
  895. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
  896. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -30
  897. package/src/feature-libraries/node-identifier/README.md +11 -0
  898. package/src/feature-libraries/node-identifier/index.ts +17 -0
  899. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
  900. package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
  901. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
  902. package/src/feature-libraries/object-forest/objectForest.ts +11 -5
  903. package/src/feature-libraries/schema-index/codec.ts +2 -1
  904. package/src/feature-libraries/sequence-field/compose.ts +2 -2
  905. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  906. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  907. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
  908. package/src/feature-libraries/sequence-field/utils.ts +2 -2
  909. package/src/feature-libraries/treeCursorUtils.ts +2 -3
  910. package/src/index.ts +43 -13
  911. package/src/jsonDomainSchema.ts +30 -11
  912. package/src/packageVersion.ts +1 -1
  913. package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
  914. package/src/shared-tree/independentView.ts +5 -29
  915. package/src/shared-tree/index.ts +1 -0
  916. package/src/shared-tree/schematizeTree.ts +5 -4
  917. package/src/shared-tree/schematizingTreeView.ts +3 -3
  918. package/src/shared-tree/sharedTree.ts +29 -19
  919. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -3
  920. package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
  921. package/src/shared-tree/treeApiAlpha.ts +45 -85
  922. package/src/shared-tree/treeCheckout.ts +4 -10
  923. package/src/shared-tree-core/branch.ts +5 -3
  924. package/src/shared-tree-core/editManager.ts +37 -45
  925. package/src/sharedTreeAttributes.ts +25 -0
  926. package/src/simple-tree/api/conciseTree.ts +25 -8
  927. package/src/simple-tree/api/create.ts +3 -3
  928. package/src/simple-tree/api/customTree.ts +60 -17
  929. package/src/simple-tree/api/getJsonSchema.ts +10 -0
  930. package/src/simple-tree/api/getSimpleSchema.ts +14 -44
  931. package/src/simple-tree/api/index.ts +17 -12
  932. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
  933. package/src/simple-tree/api/schemaFactory.ts +179 -118
  934. package/src/simple-tree/api/schemaFactoryAlpha.ts +74 -67
  935. package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
  936. package/src/simple-tree/api/schemaFromSimple.ts +96 -0
  937. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
  938. package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
  939. package/src/simple-tree/api/tree.ts +16 -11
  940. package/src/simple-tree/api/treeNodeApi.ts +5 -18
  941. package/src/simple-tree/api/typesUnsafe.ts +166 -48
  942. package/src/simple-tree/api/verboseTree.ts +45 -57
  943. package/src/simple-tree/api/view.ts +1 -2
  944. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
  945. package/src/simple-tree/arrayNode.ts +20 -14
  946. package/src/simple-tree/arrayNodeTypes.ts +93 -0
  947. package/src/simple-tree/core/getOrCreateNode.ts +3 -13
  948. package/src/simple-tree/core/index.ts +1 -1
  949. package/src/simple-tree/core/treeNodeKernel.ts +32 -18
  950. package/src/simple-tree/core/treeNodeSchema.ts +14 -8
  951. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -4
  952. package/src/simple-tree/flexList.ts +4 -14
  953. package/src/simple-tree/index.ts +36 -9
  954. package/src/simple-tree/leafNodeSchema.ts +28 -7
  955. package/src/simple-tree/mapNode.ts +13 -11
  956. package/src/simple-tree/mapNodeTypes.ts +90 -0
  957. package/src/simple-tree/objectNode.ts +40 -13
  958. package/src/simple-tree/objectNodeTypes.ts +21 -16
  959. package/src/simple-tree/proxies.ts +2 -2
  960. package/src/simple-tree/schemaTypes.ts +153 -23
  961. package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +67 -28
  962. package/src/simple-tree/toMapTree.ts +8 -8
  963. package/src/simple-tree/toStoredSchema.ts +4 -7
  964. package/src/simple-tree/treeNodeValid.ts +17 -7
  965. package/src/treeFactory.ts +1 -19
  966. package/src/util/cloneWithReplacements.ts +41 -0
  967. package/src/util/idAllocator.ts +1 -3
  968. package/src/util/index.ts +2 -1
  969. package/src/util/referenceCounting.ts +18 -1
  970. package/src/util/typeCheck.ts +7 -0
  971. package/src/util/utils.ts +0 -3
  972. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  973. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  974. package/dist/feature-libraries/node-key/index.d.ts +0 -8
  975. package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
  976. package/dist/feature-libraries/node-key/index.js +0 -16
  977. package/dist/feature-libraries/node-key/index.js.map +0 -1
  978. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  979. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  980. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  981. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
  982. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  983. package/dist/feature-libraries/node-key/nodeKey.js +0 -26
  984. package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
  985. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  986. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  987. package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
  988. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  989. package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
  990. package/dist/simple-tree/api/simpleSchema.js.map +0 -1
  991. package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
  992. package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
  993. package/dist/simple-tree/core/schemaCaching.js +0 -32
  994. package/dist/simple-tree/core/schemaCaching.js.map +0 -1
  995. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  996. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  997. package/lib/feature-libraries/node-key/index.d.ts +0 -8
  998. package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
  999. package/lib/feature-libraries/node-key/index.js +0 -8
  1000. package/lib/feature-libraries/node-key/index.js.map +0 -1
  1001. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  1002. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  1003. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +0 -45
  1004. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  1005. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
  1006. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  1007. package/lib/feature-libraries/node-key/nodeKey.js +0 -22
  1008. package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
  1009. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  1010. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  1011. package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
  1012. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  1013. package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
  1014. package/lib/simple-tree/api/simpleSchema.js.map +0 -1
  1015. package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
  1016. package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
  1017. package/lib/simple-tree/core/schemaCaching.js +0 -27
  1018. package/lib/simple-tree/core/schemaCaching.js.map +0 -1
  1019. package/prettier.config.cjs +0 -8
  1020. package/src/feature-libraries/node-key/README.md +0 -11
  1021. package/src/feature-libraries/node-key/index.ts +0 -17
  1022. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
  1023. package/src/feature-libraries/node-key/nodeKey.ts +0 -47
  1024. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
  1025. package/src/simple-tree/core/schemaCaching.ts +0 -35
  1026. /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
  1027. /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,1739 +1,1909 @@
1
1
  # @fluidframework/tree
2
2
 
3
- ## 2.23.0
3
+ ## 2.31.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - Creating large transactions and processing inbound changes is now faster ([#23929](https://github.com/microsoft/FluidFramework/pull/23929)) [35847b5ffe0](https://github.com/microsoft/FluidFramework/commit/35847b5ffe09d94cef42b74ab59e37c4bd6d8c2d)
7
+ - Better type errors for invalid recursive schema ([#24080](https://github.com/microsoft/FluidFramework/pull/24080)) [8ae8d2cb05](https://github.com/microsoft/FluidFramework/commit/8ae8d2cb05f7ce765f1d1997135e72a1ea1e00fb)
8
8
 
9
- SharedTree sometimes composes several sequential changes into a single change.
10
- It does so whenever a transaction is created and when processing inbound changes.
9
+ Constraints have been added to `*Recursive` [`SchemaFactory`](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class) methods to ensure correct use without relying on [`ValidateRecursiveSchema`](https://fluidframework.com/docs/api/fluid-framework/validaterecursiveschema-typealias) as much.
11
10
 
12
- Version 2.23.0 makes this composition process asymptotically faster.
13
- For example, creating a transaction that performs 1000 edits on a single array now takes 170ms instead of 1.5s (an 89% improvement).
11
+ - Improved type checking for recursive object schema Fields ([#24113](https://github.com/microsoft/FluidFramework/pull/24113)) [5b656f5cb0](https://github.com/microsoft/FluidFramework/commit/5b656f5cb0707c149aa4537017f71052f10467ee)
14
12
 
15
- See [Change #23902](https://github.com/microsoft/FluidFramework/pull/23902) for more details.
13
+ Most ways to provide incorrectly typed data for fields of [recursive object schema](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#objectrecursive-method) now produce simpler type errors without relying on [ValidateRecursiveSchema](https://fluidframework.com/docs/api/fluid-framework/validaterecursiveschema-typealias).
16
14
 
17
- - Faster processing of events for large transactions ([#23939](https://github.com/microsoft/FluidFramework/pull/23939)) [2a1e7e0617f](https://github.com/microsoft/FluidFramework/commit/2a1e7e0617f618f82134c0bba269119ed980aadc)
15
+ As a side effect of this work, some schema which violated the documented allowed patterns specified by [SchemaFactory](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks) but used to work (as long as they were not package exported) no longer compile.
18
16
 
19
- In versions prior to 2.23.0, event processing time could scale quadratically (`O(N^2)`) with the change count when
20
- processing a batch of changes.
17
+ The specific case known to break is when:
21
18
 
22
- This performance characteristic has been corrected. See change
23
- [#23908](https://github.com/microsoft/FluidFramework/pull/23908) for more details.
19
+ 1. An Object node schema is co-recursive with an Array node schema.
20
+ 2. The Array does not declare a named subclass.
21
+ 3. The schema reference from the Object to the Array is not using the [lazy syntax](https://fluidframework.com/docs/api/fluid-framework/lazyitem-typealias).
24
22
 
25
- - Op bunching performance enhancements ([#23732](https://github.com/microsoft/FluidFramework/pull/23732)) [a98b04fc9e0](https://github.com/microsoft/FluidFramework/commit/a98b04fc9e000971bdfa8135251a7dc3e189502c)
23
+ For example:
26
24
 
27
- `SharedTree` now takes advantage of a new feature called "op bunching" where contiguous ops in a grouped batch are
28
- bunched and processed together. This improves the performance of processing ops asymptotically; as
29
- the number of local ops and incoming ops increase, the processing time will reduce.
25
+ ```typescript
26
+ class Foo extends sf.objectRecursive("Foo", {
27
+ fooList: sf.arrayRecursive("FooList", [() => Foo]), // Bad
28
+ }) {}
29
+ {
30
+ type _check = ValidateRecursiveSchema<typeof Foo>;
31
+ }
32
+ ```
30
33
 
31
- For example, with 10 local ops + 10 incoming ops, the performance increases by 70%; with 100 local ops + 100 incoming ops, the performance increases by 94%.
34
+ Such a schema is disallowed according to the documentation. See the
35
+ ["recursive schema must explicitly declare a named class"](<(https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#schemafactory-remarks)>) remarks.
36
+ This restriction is necessary to avoid [generated `.d.ts` files replacing recursive references with `any`](https://github.com/microsoft/TypeScript/issues/55832).
37
+ Fixing this code is now also necessary to avoid a compile error.
32
38
 
33
- This will help improve performance in the following scenarios:
39
+ ```typescript
40
+ // Fixed
41
+ class FooList extends sf.arrayRecursive("FooList", [() => Foo]) {}
42
+ {
43
+ type _check = ValidateRecursiveSchema<typeof FooList>;
44
+ }
45
+ class Foo extends sf.objectRecursive("Foo", {
46
+ fooList: FooList,
47
+ }) {}
48
+ {
49
+ type _check = ValidateRecursiveSchema<typeof Foo>;
50
+ }
51
+ ```
34
52
 
35
- - A client makes a large number of changes in a single JS turn. For example, copy pasting large data like a table.
36
- - A client has a large number of local changes. For example, slow clients whose changes are slow to ack or clients with
37
- a local branch with large number of changes.
53
+ This change will also result in much nicer IntelliSense and type errors while fixing the typing if the schema is exported.
38
54
 
39
- - Invalid schema base classes in Tree.is now throw an error instead of returning false ([#23938](https://github.com/microsoft/FluidFramework/pull/23938)) [00995654070](https://github.com/microsoft/FluidFramework/commit/00995654070a4e13b57b2562ff4a5935aba70a2f)
55
+ There are still several cases which compile but violate this policy regarding recursive schema and can cause issues when exporting schema;
56
+ these should be migrated to the above pattern as well.
57
+ It is still valid to use non-recursive structurally named array and map schema inline; this change does not impact them.
40
58
 
41
- As documented in [`TreeNodeSchemaClass`](https://fluidframework.com/docs/api/fluid-framework/treenodeschemaclass-typealias#treenodeschemaclass-remarks), there are specific rules around sub-classing schema, mainly that only a single most derived class can be used.
42
- One place where it was easy to accidentally violate this rule and get hard-to-debug results was [`Tree.is`](https://fluidframework.com/docs/data-structures/tree/nodes#treeis).
43
- This has been mitigated by adding a check in `Tree.is` which detects this mistake (which used to result in `false` being returned) and instead throws a `UsageError` explaining the situation.
44
- The error will look something like:
59
+ - Performance enhancements in SharedTree branch-related ops processing ([#24093](https://github.com/microsoft/FluidFramework/pull/24093)) [47b275bcf2](https://github.com/microsoft/FluidFramework/commit/47b275bcf2dd79696387f7c8f3e876d03b2813f8)
45
60
 
46
- > Two schema classes were used (CustomObjectNode and Derived) which derived from the same SchemaFactory generated class ("com.example.Test"). This is invalid.
61
+ SharedTree leverages the "op bunching" feature where contiguous ops in a grouped batch are bunched and processed together
62
+ to asymptotically improve the performance of processing ops.
63
+ This performance enhancement focuses on the scenario where there are one or more commits in the trunk and one or more peer
64
+ commits are received in a bunch. With 1 trunk commits and 10 peer commits, the performance increases by 57%; with 100
65
+ trunk commits and 100 peer commits, the performance increases by 97%.
47
66
 
48
- For applications wanting to test if a given `TreeNode` is an instance of some schema base class, this can be done using `instanceof` which includes base classes when doing the check.
67
+ Some example scenarios where the performance will be improved:
49
68
 
50
- ## 2.22.0
69
+ - A client makes some local changes and another client simultaneously makes a large number of changes in a single JavaScript turn.
70
+ For example, a client is typing into a canvas while another client pastes a large amount of content into a table.
71
+ - A client makes a local branch with some changes and rebases it into the trunk. For example, an AI agent makes changes
72
+ on a local branch which are accepted by a user resulting in the AI's branch being merged into the trunk.
51
73
 
52
- ### Minor Changes
74
+ - Improve tree shaking for code which imports `SharedTreeAttributes` ([#24135](https://github.com/microsoft/FluidFramework/pull/24135)) [eb46f426ff](https://github.com/microsoft/FluidFramework/commit/eb46f426ff1ef6f98a3ffc666030bb59f8c7d22f)
53
75
 
54
- - Add `leaves` and statics to `SchemaFactory`. ([#23787](https://github.com/microsoft/FluidFramework/pull/23787)) [efa90f6274](https://github.com/microsoft/FluidFramework/commit/efa90f6274152cadb55329b7bbf6a6cd8e299847)
76
+ Bundling code that imports `SharedTreeAttributes` from `@fluidframework/tree/legacy` should now better prune out the rest of the tree package's code.
77
+ This change reduced the dependency on webpack's
78
+ [`usedExports`](https://webpack.js.org/configuration/optimization/#optimizationusedexports) when tree shaking, but other
79
+ bundlers should also benefit.
55
80
 
56
- `SchemaFactory` now has a `leaves` member that is an array of all leaf schema.
81
+ - `TreeAlpha.exportConcise` now supports `undefined` ([#24187](https://github.com/microsoft/FluidFramework/pull/24187)) [958b9fd8b9](https://github.com/microsoft/FluidFramework/commit/958b9fd8b9a2bd43558fe2a94dc55f8f51d47ea8)
57
82
 
58
- `SchemaFactory` now has static members to access leaf schema and create field schema.
83
+ There is a new overload for `TreeAlpha.exportConcise` which makes exporting optional fields easier.
84
+ This overload allows `undefined` and returns `undefined` in this case.
59
85
 
60
- ## 2.21.0
86
+ - Improvements to typing of object node schema ([#24143](https://github.com/microsoft/FluidFramework/pull/24143)) [02ecf8dfb2](https://github.com/microsoft/FluidFramework/commit/02ecf8dfb238dc4d1c88610cec34d7895802d28c)
61
87
 
62
- Dependency updates only.
88
+ Several tweaks to the typing of object node schema have been made to allow exposing an `@alpha` `ObjectNodeSchema` type.
63
89
 
64
- ## 2.20.0
90
+ [SchemaFactoryAlpha](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class)'s `object` and `objectRecursive` now return schema which are compatible with the new `ObjectNodeSchema` type.
91
+ This new `ObjectNodeSchema` type exposes a `fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>` property which provides an easy way to get information about the object's fields.
65
92
 
66
- ### Minor Changes
93
+ Additionally an alpha `ObjectNodeSchema` object is added to enable support for `schema instanceof ObjectNodeSchema` to safely narrow `TreeNodeSchema` to this new type.
67
94
 
68
- - Events-related interfaces have been moved to core-interfaces ([#23313](https://github.com/microsoft/FluidFramework/pull/23313)) [69a755ebd7](https://github.com/microsoft/FluidFramework/commit/69a755ebd76db36ffd4638d331062f96ec4c0648)
95
+ In support of this work, several typing details were fixed including:
69
96
 
70
- The following interfaces and types have been moved from the `@fluidframework/tree` package into the
71
- `@fluidframework/core-interfaces` package. As such, they are now deprecated in the `@fluidframework/tree` package.
97
+ - `info` field of `[typeSchemaSymbol]` type brand on recursive object schema was specified to match non-recursive variants.
98
+ - Type of field metadata was correctly plumbed through `optionalReclusive` and `requiredRecursive`.
99
+ - When fields object provided to [SchemaFactory.object](https://fluidframework.com/docs/api/fluid-framework/schemafactory-class#object-method) is typed as `RestrictiveStringRecord<ImplicitFieldSchema>` the resulting [TreeObjectNode](https://fluidframework.com/docs/api/fluid-framework/treeobjectnode-typealias) no longer gets a `Record<string, TreeNode | TreeLeafValue>` signature which could incorrectly conflict with custom members added to the object. Instead `{}` is used to provide no information about felids on the type when the schema provides no information about them. Additionally this case is explicitly made non-constructable: the constructor takes in `never` instead of a `Record<string,never>` which could be erroneously satisfied with an empty object due to how TypeScript assignability rules consider records to have all allowed fields, but also allow objects missing those fields to be assigned to them.
72
100
 
73
- - Listeners
74
- - IsListener
75
- - Listenable
76
- - Off
101
+ Lastly, `metadata` on the various schema types has been made required instead of optional.
102
+ This does not impact the APIs for constructing schema: when `undefined` is provided the schema now defaults to `{}` instead of `undefined`.
103
+ This reduces the number of cases code reading metadata from schema has to handle.
77
104
 
78
- Users should now import them from either `@fluidframework/core-interfaces` or `fluid-framework`.
79
-
80
- These deprecated interfaces will be removed from the `@fluidframework/tree` package in Fluid Framework v3.0.
81
-
82
- ## 2.13.0
105
+ ## 2.30.0
83
106
 
84
107
  ### Minor Changes
85
108
 
86
- - Metadata can be associated with Node Schema ([#23321](https://github.com/microsoft/FluidFramework/pull/23321)) [58619c3c4e](https://github.com/microsoft/FluidFramework/commit/58619c3c4ee55ca1497a117321ae0b364e6084e6)
109
+ - New SchemaFactoryAlpha.scopedFactory method ([#23987](https://github.com/microsoft/FluidFramework/pull/23987)) [cddd5139c3](https://github.com/microsoft/FluidFramework/commit/cddd5139c3e070ef26db55331528435a99c0a1b1)
87
110
 
88
- Users of TreeView can now specify metadata when creating Node Schema, via `SchemaFactoryAlpha`.
89
- This metadata may include system-understood properties like `description`.
111
+ The [`SchemaFactoryAlpha.scopedFactory`](https://fluidframework.com/docs/api/fluid-framework/schemafactoryalpha-class)
112
+ method has been added, providing an easy way to create a new `SchemaFactory` with a nested scope string.
90
113
 
91
- Example:
92
-
93
- ```typescript
94
- const schemaFactory = new SchemaFactoryAlpha(...);
95
- class Point extends schemaFactory.object("Point", {
96
- x: schemaFactory.required(schemaFactory.number),
97
- y: schemaFactory.required(schemaFactory.number),
98
- },
99
- {
100
- metadata: {
101
- description: "A point in 2D space",
102
- },
103
- }) {}
114
+ - TreeBranchEvents now exposes the rootChanged event ([#24014](https://github.com/microsoft/FluidFramework/pull/24014)) [702a08af83](https://github.com/microsoft/FluidFramework/commit/702a08af83206c21e1016ca47051052fa8554aa5)
104
115
 
105
- ```
116
+ `TreeBranchEvents` now includes the `rootChanged` event from `TreeViewEvents`.
106
117
 
107
- Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) ([getJsonSchema](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.4.0#user-content-metadata-can-now-be-associated-with-field-schema-22564)) leverages such system-understood metadata to generate useful information.
108
- In the case of the `description` property, it is mapped directly to the `description` property supported by JSON Schema.
118
+ - Alpha APIs for replacing handles in export formats have been redesigned ([#24061](https://github.com/microsoft/FluidFramework/pull/24061)) [34b319cae7](https://github.com/microsoft/FluidFramework/commit/34b319cae7a78db5530dc898689e2eb846f1419f)
109
119
 
110
- Custom, user-defined properties can also be specified.
111
- These properties will not be used by the system by default, but can be used to associate common application-specific properties with Node Schema.
120
+ The various import and export [`VerboseTree`](https://fluidframework.com/docs/api/fluid-framework/verbosetree-typealias) and [`ConciseTree`](https://fluidframework.com/docs/api/fluid-framework/concisetree-typealias) APIs no longer include `valueConverter` options.
121
+ Instead the resulting tree can be further processed to do any desired replacements.
122
+ The following `@alpha` APIs have been added to assist with this:
112
123
 
113
- #### `SchemaFactoryAlpha` Updates
124
+ 1. `cloneWithReplacements`
125
+ 2. `replaceHandles`
126
+ 3. `replaceConciseTreeHandles`
127
+ 4. `replaceVerboseTreeHandles`
114
128
 
115
- - `object` and `objectRecursive`, `arrayRecursive`, and `mapRecursive` now support `metadata` in their `options` parameter.
116
- - (new) `arrayAlpha` - Variant of `array` that accepts an options parameter which supports `metadata`
117
- - (new) `mapAlpha` - Variant of `map` that accepts an options parameter which supports `metadata`
129
+ - Rules regarding how and when lazy schema references are resolved have been clarified ([#24030](https://github.com/microsoft/FluidFramework/pull/24030)) [23f32794db](https://github.com/microsoft/FluidFramework/commit/23f32794dbd3672dcc18e2a9ba2f16f4bf1241f0)
118
130
 
119
- #### Example
131
+ A lazy schema reference is a [LazyItem](https://fluidframework.com/docs/api/fluid-framework/lazyitem-typealias) referencing a [TreeNodeSchema](https://fluidframework.com/docs/api/fluid-framework/treenodeschema-typealias).
132
+ They typically look like `() => MySchema` and are used when a [forward reference](https://en.wikipedia.org/wiki/Forward_declaration#Forward_reference) from one schema to another is required (including but not limited to recursive and co-recursive schema).
120
133
 
121
- An application is implementing search functionality.
122
- By default, the app author wishes for all app content to be potentially indexable by search, unless otherwise specified.
123
- They can leverage schema metadata to decorate types of nodes that should be ignored by search, and leverage that information when walking the tree during a search.
134
+ [TreeViewConfiguration](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class#_constructor_-constructor) now documents its significance with respect to lazy schema references.
135
+ Additionally some implicit assumptions like no modifications of [AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias)
136
+ after resolving of lazy schema references have been enforced (such modifications would previously cause undefined behavior in the future, and now an error is thrown when trying to modify them).
124
137
 
125
- ```typescript
138
+ `evaluateLazySchema` has been added as an `@alpha` API that is now consistently used by all internal code when evaluating lazy schema references.
139
+ This ensures consistent behavior and error reporting, but also adds caching.
140
+ Therefore it is now supported for applications to have lazy schema references which compute the schema when invoked,
141
+ without having to implement their own caching as long as those applications use `evaluateLazySchema` anytime they need to evaluate a lazy schema reference.
126
142
 
127
- interface AppMetadata {
128
- /**
129
- * Whether or not nodes of this type should be ignored by search.
130
- * @defaultValue `false`
131
- */
132
- searchIgnore?: boolean;
133
- }
143
+ ## 2.23.0
134
144
 
135
- const schemaFactory = new SchemaFactoryAlpha(...);
136
- class Point extends schemaFactory.object("Point", {
137
- x: schemaFactory.required(schemaFactory.number),
138
- y: schemaFactory.required(schemaFactory.number),
139
- },
140
- {
141
- metadata: {
142
- description: "A point in 2D space",
143
- custom: {
144
- searchIgnore: true,
145
- },
146
- }
147
- }) {}
148
-
149
- ```
150
-
151
- Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
152
-
153
- #### Potential for breaking existing code
154
-
155
- These changes add the new property "metadata" to the base type from which all node schema derive.
156
- If you have existing node schema subclasses that include a property of this name, there is a chance for potential conflict here that could be breaking.
157
- If you encounter issues here, consider renaming your property or leveraging the new metadata support.
158
-
159
- - New alpha APIs for schema evolution ([#23362](https://github.com/microsoft/FluidFramework/pull/23362)) [2406e00efe](https://github.com/microsoft/FluidFramework/commit/2406e00efed282be58a9e09cb3478c9a9d170ef0)
160
-
161
- There are now `@alpha` APIs for schema evolution which support adding optional fields to object node types without a staged rollout.
162
-
163
- SharedTree has many safety checks in place to ensure applications understand the format of documents they must support.
164
- One of these checks verifies that the view schema (defined in application's code) aligns with the document schema (determined by the document data at rest).
165
- This helps to ensure that clients running incompatible versions of the application's code don't collaborate at the same time on some document, which could cause data loss or disrupt application invariants.
166
- One general solution application authors can perform is to stage the rollout of a feature which changes document schema into multiple phases:
167
-
168
- 1. Release an application version which understands documents written with the new format but doesn't attempt to upgrade any documents
169
- 2. Wait for this application version to saturate in the app's ecosystem
170
- 3. Release an application version which upgrades documents to start leveraging the new format.
171
-
172
- However, this process can be cumbersome for application authors: for many types of changes, an app author doesn't particularly care if older application code collaborates with newer code, as the only downside is that the older application version might not present a fully faithful experience.
173
- As an example, consider an application which renders circles on a canvas (similar to what is presented [here](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md)).
174
- The application author might anticipate adding support to render the circle with various different other properties (border style, border width, background color, varying radius, etc.).
175
- Therefore, they should declare their schema using `SchemaFactoryObjectOptions.allowUnknownOptionalFields` like so:
176
-
177
- ```typescript
178
- import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
179
- // "Old" application code/schema
180
- const factory = new SchemaFactoryAlpha("Geometry");
181
- class Circle extends factory.object(
182
- "Circle",
183
- {
184
- x: factory.number,
185
- y: factory.number,
186
- },
187
- { allowUnknownOptionalFields: true },
188
- ) {}
189
- ```
190
-
191
- Later, they add some of these features to their application:
192
-
193
- ```typescript
194
- import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
195
- // "New" application code/schema
196
- const factory = new SchemaFactoryAlpha("Geometry");
197
- class Circle extends factory.object(
198
- "Circle",
199
- {
200
- x: factory.number,
201
- y: factory.number,
202
- // Note that radius and color must both be declared as optional fields since this application must
203
- // support opening up existing documents that didn't have this information.
204
- radius: factory.optional(factory.number),
205
- color: factory.optional(factory.string), // ex: #00FF00
206
- },
207
- { allowUnknownOptionalFields: true },
208
- ) {}
209
- ```
210
-
211
- When they go to deploy this newer version of the application, they could opt to start upgrading documents as soon as the newer code is rolled out, and the older code would still be able to open up (and collaborate on) documents using the newer schema version.
212
- Note that it's only important that the old _application code_ elected to allow opening documents with unknown optional fields.
213
- This policy is not persisted into documents in any form, so applications are free to modify it at any point.
214
-
215
- For specific API details, see documentation on `SchemaFactoryObjectOptions.allowUnknownOptionalFields`.
216
- For a more thorough discussion of this topic, see [Schema Evolvability](https://github.com/microsoft/FluidFramework/tree/main/packages/dds/tree#schema-evolvability) in the SharedTree README.
145
+ ### Minor Changes
217
146
 
218
- ## 2.12.0
147
+ - Creating large transactions and processing inbound changes is now faster ([#23929](https://github.com/microsoft/FluidFramework/pull/23929)) [35847b5ffe0](https://github.com/microsoft/FluidFramework/commit/35847b5ffe09d94cef42b74ab59e37c4bd6d8c2d)
219
148
 
220
- Dependency updates only.
149
+ SharedTree sometimes composes several sequential changes into a single change.
150
+ It does so whenever a transaction is created and when processing inbound changes.
221
151
 
222
- ## 2.11.0
152
+ Version 2.23.0 makes this composition process asymptotically faster.
153
+ For example, creating a transaction that performs 1000 edits on a single array now takes 170ms instead of 1.5s (an 89% improvement).
223
154
 
224
- ### Minor Changes
155
+ See [Change #23902](https://github.com/microsoft/FluidFramework/pull/23902) for more details.
225
156
 
226
- - Revertible objects can now be cloned using `RevertibleAlpha.clone()` ([#23044](https://github.com/microsoft/FluidFramework/pull/23044)) [5abfa015af](https://github.com/microsoft/FluidFramework/commit/5abfa015aff9d639d82830f3ad828324d5680bd7)
157
+ - Faster processing of events for large transactions ([#23939](https://github.com/microsoft/FluidFramework/pull/23939)) [2a1e7e0617f](https://github.com/microsoft/FluidFramework/commit/2a1e7e0617f618f82134c0bba269119ed980aadc)
227
158
 
228
- The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error.
159
+ In versions prior to 2.23.0, event processing time could scale quadratically (`O(N^2)`) with the change count when
160
+ processing a batch of changes.
229
161
 
230
- - Providing unused properties in object literals for building empty ObjectNodes no longer compiles ([#23162](https://github.com/microsoft/FluidFramework/pull/23162)) [dc3c30019e](https://github.com/microsoft/FluidFramework/commit/dc3c30019ef869b27b9468bff59f10434d3c5c68)
162
+ This performance characteristic has been corrected. See change
163
+ [#23908](https://github.com/microsoft/FluidFramework/pull/23908) for more details.
231
164
 
232
- ObjectNodes with no fields will now emit a compiler error if constructed from an object literal with fields.
233
- This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided.
165
+ - Op bunching performance enhancements ([#23732](https://github.com/microsoft/FluidFramework/pull/23732)) [a98b04fc9e0](https://github.com/microsoft/FluidFramework/commit/a98b04fc9e000971bdfa8135251a7dc3e189502c)
234
166
 
235
- ```typescript
236
- class A extends schemaFactory.object("A", {}) {}
237
- const a = new A({ thisDoesNotExist: 5 }); // This now errors.
238
- ```
167
+ `SharedTree` now takes advantage of a new feature called "op bunching" where contiguous ops in a grouped batch are
168
+ bunched and processed together. This improves the performance of processing ops asymptotically; as
169
+ the number of local ops and incoming ops increase, the processing time will reduce.
239
170
 
240
- - The events library has been moved from the tree package ([#23141](https://github.com/microsoft/FluidFramework/pull/23141)) [cae07b5c8c](https://github.com/microsoft/FluidFramework/commit/cae07b5c8c7904184b5fbf8c677f302da19cc697)
171
+ For example, with 10 local ops + 10 incoming ops, the performance increases by 70%; with 100 local ops + 100 incoming ops, the performance increases by 94%.
241
172
 
242
- In previous releases, the `@fluidframework/tree` package contained an internal events library. The events-related types and interfaces have been moved to
243
- `@fluidframework/core-interfaces`, while the implementation has been relocated to `@fluid-internal/client-utils`. There are
244
- no changes to how the events library is used; the relocation simply organizes the library into more appropriate
245
- packages. This change should have no impact on developers using the Fluid Framework.
173
+ This will help improve performance in the following scenarios:
246
174
 
247
- ## 2.10.0
175
+ - A client makes a large number of changes in a single JS turn. For example, copy pasting large data like a table.
176
+ - A client has a large number of local changes. For example, slow clients whose changes are slow to ack or clients with
177
+ a local branch with large number of changes.
248
178
 
249
- ### Minor Changes
179
+ - Invalid schema base classes in Tree.is now throw an error instead of returning false ([#23938](https://github.com/microsoft/FluidFramework/pull/23938)) [00995654070](https://github.com/microsoft/FluidFramework/commit/00995654070a4e13b57b2562ff4a5935aba70a2f)
250
180
 
251
- - Fix typing bug in `adaptEnum` and `enumFromStrings` ([#23077](https://github.com/microsoft/FluidFramework/pull/23077)) [cfb68388cb](https://github.com/microsoft/FluidFramework/commit/cfb68388cb6b88a0ef670633b3afa46a82c99972)
252
-
253
- When using the return value from [`adaptEnum`](https://fluidframework.com/docs/api/v2/tree#adaptenum-function) as a function, passing in a value who's type is a union no longer produced an incorrectly typed return value. This has been fixed.
254
-
255
- Additionally [`enumFromStrings`](https://fluidframework.com/docs/api/v2/tree#enumfromstrings-function) has improved the typing of its schema, ensuring the returned object's members have sufficiently specific types.
256
- Part of this improvement was fixing the `.schema` property to be a tuple over each of the schema where it was previously a tuple of a single combined schema due to a bug.
257
-
258
- One side-effect of these fixes is that narrowing of the `value` field of a node typed from the `.schema` behaves slightly different, such that the node type is now a union instead of it being a single type with a `.value` that is a union.
259
- This means that narrowing based on `.value` property narrows which node type you have, not just the value property.
260
- This mainly matters when matching all cases like the switch statement below:
261
-
262
- ```typescript
263
- const Mode = enumFromStrings(schema, ["Fun", "Bonus"]);
264
- type Mode = TreeNodeFromImplicitAllowedTypes<typeof Mode.schema>;
265
- const node = new Mode.Bonus() as Mode;
266
-
267
- switch (node.value) {
268
- case "Fun": {
269
- assert.fail();
270
- }
271
- case "Bonus": {
272
- // This one runs
273
- break;
274
- }
275
- default:
276
- // Before this change, "node.value" was never here, now "node" is never.
277
- unreachableCase(node);
278
- }
279
- ```
181
+ As documented in [`TreeNodeSchemaClass`](https://fluidframework.com/docs/api/fluid-framework/treenodeschemaclass-typealias#treenodeschemaclass-remarks), there are specific rules around sub-classing schema, mainly that only a single most derived class can be used.
182
+ One place where it was easy to accidentally violate this rule and get hard-to-debug results was [`Tree.is`](https://fluidframework.com/docs/data-structures/tree/nodes#treeis).
183
+ This has been mitigated by adding a check in `Tree.is` which detects this mistake (which used to result in `false` being returned) and instead throws a `UsageError` explaining the situation.
184
+ The error will look something like:
280
185
 
281
- - SharedTree event listeners that implement `Listenable` now allow deregistration of event listeners via an `off()` function. ([#23046](https://github.com/microsoft/FluidFramework/pull/23046)) [c59225db03](https://github.com/microsoft/FluidFramework/commit/c59225db033a516ee20e459ae31567d97ce8776c)
186
+ > Two schema classes were used (CustomObjectNode and Derived) which derived from the same SchemaFactory generated class ("com.example.Test"). This is invalid.
282
187
 
283
- The ability to deregister events via a callback returned by `on()` remains the same.
284
- Both strategies will remain supported and consumers of SharedTree events may choose which method of deregistration they prefer in a given instance.
188
+ For applications wanting to test if a given `TreeNode` is an instance of some schema base class, this can be done using `instanceof` which includes base classes when doing the check.
285
189
 
286
- ```typescript
287
- // The new behavior
288
- function deregisterViaOff(view: TreeView<MySchema>): {
289
- const listener = () => { /* ... */ };
290
- view.events.on("commitApplied", listener); // Register
291
- view.events.off("commitApplied", listener); // Deregister
292
- }
190
+ ## 2.22.0
293
191
 
294
- // The existing behavior (still supported)
295
- function deregisterViaCallback(view: TreeView<MySchema>): {
296
- const off = view.events.on("commitApplied", () => { /* ... */ }); // Register
297
- off(); // Deregister
298
- }
299
- ```
192
+ ### Minor Changes
300
193
 
301
- - Allow constructing recursive maps from objects ([#23070](https://github.com/microsoft/FluidFramework/pull/23070)) [0185a08c6f](https://github.com/microsoft/FluidFramework/commit/0185a08c6f8bf6e922a6467f11da049503c4d215)
194
+ - Add `leaves` and statics to `SchemaFactory`. ([#23787](https://github.com/microsoft/FluidFramework/pull/23787)) [efa90f6274](https://github.com/microsoft/FluidFramework/commit/efa90f6274152cadb55329b7bbf6a6cd8e299847)
302
195
 
303
- Previously only non-recursive maps could be constructed from objects.
304
- Now all maps nodes can constructed from objects:
196
+ `SchemaFactory` now has a `leaves` member that is an array of all leaf schema.
305
197
 
306
- ```typescript
307
- class MapRecursive extends sf.mapRecursive("Map", [() => MapRecursive]) {}
308
- {
309
- type _check = ValidateRecursiveSchema<typeof MapRecursive>;
310
- }
311
- // New:
312
- const fromObject = new MapRecursive({ x: new MapRecursive() });
313
- // Existing:
314
- const fromIterator = new MapRecursive([["x", new MapRecursive()]]);
315
- const fromMap = new MapRecursive(new Map([["x", new MapRecursive()]]));
316
- const fromNothing = new MapRecursive();
317
- const fromUndefined = new MapRecursive(undefined);
318
- ```
198
+ `SchemaFactory` now has static members to access leaf schema and create field schema.
319
199
 
320
- - Provide more comprehensive replacement to the `commitApplied` event ([#22977](https://github.com/microsoft/FluidFramework/pull/22977)) [e51c94da32](https://github.com/microsoft/FluidFramework/commit/e51c94da3248868de3c0c7fdce568cc425204155)
200
+ ## 2.21.0
321
201
 
322
- Adds a new `changed` event to the (currently alpha) `TreeBranchEvents` that replaces the `commitApplied` event on `TreeViewEvents`.
323
- This new event is fired for both local and remote changes and maintains the existing functionality of `commitApplied` that is used for obtaining `Revertibles`.
202
+ Dependency updates only.
324
203
 
325
- ## 2.5.0
204
+ ## 2.20.0
326
205
 
327
206
  ### Minor Changes
328
207
 
329
- - New! Alpha APIs for tree data import and export ([#22566](https://github.com/microsoft/FluidFramework/pull/22566)) [18a23e8816](https://github.com/microsoft/FluidFramework/commit/18a23e8816467f2ed0c9d6d8637b70d99aa48b7a)
208
+ - Events-related interfaces have been moved to core-interfaces ([#23313](https://github.com/microsoft/FluidFramework/pull/23313)) [69a755ebd7](https://github.com/microsoft/FluidFramework/commit/69a755ebd76db36ffd4638d331062f96ec4c0648)
330
209
 
331
- A collection of new `@alpha` APIs for importing and exporting tree content and schema from SharedTrees has been added to `TreeAlpha`.
332
- These include import and export APIs for `VerboseTree`, `ConciseTree` and compressed tree formats.
210
+ The following interfaces and types have been moved from the `@fluidframework/tree` package into the
211
+ `@fluidframework/core-interfaces` package. As such, they are now deprecated in the `@fluidframework/tree` package.
333
212
 
334
- `TreeAlpha.create` is also added to allow constructing trees with a more general API instead of having to use the schema constructor directly (since that doesn't handle polymorphic roots, or non-schema aware code).
213
+ - Listeners
214
+ - IsListener
215
+ - Listenable
216
+ - Off
335
217
 
336
- The function `independentInitializedView` has been added to provide a way to combine data from the existing `extractPersistedSchema` and new `TreeAlpha.exportCompressed` back into a `TreeView` in a way which can support safely importing data which could have been exported with a different schema.
337
- This allows replicating the schema evolution process for Fluid documents stored in a service, but entirely locally without involving any collaboration services.
338
- `independentView` has also been added, which is similar but handles the case of creating a new view without an existing schema or tree.
218
+ Users should now import them from either `@fluidframework/core-interfaces` or `fluid-framework`.
339
219
 
340
- Together these APIs address several use-cases:
220
+ These deprecated interfaces will be removed from the `@fluidframework/tree` package in Fluid Framework v3.0.
341
221
 
342
- 1. Using SharedTree as an in-memory non-collaborative datastore.
343
- 2. Importing and exporting data from a SharedTree to and from other services or storage locations (such as locally saved files).
344
- 3. Testing various scenarios without relying on a service.
345
- 4. Using SharedTree libraries for just the schema system and encode/decode support.
222
+ ## 2.13.0
346
223
 
347
- - Compilation no longer fails when building with TypeScript's libCheck option ([#22923](https://github.com/microsoft/FluidFramework/pull/22923)) [a1b4cdd45e](https://github.com/microsoft/FluidFramework/commit/a1b4cdd45ee9812e2598ab8d2854333d26a06eb4)
224
+ ### Minor Changes
348
225
 
349
- When compiling code using Fluid Framework with TypeScript's `libCheck` (meaning without [skipLibCheck](https://www.typescriptlang.org/tsconfig/#skipLibCheck)), two compile errors can be encountered:
226
+ - Metadata can be associated with Node Schema ([#23321](https://github.com/microsoft/FluidFramework/pull/23321)) [58619c3c4e](https://github.com/microsoft/FluidFramework/commit/58619c3c4ee55ca1497a117321ae0b364e6084e6)
350
227
 
351
- ```
352
- > tsc
228
+ Users of TreeView can now specify metadata when creating Node Schema, via `SchemaFactoryAlpha`.
229
+ This metadata may include system-understood properties like `description`.
353
230
 
354
- node_modules/@fluidframework/merge-tree/lib/client.d.ts:124:18 - error TS2368: Type parameter name cannot be 'undefined'.
231
+ Example:
355
232
 
356
- 124 walkSegments<undefined>(handler: ISegmentAction<undefined>, start?: number, end?: number, accum?: undefined, splitRange?: boolean): void;
357
- ~~~~~~~~~
233
+ ```typescript
234
+ const schemaFactory = new SchemaFactoryAlpha(...);
235
+ class Point extends schemaFactory.object("Point", {
236
+ x: schemaFactory.required(schemaFactory.number),
237
+ y: schemaFactory.required(schemaFactory.number),
238
+ },
239
+ {
240
+ metadata: {
241
+ description: "A point in 2D space",
242
+ },
243
+ }) {}
358
244
 
359
- node_modules/@fluidframework/tree/lib/util/utils.d.ts:5:29 - error TS7016: Could not find a declaration file for module '@ungap/structured-clone'. 'node_modules/@ungap/structured-clone/esm/index.js' implicitly has an 'any' type.
360
- Try `npm i --save-dev @types/ungap__structured-clone` if it exists or add a new declaration (.d.ts) file containing `declare module '@ungap/structured-clone';`
245
+ ```
361
246
 
362
- 5 import structuredClone from "@ungap/structured-clone";
363
- ~~~~~~~~~~~~~~~~~~~~~~~~~
364
- ```
247
+ Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) ([getJsonSchema](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.4.0#user-content-metadata-can-now-be-associated-with-field-schema-22564)) leverages such system-understood metadata to generate useful information.
248
+ In the case of the `description` property, it is mapped directly to the `description` property supported by JSON Schema.
365
249
 
366
- The first error impacts projects using TypeScript 5.5 or greater and either of the `fluid-framework` or `@fluidframework/merge-tree` packages.
367
- The second error impacts projects using the `noImplicitAny` tsconfig setting and the `fluid-framework` or `@fluidframework/tree` packages.
250
+ Custom, user-defined properties can also be specified.
251
+ These properties will not be used by the system by default, but can be used to associate common application-specific properties with Node Schema.
368
252
 
369
- Both errors have been fixed.
253
+ #### `SchemaFactoryAlpha` Updates
370
254
 
371
- This should allow `libCheck` to be reenabled in any impacted projects.
255
+ - `object` and `objectRecursive`, `arrayRecursive`, and `mapRecursive` now support `metadata` in their `options` parameter.
256
+ - (new) `arrayAlpha` - Variant of `array` that accepts an options parameter which supports `metadata`
257
+ - (new) `mapAlpha` - Variant of `map` that accepts an options parameter which supports `metadata`
372
258
 
373
- - A `.schema` member has been added to the alpha enum schema APIs ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
259
+ #### Example
374
260
 
375
- The return value from `@alpha` APIs `enumFromStrings` and `adaptEnum` now has a property named `schema` which can be used to include it in a parent schema.
376
- This replaces the use of `typedObjectValues` which has been removed.
261
+ An application is implementing search functionality.
262
+ By default, the app author wishes for all app content to be potentially indexable by search, unless otherwise specified.
263
+ They can leverage schema metadata to decorate types of nodes that should be ignored by search, and leverage that information when walking the tree during a search.
377
264
 
378
- Use of these APIs now look like:
265
+ ```typescript
379
266
 
380
- ```typescript
381
- const schemaFactory = new SchemaFactory("com.myApp");
382
- const Mode = enumFromStrings(schemaFactory, ["Fun", "Cool"]);
383
- type Mode = NodeFromSchema<(typeof Mode.schema)[number]>;
384
- class Parent extends schemaFactory.object("Parent", { mode: Mode.schema }) {}
385
- ```
267
+ interface AppMetadata {
268
+ /**
269
+ * Whether or not nodes of this type should be ignored by search.
270
+ * @defaultValue `false`
271
+ */
272
+ searchIgnore?: boolean;
273
+ }
386
274
 
387
- Previously, the last two lines would have been:
275
+ const schemaFactory = new SchemaFactoryAlpha(...);
276
+ class Point extends schemaFactory.object("Point", {
277
+ x: schemaFactory.required(schemaFactory.number),
278
+ y: schemaFactory.required(schemaFactory.number),
279
+ },
280
+ {
281
+ metadata: {
282
+ description: "A point in 2D space",
283
+ custom: {
284
+ searchIgnore: true,
285
+ },
286
+ }
287
+ }) {}
388
288
 
389
- ```typescript
390
- type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>; // This no longer works
391
- class Parent extends schemaFactory.object("Parent", { mode: typedObjectValues(Mode) }) {} // This no longer works
392
- ```
289
+ ```
393
290
 
394
- - TreeNodeSchemaClass now specifies its TNode as TreeNode ([#22938](https://github.com/microsoft/FluidFramework/pull/22938)) [b669a6efdb](https://github.com/microsoft/FluidFramework/commit/b669a6efdba685c71897cade4f907304f1a73910)
291
+ Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
395
292
 
396
- `TreeNodeSchemaClass`'s `TNode` parameter was formerly `unknown` and has been improved to be the more specific `TreeNode | TreeLeafValue`.
397
- This change further narrows this to `TreeNode`.
293
+ #### Potential for breaking existing code
398
294
 
399
- `TreeNodeSchema`, which is more commonly used, still permits `TNode` of `TreeNode | TreeLeafValue`, so this change should have little impact on most code, but in some edge cases it can result in slightly more specific typing.
295
+ These changes add the new property "metadata" to the base type from which all node schema derive.
296
+ If you have existing node schema subclasses that include a property of this name, there is a chance for potential conflict here that could be breaking.
297
+ If you encounter issues here, consider renaming your property or leveraging the new metadata support.
400
298
 
401
- - Array and Map nodes can now be explicitly constructed with undefined or no argument ([#22946](https://github.com/microsoft/FluidFramework/pull/22946)) [176335ce88](https://github.com/microsoft/FluidFramework/commit/176335ce88d005159819c559b445a1655ec429d5)
299
+ - New alpha APIs for schema evolution ([#23362](https://github.com/microsoft/FluidFramework/pull/23362)) [2406e00efe](https://github.com/microsoft/FluidFramework/commit/2406e00efed282be58a9e09cb3478c9a9d170ef0)
402
300
 
403
- The input parameter to the constructor and `create` methods of Array and Map nodes is now optional. When the optional parameter is omitted, an empty map or array will be created.
301
+ There are now `@alpha` APIs for schema evolution which support adding optional fields to object node types without a staged rollout.
404
302
 
405
- #### Examples
303
+ SharedTree has many safety checks in place to ensure applications understand the format of documents they must support.
304
+ One of these checks verifies that the view schema (defined in application's code) aligns with the document schema (determined by the document data at rest).
305
+ This helps to ensure that clients running incompatible versions of the application's code don't collaborate at the same time on some document, which could cause data loss or disrupt application invariants.
306
+ One general solution application authors can perform is to stage the rollout of a feature which changes document schema into multiple phases:
406
307
 
407
- ```typescript
408
- class Schema extends schemaFactory.array("x", schemaFactory.number) {}
308
+ 1. Release an application version which understands documents written with the new format but doesn't attempt to upgrade any documents
309
+ 2. Wait for this application version to saturate in the app's ecosystem
310
+ 3. Release an application version which upgrades documents to start leveraging the new format.
409
311
 
410
- // Existing support
411
- const _fromIterable: Schema = new Schema([]);
312
+ However, this process can be cumbersome for application authors: for many types of changes, an app author doesn't particularly care if older application code collaborates with newer code, as the only downside is that the older application version might not present a fully faithful experience.
313
+ As an example, consider an application which renders circles on a canvas (similar to what is presented [here](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md)).
314
+ The application author might anticipate adding support to render the circle with various different other properties (border style, border width, background color, varying radius, etc.).
315
+ Therefore, they should declare their schema using `SchemaFactoryObjectOptions.allowUnknownOptionalFields` like so:
412
316
 
413
- // New
414
- const _fromUndefined: Schema = new Schema(undefined);
415
- const _fromNothing: Schema = new Schema();
416
- ```
317
+ ```typescript
318
+ import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
319
+ // "Old" application code/schema
320
+ const factory = new SchemaFactoryAlpha("Geometry");
321
+ class Circle extends factory.object(
322
+ "Circle",
323
+ {
324
+ x: factory.number,
325
+ y: factory.number,
326
+ },
327
+ { allowUnknownOptionalFields: true },
328
+ ) {}
329
+ ```
330
+
331
+ Later, they add some of these features to their application:
332
+
333
+ ```typescript
334
+ import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
335
+ // "New" application code/schema
336
+ const factory = new SchemaFactoryAlpha("Geometry");
337
+ class Circle extends factory.object(
338
+ "Circle",
339
+ {
340
+ x: factory.number,
341
+ y: factory.number,
342
+ // Note that radius and color must both be declared as optional fields since this application must
343
+ // support opening up existing documents that didn't have this information.
344
+ radius: factory.optional(factory.number),
345
+ color: factory.optional(factory.string), // ex: #00FF00
346
+ },
347
+ { allowUnknownOptionalFields: true },
348
+ ) {}
349
+ ```
417
350
 
418
- ```typescript
419
- class Schema extends schemaFactory.map("x", schemaFactory.number) {}
351
+ When they go to deploy this newer version of the application, they could opt to start upgrading documents as soon as the newer code is rolled out, and the older code would still be able to open up (and collaborate on) documents using the newer schema version.
352
+ Note that it's only important that the old _application code_ elected to allow opening documents with unknown optional fields.
353
+ This policy is not persisted into documents in any form, so applications are free to modify it at any point.
420
354
 
421
- // Existing support
422
- const _fromIterable: Schema = new Schema([]);
423
- const _fromObject: Schema = new Schema({});
355
+ For specific API details, see documentation on `SchemaFactoryObjectOptions.allowUnknownOptionalFields`.
356
+ For a more thorough discussion of this topic, see [Schema Evolvability](https://github.com/microsoft/FluidFramework/tree/main/packages/dds/tree#schema-evolvability) in the SharedTree README.
424
357
 
425
- // New
426
- const _fromUndefined: Schema = new Schema(undefined);
427
- const _fromNothing: Schema = new Schema();
428
- ```
358
+ ## 2.12.0
429
359
 
430
- ```typescript
431
- const Schema = schemaFactory.array(schemaFactory.number);
432
- type Schema = NodeFromSchema<typeof Schema>;
360
+ Dependency updates only.
433
361
 
434
- // Existing support
435
- const _fromIterable: Schema = Schema.create([]);
362
+ ## 2.11.0
436
363
 
437
- // New
438
- const _fromUndefined: Schema = Schema.create(undefined);
439
- const _fromNothing: Schema = Schema.create();
440
- ```
364
+ ### Minor Changes
441
365
 
442
- ```typescript
443
- const Schema = schemaFactory.map(schemaFactory.number);
444
- type Schema = NodeFromSchema<typeof Schema>;
445
- // Existing support
446
- const _fromIterable: Schema = Schema.create([]);
447
- const _fromObject: Schema = Schema.create({});
366
+ - Revertible objects can now be cloned using `RevertibleAlpha.clone()` ([#23044](https://github.com/microsoft/FluidFramework/pull/23044)) [5abfa015af](https://github.com/microsoft/FluidFramework/commit/5abfa015aff9d639d82830f3ad828324d5680bd7)
448
367
 
449
- // New
450
- const _fromUndefined: Schema = Schema.create(undefined);
451
- const _fromNothing: Schema = Schema.create();
452
- ```
368
+ The `DisposableRevertible` interface has been replaced with `RevertibleAlpha`. The new `RevertibleAlpha` interface extends `Revertible` and includes a `clone(branch: TreeBranch)` method to facilitate cloning a Revertible to a specified target branch. The source branch where the `RevertibleAlpha` was created must share revision logs with the target branch where the `RevertibleAlpha` is being cloned. If this condition is not met, the operation will throw an error.
453
369
 
454
- - Typing has been improved when an exact TypeScript type for a schema is not provided ([#22763](https://github.com/microsoft/FluidFramework/pull/22763)) [05197d6d3f](https://github.com/microsoft/FluidFramework/commit/05197d6d3f0189ecd61fd74ec55f6836e6797249)
370
+ - Providing unused properties in object literals for building empty ObjectNodes no longer compiles ([#23162](https://github.com/microsoft/FluidFramework/pull/23162)) [dc3c30019e](https://github.com/microsoft/FluidFramework/commit/dc3c30019ef869b27b9468bff59f10434d3c5c68)
455
371
 
456
- The Tree APIs are designed to be used in a strongly typed way, with the full TypeScript type for the schema always being provided.
457
- Due to limitations of the TypeScript language, there was no practical way to prevent less descriptive types, like `TreeNodeSchema` or `ImplicitFieldSchema`, from being used where the type of a specific schema was intended.
458
- Code which does this will encounter several issues with tree APIs, and this change fixes some of those issues.
459
- This change mainly fixes that `NodeFromSchema<TreeNodeSchema>` used to return `unknown` and now returns `TreeNode | TreeLeafValue`.
372
+ ObjectNodes with no fields will now emit a compiler error if constructed from an object literal with fields.
373
+ This matches the behavior of non-empty ObjectNodes which already gave errors when unexpected properties were provided.
460
374
 
461
- This change by itself seems mostly harmless, as it just improves the precision of the typing in this one edge case.
462
- Unfortunately, there are other typing bugs which complicate the situation, causing APIs for inserting data into the tree to also behave poorly when given non-specific types like `TreeNodeSchema`.
463
- These APIs include cases like `TreeView.initialize`.
375
+ ```typescript
376
+ class A extends schemaFactory.object("A", {}) {}
377
+ const a = new A({ thisDoesNotExist: 5 }); // This now errors.
378
+ ```
464
379
 
465
- This incorrectly allowed some usage like taking a type-erased schema and initial tree pair, creating a view of type `TreeView<ImplicitFieldSchema>`, then initializing it.
466
- With the typing being partly fixed, some unsafe inputs are still allowed when trying to initialize such a view, but some are now prevented.
380
+ - The events library has been moved from the tree package ([#23141](https://github.com/microsoft/FluidFramework/pull/23141)) [cae07b5c8c](https://github.com/microsoft/FluidFramework/commit/cae07b5c8c7904184b5fbf8c677f302da19cc697)
467
381
 
468
- This use-case of modifying trees in code not that is not strongly typed by the exact schema was not intended to be supported.
469
- Despite this, it did mostly work in some cases, and has some real use-cases (like tests looping over test data consisting of pairs of schema and initial trees).
470
- To help mitigate the impact of this change, some experimental `@alpha` APIs have been introduced to help address these previously unsupported but somewhat working use-cases.
382
+ In previous releases, the `@fluidframework/tree` package contained an internal events library. The events-related types and interfaces have been moved to
383
+ `@fluidframework/core-interfaces`, while the implementation has been relocated to `@fluid-internal/client-utils`. There are
384
+ no changes to how the events library is used; the relocation simply organizes the library into more appropriate
385
+ packages. This change should have no impact on developers using the Fluid Framework.
471
386
 
472
- Before this change:
387
+ ## 2.10.0
473
388
 
474
- ```typescript
475
- import { TinyliciousClient } from "@fluidframework/tinylicious-client";
476
- import {
477
- SchemaFactory,
478
- SharedTree,
479
- TreeViewConfiguration,
480
- type TreeNodeSchema,
481
- } from "fluid-framework";
482
-
483
- // Create a ITree instance
484
- const tinyliciousClient = new TinyliciousClient();
485
- const { container } = await tinyliciousClient.createContainer({ initialObjects: {} }, "2");
486
- const tree = await container.create(SharedTree);
389
+ ### Minor Changes
487
390
 
488
- const schemaFactory = new SchemaFactory("demo");
489
-
490
- // Bad: This loses the schema aware type information. `: TreeNodeSchema` should be omitted to preserve strong typing.
491
- const schema: TreeNodeSchema = schemaFactory.array(schemaFactory.number);
492
- const config = new TreeViewConfiguration({ schema });
391
+ - Fix typing bug in `adaptEnum` and `enumFromStrings` ([#23077](https://github.com/microsoft/FluidFramework/pull/23077)) [cfb68388cb](https://github.com/microsoft/FluidFramework/commit/cfb68388cb6b88a0ef670633b3afa46a82c99972)
493
392
 
494
- // This view is typed as `TreeView<TreeNodeSchema>`, which does not work well since it's missing the actual schema type information.
495
- const view = tree.viewWith(config);
496
- // Root is typed as `unknown` allowing invalid assignment operations.
497
- view.root = "invalid";
498
- view.root = {};
499
- // Since all assignments are allowed, valid ones still work:
500
- view.root = [];
501
- ```
502
-
503
- After this change:
504
-
505
- ```typescript
506
- // Root is now typed as `TreeNode | TreeLeafValue`, still allowing some invalid assignment operations.
507
- // In the future this should be prevented as well, since the type of the setter in this case should be `never`.
508
- view.root = "invalid";
509
- // This no longer compiles:
510
- view.root = {};
511
- // This also no longer compiles despite being valid at runtime:
512
- view.root = [];
513
- ```
514
-
515
- For code that wants to continue using an unsafe API, which can result in runtime errors if the data does not follow the schema, a new alternative has been added to address this use-case. A special type `UnsafeUnknownSchema` can now be used to opt into allowing all valid trees to be provided.
516
- Note that this leaves ensuring the data is in schema up to the user.
517
- For now these adjusted APIs can be accessed by casting the view to `TreeViewAlpha<UnsafeUnknownSchema>`.
518
- If stabilized, this option will be added to `TreeView` directly.
519
-
520
- ```typescript
521
- const viewAlpha = view as TreeViewAlpha<UnsafeUnknownSchema>;
522
- viewAlpha.initialize([]);
523
- viewAlpha.root = [];
524
- ```
525
-
526
- Additionally, this seems to have negatively impacted co-recursive schema which declare a co-recursive array as the first schema in the co-recursive cycle.
527
- Like the TypeScript language our schema system is built on, we don't guarantee exactly which recursive type will compile, but will do our best to ensure useful recursive schema can be created easily.
528
- In this case a slight change may be required to some recursive schema to get them to compile again:
529
-
530
- For example this schema used to compile:
531
-
532
- ```typescript
533
- class A extends sf.arrayRecursive("A", [() => B]) {}
534
- {
535
- type _check = ValidateRecursiveSchema<typeof A>;
536
- }
537
- // Used to work, but breaks in this update.
538
- class B extends sf.object("B", { x: A }) {}
539
- ```
393
+ When using the return value from [`adaptEnum`](https://fluidframework.com/docs/api/v2/tree#adaptenum-function) as a function, passing in a value who's type is a union no longer produced an incorrectly typed return value. This has been fixed.
540
394
 
541
- But now you must use the recursive functions like `objectRecursive` for types which are co-recursive with an array in some cases.
542
- In our example, it can be fixed as follows:
395
+ Additionally [`enumFromStrings`](https://fluidframework.com/docs/api/v2/tree#enumfromstrings-function) has improved the typing of its schema, ensuring the returned object's members have sufficiently specific types.
396
+ Part of this improvement was fixing the `.schema` property to be a tuple over each of the schema where it was previously a tuple of a single combined schema due to a bug.
543
397
 
544
- ```typescript
545
- class A extends sf.arrayRecursive("A", [() => B]) {}
546
- {
547
- type _check = ValidateRecursiveSchema<typeof A>;
548
- }
549
- // Fixed corecursive type, using "Recursive" method variant to declare schema.
550
- class B extends sf.objectRecursive("B", { x: A }) {}
551
- {
552
- type _check = ValidateRecursiveSchema<typeof B>;
553
- }
554
- ```
398
+ One side-effect of these fixes is that narrowing of the `value` field of a node typed from the `.schema` behaves slightly different, such that the node type is now a union instead of it being a single type with a `.value` that is a union.
399
+ This means that narrowing based on `.value` property narrows which node type you have, not just the value property.
400
+ This mainly matters when matching all cases like the switch statement below:
555
401
 
556
- Note: while the following pattern may still compile, we recommend using the previous pattern instead since the one below may break in the future.
402
+ ```typescript
403
+ const Mode = enumFromStrings(schema, ["Fun", "Bonus"]);
404
+ type Mode = TreeNodeFromImplicitAllowedTypes<typeof Mode.schema>;
405
+ const node = new Mode.Bonus() as Mode;
557
406
 
558
- ```typescript
559
- class B extends sf.objectRecursive("B", { x: [() => A] }) {}
560
- {
561
- type _check = ValidateRecursiveSchema<typeof B>;
407
+ switch (node.value) {
408
+ case "Fun": {
409
+ assert.fail();
562
410
  }
563
- // Works, for now, but not recommended.
564
- class A extends sf.array("A", B) {}
565
- ```
566
-
567
- - The strictness of input tree types when inexact schemas are provided has been improved ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
568
-
569
- Consider the following code where the type of the schema is not exactly specified:
411
+ case "Bonus": {
412
+ // This one runs
413
+ break;
414
+ }
415
+ default:
416
+ // Before this change, "node.value" was never here, now "node" is never.
417
+ unreachableCase(node);
418
+ }
419
+ ```
420
+
421
+ - SharedTree event listeners that implement `Listenable` now allow deregistration of event listeners via an `off()` function. ([#23046](https://github.com/microsoft/FluidFramework/pull/23046)) [c59225db03](https://github.com/microsoft/FluidFramework/commit/c59225db033a516ee20e459ae31567d97ce8776c)
422
+
423
+ The ability to deregister events via a callback returned by `on()` remains the same.
424
+ Both strategies will remain supported and consumers of SharedTree events may choose which method of deregistration they prefer in a given instance.
425
+
426
+ ```typescript
427
+ // The new behavior
428
+ function deregisterViaOff(view: TreeView<MySchema>): {
429
+ const listener = () => { /* ... */ };
430
+ view.events.on("commitApplied", listener); // Register
431
+ view.events.off("commitApplied", listener); // Deregister
432
+ }
433
+
434
+ // The existing behavior (still supported)
435
+ function deregisterViaCallback(view: TreeView<MySchema>): {
436
+ const off = view.events.on("commitApplied", () => { /* ... */ }); // Register
437
+ off(); // Deregister
438
+ }
439
+ ```
440
+
441
+ - Allow constructing recursive maps from objects ([#23070](https://github.com/microsoft/FluidFramework/pull/23070)) [0185a08c6f](https://github.com/microsoft/FluidFramework/commit/0185a08c6f8bf6e922a6467f11da049503c4d215)
442
+
443
+ Previously only non-recursive maps could be constructed from objects.
444
+ Now all maps nodes can constructed from objects:
445
+
446
+ ```typescript
447
+ class MapRecursive extends sf.mapRecursive("Map", [() => MapRecursive]) {}
448
+ {
449
+ type _check = ValidateRecursiveSchema<typeof MapRecursive>;
450
+ }
451
+ // New:
452
+ const fromObject = new MapRecursive({ x: new MapRecursive() });
453
+ // Existing:
454
+ const fromIterator = new MapRecursive([["x", new MapRecursive()]]);
455
+ const fromMap = new MapRecursive(new Map([["x", new MapRecursive()]]));
456
+ const fromNothing = new MapRecursive();
457
+ const fromUndefined = new MapRecursive(undefined);
458
+ ```
459
+
460
+ - Provide more comprehensive replacement to the `commitApplied` event ([#22977](https://github.com/microsoft/FluidFramework/pull/22977)) [e51c94da32](https://github.com/microsoft/FluidFramework/commit/e51c94da3248868de3c0c7fdce568cc425204155)
461
+
462
+ Adds a new `changed` event to the (currently alpha) `TreeBranchEvents` that replaces the `commitApplied` event on `TreeViewEvents`.
463
+ This new event is fired for both local and remote changes and maintains the existing functionality of `commitApplied` that is used for obtaining `Revertibles`.
570
464
 
571
- ```typescript
572
- const schemaFactory = new SchemaFactory("com.myApp");
573
- class A extends schemaFactory.object("A", {}) {}
574
- class B extends schemaFactory.array("B", schemaFactory.number) {}
465
+ ## 2.5.0
575
466
 
576
- // Gives imprecise type (typeof A | typeof B)[]. The desired precise type here is [typeof A, typeof B].
577
- const schema = [A, B];
467
+ ### Minor Changes
578
468
 
579
- const config = new TreeViewConfiguration({ schema });
580
- const view = sharedTree.viewWith(config);
469
+ - New! Alpha APIs for tree data import and export ([#22566](https://github.com/microsoft/FluidFramework/pull/22566)) [18a23e8816](https://github.com/microsoft/FluidFramework/commit/18a23e8816467f2ed0c9d6d8637b70d99aa48b7a)
581
470
 
582
- // Does not compile since setter for root is typed `never` due to imprecise schema.
583
- view.root = [];
584
- ```
471
+ A collection of new `@alpha` APIs for importing and exporting tree content and schema from SharedTrees has been added to `TreeAlpha`.
472
+ These include import and export APIs for `VerboseTree`, `ConciseTree` and compressed tree formats.
585
473
 
586
- The assignment of `view.root` is disallowed since a schema with type `(typeof A | typeof B)[]` could be any of:
474
+ `TreeAlpha.create` is also added to allow constructing trees with a more general API instead of having to use the schema constructor directly (since that doesn't handle polymorphic roots, or non-schema aware code).
587
475
 
588
- ```typescript
589
- const schema: (typeof A | typeof B)[] = [A];
590
- ```
476
+ The function `independentInitializedView` has been added to provide a way to combine data from the existing `extractPersistedSchema` and new `TreeAlpha.exportCompressed` back into a `TreeView` in a way which can support safely importing data which could have been exported with a different schema.
477
+ This allows replicating the schema evolution process for Fluid documents stored in a service, but entirely locally without involving any collaboration services.
478
+ `independentView` has also been added, which is similar but handles the case of creating a new view without an existing schema or tree.
591
479
 
592
- ```typescript
593
- const schema: (typeof A | typeof B)[] = [B];
594
- ```
480
+ Together these APIs address several use-cases:
595
481
 
596
- ```typescript
597
- const schema: (typeof A | typeof B)[] = [A, B];
598
- ```
482
+ 1. Using SharedTree as an in-memory non-collaborative datastore.
483
+ 2. Importing and exporting data from a SharedTree to and from other services or storage locations (such as locally saved files).
484
+ 3. Testing various scenarios without relying on a service.
485
+ 4. Using SharedTree libraries for just the schema system and encode/decode support.
599
486
 
600
- The attempted assignment is not compatible with all of these (specifically it is incompatible with the first one) so performing this assignment could make the tree out of schema and is thus disallowed.
487
+ - Compilation no longer fails when building with TypeScript's libCheck option ([#22923](https://github.com/microsoft/FluidFramework/pull/22923)) [a1b4cdd45e](https://github.com/microsoft/FluidFramework/commit/a1b4cdd45ee9812e2598ab8d2854333d26a06eb4)
601
488
 
602
- To avoid this ambiguity and capture the precise type of `[typeof A, typeof B]`, use one of the following patterns:
489
+ When compiling code using Fluid Framework with TypeScript's `libCheck` (meaning without [skipLibCheck](https://www.typescriptlang.org/tsconfig/#skipLibCheck)), two compile errors can be encountered:
603
490
 
604
- ```typescript
605
- const schema = [A, B] as const;
606
- const config = new TreeViewConfiguration({ schema });
607
- ```
491
+ ```
492
+ > tsc
608
493
 
609
- ```typescript
610
- const config = new TreeViewConfiguration({ schema: [A, B] });
611
- ```
494
+ node_modules/@fluidframework/merge-tree/lib/client.d.ts:124:18 - error TS2368: Type parameter name cannot be 'undefined'.
612
495
 
613
- To help update existing code which accidentally depended on this bug, an `@alpha` API `unsafeArrayToTuple` has been added.
614
- Many usages of this API will produce incorrectly typed outputs.
615
- However, when given `AllowedTypes` arrays which should not contain any unions, but that were accidentally flattened to a single union, it can fix them:
496
+ 124 walkSegments<undefined>(handler: ISegmentAction<undefined>, start?: number, end?: number, accum?: undefined, splitRange?: boolean): void;
497
+ ~~~~~~~~~
616
498
 
617
- ```typescript
618
- // Gives imprecise type (typeof A | typeof B)[]
619
- const schemaBad = [A, B];
620
- // Fixes the type to be [typeof A, typeof B]
621
- const schema = unsafeArrayToTuple(schemaBad);
499
+ node_modules/@fluidframework/tree/lib/util/utils.d.ts:5:29 - error TS7016: Could not find a declaration file for module '@ungap/structured-clone'. 'node_modules/@ungap/structured-clone/esm/index.js' implicitly has an 'any' type.
500
+ Try `npm i --save-dev @types/ungap__structured-clone` if it exists or add a new declaration (.d.ts) file containing `declare module '@ungap/structured-clone';`
622
501
 
623
- const config = new TreeViewConfiguration({ schema });
624
- ```
502
+ 5 import structuredClone from "@ungap/structured-clone";
503
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
504
+ ```
625
505
 
626
- - SharedTree branching API has been improved ([#22970](https://github.com/microsoft/FluidFramework/pull/22970)) [80ed0284f0](https://github.com/microsoft/FluidFramework/commit/80ed0284f01107d2ba8bcf2f3ebaf6175367603a)
506
+ The first error impacts projects using TypeScript 5.5 or greater and either of the `fluid-framework` or `@fluidframework/merge-tree` packages.
507
+ The second error impacts projects using the `noImplicitAny` tsconfig setting and the `fluid-framework` or `@fluidframework/tree` packages.
627
508
 
628
- The alpha SharedTree branching API has been updated to be more accessible and intuitive.
629
- The branching functions (`branch`, `merge`, `rebaseOnto`, etc.) are now directly available on the view object rather than a separate object.
630
- In particular, `TreeViewAlpha` is now a `TreeBranch`, which exposes the methods to coordinate branches.
509
+ Both errors have been fixed.
631
510
 
632
- The existing `TreeBranch` type has been renamed to `BranchableTree` and is now **deprecated**.
511
+ This should allow `libCheck` to be reenabled in any impacted projects.
633
512
 
634
- See the `TreeBranch` interface for more details.
513
+ - A `.schema` member has been added to the alpha enum schema APIs ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
635
514
 
636
- The new API is used e.g. as follows:
515
+ The return value from `@alpha` APIs `enumFromStrings` and `adaptEnum` now has a property named `schema` which can be used to include it in a parent schema.
516
+ This replaces the use of `typedObjectValues` which has been removed.
637
517
 
638
- ```typescript
639
- const sf = new SchemaFactory("example");
640
- class StringArray extends sf.array("StringArray", sf.string) {}
518
+ Use of these APIs now look like:
641
519
 
642
- function example(view: TreeViewAlpha<typeof StringArray>): void {
643
- // Create a branch
644
- const branch = view.fork();
645
- // Modify the branch rather than the main view
646
- branch.root.insertAtEnd("new string");
647
- // `view` does not yet contain "new string"
648
- // ...
649
- // Later, merge the branch into the main view
650
- view.merge(branch);
651
- // `view` now contains "new string"
652
- }
653
- ```
654
-
655
- Here is the equivalent behavior with the previous API, for reference:
656
-
657
- ```typescript
658
- const sf = new SchemaFactory("example");
659
- class StringArray extends sf.array("StringArray", sf.string) {}
660
-
661
- function example(view: TreeViewAlpha<typeof StringArray>): void {
662
- // Get the branch for the view
663
- const branch = getBranch(view);
664
- const fork = branch.branch();
665
- // Modify the branch rather than the main view
666
- fork.root.insertAtEnd("new string");
667
- // `view` does not yet contain "new string"
668
- // ...
669
- // Later, merge the branch into the main view
670
- branch.merge(fork);
671
- // `view` now contains "new string"
672
- }
673
- ```
520
+ ```typescript
521
+ const schemaFactory = new SchemaFactory("com.myApp");
522
+ const Mode = enumFromStrings(schemaFactory, ["Fun", "Cool"]);
523
+ type Mode = NodeFromSchema<(typeof Mode.schema)[number]>;
524
+ class Parent extends schemaFactory.object("Parent", { mode: Mode.schema }) {}
525
+ ```
674
526
 
675
- Additionally, there is a new API to acquire the branch from a node:
527
+ Previously, the last two lines would have been:
676
528
 
677
- ```typescript
678
- // All nodes that have been inserted into the tree belong to a branch - this retrieves that branch
679
- const branch = TreeAlpha.branch(node);
680
- ```
529
+ ```typescript
530
+ type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>; // This no longer works
531
+ class Parent extends schemaFactory.object("Parent", {
532
+ mode: typedObjectValues(Mode),
533
+ }) {} // This no longer works
534
+ ```
681
535
 
682
- To convert the branch object to a view with a known schema, use:
536
+ - TreeNodeSchemaClass now specifies its TNode as TreeNode ([#22938](https://github.com/microsoft/FluidFramework/pull/22938)) [b669a6efdb](https://github.com/microsoft/FluidFramework/commit/b669a6efdba685c71897cade4f907304f1a73910)
683
537
 
684
- ```typescript
685
- if (branch.hasRootSchema(MySchema)) {
686
- const view = branch; // `branch` is now typed as a `TreeViewAlpha<MySchema>`
687
- }
688
- ```
538
+ `TreeNodeSchemaClass`'s `TNode` parameter was formerly `unknown` and has been improved to be the more specific `TreeNode | TreeLeafValue`.
539
+ This change further narrows this to `TreeNode`.
689
540
 
690
- Use the following function to expose the alpha APIs on a `TreeView` that is not typed as a `TreeViewAlpha`:
541
+ `TreeNodeSchema`, which is more commonly used, still permits `TNode` of `TreeNode | TreeLeafValue`, so this change should have little impact on most code, but in some edge cases it can result in slightly more specific typing.
691
542
 
692
- ```typescript
693
- const viewAlpha = asTreeViewAlpha(view);
694
- ```
543
+ - Array and Map nodes can now be explicitly constructed with undefined or no argument ([#22946](https://github.com/microsoft/FluidFramework/pull/22946)) [176335ce88](https://github.com/microsoft/FluidFramework/commit/176335ce88d005159819c559b445a1655ec429d5)
695
544
 
696
- ## 2.4.0
545
+ The input parameter to the constructor and `create` methods of Array and Map nodes is now optional. When the optional parameter is omitted, an empty map or array will be created.
697
546
 
698
- ### Minor Changes
547
+ #### Examples
699
548
 
700
- - ✨ New! Alpha API for providing SharedTree configuration options ([#22701](https://github.com/microsoft/FluidFramework/pull/22701)) [40d3648ddf](https://github.com/microsoft/FluidFramework/commit/40d3648ddfb5223ef6daef49a4f5cab1cfa52b71)
701
-
702
- A new alpha `configuredSharedTree` had been added.
703
- This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
704
- The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
705
-
706
- ```typescript
707
- import {
708
- ForestType,
709
- TreeCompressionStrategy,
710
- configuredSharedTree,
711
- typeboxValidator,
712
- } from "@fluid-framework/alpha";
713
- // Maximum debuggability and validation enabled:
714
- const SharedTree = configuredSharedTree({
715
- forest: ForestType.Expensive,
716
- jsonValidator: typeboxValidator,
717
- treeEncodeType: TreeCompressionStrategy.Uncompressed,
718
- });
719
- // Opts into the under development optimized tree storage planned to be the eventual default implementation:
720
- const SharedTree = configuredSharedTree({
721
- forest: ForestType.Optimized,
722
- });
723
- ```
724
-
725
- - ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
726
-
727
- `extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
728
- This can be used write tests which snapshot an applications schema.
729
- Such tests can be used to detect schema changes which could would impact document compatibility,
730
- and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
731
-
732
- - Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
733
-
734
- Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
735
- This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
736
-
737
- - Expose the view schema from the TreeView interface ([#22547](https://github.com/microsoft/FluidFramework/pull/22547)) [2aa29d9a13](https://github.com/microsoft/FluidFramework/commit/2aa29d9a13f099b129ec6834c8cbdaf6a25db114)
738
-
739
- Users of TreeView can now access the type-safe view schema directly on the view object via `TreeView.schema`.
740
- This allows users to avoid passing the schema around in addition to the view in scenarios where both are needed.
741
- It also avoids scenarios in which code wants to accept both a view and its schema and thus must constrain both to be of the same schema type.
742
-
743
- - Metadata can now be associated with Field Schema ([#22564](https://github.com/microsoft/FluidFramework/pull/22564)) [1d9f4c97ed](https://github.com/microsoft/FluidFramework/commit/1d9f4c97edf3f2bbf23ca30c35b67f0ec38b728d)
744
-
745
- Users of TreeView can now specify metadata when creating Field Schema.
746
- This includes system-understood metadata, i.e., `description`.
747
-
748
- Example:
749
-
750
- ```typescript
751
- class Point extends schemaFactory.object("Point", {
752
- x: schemaFactory.required(schemaFactory.number, {
753
- metadata: { description: "The horizontal component of the point." },
754
- }),
755
- y: schemaFactory.required(schemaFactory.number, {
756
- metadata: { description: "The vertical component of the point." },
757
- }),
758
- }) {}
759
- ```
760
-
761
- Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) (`getJsonSchema`) can leverage such system-understood metadata to generate useful information.
762
- In the case of the `description` property, this is mapped directly to the `description` property supported by JSON Schema.
763
-
764
- Custom, user-defined properties can also be specified.
765
- These properties will not be leveraged by the system by default, but can be used as a handy means of associating common application-specific properties with Field Schema.
766
-
767
- Example:
768
-
769
- An application is implementing search functionality.
770
- By default, the app author wishes for all app content to be indexable by search, unless otherwise specified.
771
- They can leverage schema metadata to decorate fields that should be ignored by search, and leverage that information when walking the tree during a search.
772
-
773
- ```typescript
774
-
775
- interface AppMetadata {
776
- /**
777
- * Whether or not the field should be ignored by search.
778
- * @defaultValue `false`
779
- */
780
- searchIgnore?: boolean;
781
- }
549
+ ```typescript
550
+ class Schema extends schemaFactory.array("x", schemaFactory.number) {}
782
551
 
783
- class Note extends schemaFactory.object("Note", {
784
- position: schemaFactory.required(Point, {
785
- metadata: {
786
- description: "The position of the upper-left corner of the note."
787
- custom: {
788
- // Search doesn't care where the note is on the canvas.
789
- // It only cares about the text content.
790
- searchIgnore: true
791
- }
792
- }
793
- }),
794
- text: schemaFactory.required(schemaFactory.string, {
795
- metadata: {
796
- description: "The textual contents of the note."
797
- }
798
- }),
799
- }) {}
800
-
801
- ```
802
-
803
- Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
804
-
805
- - ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
806
-
807
- Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
808
- Use the `getBranch` entry point function to acquire a branch.
809
- For example:
810
-
811
- ```ts
812
- function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
813
- mainView.root.myData = 3;
814
- const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
815
- const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
816
- const forkView = forkBranch.viewWith(new TreeViewConfiguration({ schema: MySchema })); // Acquire a view of the forked branch in order to read or edit its tree.
817
- forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
818
- mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
819
-
820
- // Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
821
- // To prevent this, use `mainBranch.merge(forkBranch, false)`.
822
- }
823
- ```
552
+ // Existing support
553
+ const _fromIterable: Schema = new Schema([]);
824
554
 
825
- Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
826
- commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
827
- about revertible support in the branching APIs.
555
+ // New
556
+ const _fromUndefined: Schema = new Schema(undefined);
557
+ const _fromNothing: Schema = new Schema();
558
+ ```
828
559
 
829
- - Unhydrated SharedTree nodes now emit change events when edited ([#22661](https://github.com/microsoft/FluidFramework/pull/22661)) [d1eade6547](https://github.com/microsoft/FluidFramework/commit/d1eade65477a4e7fb1f8062cb83dfa03a8b1d800)
560
+ ```typescript
561
+ class Schema extends schemaFactory.map("x", schemaFactory.number) {}
830
562
 
831
- Newly-created SharedTree nodes which have not yet been inserted into the tree will now emit `nodeChanged` and `treeChanged` events when they are mutated via editing operations.
563
+ // Existing support
564
+ const _fromIterable: Schema = new Schema([]);
565
+ const _fromObject: Schema = new Schema({});
832
566
 
833
- ```ts
834
- const node = new Foo({ foo: 3 });
835
- Tree.on(node, "nodeChanged", () => {
836
- console.log("This will fire even before node is inserted!");
837
- });
567
+ // New
568
+ const _fromUndefined: Schema = new Schema(undefined);
569
+ const _fromNothing: Schema = new Schema();
570
+ ```
838
571
 
839
- node.foo = 4; // log: "This will fire even before node is inserted!";
840
- ```
572
+ ```typescript
573
+ const Schema = schemaFactory.array(schemaFactory.number);
574
+ type Schema = NodeFromSchema<typeof Schema>;
841
575
 
842
- - SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
576
+ // Existing support
577
+ const _fromIterable: Schema = Schema.create([]);
843
578
 
844
- `RestrictiveReadonlyRecord` was an attempt to implement a version of TypeScript's built-in `Record<TKey, TValue>` type that would prohibit (instead of leaving unrestricted like Record does) values under keys that do not extend `TKey`.
579
+ // New
580
+ const _fromUndefined: Schema = Schema.create(undefined);
581
+ const _fromNothing: Schema = Schema.create();
582
+ ```
845
583
 
846
- The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
847
- Fixing this bug appears to be impossible within the current limitation of TypeScript, however this library does not require any case other than `TKey` being exactly `string`.
584
+ ```typescript
585
+ const Schema = schemaFactory.map(schemaFactory.number);
586
+ type Schema = NodeFromSchema<typeof Schema>;
587
+ // Existing support
588
+ const _fromIterable: Schema = Schema.create([]);
589
+ const _fromObject: Schema = Schema.create({});
848
590
 
849
- To reduce the risk of users of the tree library using the problematic `RestrictiveReadonlyRecord` type, it has been deprecated and replaced with a more specific type that avoids the bug, `RestrictiveStringRecord<TValue>`.
591
+ // New
592
+ const _fromUndefined: Schema = Schema.create(undefined);
593
+ const _fromNothing: Schema = Schema.create();
594
+ ```
595
+
596
+ - Typing has been improved when an exact TypeScript type for a schema is not provided ([#22763](https://github.com/microsoft/FluidFramework/pull/22763)) [05197d6d3f](https://github.com/microsoft/FluidFramework/commit/05197d6d3f0189ecd61fd74ec55f6836e6797249)
597
+
598
+ The Tree APIs are designed to be used in a strongly typed way, with the full TypeScript type for the schema always being provided.
599
+ Due to limitations of the TypeScript language, there was no practical way to prevent less descriptive types, like `TreeNodeSchema` or `ImplicitFieldSchema`, from being used where the type of a specific schema was intended.
600
+ Code which does this will encounter several issues with tree APIs, and this change fixes some of those issues.
601
+ This change mainly fixes that `NodeFromSchema<TreeNodeSchema>` used to return `unknown` and now returns `TreeNode | TreeLeafValue`.
602
+
603
+ This change by itself seems mostly harmless, as it just improves the precision of the typing in this one edge case.
604
+ Unfortunately, there are other typing bugs which complicate the situation, causing APIs for inserting data into the tree to also behave poorly when given non-specific types like `TreeNodeSchema`.
605
+ These APIs include cases like `TreeView.initialize`.
606
+
607
+ This incorrectly allowed some usage like taking a type-erased schema and initial tree pair, creating a view of type `TreeView<ImplicitFieldSchema>`, then initializing it.
608
+ With the typing being partly fixed, some unsafe inputs are still allowed when trying to initialize such a view, but some are now prevented.
609
+
610
+ This use-case of modifying trees in code not that is not strongly typed by the exact schema was not intended to be supported.
611
+ Despite this, it did mostly work in some cases, and has some real use-cases (like tests looping over test data consisting of pairs of schema and initial trees).
612
+ To help mitigate the impact of this change, some experimental `@alpha` APIs have been introduced to help address these previously unsupported but somewhat working use-cases.
613
+
614
+ Before this change:
615
+
616
+ ```typescript
617
+ import { TinyliciousClient } from "@fluidframework/tinylicious-client";
618
+ import {
619
+ SchemaFactory,
620
+ SharedTree,
621
+ TreeViewConfiguration,
622
+ type TreeNodeSchema,
623
+ } from "fluid-framework";
624
+
625
+ // Create a ITree instance
626
+ const tinyliciousClient = new TinyliciousClient();
627
+ const { container } = await tinyliciousClient.createContainer(
628
+ { initialObjects: {} },
629
+ "2",
630
+ );
631
+ const tree = await container.create(SharedTree);
632
+
633
+ const schemaFactory = new SchemaFactory("demo");
634
+
635
+ // Bad: This loses the schema aware type information. `: TreeNodeSchema` should be omitted to preserve strong typing.
636
+ const schema: TreeNodeSchema = schemaFactory.array(schemaFactory.number);
637
+ const config = new TreeViewConfiguration({ schema });
638
+
639
+ // This view is typed as `TreeView<TreeNodeSchema>`, which does not work well since it's missing the actual schema type information.
640
+ const view = tree.viewWith(config);
641
+ // Root is typed as `unknown` allowing invalid assignment operations.
642
+ view.root = "invalid";
643
+ view.root = {};
644
+ // Since all assignments are allowed, valid ones still work:
645
+ view.root = [];
646
+ ```
647
+
648
+ After this change:
649
+
650
+ ```typescript
651
+ // Root is now typed as `TreeNode | TreeLeafValue`, still allowing some invalid assignment operations.
652
+ // In the future this should be prevented as well, since the type of the setter in this case should be `never`.
653
+ view.root = "invalid";
654
+ // This no longer compiles:
655
+ view.root = {};
656
+ // This also no longer compiles despite being valid at runtime:
657
+ view.root = [];
658
+ ```
659
+
660
+ For code that wants to continue using an unsafe API, which can result in runtime errors if the data does not follow the schema, a new alternative has been added to address this use-case. A special type `UnsafeUnknownSchema` can now be used to opt into allowing all valid trees to be provided.
661
+ Note that this leaves ensuring the data is in schema up to the user.
662
+ For now these adjusted APIs can be accessed by casting the view to `TreeViewAlpha<UnsafeUnknownSchema>`.
663
+ If stabilized, this option will be added to `TreeView` directly.
664
+
665
+ ```typescript
666
+ const viewAlpha = view as TreeViewAlpha<UnsafeUnknownSchema>;
667
+ viewAlpha.initialize([]);
668
+ viewAlpha.root = [];
669
+ ```
670
+
671
+ Additionally, this seems to have negatively impacted co-recursive schema which declare a co-recursive array as the first schema in the co-recursive cycle.
672
+ Like the TypeScript language our schema system is built on, we don't guarantee exactly which recursive type will compile, but will do our best to ensure useful recursive schema can be created easily.
673
+ In this case a slight change may be required to some recursive schema to get them to compile again:
674
+
675
+ For example this schema used to compile:
676
+
677
+ ```typescript
678
+ class A extends sf.arrayRecursive("A", [() => B]) {}
679
+ {
680
+ type _check = ValidateRecursiveSchema<typeof A>;
681
+ }
682
+ // Used to work, but breaks in this update.
683
+ class B extends sf.object("B", { x: A }) {}
684
+ ```
685
+
686
+ But now you must use the recursive functions like `objectRecursive` for types which are co-recursive with an array in some cases.
687
+ In our example, it can be fixed as follows:
688
+
689
+ ```typescript
690
+ class A extends sf.arrayRecursive("A", [() => B]) {}
691
+ {
692
+ type _check = ValidateRecursiveSchema<typeof A>;
693
+ }
694
+ // Fixed corecursive type, using "Recursive" method variant to declare schema.
695
+ class B extends sf.objectRecursive("B", { x: A }) {}
696
+ {
697
+ type _check = ValidateRecursiveSchema<typeof B>;
698
+ }
699
+ ```
700
+
701
+ Note: while the following pattern may still compile, we recommend using the previous pattern instead since the one below may break in the future.
702
+
703
+ ```typescript
704
+ class B extends sf.objectRecursive("B", { x: [() => A] }) {}
705
+ {
706
+ type _check = ValidateRecursiveSchema<typeof B>;
707
+ }
708
+ // Works, for now, but not recommended.
709
+ class A extends sf.array("A", B) {}
710
+ ```
711
+
712
+ - The strictness of input tree types when inexact schemas are provided has been improved ([#22874](https://github.com/microsoft/FluidFramework/pull/22874)) [645b9ed695](https://github.com/microsoft/FluidFramework/commit/645b9ed69540338843ad14f1144ff4d1f80d6f09)
713
+
714
+ Consider the following code where the type of the schema is not exactly specified:
715
+
716
+ ```typescript
717
+ const schemaFactory = new SchemaFactory("com.myApp");
718
+ class A extends schemaFactory.object("A", {}) {}
719
+ class B extends schemaFactory.array("B", schemaFactory.number) {}
720
+
721
+ // Gives imprecise type (typeof A | typeof B)[]. The desired precise type here is [typeof A, typeof B].
722
+ const schema = [A, B];
723
+
724
+ const config = new TreeViewConfiguration({ schema });
725
+ const view = sharedTree.viewWith(config);
726
+
727
+ // Does not compile since setter for root is typed `never` due to imprecise schema.
728
+ view.root = [];
729
+ ```
730
+
731
+ The assignment of `view.root` is disallowed since a schema with type `(typeof A | typeof B)[]` could be any of:
732
+
733
+ ```typescript
734
+ const schema: (typeof A | typeof B)[] = [A];
735
+ ```
736
+
737
+ ```typescript
738
+ const schema: (typeof A | typeof B)[] = [B];
739
+ ```
740
+
741
+ ```typescript
742
+ const schema: (typeof A | typeof B)[] = [A, B];
743
+ ```
744
+
745
+ The attempted assignment is not compatible with all of these (specifically it is incompatible with the first one) so performing this assignment could make the tree out of schema and is thus disallowed.
746
+
747
+ To avoid this ambiguity and capture the precise type of `[typeof A, typeof B]`, use one of the following patterns:
748
+
749
+ ```typescript
750
+ const schema = [A, B] as const;
751
+ const config = new TreeViewConfiguration({ schema });
752
+ ```
753
+
754
+ ```typescript
755
+ const config = new TreeViewConfiguration({ schema: [A, B] });
756
+ ```
757
+
758
+ To help update existing code which accidentally depended on this bug, an `@alpha` API `unsafeArrayToTuple` has been added.
759
+ Many usages of this API will produce incorrectly typed outputs.
760
+ However, when given `AllowedTypes` arrays which should not contain any unions, but that were accidentally flattened to a single union, it can fix them:
761
+
762
+ ```typescript
763
+ // Gives imprecise type (typeof A | typeof B)[]
764
+ const schemaBad = [A, B];
765
+ // Fixes the type to be [typeof A, typeof B]
766
+ const schema = unsafeArrayToTuple(schemaBad);
767
+
768
+ const config = new TreeViewConfiguration({ schema });
769
+ ```
770
+
771
+ - SharedTree branching API has been improved ([#22970](https://github.com/microsoft/FluidFramework/pull/22970)) [80ed0284f0](https://github.com/microsoft/FluidFramework/commit/80ed0284f01107d2ba8bcf2f3ebaf6175367603a)
772
+
773
+ The alpha SharedTree branching API has been updated to be more accessible and intuitive.
774
+ The branching functions (`branch`, `merge`, `rebaseOnto`, etc.) are now directly available on the view object rather than a separate object.
775
+ In particular, `TreeViewAlpha` is now a `TreeBranch`, which exposes the methods to coordinate branches.
776
+
777
+ The existing `TreeBranch` type has been renamed to `BranchableTree` and is now **deprecated**.
778
+
779
+ See the `TreeBranch` interface for more details.
780
+
781
+ The new API is used e.g. as follows:
782
+
783
+ ```typescript
784
+ const sf = new SchemaFactory("example");
785
+ class StringArray extends sf.array("StringArray", sf.string) {}
786
+
787
+ function example(view: TreeViewAlpha<typeof StringArray>): void {
788
+ // Create a branch
789
+ const branch = view.fork();
790
+ // Modify the branch rather than the main view
791
+ branch.root.insertAtEnd("new string");
792
+ // `view` does not yet contain "new string"
793
+ // ...
794
+ // Later, merge the branch into the main view
795
+ view.merge(branch);
796
+ // `view` now contains "new string"
797
+ }
798
+ ```
850
799
 
851
- To highlight that this new type is not intended for direct use by users of tree, and instead is just used as part of the typing of its public API, `RestrictiveStringRecord` has been tagged with `@system`.
852
- See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
800
+ Here is the equivalent behavior with the previous API, for reference:
853
801
 
854
- - Fix `.create` on structurally named MapNode and ArrayNode schema ([#22522](https://github.com/microsoft/FluidFramework/pull/22522)) [b3f91ae91c](https://github.com/microsoft/FluidFramework/commit/b3f91ae91cb750a6a7696ab5ea17c00895bb6d92)
802
+ ```typescript
803
+ const sf = new SchemaFactory("example");
804
+ class StringArray extends sf.array("StringArray", sf.string) {}
855
805
 
856
- Constructing a structurally named MapNode or ArrayNode schema (using the overload of `SchemaFactory.map` or `SchemaFactory.array` which does not take an explicit name), returned a `TreeNodeSchema` instead of a `TreeNodeSchemaNonClass`, which resulted in the `create` static method not being exposed.
857
- This has been fixed, and can now be used as follows:
806
+ function example(view: TreeViewAlpha<typeof StringArray>): void {
807
+ // Get the branch for the view
808
+ const branch = getBranch(view);
809
+ const fork = branch.branch();
810
+ // Modify the branch rather than the main view
811
+ fork.root.insertAtEnd("new string");
812
+ // `view` does not yet contain "new string"
813
+ // ...
814
+ // Later, merge the branch into the main view
815
+ branch.merge(fork);
816
+ // `view` now contains "new string"
817
+ }
818
+ ```
858
819
 
859
- ```typescript
860
- const MyMap = schemaFactory.map(schemaFactory.number);
861
- type MyMap = NodeFromSchema<typeof MyMap>;
862
- const _fromMap: MyMap = MyMap.create(new MyMap());
863
- const _fromIterable: MyMap = MyMap.create([]);
864
- const _fromObject: MyMap = MyMap.create({});
865
- ```
820
+ Additionally, there is a new API to acquire the branch from a node:
866
821
 
867
- This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
868
- While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
869
- ](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
870
- this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
871
- Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
872
- this change could break the build of packages exporting types referencing structurally named map and array schema.
873
- This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
874
- any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
822
+ ```typescript
823
+ // All nodes that have been inserted into the tree belong to a branch - this retrieves that branch
824
+ const branch = TreeAlpha.branch(node);
825
+ ```
875
826
 
876
- - Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
827
+ To convert the branch object to a view with a known schema, use:
877
828
 
878
- When reading non-leaf children which have been read previously, they are retrieved from cache faster.
879
- Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
880
- Overall this showed a roughly 5% speed up in a read heavy test application (the BubbleBench example) but gains are expected to vary a lot based on use-case.
829
+ ```typescript
830
+ if (branch.hasRootSchema(MySchema)) {
831
+ const view = branch; // `branch` is now typed as a `TreeViewAlpha<MySchema>`
832
+ }
833
+ ```
881
834
 
882
- - ✨ New! Alpha APIs for producing SharedTree schema from enums ([#20035](https://github.com/microsoft/FluidFramework/pull/20035)) [5f9bbe011a](https://github.com/microsoft/FluidFramework/commit/5f9bbe011a18ccac08a70340f6d20e60ce30c4a4)
835
+ Use the following function to expose the alpha APIs on a `TreeView` that is not typed as a `TreeViewAlpha`:
883
836
 
884
- `adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
885
- These unstable alpha APIs are relatively simple helpers on-top of public APIs (source: [schemaCreationUtilities.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/simple-tree/schemaCreationUtilities.ts)):
886
- thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
837
+ ```typescript
838
+ const viewAlpha = asTreeViewAlpha(view);
839
+ ```
887
840
 
888
- ## 2.3.0
841
+ ## 2.4.0
889
842
 
890
843
  ### Minor Changes
891
844
 
892
- - Add /alpha import path to @fluidframework/tree and fluid-framework packages ([#22483](https://github.com/microsoft/FluidFramework/pull/22483)) [12242cfdb5a](https://github.com/microsoft/FluidFramework/commit/12242cfdb5aa4c342cc62f11cbf1c072840bec44)
845
+ - New! Alpha API for providing SharedTree configuration options ([#22701](https://github.com/microsoft/FluidFramework/pull/22701)) [40d3648ddf](https://github.com/microsoft/FluidFramework/commit/40d3648ddfb5223ef6daef49a4f5cab1cfa52b71)
846
+
847
+ A new alpha `configuredSharedTree` had been added.
848
+ This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
849
+ The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
850
+
851
+ ```typescript
852
+ import {
853
+ ForestType,
854
+ TreeCompressionStrategy,
855
+ configuredSharedTree,
856
+ typeboxValidator,
857
+ } from "@fluid-framework/alpha";
858
+ // Maximum debuggability and validation enabled:
859
+ const SharedTree = configuredSharedTree({
860
+ forest: ForestType.Expensive,
861
+ jsonValidator: typeboxValidator,
862
+ treeEncodeType: TreeCompressionStrategy.Uncompressed,
863
+ });
864
+ // Opts into the under development optimized tree storage planned to be the eventual default implementation:
865
+ const SharedTree = configuredSharedTree({
866
+ forest: ForestType.Optimized,
867
+ });
868
+ ```
869
+
870
+ - ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
871
+
872
+ `extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
873
+ This can be used write tests which snapshot an applications schema.
874
+ Such tests can be used to detect schema changes which could would impact document compatibility,
875
+ and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
876
+
877
+ - Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
878
+
879
+ Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
880
+ This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
881
+
882
+ - Expose the view schema from the TreeView interface ([#22547](https://github.com/microsoft/FluidFramework/pull/22547)) [2aa29d9a13](https://github.com/microsoft/FluidFramework/commit/2aa29d9a13f099b129ec6834c8cbdaf6a25db114)
883
+
884
+ Users of TreeView can now access the type-safe view schema directly on the view object via `TreeView.schema`.
885
+ This allows users to avoid passing the schema around in addition to the view in scenarios where both are needed.
886
+ It also avoids scenarios in which code wants to accept both a view and its schema and thus must constrain both to be of the same schema type.
887
+
888
+ - Metadata can now be associated with Field Schema ([#22564](https://github.com/microsoft/FluidFramework/pull/22564)) [1d9f4c97ed](https://github.com/microsoft/FluidFramework/commit/1d9f4c97edf3f2bbf23ca30c35b67f0ec38b728d)
889
+
890
+ Users of TreeView can now specify metadata when creating Field Schema.
891
+ This includes system-understood metadata, i.e., `description`.
892
+
893
+ Example:
894
+
895
+ ```typescript
896
+ class Point extends schemaFactory.object("Point", {
897
+ x: schemaFactory.required(schemaFactory.number, {
898
+ metadata: { description: "The horizontal component of the point." },
899
+ }),
900
+ y: schemaFactory.required(schemaFactory.number, {
901
+ metadata: { description: "The vertical component of the point." },
902
+ }),
903
+ }) {}
904
+ ```
905
+
906
+ Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) (`getJsonSchema`) can leverage such system-understood metadata to generate useful information.
907
+ In the case of the `description` property, this is mapped directly to the `description` property supported by JSON Schema.
908
+
909
+ Custom, user-defined properties can also be specified.
910
+ These properties will not be leveraged by the system by default, but can be used as a handy means of associating common application-specific properties with Field Schema.
911
+
912
+ Example:
913
+
914
+ An application is implementing search functionality.
915
+ By default, the app author wishes for all app content to be indexable by search, unless otherwise specified.
916
+ They can leverage schema metadata to decorate fields that should be ignored by search, and leverage that information when walking the tree during a search.
917
+
918
+ ```typescript
919
+
920
+ interface AppMetadata {
921
+ /**
922
+ * Whether or not the field should be ignored by search.
923
+ * @defaultValue `false`
924
+ */
925
+ searchIgnore?: boolean;
926
+ }
927
+
928
+ class Note extends schemaFactory.object("Note", {
929
+ position: schemaFactory.required(Point, {
930
+ metadata: {
931
+ description: "The position of the upper-left corner of the note."
932
+ custom: {
933
+ // Search doesn't care where the note is on the canvas.
934
+ // It only cares about the text content.
935
+ searchIgnore: true
936
+ }
937
+ }
938
+ }),
939
+ text: schemaFactory.required(schemaFactory.string, {
940
+ metadata: {
941
+ description: "The textual contents of the note."
942
+ }
943
+ }),
944
+ }) {}
945
+
946
+ ```
947
+
948
+ Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
949
+
950
+ - ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
951
+
952
+ Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
953
+ Use the `getBranch` entry point function to acquire a branch.
954
+ For example:
955
+
956
+ ```ts
957
+ function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
958
+ mainView.root.myData = 3;
959
+ const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
960
+ const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
961
+ const forkView = forkBranch.viewWith(
962
+ new TreeViewConfiguration({ schema: MySchema }),
963
+ ); // Acquire a view of the forked branch in order to read or edit its tree.
964
+ forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
965
+ mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
893
966
 
894
- `@fluidframework/tree` and `fluid-framework` now have a `/alpha` import path where their `@alpha` APIs are exported.
967
+ // Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
968
+ // To prevent this, use `mainBranch.merge(forkBranch, false)`.
969
+ }
970
+ ```
895
971
 
896
- - Refactor code for emitting events to make it easier to copy into other projects ([#22275](https://github.com/microsoft/FluidFramework/pull/22275)) [49849bb5f6b](https://github.com/microsoft/FluidFramework/commit/49849bb5f6bf92765bc63e19cdaf4f7d0498bebc)
972
+ Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
973
+ commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
974
+ about revertible support in the branching APIs.
897
975
 
898
- Factored event emitting utilities into their own file, `events/emitter.ts`.
899
- Applications wishing to use SharedTree's eventing library for custom events can copy this file (and its referenced utility function) as a starting point for defining and emitting their own custom events.
900
- See `createEmitter`'s documentation for example usage.
976
+ - Unhydrated SharedTree nodes now emit change events when edited ([#22661](https://github.com/microsoft/FluidFramework/pull/22661)) [d1eade6547](https://github.com/microsoft/FluidFramework/commit/d1eade65477a4e7fb1f8062cb83dfa03a8b1d800)
901
977
 
902
- Currently there are no published or officially supported versions of these utilities, but they are relatively simple, and can be copied and customized as needed.
978
+ Newly-created SharedTree nodes which have not yet been inserted into the tree will now emit `nodeChanged` and `treeChanged` events when they are mutated via editing operations.
979
+
980
+ ```ts
981
+ const node = new Foo({ foo: 3 });
982
+ Tree.on(node, "nodeChanged", () => {
983
+ console.log("This will fire even before node is inserted!");
984
+ });
985
+
986
+ node.foo = 4; // log: "This will fire even before node is inserted!";
987
+ ```
988
+
989
+ - SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
990
+
991
+ `RestrictiveReadonlyRecord` was an attempt to implement a version of TypeScript's built-in `Record<TKey, TValue>` type that would prohibit (instead of leaving unrestricted like Record does) values under keys that do not extend `TKey`.
992
+
993
+ The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
994
+ Fixing this bug appears to be impossible within the current limitation of TypeScript, however this library does not require any case other than `TKey` being exactly `string`.
995
+
996
+ To reduce the risk of users of the tree library using the problematic `RestrictiveReadonlyRecord` type, it has been deprecated and replaced with a more specific type that avoids the bug, `RestrictiveStringRecord<TValue>`.
997
+
998
+ To highlight that this new type is not intended for direct use by users of tree, and instead is just used as part of the typing of its public API, `RestrictiveStringRecord` has been tagged with `@system`.
999
+ See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
1000
+
1001
+ - Fix `.create` on structurally named MapNode and ArrayNode schema ([#22522](https://github.com/microsoft/FluidFramework/pull/22522)) [b3f91ae91c](https://github.com/microsoft/FluidFramework/commit/b3f91ae91cb750a6a7696ab5ea17c00895bb6d92)
1002
+
1003
+ Constructing a structurally named MapNode or ArrayNode schema (using the overload of `SchemaFactory.map` or `SchemaFactory.array` which does not take an explicit name), returned a `TreeNodeSchema` instead of a `TreeNodeSchemaNonClass`, which resulted in the `create` static method not being exposed.
1004
+ This has been fixed, and can now be used as follows:
903
1005
 
904
- - Implicitly constructed object nodes now only consider own properties during validation ([#22453](https://github.com/microsoft/FluidFramework/pull/22453)) [27faa56f5ae](https://github.com/microsoft/FluidFramework/commit/27faa56f5ae334e0b65fdd84c75764645e64f063)
1006
+ ```typescript
1007
+ const MyMap = schemaFactory.map(schemaFactory.number);
1008
+ type MyMap = NodeFromSchema<typeof MyMap>;
1009
+ const _fromMap: MyMap = MyMap.create(new MyMap());
1010
+ const _fromIterable: MyMap = MyMap.create([]);
1011
+ const _fromObject: MyMap = MyMap.create({});
1012
+ ```
1013
+
1014
+ This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
1015
+ While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
1016
+ ](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
1017
+ this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
1018
+ Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
1019
+ this change could break the build of packages exporting types referencing structurally named map and array schema.
1020
+ This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
1021
+ any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
1022
+
1023
+ - Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
1024
+
1025
+ When reading non-leaf children which have been read previously, they are retrieved from cache faster.
1026
+ Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
1027
+ Overall this showed a roughly 5% speed up in a read heavy test application (the BubbleBench example) but gains are expected to vary a lot based on use-case.
1028
+
1029
+ - ✨ New! Alpha APIs for producing SharedTree schema from enums ([#20035](https://github.com/microsoft/FluidFramework/pull/20035)) [5f9bbe011a](https://github.com/microsoft/FluidFramework/commit/5f9bbe011a18ccac08a70340f6d20e60ce30c4a4)
1030
+
1031
+ `adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
1032
+ These unstable alpha APIs are relatively simple helpers on-top of public APIs (source: [schemaCreationUtilities.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/simple-tree/schemaCreationUtilities.ts)):
1033
+ thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
905
1034
 
906
- When determining if some given data is compatible with a particular ObjectNode schema, both inherited and own properties were considered.
907
- However, when constructing the node from this data, only own properties were used.
908
- This allowed input which provided required values in inherited fields to pass validation.
909
- When the node was constructed, it would lack these fields, and end up out of schema.
910
- This has been fixed: both validation and node construction now only consider own properties.
1035
+ ## 2.3.0
911
1036
 
912
- This may cause some cases which previously exhibited data corruption to now throw a usage error reporting the data is incompatible.
913
- Such cases may need to copy data from the objects with inherited properties into new objects with own properties before constructing nodes from them.
1037
+ ### Minor Changes
914
1038
 
915
- - A `@beta` version of `nodeChanged` which includes the list of properties has been added ([#22229](https://github.com/microsoft/FluidFramework/pull/22229)) [aae34dd9fe1](https://github.com/microsoft/FluidFramework/commit/aae34dd9fe1aa6c153c26035f1486f4d8944c810)
1039
+ - Add /alpha import path to @fluidframework/tree and fluid-framework packages ([#22483](https://github.com/microsoft/FluidFramework/pull/22483)) [12242cfdb5a](https://github.com/microsoft/FluidFramework/commit/12242cfdb5aa4c342cc62f11cbf1c072840bec44)
916
1040
 
917
- ```typescript
918
- const factory = new SchemaFactory("example");
919
- class Point2d extends factory.object("Point2d", {
920
- x: factory.number,
921
- y: factory.number,
922
- }) {}
1041
+ `@fluidframework/tree` and `fluid-framework` now have a `/alpha` import path where their `@alpha` APIs are exported.
923
1042
 
924
- const point = new Point2d({ x: 0, y: 0 });
1043
+ - Refactor code for emitting events to make it easier to copy into other projects ([#22275](https://github.com/microsoft/FluidFramework/pull/22275)) [49849bb5f6b](https://github.com/microsoft/FluidFramework/commit/49849bb5f6bf92765bc63e19cdaf4f7d0498bebc)
925
1044
 
926
- TreeBeta.on(point, "nodeChanged", (data) => {
927
- const changed: ReadonlySet<"x" | "y"> = data.changedProperties;
928
- if (changed.has("x")) {
929
- // ...
930
- }
931
- });
932
- ```
1045
+ Factored event emitting utilities into their own file, `events/emitter.ts`.
1046
+ Applications wishing to use SharedTree's eventing library for custom events can copy this file (and its referenced utility function) as a starting point for defining and emitting their own custom events.
1047
+ See `createEmitter`'s documentation for example usage.
933
1048
 
934
- The payload of the `nodeChanged` event emitted by SharedTree's `TreeBeta` includes a `changedProperties` property that indicates
935
- which properties of the node changed.
1049
+ Currently there are no published or officially supported versions of these utilities, but they are relatively simple, and can be copied and customized as needed.
936
1050
 
937
- For object nodes, the list of properties uses the property identifiers defined in the schema, and not the persisted
938
- identifiers (or "stored keys") that can be provided through `FieldProps` when defining a schema.
939
- See the documentation for `FieldProps` for more details about the distinction between "property keys" and "stored keys".
1051
+ - Implicitly constructed object nodes now only consider own properties during validation ([#22453](https://github.com/microsoft/FluidFramework/pull/22453)) [27faa56f5ae](https://github.com/microsoft/FluidFramework/commit/27faa56f5ae334e0b65fdd84c75764645e64f063)
940
1052
 
941
- For map nodes, every key that was added, removed, or updated by a change to the tree is included in the list of properties.
1053
+ When determining if some given data is compatible with a particular ObjectNode schema, both inherited and own properties were considered.
1054
+ However, when constructing the node from this data, only own properties were used.
1055
+ This allowed input which provided required values in inherited fields to pass validation.
1056
+ When the node was constructed, it would lack these fields, and end up out of schema.
1057
+ This has been fixed: both validation and node construction now only consider own properties.
942
1058
 
943
- For array nodes, the set of properties will always be undefined: there is currently no API to get details about changes to an array.
1059
+ This may cause some cases which previously exhibited data corruption to now throw a usage error reporting the data is incompatible.
1060
+ Such cases may need to copy data from the objects with inherited properties into new objects with own properties before constructing nodes from them.
944
1061
 
945
- Object nodes revieve strongly types sets of changed keys, allowing compile time detection of incorrect keys:
1062
+ - A `@beta` version of `nodeChanged` which includes the list of properties has been added ([#22229](https://github.com/microsoft/FluidFramework/pull/22229)) [aae34dd9fe1](https://github.com/microsoft/FluidFramework/commit/aae34dd9fe1aa6c153c26035f1486f4d8944c810)
946
1063
 
947
- ```typescript
948
- TreeBeta.on(point, "nodeChanged", (data) => {
949
- // @ts-expect-error Strong typing for changed properties of object nodes detects incorrect keys:
950
- if (data.changedProperties.has("z")) {
951
- // ...
952
- }
953
- });
954
- ```
1064
+ ```typescript
1065
+ const factory = new SchemaFactory("example");
1066
+ class Point2d extends factory.object("Point2d", {
1067
+ x: factory.number,
1068
+ y: factory.number,
1069
+ }) {}
955
1070
 
956
- The existing stable "nodeChanged" event's callback now is given a parameter called `unstable` of type `unknown` which is used to indicate that additional data can be provided there.
957
- This could break existing code using "nodeChanged" in a particularly fragile way.
1071
+ const point = new Point2d({ x: 0, y: 0 });
958
1072
 
959
- ```typescript
960
- function f(optional?: number) {
961
- // ...
1073
+ TreeBeta.on(point, "nodeChanged", (data) => {
1074
+ const changed: ReadonlySet<"x" | "y"> = data.changedProperties;
1075
+ if (changed.has("x")) {
1076
+ // ...
962
1077
  }
963
- Tree.on(point, "nodeChanged", f); // Bad
964
- ```
1078
+ });
1079
+ ```
965
1080
 
966
- Code like this which is implicitly discarding an optional argument from the function used as the listener will be broken.
967
- It can be fixed by using an inline lambda expression:
1081
+ The payload of the `nodeChanged` event emitted by SharedTree's `TreeBeta` includes a `changedProperties` property that indicates
1082
+ which properties of the node changed.
968
1083
 
969
- ```typescript
970
- function f(optional?: number) {
971
- // ...
972
- }
973
- Tree.on(point, "nodeChanged", () => f()); // Safe
974
- ```
1084
+ For object nodes, the list of properties uses the property identifiers defined in the schema, and not the persisted
1085
+ identifiers (or "stored keys") that can be provided through `FieldProps` when defining a schema.
1086
+ See the documentation for `FieldProps` for more details about the distinction between "property keys" and "stored keys".
975
1087
 
976
- - Make SharedTree usable with legacy APIs ([#22320](https://github.com/microsoft/FluidFramework/pull/22320)) [bbdf869b8a1](https://github.com/microsoft/FluidFramework/commit/bbdf869b8a1aae266bc8cb6f6016dcd8c22f0f88)
1088
+ For map nodes, every key that was added, removed, or updated by a change to the tree is included in the list of properties.
977
1089
 
978
- SharedTree was not previously exported in a way that made it usable with @fluidframework/aqueduct or other lower-level legacy APIs. This fixes that issue by making it consistent with other DDSes: such usages can `import { SharedTree } from "@fluidframework/tree/legacy";`.
1090
+ For array nodes, the set of properties will always be undefined: there is currently no API to get details about changes to an array.
979
1091
 
980
- ## 2.2.0
981
-
982
- ### Minor Changes
1092
+ Object nodes revieve strongly types sets of changed keys, allowing compile time detection of incorrect keys:
983
1093
 
984
- - Compile-time type narrowing based on a TreeNode's NodeKind ([#22222](https://github.com/microsoft/FluidFramework/pull/22222)) [4d3bc876ae](https://github.com/microsoft/FluidFramework/commit/4d3bc876ae32fa3f2568299e29246f6970e48ee0)
985
-
986
- `TreeNode`'s schema-aware APIs implement `WithType`, which now has a `NodeKind` parameter that can be used to narrow `TreeNode`s based on `NodeKind`.
987
-
988
- Example:
989
-
990
- ```typescript
991
- function getKeys(node: TreeNode & WithType<string, NodeKind.Array>): number[];
992
- function getKeys(node: TreeNode & WithType<string, NodeKind.Map | NodeKind.Object>): string[];
993
- function getKeys(node: TreeNode): string[] | number[];
994
- function getKeys(node: TreeNode): string[] | number[] {
995
- const schema = Tree.schema(node);
996
- switch (schema.kind) {
997
- case NodeKind.Array: {
998
- const arrayNode = node as TreeArrayNode;
999
- const keys: number[] = [];
1000
- for (let index = 0; index < arrayNode.length; index++) {
1001
- keys.push(index);
1002
- }
1003
- return keys;
1004
- }
1005
- case NodeKind.Map:
1006
- return [...(node as TreeMapNode).keys()];
1007
- case NodeKind.Object:
1008
- return Object.keys(node);
1009
- default:
1010
- throw new Error("Unsupported Kind");
1011
- }
1094
+ ```typescript
1095
+ TreeBeta.on(point, "nodeChanged", (data) => {
1096
+ // @ts-expect-error Strong typing for changed properties of object nodes detects incorrect keys:
1097
+ if (data.changedProperties.has("z")) {
1098
+ // ...
1012
1099
  }
1013
- ```
1014
-
1015
- - ✨ New! `Record`-typed objects can now be used to construct MapNodes ([#22042](https://github.com/microsoft/FluidFramework/pull/22042)) [25deff344b](https://github.com/microsoft/FluidFramework/commit/25deff344b447380486c1efb64ed69177c32ddc5)
1016
-
1017
- You can now construct MapNodes from `Record` typed objects, similar to how maps are expressed in JSON.
1018
-
1019
- Before this change, an `Iterable<string, Child>` was required, but now an object like `{key1: Child1, key2: Child2}` is allowed.
1100
+ });
1101
+ ```
1020
1102
 
1021
- Full example using this new API:
1103
+ The existing stable "nodeChanged" event's callback now is given a parameter called `unstable` of type `unknown` which is used to indicate that additional data can be provided there.
1104
+ This could break existing code using "nodeChanged" in a particularly fragile way.
1022
1105
 
1023
- ```typescript
1024
- class Schema extends schemaFactory.map("ExampleMap", schemaFactory.number) {}
1025
- const fromRecord = new Schema({ x: 5 });
1026
- ```
1106
+ ```typescript
1107
+ function f(optional?: number) {
1108
+ // ...
1109
+ }
1110
+ Tree.on(point, "nodeChanged", f); // Bad
1111
+ ```
1027
1112
 
1028
- This new feature makes it possible for schemas to construct a tree entirely from JSON-compatible objects using their constructors,
1029
- as long as they do not require unhydrated nodes to differentiate ambiguous unions,
1030
- or IFluidHandles (which themselves are not JSON compatible).
1113
+ Code like this which is implicitly discarding an optional argument from the function used as the listener will be broken.
1114
+ It can be fixed by using an inline lambda expression:
1031
1115
 
1032
- Due to limitations of TypeScript and recursive types,
1033
- recursive maps do not advertise support for this feature in their typing,
1034
- but it works at runtime.
1116
+ ```typescript
1117
+ function f(optional?: number) {
1118
+ // ...
1119
+ }
1120
+ Tree.on(point, "nodeChanged", () => f()); // Safe
1121
+ ```
1035
1122
 
1036
- - New SharedTree configuration option: `ITreeConfigurationOptions.preventAmbiguity` ([#22048](https://github.com/microsoft/FluidFramework/pull/22048)) [966906a034](https://github.com/microsoft/FluidFramework/commit/966906a03490daa5a914030b37342abb8267c12d)
1123
+ - Make SharedTree usable with legacy APIs ([#22320](https://github.com/microsoft/FluidFramework/pull/22320)) [bbdf869b8a1](https://github.com/microsoft/FluidFramework/commit/bbdf869b8a1aae266bc8cb6f6016dcd8c22f0f88)
1037
1124
 
1038
- The new `ITreeConfigurationOptions.preventAmbiguity` flag can be set to true to enable checking of some additional rules when constructing the `TreeViewConfiguration`.
1125
+ SharedTree was not previously exported in a way that made it usable with @fluidframework/aqueduct or other lower-level legacy APIs. This fixes that issue by making it consistent with other DDSes: such usages can `import { SharedTree } from "@fluidframework/tree/legacy";`.
1039
1126
 
1040
- This example shows an ambiguous schema:
1041
-
1042
- ```typescript
1043
- const schemaFactory = new SchemaFactory("com.example");
1044
- class Feet extends schemaFactory.object("Feet", { length: schemaFactory.number }) {}
1045
- class Meters extends schemaFactory.object("Meters", { length: schemaFactory.number }) {}
1046
- const config = new TreeViewConfiguration({
1047
- // This combination of schema can lead to ambiguous cases, and will error since preventAmbiguity is true.
1048
- schema: [Feet, Meters],
1049
- preventAmbiguity: true,
1050
- });
1051
- const view = tree.viewWith(config);
1052
- // This is invalid since it is ambiguous which type of node is being constructed.
1053
- // The error thrown above when constructing the TreeViewConfiguration is because of this ambiguous case:
1054
- view.initialize({ length: 5 });
1055
- ```
1056
-
1057
- See the documentation on `ITreeConfigurationOptions.preventAmbiguity` for a more complete example and more details.
1058
-
1059
- - `Tree.schema` now returns `TreeNodeSchema` ([#22185](https://github.com/microsoft/FluidFramework/pull/22185)) [bfe8310a94](https://github.com/microsoft/FluidFramework/commit/bfe8310a9406a8658c2fac8827c7114844c32234)
1060
-
1061
- The typing of `Tree.schema` has changed from:
1062
-
1063
- ```typescript
1064
- schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
1065
- ```
1066
-
1067
- to:
1068
-
1069
- ```typescript
1070
- schema(node: TreeNode | TreeLeafValue): TreeNodeSchema;
1071
- ```
1072
-
1073
- The runtime behavior is unaffected: any code which worked and still compiles is fine and does not need changes.
1074
-
1075
- `Tree.schema` was changed to mitigate two different issues:
1127
+ ## 2.2.0
1076
1128
 
1077
- 1. It tried to give a more specific type based on the type of the passed in value.
1078
- When the type of the input is not known precisely (for example it is a union of node types like `Foo | Bar`, or `TreeNode` or even `TreeNode | TreeLeafValue`), this was fine since schema are covariant over their node type.
1079
- However when the input was more specific that the schema type, for example the type is simply `0`, this would result in unsound typing, since the create function could actually return values that did not conform with that schema (for example `schema.create(1)` for the number schema typed with `0` would return `1` with type `0`).
1080
- 2. The node type was provided to the incorrect type parameter of TreeNodeSchema.
1081
- The `TNode` parameter is the third one, not the fourth.
1082
- The fourth is `TBuild` which sets the input accepted to its create function or constructor.
1083
- Thus this code accidentally left `TNode` unset (which is good due to the above issue), but invalidly set `TBuild`.
1084
- `TBuild` is contravariant, so it has the opposite issue that setting `TNode` would have: if your input is simply typed as something general like `TreeNode`, then the returned schema would claim to be able to construct an instance given any `TreeNode`.
1085
- This is incorrect, and this typing has been removed.
1129
+ ### Minor Changes
1086
1130
 
1087
- Fortunately it should be rare for code to be impacted by this issue.
1088
- Any code which manually specified a generic type parameter to `Tree.schema()` will break, as well as code which assigned its result to an overly specifically typed variable.
1089
- Code which used `typeof` on the returned schema could also break, though there are few use-cases for this so such code is not expected to exist.
1090
- Currently it's very difficult to invoke the create function or constructor associated with a `TreeNodeSchema` as doing so already requires narrowing to `TreeNodeSchemaClass` or `TreeNodeSchemaNonClass`.
1091
- It is possible some such code exists which will need to have an explicit cast added because it happened to work with the more specific (but incorrect) constructor input type.
1131
+ - Compile-time type narrowing based on a TreeNode's NodeKind ([#22222](https://github.com/microsoft/FluidFramework/pull/22222)) [4d3bc876ae](https://github.com/microsoft/FluidFramework/commit/4d3bc876ae32fa3f2568299e29246f6970e48ee0)
1132
+
1133
+ `TreeNode`'s schema-aware APIs implement `WithType`, which now has a `NodeKind` parameter that can be used to narrow `TreeNode`s based on `NodeKind`.
1134
+
1135
+ Example:
1136
+
1137
+ ```typescript
1138
+ function getKeys(node: TreeNode & WithType<string, NodeKind.Array>): number[];
1139
+ function getKeys(
1140
+ node: TreeNode & WithType<string, NodeKind.Map | NodeKind.Object>,
1141
+ ): string[];
1142
+ function getKeys(node: TreeNode): string[] | number[];
1143
+ function getKeys(node: TreeNode): string[] | number[] {
1144
+ const schema = Tree.schema(node);
1145
+ switch (schema.kind) {
1146
+ case NodeKind.Array: {
1147
+ const arrayNode = node as TreeArrayNode;
1148
+ const keys: number[] = [];
1149
+ for (let index = 0; index < arrayNode.length; index++) {
1150
+ keys.push(index);
1151
+ }
1152
+ return keys;
1153
+ }
1154
+ case NodeKind.Map:
1155
+ return [...(node as TreeMapNode).keys()];
1156
+ case NodeKind.Object:
1157
+ return Object.keys(node);
1158
+ default:
1159
+ throw new Error("Unsupported Kind");
1160
+ }
1161
+ }
1162
+ ```
1092
1163
 
1093
- - Recursive SharedTree schemas using MapNodes no longer produce invalid d.ts files ([#22106](https://github.com/microsoft/FluidFramework/pull/22106)) [554fc5a94e](https://github.com/microsoft/FluidFramework/commit/554fc5a94e57e2d109ea9008b7c64517c58a6b73)
1164
+ - New! `Record`-typed objects can now be used to construct MapNodes ([#22042](https://github.com/microsoft/FluidFramework/pull/22042)) [25deff344b](https://github.com/microsoft/FluidFramework/commit/25deff344b447380486c1efb64ed69177c32ddc5)
1094
1165
 
1095
- Consider a recursive SharedTree schema like the following, which follows all our recommended best practices:
1166
+ You can now construct MapNodes from `Record` typed objects, similar to how maps are expressed in JSON.
1096
1167
 
1097
- ```typescript
1098
- export class RecursiveMap extends schema.mapRecursive("RM", [() => RecursiveMap]) {}
1168
+ Before this change, an `Iterable<string, Child>` was required, but now an object like `{key1: Child1, key2: Child2}` is allowed.
1169
+
1170
+ Full example using this new API:
1171
+
1172
+ ```typescript
1173
+ class Schema extends schemaFactory.map("ExampleMap", schemaFactory.number) {}
1174
+ const fromRecord = new Schema({ x: 5 });
1175
+ ```
1176
+
1177
+ This new feature makes it possible for schemas to construct a tree entirely from JSON-compatible objects using their constructors,
1178
+ as long as they do not require unhydrated nodes to differentiate ambiguous unions,
1179
+ or IFluidHandles (which themselves are not JSON compatible).
1180
+
1181
+ Due to limitations of TypeScript and recursive types,
1182
+ recursive maps do not advertise support for this feature in their typing,
1183
+ but it works at runtime.
1184
+
1185
+ - New SharedTree configuration option: `ITreeConfigurationOptions.preventAmbiguity` ([#22048](https://github.com/microsoft/FluidFramework/pull/22048)) [966906a034](https://github.com/microsoft/FluidFramework/commit/966906a03490daa5a914030b37342abb8267c12d)
1186
+
1187
+ The new `ITreeConfigurationOptions.preventAmbiguity` flag can be set to true to enable checking of some additional rules when constructing the `TreeViewConfiguration`.
1188
+
1189
+ This example shows an ambiguous schema:
1190
+
1191
+ ```typescript
1192
+ const schemaFactory = new SchemaFactory("com.example");
1193
+ class Feet extends schemaFactory.object("Feet", {
1194
+ length: schemaFactory.number,
1195
+ }) {}
1196
+ class Meters extends schemaFactory.object("Meters", {
1197
+ length: schemaFactory.number,
1198
+ }) {}
1199
+ const config = new TreeViewConfiguration({
1200
+ // This combination of schema can lead to ambiguous cases, and will error since preventAmbiguity is true.
1201
+ schema: [Feet, Meters],
1202
+ preventAmbiguity: true,
1203
+ });
1204
+ const view = tree.viewWith(config);
1205
+ // This is invalid since it is ambiguous which type of node is being constructed.
1206
+ // The error thrown above when constructing the TreeViewConfiguration is because of this ambiguous case:
1207
+ view.initialize({ length: 5 });
1208
+ ```
1209
+
1210
+ See the documentation on `ITreeConfigurationOptions.preventAmbiguity` for a more complete example and more details.
1211
+
1212
+ - `Tree.schema` now returns `TreeNodeSchema` ([#22185](https://github.com/microsoft/FluidFramework/pull/22185)) [bfe8310a94](https://github.com/microsoft/FluidFramework/commit/bfe8310a9406a8658c2fac8827c7114844c32234)
1213
+
1214
+ The typing of `Tree.schema` has changed from:
1215
+
1216
+ ```typescript
1217
+ schema<T extends TreeNode | TreeLeafValue>(node: T): TreeNodeSchema<string, NodeKind, unknown, T>;
1218
+ ```
1219
+
1220
+ to:
1221
+
1222
+ ```typescript
1223
+ schema(node: TreeNode | TreeLeafValue): TreeNodeSchema;
1224
+ ```
1225
+
1226
+ The runtime behavior is unaffected: any code which worked and still compiles is fine and does not need changes.
1227
+
1228
+ `Tree.schema` was changed to mitigate two different issues:
1229
+
1230
+ 1. It tried to give a more specific type based on the type of the passed in value.
1231
+ When the type of the input is not known precisely (for example it is a union of node types like `Foo | Bar`, or `TreeNode` or even `TreeNode | TreeLeafValue`), this was fine since schema are covariant over their node type.
1232
+ However when the input was more specific that the schema type, for example the type is simply `0`, this would result in unsound typing, since the create function could actually return values that did not conform with that schema (for example `schema.create(1)` for the number schema typed with `0` would return `1` with type `0`).
1233
+ 2. The node type was provided to the incorrect type parameter of TreeNodeSchema.
1234
+ The `TNode` parameter is the third one, not the fourth.
1235
+ The fourth is `TBuild` which sets the input accepted to its create function or constructor.
1236
+ Thus this code accidentally left `TNode` unset (which is good due to the above issue), but invalidly set `TBuild`.
1237
+ `TBuild` is contravariant, so it has the opposite issue that setting `TNode` would have: if your input is simply typed as something general like `TreeNode`, then the returned schema would claim to be able to construct an instance given any `TreeNode`.
1238
+ This is incorrect, and this typing has been removed.
1239
+
1240
+ Fortunately it should be rare for code to be impacted by this issue.
1241
+ Any code which manually specified a generic type parameter to `Tree.schema()` will break, as well as code which assigned its result to an overly specifically typed variable.
1242
+ Code which used `typeof` on the returned schema could also break, though there are few use-cases for this so such code is not expected to exist.
1243
+ Currently it's very difficult to invoke the create function or constructor associated with a `TreeNodeSchema` as doing so already requires narrowing to `TreeNodeSchemaClass` or `TreeNodeSchemaNonClass`.
1244
+ It is possible some such code exists which will need to have an explicit cast added because it happened to work with the more specific (but incorrect) constructor input type.
1245
+
1246
+ - Recursive SharedTree schemas using MapNodes no longer produce invalid d.ts files ([#22106](https://github.com/microsoft/FluidFramework/pull/22106)) [554fc5a94e](https://github.com/microsoft/FluidFramework/commit/554fc5a94e57e2d109ea9008b7c64517c58a6b73)
1247
+
1248
+ Consider a recursive SharedTree schema like the following, which follows all our recommended best practices:
1249
+
1250
+ ```typescript
1251
+ export class RecursiveMap extends schema.mapRecursive("RM", [
1252
+ () => RecursiveMap,
1253
+ ]) {}
1254
+ {
1255
+ type _check = ValidateRecursiveSchema<typeof RecursiveMap>;
1256
+ }
1257
+ ```
1258
+
1259
+ This schema would work when used from within its compilation unit, but would generate d.ts that fails to compile when exporting it:
1260
+
1261
+ ```typescript
1262
+ declare const RecursiveMap_base: import("@fluidframework/tree").TreeNodeSchemaClass<
1263
+ "com.example.RM",
1264
+ import("@fluidframework/tree").NodeKind.Map,
1265
+ import("@fluidframework/tree").TreeMapNodeUnsafe<
1266
+ readonly [() => typeof RecursiveMap]
1267
+ > &
1268
+ import("@fluidframework/tree").WithType<"com.example.RM">,
1099
1269
  {
1100
- type _check = ValidateRecursiveSchema<typeof RecursiveMap>;
1101
- }
1102
- ```
1103
-
1104
- This schema would work when used from within its compilation unit, but would generate d.ts that fails to compile when exporting it:
1105
-
1106
- ```typescript
1107
- declare const RecursiveMap_base: import("@fluidframework/tree").TreeNodeSchemaClass<
1108
- "com.example.RM",
1109
- import("@fluidframework/tree").NodeKind.Map,
1110
- import("@fluidframework/tree").TreeMapNodeUnsafe<readonly [() => typeof RecursiveMap]> &
1111
- import("@fluidframework/tree").WithType<"com.example.RM">,
1112
- {
1113
- [Symbol.iterator](): Iterator<[string, RecursiveMap], any, undefined>;
1114
- },
1115
- false,
1116
- readonly [() => typeof RecursiveMap]
1117
- >;
1118
- export declare class RecursiveMap extends RecursiveMap_base {}
1119
- ```
1270
+ [Symbol.iterator](): Iterator<[string, RecursiveMap], any, undefined>;
1271
+ },
1272
+ false,
1273
+ readonly [() => typeof RecursiveMap]
1274
+ >;
1275
+ export declare class RecursiveMap extends RecursiveMap_base {}
1276
+ ```
1120
1277
 
1121
- This results in the compile error in TypeScript 5.4.5:
1278
+ This results in the compile error in TypeScript 5.4.5:
1122
1279
 
1123
- > error TS2310: Type 'RecursiveMap' recursively references itself as a base type.
1280
+ > error TS2310: Type 'RecursiveMap' recursively references itself as a base type.
1124
1281
 
1125
- With this change, that error is fixed by modifying the `TreeMapNodeUnsafe` type it references to inline the definition of `ReadonlyMap` instead of using the one from the TypeScript standard library.
1282
+ With this change, that error is fixed by modifying the `TreeMapNodeUnsafe` type it references to inline the definition of `ReadonlyMap` instead of using the one from the TypeScript standard library.
1126
1283
 
1127
- - ✨ New! When unambiguous, ArrayNodes can now be constructed from Maps and MapNodes from arrays ([#22036](https://github.com/microsoft/FluidFramework/pull/22036)) [25e74f9f3b](https://github.com/microsoft/FluidFramework/commit/25e74f9f3bed6e6ff041c088813c4cc1ea276b9c)
1284
+ - ✨ New! When unambiguous, ArrayNodes can now be constructed from Maps and MapNodes from arrays ([#22036](https://github.com/microsoft/FluidFramework/pull/22036)) [25e74f9f3b](https://github.com/microsoft/FluidFramework/commit/25e74f9f3bed6e6ff041c088813c4cc1ea276b9c)
1128
1285
 
1129
- Since the types for ArrayNodes and MapNodes indicate they can be constructed from iterables,
1130
- it should work, even if those iterables are themselves arrays or maps.
1131
- To avoid this being a breaking change, a priority system was introduced.
1132
- ArrayNodes will only be implicitly constructable from JavaScript Map objects in contexts where no MapNodes are allowed.
1133
- Similarly MapNodes will only be implicitly constructable from JavaScript Array objects in contexts where no ArrayNodes are allowed.
1286
+ Since the types for ArrayNodes and MapNodes indicate they can be constructed from iterables,
1287
+ it should work, even if those iterables are themselves arrays or maps.
1288
+ To avoid this being a breaking change, a priority system was introduced.
1289
+ ArrayNodes will only be implicitly constructable from JavaScript Map objects in contexts where no MapNodes are allowed.
1290
+ Similarly MapNodes will only be implicitly constructable from JavaScript Array objects in contexts where no ArrayNodes are allowed.
1134
1291
 
1135
- In practice, the main case in which this is likely to matter is when implicitly constructing a map node. If you provide an array of key value pairs, this now works instead of erroring, as long as no ArrayNode is valid at that location in the tree.
1292
+ In practice, the main case in which this is likely to matter is when implicitly constructing a map node. If you provide an array of key value pairs, this now works instead of erroring, as long as no ArrayNode is valid at that location in the tree.
1136
1293
 
1137
- ```typescript
1138
- class MyMapNode extends schemaFactory.map("x", schemaFactory.number) {}
1139
- class Root extends schemaFactory.object("root", { data: MyMapNode }) {}
1140
- // This now works (before it compiled, but error at runtime):
1141
- const fromArray = new Root({ data: [["x", 5]] });
1142
- ```
1294
+ ```typescript
1295
+ class MyMapNode extends schemaFactory.map("x", schemaFactory.number) {}
1296
+ class Root extends schemaFactory.object("root", { data: MyMapNode }) {}
1297
+ // This now works (before it compiled, but error at runtime):
1298
+ const fromArray = new Root({ data: [["x", 5]] });
1299
+ ```
1143
1300
 
1144
- Prior versions used to have to do:
1301
+ Prior versions used to have to do:
1145
1302
 
1146
- ```typescript
1147
- new Root({ data: new MyMapNode([["x", 5]]) });
1148
- ```
1303
+ ```typescript
1304
+ new Root({ data: new MyMapNode([["x", 5]]) });
1305
+ ```
1149
1306
 
1150
- or:
1307
+ or:
1151
1308
 
1152
- ```typescript
1153
- new Root({ data: new Map([["x", 5]]) });
1154
- ```
1309
+ ```typescript
1310
+ new Root({ data: new Map([["x", 5]]) });
1311
+ ```
1155
1312
 
1156
- Both of these options still work: strictly more cases are allowed with this change.
1313
+ Both of these options still work: strictly more cases are allowed with this change.
1157
1314
 
1158
- - Implicit TreeNode construction improvements ([#21995](https://github.com/microsoft/FluidFramework/pull/21995)) [977f96c1a0](https://github.com/microsoft/FluidFramework/commit/977f96c1a0dd1d5eb0dbcd087d07cb7510d533ea)
1315
+ - Implicit TreeNode construction improvements ([#21995](https://github.com/microsoft/FluidFramework/pull/21995)) [977f96c1a0](https://github.com/microsoft/FluidFramework/commit/977f96c1a0dd1d5eb0dbcd087d07cb7510d533ea)
1159
1316
 
1160
- ArrayNodes and MapNodes could always be explicitly constructed (using `new`) from iterables.
1161
- The types also allowed using of iterables to implicitly construct array nodes and map nodes,
1162
- but this did not work at runtime.
1163
- This has been fixed for all cases except implicitly constructing an ArrayNode form an `Iterable` that is actually a `Map`,
1164
- and implicitly constructing a MapNode from an `Iterable` that is actually an `Array`.
1165
- These cases may be fixed in the future, but require additional work to ensure unions of array nodes and map nodes work correctly.
1317
+ ArrayNodes and MapNodes could always be explicitly constructed (using `new`) from iterables.
1318
+ The types also allowed using of iterables to implicitly construct array nodes and map nodes,
1319
+ but this did not work at runtime.
1320
+ This has been fixed for all cases except implicitly constructing an ArrayNode form an `Iterable` that is actually a `Map`,
1321
+ and implicitly constructing a MapNode from an `Iterable` that is actually an `Array`.
1322
+ These cases may be fixed in the future, but require additional work to ensure unions of array nodes and map nodes work correctly.
1166
1323
 
1167
- Additionally MapNodes can now be constructed from `Iterator<readonly [string, content]>` where previously the inner arrays had to be mutable.
1324
+ Additionally MapNodes can now be constructed from `Iterator<readonly [string, content]>` where previously the inner arrays had to be mutable.
1168
1325
 
1169
- - Support generation of JSON Schema from Shared Tree view schema (alpha) ([#21984](https://github.com/microsoft/FluidFramework/pull/21984)) [9097bf8a44](https://github.com/microsoft/FluidFramework/commit/9097bf8a44310d0dcf1a4d2efc3a6f75997c58b3)
1326
+ - Support generation of JSON Schema from Shared Tree view schema (alpha) ([#21984](https://github.com/microsoft/FluidFramework/pull/21984)) [9097bf8a44](https://github.com/microsoft/FluidFramework/commit/9097bf8a44310d0dcf1a4d2efc3a6f75997c58b3)
1170
1327
 
1171
- > [!WARNING]
1172
- > This API is [alpha quality](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) and may change at any time.
1328
+ > [!WARNING]
1329
+ > This API is [alpha quality](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) and may change at any time.
1173
1330
 
1174
- Adds alpha-quality support for canonical [JSON Schema](https://json-schema.org/docs) representation of Shared Tree schema and adds a `getJsonSchema` function for getting that representation for a given `TreeNodeSchema`.
1175
- This JSON Schema representation can be used to describe schema requirements to external systems, and can be used with validation tools like [ajv](https://ajv.js.org/) to validate data before inserting it into a `SharedTree`.
1331
+ Adds alpha-quality support for canonical [JSON Schema](https://json-schema.org/docs) representation of Shared Tree schema and adds a `getJsonSchema` function for getting that representation for a given `TreeNodeSchema`.
1332
+ This JSON Schema representation can be used to describe schema requirements to external systems, and can be used with validation tools like [ajv](https://ajv.js.org/) to validate data before inserting it into a `SharedTree`.
1176
1333
 
1177
- #### Example
1334
+ #### Example
1178
1335
 
1179
- Given a `SharedTree` schema like the following:
1336
+ Given a `SharedTree` schema like the following:
1180
1337
 
1181
- ```typescript
1182
- class MyObject extends schemaFactory.object("MyObject", {
1183
- foo: schemaFactory.number,
1184
- bar: schemaFactory.optional(schemaFactory.string),
1185
- });
1186
- ```
1338
+ ```typescript
1339
+ class MyObject extends schemaFactory.object("MyObject", {
1340
+ foo: schemaFactory.number,
1341
+ bar: schemaFactory.optional(schemaFactory.string),
1342
+ });
1343
+ ```
1187
1344
 
1188
- JSON Schema like the following would be produced:
1345
+ JSON Schema like the following would be produced:
1189
1346
 
1190
- ```json
1191
- {
1192
- "$defs": {
1193
- "com.fluidframework.leaf.string": {
1194
- "type": "string"
1195
- },
1196
- "com.fluidframework.leaf.number": {
1197
- "type": "number"
1198
- },
1199
- "com.myapp.MyObject": {
1200
- "type": "object",
1201
- "properties": {
1202
- "foo": { "$ref": "com.fluidframework.leaf.number" },
1203
- "bar": { "$ref": "com.fluidframework.leaf.string" }
1204
- },
1205
- "required": ["foo"]
1206
- }
1207
- },
1208
- "anyOf": [{ "$ref": "#/$defs/com.myapp.MyObject" }]
1209
- }
1210
- ```
1347
+ ```json
1348
+ {
1349
+ "$defs": {
1350
+ "com.fluidframework.leaf.string": {
1351
+ "type": "string"
1352
+ },
1353
+ "com.fluidframework.leaf.number": {
1354
+ "type": "number"
1355
+ },
1356
+ "com.myapp.MyObject": {
1357
+ "type": "object",
1358
+ "properties": {
1359
+ "foo": { "$ref": "com.fluidframework.leaf.number" },
1360
+ "bar": { "$ref": "com.fluidframework.leaf.string" }
1361
+ },
1362
+ "required": ["foo"]
1363
+ }
1364
+ },
1365
+ "anyOf": [{ "$ref": "#/$defs/com.myapp.MyObject" }]
1366
+ }
1367
+ ```
1211
1368
 
1212
- - Enforce use of TreeViewConfiguration's constructor ([#22055](https://github.com/microsoft/FluidFramework/pull/22055)) [e8955579f6](https://github.com/microsoft/FluidFramework/commit/e8955579f6d52a6c7e300642088c60d6ed12d7db)
1369
+ - Enforce use of TreeViewConfiguration's constructor ([#22055](https://github.com/microsoft/FluidFramework/pull/22055)) [e8955579f6](https://github.com/microsoft/FluidFramework/commit/e8955579f6d52a6c7e300642088c60d6ed12d7db)
1213
1370
 
1214
- `TreeViewConfiguration` is `@sealed`, meaning creating custom implementations of it such as assigning object literals to a `TreeViewConfiguration` or sub-classing it are not supported.
1215
- This reserved the ability for the Fluid Framework to add members to this class over time, informing users that they must use it in such a way where such changes are non-breaking.
1216
- However, there was no compiler-based enforcement of this expectation.
1217
- It was only indicated via documentation and an implicit assumption that when an API takes in a typed defined as a class, that an instance of that class must be used rather than an arbitrary object of a similar shape.
1371
+ `TreeViewConfiguration` is `@sealed`, meaning creating custom implementations of it such as assigning object literals to a `TreeViewConfiguration` or sub-classing it are not supported.
1372
+ This reserved the ability for the Fluid Framework to add members to this class over time, informing users that they must use it in such a way where such changes are non-breaking.
1373
+ However, there was no compiler-based enforcement of this expectation.
1374
+ It was only indicated via documentation and an implicit assumption that when an API takes in a typed defined as a class, that an instance of that class must be used rather than an arbitrary object of a similar shape.
1218
1375
 
1219
- With this change, the TypeScript compiler will now inform users when they invalidly provide an object literal as a `TreeViewConfiguration`.
1376
+ With this change, the TypeScript compiler will now inform users when they invalidly provide an object literal as a `TreeViewConfiguration`.
1220
1377
 
1221
- More specifically this causes code like this to produce a compile error:
1378
+ More specifically this causes code like this to produce a compile error:
1222
1379
 
1223
- ```typescript
1224
- // Don't do this!
1225
- const view = tree.viewWith({ schema: TestNode, enableSchemaValidation: false });
1226
- ```
1380
+ ```typescript
1381
+ // Don't do this!
1382
+ const view = tree.viewWith({
1383
+ schema: TestNode,
1384
+ enableSchemaValidation: false,
1385
+ });
1386
+ ```
1227
1387
 
1228
- The above was never intended to work, and is not a supported use of the `viewWith` since it requires a `TreeViewConfiguration` which is sealed.
1229
- Any code using the above pattern will break in Fluid Framework 2.2 and above. Such code will need to be updated to the pattern shown below.
1230
- Any code broken by this change is technically unsupported and only worked due to a gap in the type checking. This is not considered a breaking change.
1231
- The correct way to get a `TreeViewConfiguration` is by using its constructor:
1388
+ The above was never intended to work, and is not a supported use of the `viewWith` since it requires a `TreeViewConfiguration` which is sealed.
1389
+ Any code using the above pattern will break in Fluid Framework 2.2 and above. Such code will need to be updated to the pattern shown below.
1390
+ Any code broken by this change is technically unsupported and only worked due to a gap in the type checking. This is not considered a breaking change.
1391
+ The correct way to get a `TreeViewConfiguration` is by using its constructor:
1232
1392
 
1233
- ```typescript
1234
- // This pattern correctly initializes default values and validates input.
1235
- const view = tree.viewWith(new TreeViewConfiguration({ schema: TestNode }));
1236
- ```
1393
+ ```typescript
1394
+ // This pattern correctly initializes default values and validates input.
1395
+ const view = tree.viewWith(new TreeViewConfiguration({ schema: TestNode }));
1396
+ ```
1237
1397
 
1238
- Skipping the constructor causes the following problems:
1398
+ Skipping the constructor causes the following problems:
1239
1399
 
1240
- 1. `TreeViewConfiguration` does validation in its constructor, so skipping it also skips the validation which leads to much less friendly error messages for invalid schema.
1241
- 2. Skipping the constructor also discards any default values for options like `enableSchemaValidation`.
1242
- This means that code written in that style would break if more options were added. Since such changes are planned,
1243
- it is not practical to support this pattern.
1400
+ 1. `TreeViewConfiguration` does validation in its constructor, so skipping it also skips the validation which leads to much less friendly error messages for invalid schema.
1401
+ 2. Skipping the constructor also discards any default values for options like `enableSchemaValidation`.
1402
+ This means that code written in that style would break if more options were added. Since such changes are planned,
1403
+ it is not practical to support this pattern.
1244
1404
 
1245
- - Add a function `isRepoSuperset` to determine if changes to a document schema are backward-compatible ([#22045](https://github.com/microsoft/FluidFramework/pull/22045)) [f6fdc95bb3](https://github.com/microsoft/FluidFramework/commit/f6fdc95bb36a892710bc315aae85fd2c75aec975)
1405
+ - Add a function `isRepoSuperset` to determine if changes to a document schema are backward-compatible ([#22045](https://github.com/microsoft/FluidFramework/pull/22045)) [f6fdc95bb3](https://github.com/microsoft/FluidFramework/commit/f6fdc95bb36a892710bc315aae85fd2c75aec975)
1246
1406
 
1247
- Note: These changes are not customer-facing and make progress toward future plans in Tree's schema evolution space.
1407
+ Note: These changes are not customer-facing and make progress toward future plans in Tree's schema evolution space.
1248
1408
 
1249
- - Add `@alpha` API `FixRecursiveArraySchema` as a workaround around an issue with recursive ArrayNode schema ([#22122](https://github.com/microsoft/FluidFramework/pull/22122)) [9ceacf9b54](https://github.com/microsoft/FluidFramework/commit/9ceacf9b5468ac8280a1dc48ada9d8b46b499f14)
1409
+ - Add `@alpha` API `FixRecursiveArraySchema` as a workaround around an issue with recursive ArrayNode schema ([#22122](https://github.com/microsoft/FluidFramework/pull/22122)) [9ceacf9b54](https://github.com/microsoft/FluidFramework/commit/9ceacf9b5468ac8280a1dc48ada9d8b46b499f14)
1250
1410
 
1251
- Importing a recursive ArrayNode schema via a d.ts file can produce an error like
1252
- `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.`
1253
- if using a tsconfig with `"skipLibCheck": false`.
1411
+ Importing a recursive ArrayNode schema via a d.ts file can produce an error like
1412
+ `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.`
1413
+ if using a tsconfig with `"skipLibCheck": false`.
1254
1414
 
1255
- This error occurs due to the TypeScript compiler splitting the class definition into two separate declarations in the d.ts file (one for the base, and one for the actual class).
1256
- For unknown reasons, splitting the class declaration in this way breaks the recursive type handling, leading to the mentioned error.
1415
+ This error occurs due to the TypeScript compiler splitting the class definition into two separate declarations in the d.ts file (one for the base, and one for the actual class).
1416
+ For unknown reasons, splitting the class declaration in this way breaks the recursive type handling, leading to the mentioned error.
1257
1417
 
1258
- Since recursive type handling in TypeScript is order dependent, putting just the right kind of usages of the type before the declarations can cause it to not hit this error.
1259
- For the case of ArrayNodes, this can be done via usage that looks like this:
1418
+ Since recursive type handling in TypeScript is order dependent, putting just the right kind of usages of the type before the declarations can cause it to not hit this error.
1419
+ For the case of ArrayNodes, this can be done via usage that looks like this:
1260
1420
 
1261
- ```typescript
1262
- /**
1263
- * Workaround to avoid
1264
- * `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.
1265
- */
1266
- export declare const _RecursiveArrayWorkaround: FixRecursiveArraySchema<typeof RecursiveArray>;
1267
- export class RecursiveArray extends schema.arrayRecursive("RA", [() => RecursiveArray]) {}
1268
- {
1269
- type _check = ValidateRecursiveSchema<typeof RecursiveArray>;
1270
- }
1271
- ```
1421
+ ```typescript
1422
+ /**
1423
+ * Workaround to avoid
1424
+ * `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.
1425
+ */
1426
+ export declare const _RecursiveArrayWorkaround: FixRecursiveArraySchema<
1427
+ typeof RecursiveArray
1428
+ >;
1429
+ export class RecursiveArray extends schema.arrayRecursive("RA", [
1430
+ () => RecursiveArray,
1431
+ ]) {}
1432
+ {
1433
+ type _check = ValidateRecursiveSchema<typeof RecursiveArray>;
1434
+ }
1435
+ ```
1272
1436
 
1273
- - Fix document-corrupting bug when rebasing over move compositions ([#21993](https://github.com/microsoft/FluidFramework/pull/21993)) [f3af9d1cd3](https://github.com/microsoft/FluidFramework/commit/f3af9d1cd3f7ee1ea3660ae934ddca8473fbdb9b)
1437
+ - Fix document-corrupting bug when rebasing over move compositions ([#21993](https://github.com/microsoft/FluidFramework/pull/21993)) [f3af9d1cd3](https://github.com/microsoft/FluidFramework/commit/f3af9d1cd3f7ee1ea3660ae934ddca8473fbdb9b)
1274
1438
 
1275
- Before this fix, if multiple users concurrently performed moves (possibly by reverting prior moves), there was a chance that the document would become corrupted.
1439
+ Before this fix, if multiple users concurrently performed moves (possibly by reverting prior moves), there was a chance that the document would become corrupted.
1276
1440
 
1277
1441
  ## 2.1.0
1278
1442
 
1279
1443
  ### Minor Changes
1280
1444
 
1281
- - Detect arrayNode iterator invalidation ([#21760](https://github.com/microsoft/FluidFramework/pull/21760)) [6fd320c385](https://github.com/microsoft/FluidFramework/commit/6fd320c38561e272a1acaf4248f47fc386c650e4)
1445
+ - Detect arrayNode iterator invalidation ([#21760](https://github.com/microsoft/FluidFramework/pull/21760)) [6fd320c385](https://github.com/microsoft/FluidFramework/commit/6fd320c38561e272a1acaf4248f47fc386c650e4)
1282
1446
 
1283
- When `arrayNode`s are edited concurrently during iteration, an error will be thrown.
1447
+ When `arrayNode`s are edited concurrently during iteration, an error will be thrown.
1284
1448
 
1285
- - tree: Improved performance for accessing identifiers in shortId API ([#21944](https://github.com/microsoft/FluidFramework/pull/21944)) [6b4cf26d9c](https://github.com/microsoft/FluidFramework/commit/6b4cf26d9cc14c1a36cf07fd7408f1d1227e373a)
1449
+ - tree: Improved performance for accessing identifiers in shortId API ([#21944](https://github.com/microsoft/FluidFramework/pull/21944)) [6b4cf26d9c](https://github.com/microsoft/FluidFramework/commit/6b4cf26d9cc14c1a36cf07fd7408f1d1227e373a)
1286
1450
 
1287
- Users should see improved performance when calling the `Tree.shortId` API. Identifier field keys are now cached in the schema for faster access.
1451
+ Users should see improved performance when calling the `Tree.shortId` API. Identifier field keys are now cached in the schema for faster access.
1288
1452
 
1289
- - ✨ New! Debug visualizers for TreeNodes in NodeJS and browsers ([#21895](https://github.com/microsoft/FluidFramework/pull/21895)) [0d197fefec](https://github.com/microsoft/FluidFramework/commit/0d197fefec852df2911151217ac1b71cde528a70)
1453
+ - ✨ New! Debug visualizers for TreeNodes in NodeJS and browsers ([#21895](https://github.com/microsoft/FluidFramework/pull/21895)) [0d197fefec](https://github.com/microsoft/FluidFramework/commit/0d197fefec852df2911151217ac1b71cde528a70)
1290
1454
 
1291
- TreeNodes now have custom debug visualizers to improve the debug experience in NodeJS and in browsers. Note that custom formatters must be enabled in the browser developer tools for that visualizer to be used.
1455
+ TreeNodes now have custom debug visualizers to improve the debug experience in NodeJS and in browsers. Note that custom formatters must be enabled in the browser developer tools for that visualizer to be used.
1292
1456
 
1293
- - Using "delete" on tree fields now throws an error instead of not working correctly ([#21609](https://github.com/microsoft/FluidFramework/pull/21609)) [416849b1fd](https://github.com/microsoft/FluidFramework/commit/416849b1fda029870ee1c1742100de4f8dde45b7)
1457
+ - Using "delete" on tree fields now throws an error instead of not working correctly ([#21609](https://github.com/microsoft/FluidFramework/pull/21609)) [416849b1fd](https://github.com/microsoft/FluidFramework/commit/416849b1fda029870ee1c1742100de4f8dde45b7)
1294
1458
 
1295
- TypeScript allows `delete` on object node optional fields if the `exactOptionalPropertyTypes` tsconfig setting is not
1296
- enabled. This does not work correctly at runtime and now produces an informative error.
1459
+ TypeScript allows `delete` on object node optional fields if the `exactOptionalPropertyTypes` tsconfig setting is not
1460
+ enabled. This does not work correctly at runtime and now produces an informative error.
1297
1461
 
1298
- - SharedTree content that is removed is now deleted ([#21372](https://github.com/microsoft/FluidFramework/pull/21372)) [a6e412159a](https://github.com/microsoft/FluidFramework/commit/a6e412159a4df6aceb84aac35288b108a5351905)
1462
+ - SharedTree content that is removed is now deleted ([#21372](https://github.com/microsoft/FluidFramework/pull/21372)) [a6e412159a](https://github.com/microsoft/FluidFramework/commit/a6e412159a4df6aceb84aac35288b108a5351905)
1299
1463
 
1300
- SharedTree now supports garbage collection so that removed content is not retained forever.
1301
- This is an internal change and users of SharedTree won't need to adapt any existing code.
1464
+ SharedTree now supports garbage collection so that removed content is not retained forever.
1465
+ This is an internal change and users of SharedTree won't need to adapt any existing code.
1302
1466
 
1303
- This change could cause errors with cross-version collaboration where an older client does not send data that a newer
1304
- version may need. In this case, a "refresher data not found" error will be thrown.
1467
+ This change could cause errors with cross-version collaboration where an older client does not send data that a newer
1468
+ version may need. In this case, a "refresher data not found" error will be thrown.
1305
1469
 
1306
- - Improved error reporting ([#21940](https://github.com/microsoft/FluidFramework/pull/21940)) [3b8a366dd1](https://github.com/microsoft/FluidFramework/commit/3b8a366dd15660f9c916832040faf772534c0755)
1470
+ - Improved error reporting ([#21940](https://github.com/microsoft/FluidFramework/pull/21940)) [3b8a366dd1](https://github.com/microsoft/FluidFramework/commit/3b8a366dd15660f9c916832040faf772534c0755)
1307
1471
 
1308
- Several cases of invalid usage patterns for tree APIs have gained improved error reporting, as well as improved documentation on the APIs detailing what usage is supported.
1309
- These improvements include:
1472
+ Several cases of invalid usage patterns for tree APIs have gained improved error reporting, as well as improved documentation on the APIs detailing what usage is supported.
1473
+ These improvements include:
1310
1474
 
1311
- - Unsupported usages of schema classes: using more than one schema class derived from a single SchemaFactory generated base class. This used to hit internal asserts, but now has a descriptive user-facing UsageError. Most of this work was done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707).
1312
- - Improved detection of when prior exception may have left SharedTree in an invalid state.
1313
- These cases now report a UsageError including a reference to the prior exception. This was mainly done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707) and [b77d530](https://github.com/microsoft/FluidFramework/commit/b77d530b9252201c40a90d1a2a6315f76f1a4a4b).
1475
+ - Unsupported usages of schema classes: using more than one schema class derived from a single SchemaFactory generated base class. This used to hit internal asserts, but now has a descriptive user-facing UsageError. Most of this work was done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707).
1476
+ - Improved detection of when prior exception may have left SharedTree in an invalid state.
1477
+ These cases now report a UsageError including a reference to the prior exception. This was mainly done in [9fb3dcf](https://github.com/microsoft/FluidFramework/commit/9fb3dcf491a7f0d66f4abbdc64ab97ccabef4707) and [b77d530](https://github.com/microsoft/FluidFramework/commit/b77d530b9252201c40a90d1a2a6315f76f1a4a4b).
1314
1478
 
1315
1479
  ## 2.0.0-rc.5.0.0
1316
1480
 
1317
1481
  ### Minor Changes
1318
1482
 
1319
- - fluid-framework: Type Erase ISharedObjectKind ([#21081](https://github.com/microsoft/FluidFramework/pull/21081)) [78f228e370](https://github.com/microsoft/FluidFramework/commit/78f228e37055bd4d9a8f02b3a1eefebf4da9c59c)
1483
+ - fluid-framework: Type Erase ISharedObjectKind ([#21081](https://github.com/microsoft/FluidFramework/pull/21081)) [78f228e370](https://github.com/microsoft/FluidFramework/commit/78f228e37055bd4d9a8f02b3a1eefebf4da9c59c)
1320
1484
 
1321
- A new type, `SharedObjectKind` is added as a type erased version of `ISharedObjectKind` and `DataObjectClass`.
1485
+ A new type, `SharedObjectKind` is added as a type erased version of `ISharedObjectKind` and `DataObjectClass`.
1322
1486
 
1323
- This type fills the role of both `ISharedObjectKind` and `DataObjectClass` in the `@public` "declarative API" exposed in the `fluid-framework` package.
1487
+ This type fills the role of both `ISharedObjectKind` and `DataObjectClass` in the `@public` "declarative API" exposed in the `fluid-framework` package.
1324
1488
 
1325
- This allows several types referenced by `ISharedObjectKind` to be made `@alpha` as they should only need to be used by legacy code and users of the unstable/alpha/legacy "encapsulated API".
1489
+ This allows several types referenced by `ISharedObjectKind` to be made `@alpha` as they should only need to be used by legacy code and users of the unstable/alpha/legacy "encapsulated API".
1326
1490
 
1327
- Access to these now less public types should not be required for users of the `@public` "declarative API" exposed in the `fluid-framework` package, but can still be accessed for those who need them under the `/legacy` import paths.
1328
- The full list of such types is:
1491
+ Access to these now less public types should not be required for users of the `@public` "declarative API" exposed in the `fluid-framework` package, but can still be accessed for those who need them under the `/legacy` import paths.
1492
+ The full list of such types is:
1329
1493
 
1330
- - `SharedTree` as exported from `@fluidframwork/tree`: It is still exported as `@public` from `fluid-framework` as `SharedObjectKind`.
1331
- - `ISharedObjectKind`: See new `SharedObjectKind` type for use in `@public` APIs.
1332
- `ISharedObject`
1333
- - `IChannel`
1334
- - `IChannelAttributes`
1335
- - `IChannelFactory`
1336
- - `IExperimentalIncrementalSummaryContext`
1337
- - `IGarbageCollectionData`
1338
- - `ISummaryStats`
1339
- - `ISummaryTreeWithStats`
1340
- - `ITelemetryContext`
1341
- - `IDeltaManagerErased`
1342
- - `IFluidDataStoreRuntimeEvents`
1343
- - `IFluidHandleContext`
1344
- - `IProvideFluidHandleContext`
1494
+ - `SharedTree` as exported from `@fluidframwork/tree`: It is still exported as `@public` from `fluid-framework` as `SharedObjectKind`.
1495
+ - `ISharedObjectKind`: See new `SharedObjectKind` type for use in `@public` APIs.
1496
+ `ISharedObject`
1497
+ - `IChannel`
1498
+ - `IChannelAttributes`
1499
+ - `IChannelFactory`
1500
+ - `IExperimentalIncrementalSummaryContext`
1501
+ - `IGarbageCollectionData`
1502
+ - `ISummaryStats`
1503
+ - `ISummaryTreeWithStats`
1504
+ - `ITelemetryContext`
1505
+ - `IDeltaManagerErased`
1506
+ - `IFluidDataStoreRuntimeEvents`
1507
+ - `IFluidHandleContext`
1508
+ - `IProvideFluidHandleContext`
1345
1509
 
1346
- Removed APIs:
1510
+ Removed APIs:
1347
1511
 
1348
- - `DataObjectClass`: Usages replaced with `SharedObjectKind`.
1349
- - `LoadableObjectClass`: Replaced with `SharedObjectKind`.
1350
- - `LoadableObjectClassRecord`: Replaced with `Record<string, SharedObjectKind>`.
1351
- -
1512
+ - `DataObjectClass`: Usages replaced with `SharedObjectKind`.
1513
+ - `LoadableObjectClass`: Replaced with `SharedObjectKind`.
1514
+ - `LoadableObjectClassRecord`: Replaced with `Record<string, SharedObjectKind>`.
1515
+ -
1352
1516
 
1353
- - tree: Added support for optional schema validation on newly inserted content in SharedTree ([#21011](https://github.com/microsoft/FluidFramework/pull/21011)) [b14e9fa607](https://github.com/microsoft/FluidFramework/commit/b14e9fa607a8281f86d0cfac631e33ef12033e21)
1517
+ - tree: Added support for optional schema validation on newly inserted content in SharedTree ([#21011](https://github.com/microsoft/FluidFramework/pull/21011)) [b14e9fa607](https://github.com/microsoft/FluidFramework/commit/b14e9fa607a8281f86d0cfac631e33ef12033e21)
1354
1518
 
1355
- When defining how to view a SharedTree, an application can now specify that new content inserted into the tree should
1356
- be subject to schema validation at the time it is inserted, so if it's not valid according to the stored schema in the
1357
- tree an error is thrown immediately.
1519
+ When defining how to view a SharedTree, an application can now specify that new content inserted into the tree should
1520
+ be subject to schema validation at the time it is inserted, so if it's not valid according to the stored schema in the
1521
+ tree an error is thrown immediately.
1358
1522
 
1359
- This can be accomplished by passing an `ITreeConfigurationOptions` argument with `enableSchemaValidation` set to `true`
1360
- when creating a `TreeConfiguration` to use with the SharedTree.
1523
+ This can be accomplished by passing an `ITreeConfigurationOptions` argument with `enableSchemaValidation` set to `true`
1524
+ when creating a `TreeConfiguration` to use with the SharedTree.
1361
1525
 
1362
- Since this feature requires additional compute when inserting new content into the tree, it is not enabled by default.
1526
+ Since this feature requires additional compute when inserting new content into the tree, it is not enabled by default.
1363
1527
 
1364
- - Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
1528
+ - Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
1365
1529
 
1366
- Update package implementations to use TypeScript 5.4.5.
1530
+ Update package implementations to use TypeScript 5.4.5.
1367
1531
 
1368
- - tree: A new tree status has been added for SharedTree nodes. ([#21270](https://github.com/microsoft/FluidFramework/pull/21270)) [8760e321b0](https://github.com/microsoft/FluidFramework/commit/8760e321b02177babfb187ae293a17a65723f249)
1532
+ - tree: A new tree status has been added for SharedTree nodes. ([#21270](https://github.com/microsoft/FluidFramework/pull/21270)) [8760e321b0](https://github.com/microsoft/FluidFramework/commit/8760e321b02177babfb187ae293a17a65723f249)
1369
1533
 
1370
- `TreeStatus.Created` indicates that a SharedTree node has been constructed but not yet inserted into the tree.
1371
- Constraints passed to the `runTransaction` API are now marked as `readonly`.
1534
+ `TreeStatus.Created` indicates that a SharedTree node has been constructed but not yet inserted into the tree.
1535
+ Constraints passed to the `runTransaction` API are now marked as `readonly`.
1372
1536
 
1373
- - tree: Adjusted Listenable multi-event subscription policy. ([#21244](https://github.com/microsoft/FluidFramework/pull/21244)) [a0c1d2c5b1](https://github.com/microsoft/FluidFramework/commit/a0c1d2c5b1e20f3dc469377c093649fc5eb8c3dd)
1537
+ - tree: Adjusted Listenable multi-event subscription policy. ([#21244](https://github.com/microsoft/FluidFramework/pull/21244)) [a0c1d2c5b1](https://github.com/microsoft/FluidFramework/commit/a0c1d2c5b1e20f3dc469377c093649fc5eb8c3dd)
1374
1538
 
1375
- `Listenable.on()` no longer supports the same listener function object being registered twice for the same event.
1376
- The deregister function returned by `Listenable.on()` may now be called multiple times with no effect.
1539
+ `Listenable.on()` no longer supports the same listener function object being registered twice for the same event.
1540
+ The deregister function returned by `Listenable.on()` may now be called multiple times with no effect.
1377
1541
 
1378
- - Update to ES 2022 ([#21292](https://github.com/microsoft/FluidFramework/pull/21292)) [68921502f7](https://github.com/microsoft/FluidFramework/commit/68921502f79b1833c4cd6d0fe339bfb126a712c7)
1542
+ - Update to ES 2022 ([#21292](https://github.com/microsoft/FluidFramework/pull/21292)) [68921502f7](https://github.com/microsoft/FluidFramework/commit/68921502f79b1833c4cd6d0fe339bfb126a712c7)
1379
1543
 
1380
- Update tsconfig to target ES 2022.
1544
+ Update tsconfig to target ES 2022.
1381
1545
 
1382
- - tree: Event types have been renamed ([#21233](https://github.com/microsoft/FluidFramework/pull/21233)) [4d56fd1f99](https://github.com/microsoft/FluidFramework/commit/4d56fd1f99a25f34c69d1aed2b60fbe156fc068f)
1546
+ - tree: Event types have been renamed ([#21233](https://github.com/microsoft/FluidFramework/pull/21233)) [4d56fd1f99](https://github.com/microsoft/FluidFramework/commit/4d56fd1f99a25f34c69d1aed2b60fbe156fc068f)
1383
1547
 
1384
- - `ISubscribable` is renamed to `Listenable`.
1385
- - `IsEvent` type helper is renamed to `IsListener`.
1386
- - `Events` is renamed to `Listeners`.
1548
+ - `ISubscribable` is renamed to `Listenable`.
1549
+ - `IsEvent` type helper is renamed to `IsListener`.
1550
+ - `Events` is renamed to `Listeners`.
1387
1551
 
1388
- - tree: Move several types into InternalTypes ([#21482](https://github.com/microsoft/FluidFramework/pull/21482)) [64d49dd362](https://github.com/microsoft/FluidFramework/commit/64d49dd3629cefe6260a1d6223e58b10c2ac0cb6)
1552
+ - tree: Move several types into InternalTypes ([#21482](https://github.com/microsoft/FluidFramework/pull/21482)) [64d49dd362](https://github.com/microsoft/FluidFramework/commit/64d49dd3629cefe6260a1d6223e58b10c2ac0cb6)
1389
1553
 
1390
- The stable public API surface for Tree has been reduced.
1391
- Several types have been moved into InternalTypes, indicating that they are not fully stable nor intended to be referenced by users of Tree.
1554
+ The stable public API surface for Tree has been reduced.
1555
+ Several types have been moved into InternalTypes, indicating that they are not fully stable nor intended to be referenced by users of Tree.
1392
1556
 
1393
- - NodeBuilderData
1394
- - FieldHasDefault
1395
- - TreeNodeSchemaNonClass
1396
- - TreeArrayNodeBase
1397
- - ScopedSchemaName
1398
- - DefaultProvider
1399
- - typeNameSymbol
1400
- - InsertableObjectFromSchemaRecord
1401
- - ObjectFromSchemaRecord
1402
- - FieldHasDefaultUnsafe
1403
- - ObjectFromSchemaRecordUnsafe
1404
- - TreeObjectNodeUnsafe
1405
- - TreeFieldFromImplicitFieldUnsafe
1406
- - TreeNodeFromImplicitAllowedTypesUnsafe
1407
- - InsertableTreeNodeFromImplicitAllowedTypesUnsafe
1408
- - TreeArrayNodeUnsafe
1409
- - TreeMapNodeUnsafe
1410
- - InsertableObjectFromSchemaRecordUnsafe
1411
- - InsertableTreeFieldFromImplicitFieldUnsafe
1412
- - InsertableTypedNodeUnsafe
1413
- - NodeBuilderDataUnsafe
1414
- - NodeFromSchemaUnsafe
1415
- - FlexList
1416
- - TreeApi
1557
+ - NodeBuilderData
1558
+ - FieldHasDefault
1559
+ - TreeNodeSchemaNonClass
1560
+ - TreeArrayNodeBase
1561
+ - ScopedSchemaName
1562
+ - DefaultProvider
1563
+ - typeNameSymbol
1564
+ - InsertableObjectFromSchemaRecord
1565
+ - ObjectFromSchemaRecord
1566
+ - FieldHasDefaultUnsafe
1567
+ - ObjectFromSchemaRecordUnsafe
1568
+ - TreeObjectNodeUnsafe
1569
+ - TreeFieldFromImplicitFieldUnsafe
1570
+ - TreeNodeFromImplicitAllowedTypesUnsafe
1571
+ - InsertableTreeNodeFromImplicitAllowedTypesUnsafe
1572
+ - TreeArrayNodeUnsafe
1573
+ - TreeMapNodeUnsafe
1574
+ - InsertableObjectFromSchemaRecordUnsafe
1575
+ - InsertableTreeFieldFromImplicitFieldUnsafe
1576
+ - InsertableTypedNodeUnsafe
1577
+ - NodeBuilderDataUnsafe
1578
+ - NodeFromSchemaUnsafe
1579
+ - FlexList
1580
+ - TreeApi
1417
1581
 
1418
- Additionally a few more types which could not be moved due to technically limitations have been documented that they should be treated similarly.
1582
+ Additionally a few more types which could not be moved due to technically limitations have been documented that they should be treated similarly.
1419
1583
 
1420
- - TreeNodeApi
1421
- - TreeNodeSchemaCore
1422
- - All \*Unsafe type (use for construction of recursive schema).
1423
- - WithType
1424
- - AllowedTypes
1425
- - FieldSchemaUnsafe
1584
+ - TreeNodeApi
1585
+ - TreeNodeSchemaCore
1586
+ - All \*Unsafe type (use for construction of recursive schema).
1587
+ - WithType
1588
+ - AllowedTypes
1589
+ - FieldSchemaUnsafe
1426
1590
 
1427
- Also to reduce confusion `type` was renamed to `typeNameSymbol`, and is now only type exported. `Tree.is` should be used to get type information from `TreeNodes` instead.
1591
+ Also to reduce confusion `type` was renamed to `typeNameSymbol`, and is now only type exported. `Tree.is` should be used to get type information from `TreeNodes` instead.
1428
1592
 
1429
- - tree: object node fields with statically known default values are now optional ([#21193](https://github.com/microsoft/FluidFramework/pull/21193)) [21eac41660](https://github.com/microsoft/FluidFramework/commit/21eac41660944208bad42b156d7df05fe6dc6b97)
1593
+ - tree: object node fields with statically known default values are now optional ([#21193](https://github.com/microsoft/FluidFramework/pull/21193)) [21eac41660](https://github.com/microsoft/FluidFramework/commit/21eac41660944208bad42b156d7df05fe6dc6b97)
1430
1594
 
1431
- Makes object node fields with statically known default values (i.e., `optional` and `identifier` fields) optional when creating trees, where they were previously required.
1595
+ Makes object node fields with statically known default values (i.e., `optional` and `identifier` fields) optional when creating trees, where they were previously required.
1432
1596
 
1433
- Example:
1597
+ Example:
1434
1598
 
1435
- ```typescript
1436
- class Foo extends schemaFactory.object("Foo", {
1437
- name: schemaFactory.string,
1438
- id: schemaFactory.identifier,
1439
- nickname: schemaFactory.optional(schemaFactory.string),
1440
- }) {}
1599
+ ```typescript
1600
+ class Foo extends schemaFactory.object("Foo", {
1601
+ name: schemaFactory.string,
1602
+ id: schemaFactory.identifier,
1603
+ nickname: schemaFactory.optional(schemaFactory.string),
1604
+ }) {}
1441
1605
 
1442
- // Before
1443
- const foo = new Foo({
1444
- name: "Bar",
1445
- id: undefined, // Had to explicitly specify `undefined` to opt into default behavior
1446
- nickname: undefined, // Had to explicitly specify `undefined` for optional field
1447
- });
1606
+ // Before
1607
+ const foo = new Foo({
1608
+ name: "Bar",
1609
+ id: undefined, // Had to explicitly specify `undefined` to opt into default behavior
1610
+ nickname: undefined, // Had to explicitly specify `undefined` for optional field
1611
+ });
1448
1612
 
1449
- // After
1450
- const foo = new Foo({
1451
- name: "Bar",
1452
- // Can omit `id` and `nickname` fields, as both have statically known defaults!
1453
- });
1454
- ```
1613
+ // After
1614
+ const foo = new Foo({
1615
+ name: "Bar",
1616
+ // Can omit `id` and `nickname` fields, as both have statically known defaults!
1617
+ });
1618
+ ```
1455
1619
 
1456
- - tree: Breaking change: Removed the `"afterBatch"` event from `Treeview` ([#21406](https://github.com/microsoft/FluidFramework/pull/21406)) [69aceb88e5](https://github.com/microsoft/FluidFramework/commit/69aceb88e525d7fb5c93aaa8328ce26a56e2d9cb)
1620
+ - tree: Breaking change: Removed the `"afterBatch"` event from `Treeview` ([#21406](https://github.com/microsoft/FluidFramework/pull/21406)) [69aceb88e5](https://github.com/microsoft/FluidFramework/commit/69aceb88e525d7fb5c93aaa8328ce26a56e2d9cb)
1457
1621
 
1458
- This event is no longer necessary.
1459
- In the past, it provided a means for waiting for a batch of changes to finish applying to the tree before taking some action.
1460
- However, the tree change events exposed via `Tree.on` wait for a batch to complete before firing, so the `"afterBatch"` event provides no additional guarantees.
1461
- Listeners of this event who wish to respond to changes to the tree view can use `"rootChanged"` instead.
1622
+ This event is no longer necessary.
1623
+ In the past, it provided a means for waiting for a batch of changes to finish applying to the tree before taking some action.
1624
+ However, the tree change events exposed via `Tree.on` wait for a batch to complete before firing, so the `"afterBatch"` event provides no additional guarantees.
1625
+ Listeners of this event who wish to respond to changes to the tree view can use `"rootChanged"` instead.
1462
1626
 
1463
- - tree: Fix AfterBatch event ([#21162](https://github.com/microsoft/FluidFramework/pull/21162)) [cecd740a6c](https://github.com/microsoft/FluidFramework/commit/cecd740a6cadc6d3cdafdba7e22312b3d756c780)
1627
+ - tree: Fix AfterBatch event ([#21162](https://github.com/microsoft/FluidFramework/pull/21162)) [cecd740a6c](https://github.com/microsoft/FluidFramework/commit/cecd740a6cadc6d3cdafdba7e22312b3d756c780)
1464
1628
 
1465
- `TreeViewEvents.afterBatch` is now triggered when appropriate instead of never firing.
1629
+ `TreeViewEvents.afterBatch` is now triggered when appropriate instead of never firing.
1466
1630
 
1467
- - tree: Breaking change: `TreeStatus.Created` is now `TreeStatus.New` ([#21278](https://github.com/microsoft/FluidFramework/pull/21278)) [5a26346a14](https://github.com/microsoft/FluidFramework/commit/5a26346a145ed54d08cd5a9b4f1c9b177711bd7c)
1631
+ - tree: Breaking change: `TreeStatus.Created` is now `TreeStatus.New` ([#21278](https://github.com/microsoft/FluidFramework/pull/21278)) [5a26346a14](https://github.com/microsoft/FluidFramework/commit/5a26346a145ed54d08cd5a9b4f1c9b177711bd7c)
1468
1632
 
1469
- `TreeStatus.Created` has been renamed to `TreeStatus.New`.
1633
+ `TreeStatus.Created` has been renamed to `TreeStatus.New`.
1470
1634
 
1471
- - tree: Implement compatibility-based schema evolution API ([#20815](https://github.com/microsoft/FluidFramework/pull/20815)) [64e5763b70](https://github.com/microsoft/FluidFramework/commit/64e5763b70e269418fbb77f75dbd3c82b91b1aff)
1635
+ - tree: Implement compatibility-based schema evolution API ([#20815](https://github.com/microsoft/FluidFramework/pull/20815)) [64e5763b70](https://github.com/microsoft/FluidFramework/commit/64e5763b70e269418fbb77f75dbd3c82b91b1aff)
1472
1636
 
1473
- This change adjusts some top-level APIs for using SharedTree to better accommodate applications that need to change their schema.
1474
- These changes enable forwards compatibility with future work to relax `SharedTree`'s restrictions around view schema and stored schema compatibility.
1475
- That future work will enable more flexible policies around how applications can update their documents' schemas over time.
1637
+ This change adjusts some top-level APIs for using SharedTree to better accommodate applications that need to change their schema.
1638
+ These changes enable forwards compatibility with future work to relax `SharedTree`'s restrictions around view schema and stored schema compatibility.
1639
+ That future work will enable more flexible policies around how applications can update their documents' schemas over time.
1476
1640
 
1477
- Application authors are encouraged to develop a compatibility policy which they are comfortable with using the guidance in the
1478
- "Schema Evolvability" section of `@fluidframework/tree`'s readme.
1641
+ Application authors are encouraged to develop a compatibility policy which they are comfortable with using the guidance in the
1642
+ "Schema Evolvability" section of `@fluidframework/tree`'s readme.
1479
1643
 
1480
- To make the details of schema compatibilities that SharedTree supports more clear,
1481
- `TreeView.error` has been functionally replaced with the `compatibility` property.
1482
- Users desiring the previous strict behavior should use `view.compatibility.isEquivalent` at appropriate places in application logic.
1644
+ To make the details of schema compatibilities that SharedTree supports more clear,
1645
+ `TreeView.error` has been functionally replaced with the `compatibility` property.
1646
+ Users desiring the previous strict behavior should use `view.compatibility.isEquivalent` at appropriate places in application logic.
1483
1647
 
1484
- # `ITree.schematize` removal
1648
+ # `ITree.schematize` removal
1485
1649
 
1486
- `ITree.schematize` (and its argument `TreeConfiguration`) has been removed. Instead, call `ITree.viewWith` and provide it a `TreeViewConfiguration`.
1487
- Unlike `schematize`, `viewWith` does not implicitly initialize the document.
1488
- As such, it doesn't take an `initialTree` property.
1489
- Instead, applications should initialize their trees in document creation codepaths using the added `TreeView.initialize` API.
1490
-
1491
- ## Old
1492
-
1493
- As an example, something like the following code may have been used before for both the document create and document load codepaths:
1494
-
1495
- ```typescript
1496
- // -- fluid-framework API for statically defined objects in container schema --
1497
- const tree = container.initialObjects.myTree;
1498
- const view = tree.schematize(new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })));
1650
+ `ITree.schematize` (and its argument `TreeConfiguration`) has been removed. Instead, call `ITree.viewWith` and provide it a `TreeViewConfiguration`.
1651
+ Unlike `schematize`, `viewWith` does not implicitly initialize the document.
1652
+ As such, it doesn't take an `initialTree` property.
1653
+ Instead, applications should initialize their trees in document creation codepaths using the added `TreeView.initialize` API.
1499
1654
 
1500
- // -- fluid-framework API for dynamically created objects --
1501
- const tree = await container.create(SharedTree);
1502
- const view = tree.schematize(new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })));
1503
- ```
1655
+ ## Old
1504
1656
 
1505
- When using the encapsulated API, creating a tree looks a bit different but the call to `schematize` is the same:
1657
+ As an example, something like the following code may have been used before for both the document create and document load codepaths:
1506
1658
 
1507
- ```typescript
1508
- // -- encapsulated API --
1509
- const tree = SharedTree.create(runtime, "foo");
1510
- const view = tree.schematize(new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })));
1511
- ```
1659
+ ```typescript
1660
+ // -- fluid-framework API for statically defined objects in container schema --
1661
+ const tree = container.initialObjects.myTree;
1662
+ const view = tree.schematize(
1663
+ new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
1664
+ );
1512
1665
 
1513
- ## New
1666
+ // -- fluid-framework API for dynamically created objects --
1667
+ const tree = await container.create(SharedTree);
1668
+ const view = tree.schematize(
1669
+ new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
1670
+ );
1671
+ ```
1514
1672
 
1515
- After migrating this code away from `schematize` and onto `viewWith`, it would look like this on the create codepath:
1673
+ When using the encapsulated API, creating a tree looks a bit different but the call to `schematize` is the same:
1516
1674
 
1517
- ```typescript
1518
- const treeConfig = new TreeViewConfiguration({ schema: Point });
1675
+ ```typescript
1676
+ // -- encapsulated API --
1677
+ const tree = SharedTree.create(runtime, "foo");
1678
+ const view = tree.schematize(
1679
+ new TreeConfiguration(Point, () => new Point({ x: 0, y: 0 })),
1680
+ );
1681
+ ```
1519
1682
 
1520
- // The following line reflects the first-party API (e.g. @fluidframework/aqueduct). If using the third-party API, obtaining
1521
- // a SharedTree is unaffected by this changeset.
1522
- const tree = SharedTree.create(runtime, "foo");
1523
- const view = tree.viewWith(treeConfig);
1524
- view.initialize(new Point({ x: 0, y: 0 }));
1525
- ```
1683
+ ## New
1526
1684
 
1527
- and this on the load codepath:
1685
+ After migrating this code away from `schematize` and onto `viewWith`, it would look like this on the create codepath:
1528
1686
 
1529
- ```typescript
1530
- // 'tree' would typically be obtained by retrieving it from a well-known location, e.g. within a `DataObject`'s
1531
- // root directory or in `IFluidContainer.initialObjects`
1532
- const view = tree.viewWith(treeConfig);
1533
- ```
1687
+ ```typescript
1688
+ const treeConfig = new TreeViewConfiguration({ schema: Point });
1534
1689
 
1535
- Besides only making the initial tree required to specify in places that actually perform document initialization, this is beneficial for mutation semantics: `tree.viewWith` never modifies the state of the underlying tree.
1536
- This means applications are free to attempt to view a document using multiple schemas (e.g. legacy versions of their document format) without worrying about altering the document state.
1690
+ // The following line reflects the first-party API (e.g. @fluidframework/aqueduct). If using the third-party API, obtaining
1691
+ // a SharedTree is unaffected by this changeset.
1692
+ const tree = SharedTree.create(runtime, "foo");
1693
+ const view = tree.viewWith(treeConfig);
1694
+ view.initialize(new Point({ x: 0, y: 0 }));
1695
+ ```
1537
1696
 
1538
- If existing code used schematize in a context where it wasn't known whether the document needed to be initialized, you can leverage `TreeView.compatibility` like so:
1697
+ and this on the load codepath:
1539
1698
 
1540
- ```typescript
1541
- const view = tree.viewWith(config);
1542
- if (view.compatibility.canInitialize) {
1543
- view.initialize(initialTree);
1544
- }
1545
- ```
1699
+ ```typescript
1700
+ // 'tree' would typically be obtained by retrieving it from a well-known location, e.g. within a `DataObject`'s
1701
+ // root directory or in `IFluidContainer.initialObjects`
1702
+ const view = tree.viewWith(treeConfig);
1703
+ ```
1704
+
1705
+ Besides only making the initial tree required to specify in places that actually perform document initialization, this is beneficial for mutation semantics: `tree.viewWith` never modifies the state of the underlying tree.
1706
+ This means applications are free to attempt to view a document using multiple schemas (e.g. legacy versions of their document format) without worrying about altering the document state.
1707
+
1708
+ If existing code used schematize in a context where it wasn't known whether the document needed to be initialized, you can leverage `TreeView.compatibility` like so:
1709
+
1710
+ ```typescript
1711
+ const view = tree.viewWith(config);
1712
+ if (view.compatibility.canInitialize) {
1713
+ view.initialize(initialTree);
1714
+ }
1715
+ ```
1546
1716
 
1547
- # Separate `schemaChanged` event on `TreeView`
1717
+ # Separate `schemaChanged` event on `TreeView`
1548
1718
 
1549
- The previous `rootChanged` event was called whenever the root was invalidated, which happens on changes to the document schema
1550
- as well as changes to the root field (i.e. usage of `TreeView.root`'s setter on a local client, or acking such a change made by
1551
- a remote client).
1719
+ The previous `rootChanged` event was called whenever the root was invalidated, which happens on changes to the document schema
1720
+ as well as changes to the root field (i.e. usage of `TreeView.root`'s setter on a local client, or acking such a change made by
1721
+ a remote client).
1552
1722
 
1553
- There was no distinct `schemaChanged` event, meaning that any time the root changed,
1554
- clients would have needed to check the `error` state on `TreeView` to see if the document's underlying schema had been changed.
1723
+ There was no distinct `schemaChanged` event, meaning that any time the root changed,
1724
+ clients would have needed to check the `error` state on `TreeView` to see if the document's underlying schema had been changed.
1555
1725
 
1556
- Now, the latter case of the document's underlying schema changing has been split off into a `schemaChanged` event, which will
1557
- fire before `rootChanged`.
1558
- This should allow applications to run slightly less compatibility logic to routine changes to the root field.
1726
+ Now, the latter case of the document's underlying schema changing has been split off into a `schemaChanged` event, which will
1727
+ fire before `rootChanged`.
1728
+ This should allow applications to run slightly less compatibility logic to routine changes to the root field.
1559
1729
 
1560
- - core-interfaces, tree: Unify `IDisposable` interfaces ([#21184](https://github.com/microsoft/FluidFramework/pull/21184)) [cfcb827851](https://github.com/microsoft/FluidFramework/commit/cfcb827851ffc81486db6c718380150189fb95c5)
1730
+ - core-interfaces, tree: Unify `IDisposable` interfaces ([#21184](https://github.com/microsoft/FluidFramework/pull/21184)) [cfcb827851](https://github.com/microsoft/FluidFramework/commit/cfcb827851ffc81486db6c718380150189fb95c5)
1561
1731
 
1562
- Public APIs in `@fluidframework/tree` now use `IDisposable` from `@fluidframework/core-interfaces` replacing `disposeSymbol` with "dispose".
1732
+ Public APIs in `@fluidframework/tree` now use `IDisposable` from `@fluidframework/core-interfaces` replacing `disposeSymbol` with "dispose".
1563
1733
 
1564
- `IDisposable` in `@fluidframework/core-interfaces` is now `@sealed` indicating that third parties should not implement it to reserve the ability for Fluid Framework to extend it to include `Symbol.dispose` as a future non-breaking change.
1734
+ `IDisposable` in `@fluidframework/core-interfaces` is now `@sealed` indicating that third parties should not implement it to reserve the ability for Fluid Framework to extend it to include `Symbol.dispose` as a future non-breaking change.
1565
1735
 
1566
- - tree: Fix bug where reading tree during events could cause issues ([#21172](https://github.com/microsoft/FluidFramework/pull/21172)) [81a648a984](https://github.com/microsoft/FluidFramework/commit/81a648a9843f7940df318b63258d864d1fa91bc1)
1736
+ - tree: Fix bug where reading tree during events could cause issues ([#21172](https://github.com/microsoft/FluidFramework/pull/21172)) [81a648a984](https://github.com/microsoft/FluidFramework/commit/81a648a9843f7940df318b63258d864d1fa91bc1)
1567
1737
 
1568
- Reading the tree inside of NodeChange and TreeChange events could corrupt internal memory structures leading to invalid data in subsequence reads as well as internal errors being thrown. This bug has been fixed.
1738
+ Reading the tree inside of NodeChange and TreeChange events could corrupt internal memory structures leading to invalid data in subsequence reads as well as internal errors being thrown. This bug has been fixed.
1569
1739
 
1570
1740
  ## 2.0.0-rc.4.0.0
1571
1741
 
1572
1742
  ### Minor Changes
1573
1743
 
1574
- - Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
1744
+ - Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
1575
1745
 
1576
- Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
1577
- Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
1746
+ Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
1747
+ Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
1578
1748
 
1579
- External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
1580
- Any existing and previously working, and now broken, external implementations of `IFluidHandle` should still work at runtime, but will need some unsafe type casts to compile.
1581
- Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
1749
+ External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
1750
+ Any existing and previously working, and now broken, external implementations of `IFluidHandle` should still work at runtime, but will need some unsafe type casts to compile.
1751
+ Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
1582
1752
 
1583
- - Minor API fixes for "@fluidframework/tree" package. [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
1753
+ - Minor API fixes for "@fluidframework/tree" package. [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
1584
1754
 
1585
- Changes constructor for `FieldSchema` from public to private. Users should call `makeFieldSchema` to create instance of `FieldSchema`.
1755
+ Changes constructor for `FieldSchema` from public to private. Users should call `makeFieldSchema` to create instance of `FieldSchema`.
1586
1756
 
1587
1757
  ## 2.0.0-rc.3.0.0
1588
1758
 
1589
1759
  ### Major Changes
1590
1760
 
1591
- - Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1761
+ - Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1592
1762
 
1593
- Fluid Framework packages have been updated to use the [package.json "exports"
1594
- field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
1595
- TypeScript types and implementation code.
1763
+ Fluid Framework packages have been updated to use the [package.json "exports"
1764
+ field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
1765
+ TypeScript types and implementation code.
1596
1766
 
1597
- This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
1767
+ This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
1598
1768
 
1599
- - `"moduleResolution": "Node16"` with `"module": "Node16"`
1600
- - `"moduleResolution": "Bundler"` with `"module": "ESNext"`
1769
+ - `"moduleResolution": "Node16"` with `"module": "Node16"`
1770
+ - `"moduleResolution": "Bundler"` with `"module": "ESNext"`
1601
1771
 
1602
- We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
1603
- for use with modern versions of Node.js _and_ Bundlers.
1604
- [See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
1605
- regarding the module and moduleResolution options.
1772
+ We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
1773
+ for use with modern versions of Node.js _and_ Bundlers.
1774
+ [See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
1775
+ regarding the module and moduleResolution options.
1606
1776
 
1607
- **Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
1608
- to distinguish stable APIs from those that are in development.**
1777
+ **Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
1778
+ to distinguish stable APIs from those that are in development.**
1609
1779
 
1610
1780
  ### Minor Changes
1611
1781
 
1612
- - Better events [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1782
+ - Better events [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1613
1783
 
1614
- We have updated the Events to make it easier to create granular event listeners for single nodes and better support the
1615
- undo/redo feature. SharedTree nodes now expose `nodeChanged` and `treeChanged` events that fire in response to changes
1616
- in the node, and to changes in the subtree rooted at the node, respectively.
1784
+ We have updated the Events to make it easier to create granular event listeners for single nodes and better support the
1785
+ undo/redo feature. SharedTree nodes now expose `nodeChanged` and `treeChanged` events that fire in response to changes
1786
+ in the node, and to changes in the subtree rooted at the node, respectively.
1617
1787
 
1618
- This change was originally made in [#20286](https://github.com/microsoft/FluidFramework/pull/20286) ([ac1e773960](https://github.com/microsoft/FluidFramework/commit/ac1e7739607551abb0dae7fa74dda56aec94b609)).
1788
+ This change was originally made in [#20286](https://github.com/microsoft/FluidFramework/pull/20286) ([ac1e773960](https://github.com/microsoft/FluidFramework/commit/ac1e7739607551abb0dae7fa74dda56aec94b609)).
1619
1789
 
1620
- [Read more about SharedTree Events at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#event-handling)
1790
+ [Read more about SharedTree Events at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#event-handling)
1621
1791
 
1622
- - Recursive schemas [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1792
+ - Recursive schemas [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1623
1793
 
1624
- Schemas are even more powerful now with the added support for recursive types, which allows you to define types that
1625
- reference nodes of the same type in their subtree.
1794
+ Schemas are even more powerful now with the added support for recursive types, which allows you to define types that
1795
+ reference nodes of the same type in their subtree.
1626
1796
 
1627
- Users of the beta APIs via `SchemaFactoryRecursive` can now find them on `SchemaFactory`.
1797
+ Users of the beta APIs via `SchemaFactoryRecursive` can now find them on `SchemaFactory`.
1628
1798
 
1629
- [Read more about Recursive Schema at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#recursive-schema)
1799
+ [Read more about Recursive Schema at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#recursive-schema)
1630
1800
 
1631
- - Transactions [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1801
+ - Transactions [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1632
1802
 
1633
- You can group multiple changes such that they are applied atomically, and if they fail, they fail atomically. As a
1634
- result of grouping changes in a transaction, you also get a single revertible object making it easier to undo and redo.
1803
+ You can group multiple changes such that they are applied atomically, and if they fail, they fail atomically. As a
1804
+ result of grouping changes in a transaction, you also get a single revertible object making it easier to undo and redo.
1635
1805
 
1636
- [Read more about Transactions at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#transactions)
1806
+ [Read more about Transactions at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#transactions)
1637
1807
 
1638
- - tree: Empty optional fields on object nodes now are undefined non-enumerable own properties instead of not a property at all. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1808
+ - tree: Empty optional fields on object nodes now are undefined non-enumerable own properties instead of not a property at all. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1639
1809
 
1640
- Empty optional fields on object nodes now are now undefined non-enumerable own properties.
1641
- This improves behavior in cases where they shadow inherited members which no longer have types which differ from the runtime behavior.
1810
+ Empty optional fields on object nodes now are now undefined non-enumerable own properties.
1811
+ This improves behavior in cases where they shadow inherited members which no longer have types which differ from the runtime behavior.
1642
1812
 
1643
- - tree: Allow root editing and make TreeView parameterized over schema. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1813
+ - tree: Allow root editing and make TreeView parameterized over schema. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1644
1814
 
1645
- TreeView now is parameterized over the field schema instead of the root field type. This was needed to infer the correct input type when reassigning the root.
1646
- Code providing an explicit type to TreeView, like `TreeView<Foo>` can usually be updated by replacing that with `TreeView<typeof Foo>`.
1815
+ TreeView now is parameterized over the field schema instead of the root field type. This was needed to infer the correct input type when reassigning the root.
1816
+ Code providing an explicit type to TreeView, like `TreeView<Foo>` can usually be updated by replacing that with `TreeView<typeof Foo>`.
1647
1817
 
1648
- - fluid-framework: Replace SharedObjectClass with new ISharedObjectKind type. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1818
+ - fluid-framework: Replace SharedObjectClass with new ISharedObjectKind type. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1649
1819
 
1650
- The static objects used as SharedObjectClass now explicitly implement the new ISharedObjectKind type.
1651
- SharedObjectClass has been removed as ISharedObjectKind now fills that role.
1652
- LoadableObjectCtor has been inlined as it only had one use: an external user of it can replace it with `(new (...args: any[]) => T)`.
1820
+ The static objects used as SharedObjectClass now explicitly implement the new ISharedObjectKind type.
1821
+ SharedObjectClass has been removed as ISharedObjectKind now fills that role.
1822
+ LoadableObjectCtor has been inlined as it only had one use: an external user of it can replace it with `(new (...args: any[]) => T)`.
1653
1823
 
1654
- - Undo/Redo [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1824
+ - Undo/Redo [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
1655
1825
 
1656
- Added the ability to listen for changes and track revertible objects on your undo/redo stacks. Revertibles allow you to
1657
- undo and redo changes even if other changes have been made in remote clients.
1826
+ Added the ability to listen for changes and track revertible objects on your undo/redo stacks. Revertibles allow you to
1827
+ undo and redo changes even if other changes have been made in remote clients.
1658
1828
 
1659
- [Read more about Undo/redo at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#undoredo-support)
1829
+ [Read more about Undo/redo at fluidframework.com](https://fluidframework.com/docs/data-structures/tree/#undoredo-support)
1660
1830
 
1661
1831
  ## 2.0.0-rc.2.0.0
1662
1832
 
1663
1833
  ### Minor Changes
1664
1834
 
1665
- - map, tree: DDS classes are no longer publicly exported ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
1835
+ - map, tree: DDS classes are no longer publicly exported ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
1666
1836
 
1667
- SharedMap and SharedTree now only export their factories and the interface types.
1668
- The actual concrete classes which leak implementation details are no longer exported.
1669
- Users of the `SharedMap` type should use `ISharedMap`.
1670
- Users of the `SharedTree` type should use `ISharedTree`.
1837
+ SharedMap and SharedTree now only export their factories and the interface types.
1838
+ The actual concrete classes which leak implementation details are no longer exported.
1839
+ Users of the `SharedMap` type should use `ISharedMap`.
1840
+ Users of the `SharedTree` type should use `ISharedTree`.
1671
1841
 
1672
- - tree: Minor API fixes for "@fluidframework/tree" package. ([#19057](https://github.com/microsoft/FluidFramework/issues/19057)) [3e0f218832](https://github.com/microsoft/FluidFramework/commits/3e0f21883255317f8bb1f7c420543650502a5b66)
1842
+ - tree: Minor API fixes for "@fluidframework/tree" package. ([#19057](https://github.com/microsoft/FluidFramework/issues/19057)) [3e0f218832](https://github.com/microsoft/FluidFramework/commits/3e0f21883255317f8bb1f7c420543650502a5b66)
1673
1843
 
1674
- Rename `IterableTreeListContent` to `IterableTreeArrayContent`, inline `TreeMapNodeBase` into `TreeMapNode`, rename `TreeArrayNode.spread` to `TreeArrayNode.spread` and remove `create` which was not supposed to be public (use `TreeArrayNode.spread` instead).
1844
+ Rename `IterableTreeListContent` to `IterableTreeArrayContent`, inline `TreeMapNodeBase` into `TreeMapNode`, rename `TreeArrayNode.spread` to `TreeArrayNode.spread` and remove `create` which was not supposed to be public (use `TreeArrayNode.spread` instead).
1675
1845
 
1676
1846
  ## 2.0.0-rc.1.0.0
1677
1847
 
1678
1848
  ### Major Changes
1679
1849
 
1680
- - @fluid-experimental/tree2 package renamed ([#18851](https://github.com/microsoft/FluidFramework/issues/18851)) [6161193ffe](https://github.com/microsoft/FluidFramework/commits/6161193ffe661c3835c4f1ba2da78078dca10b4b)
1850
+ - @fluid-experimental/tree2 package renamed ([#18851](https://github.com/microsoft/FluidFramework/issues/18851)) [6161193ffe](https://github.com/microsoft/FluidFramework/commits/6161193ffe661c3835c4f1ba2da78078dca10b4b)
1681
1851
 
1682
- The package is now `@fluidframework/tree`.
1852
+ The package is now `@fluidframework/tree`.
1683
1853
 
1684
1854
  ### Minor Changes
1685
1855
 
1686
- - Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
1687
-
1688
- The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
1689
-
1690
- - @fluidframework/gitresources
1691
- - @fluidframework/server-kafka-orderer
1692
- - @fluidframework/server-lambdas
1693
- - @fluidframework/server-lambdas-driver
1694
- - @fluidframework/server-local-server
1695
- - @fluidframework/server-memory-orderer
1696
- - @fluidframework/protocol-base
1697
- - @fluidframework/server-routerlicious
1698
- - @fluidframework/server-routerlicious-base
1699
- - @fluidframework/server-services
1700
- - @fluidframework/server-services-client
1701
- - @fluidframework/server-services-core
1702
- - @fluidframework/server-services-ordering-kafkanode
1703
- - @fluidframework/server-services-ordering-rdkafka
1704
- - @fluidframework/server-services-ordering-zookeeper
1705
- - @fluidframework/server-services-shared
1706
- - @fluidframework/server-services-telemetry
1707
- - @fluidframework/server-services-utils
1708
- - @fluidframework/server-test-utils
1709
- - tinylicious
1710
-
1711
- - Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
1712
-
1713
- The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
1714
- changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
1856
+ - Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
1857
+
1858
+ The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
1859
+
1860
+ - @fluidframework/gitresources
1861
+ - @fluidframework/server-kafka-orderer
1862
+ - @fluidframework/server-lambdas
1863
+ - @fluidframework/server-lambdas-driver
1864
+ - @fluidframework/server-local-server
1865
+ - @fluidframework/server-memory-orderer
1866
+ - @fluidframework/protocol-base
1867
+ - @fluidframework/server-routerlicious
1868
+ - @fluidframework/server-routerlicious-base
1869
+ - @fluidframework/server-services
1870
+ - @fluidframework/server-services-client
1871
+ - @fluidframework/server-services-core
1872
+ - @fluidframework/server-services-ordering-kafkanode
1873
+ - @fluidframework/server-services-ordering-rdkafka
1874
+ - @fluidframework/server-services-ordering-zookeeper
1875
+ - @fluidframework/server-services-shared
1876
+ - @fluidframework/server-services-telemetry
1877
+ - @fluidframework/server-services-utils
1878
+ - @fluidframework/server-test-utils
1879
+ - tinylicious
1880
+
1881
+ - Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
1882
+
1883
+ The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
1884
+ changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
1715
1885
 
1716
1886
  ## 2.0.0-internal.8.0.0
1717
1887
 
1718
1888
  ### Major Changes
1719
1889
 
1720
- - datastore-definitions: Jsonable and Serializable now require a generic parameter [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
1890
+ - datastore-definitions: Jsonable and Serializable now require a generic parameter [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
1721
1891
 
1722
- The `Jsonable` and `Serializable` types from @fluidframework/datastore-definitions now require a generic parameter and
1723
- if that type is `any` or `unknown`will return a new result `JsonableTypeWith<>` that more accurately represents the
1724
- limitation of serialization.
1892
+ The `Jsonable` and `Serializable` types from @fluidframework/datastore-definitions now require a generic parameter and
1893
+ if that type is `any` or `unknown`will return a new result `JsonableTypeWith<>` that more accurately represents the
1894
+ limitation of serialization.
1725
1895
 
1726
- Additional modifications:
1896
+ Additional modifications:
1727
1897
 
1728
- - `Jsonable`'s `TReplacement` parameter default has also been changed from `void` to `never`, which now disallows
1729
- `void`.
1730
- - Unrecognized primitive types like `symbol` are now filtered to `never` instead of `{}`.
1731
- - Recursive types with arrays (`[]`) are now supported.
1898
+ - `Jsonable`'s `TReplacement` parameter default has also been changed from `void` to `never`, which now disallows
1899
+ `void`.
1900
+ - Unrecognized primitive types like `symbol` are now filtered to `never` instead of `{}`.
1901
+ - Recursive types with arrays (`[]`) are now supported.
1732
1902
 
1733
- `Serializable` is commonly used for DDS values and now requires more precision when using them. For example SharedMatrix
1734
- (unqualified) has an `any` default that meant values were `Serializable<any>` (i.e. `any`), but now `Serializable<any>`
1735
- is `JsonableTypeWith<IFluidHandle>` which may be problematic for reading or writing. Preferred correction is to specify
1736
- the value type but casting through `any` may provide a quick fix.
1903
+ `Serializable` is commonly used for DDS values and now requires more precision when using them. For example SharedMatrix
1904
+ (unqualified) has an `any` default that meant values were `Serializable<any>` (i.e. `any`), but now `Serializable<any>`
1905
+ is `JsonableTypeWith<IFluidHandle>` which may be problematic for reading or writing. Preferred correction is to specify
1906
+ the value type but casting through `any` may provide a quick fix.
1737
1907
 
1738
1908
  ## 2.0.0-internal.7.4.0
1739
1909
 
@@ -1743,190 +1913,190 @@ Dependency updates only.
1743
1913
 
1744
1914
  ### Minor Changes
1745
1915
 
1746
- - Rename SchemaCollection.treeSchema to nodeSchema ([#18067](https://github.com/microsoft/FluidFramework/issues/18067)) [be7ee4b383](https://github.com/microsoft/FluidFramework/commits/be7ee4b383c86fbcb60e92b606bbd305d0157acb)
1916
+ - Rename SchemaCollection.treeSchema to nodeSchema ([#18067](https://github.com/microsoft/FluidFramework/issues/18067)) [be7ee4b383](https://github.com/microsoft/FluidFramework/commits/be7ee4b383c86fbcb60e92b606bbd305d0157acb)
1747
1917
 
1748
- This breaks all existing documents, as well as any users of SchemaCollection.treeSchema.
1918
+ This breaks all existing documents, as well as any users of SchemaCollection.treeSchema.
1749
1919
 
1750
- - Remove editable-tree-1 ([#18169](https://github.com/microsoft/FluidFramework/issues/18169)) [f0100204bd](https://github.com/microsoft/FluidFramework/commits/f0100204bd19f8be769a1163a655a185e7c1289e)
1920
+ - Remove editable-tree-1 ([#18169](https://github.com/microsoft/FluidFramework/issues/18169)) [f0100204bd](https://github.com/microsoft/FluidFramework/commits/f0100204bd19f8be769a1163a655a185e7c1289e)
1751
1921
 
1752
- Remove editable-tree-1 and APIs related to it. Users must migrate to editable-tree-2.
1922
+ Remove editable-tree-1 and APIs related to it. Users must migrate to editable-tree-2.
1753
1923
 
1754
1924
  ## 2.0.0-internal.7.2.0
1755
1925
 
1756
1926
  ### Minor Changes
1757
1927
 
1758
- - tree2: Rename DocumentSchema and toDocumentSchema ([#17854](https://github.com/microsoft/FluidFramework/issues/17854)) [0b5944050d](https://github.com/microsoft/FluidFramework/commits/0b5944050d3bc4470a87de4a4332235d37cb719c)
1928
+ - tree2: Rename DocumentSchema and toDocumentSchema ([#17854](https://github.com/microsoft/FluidFramework/issues/17854)) [0b5944050d](https://github.com/microsoft/FluidFramework/commits/0b5944050d3bc4470a87de4a4332235d37cb719c)
1759
1929
 
1760
- The following APIs have been renamed:
1930
+ The following APIs have been renamed:
1761
1931
 
1762
- - `DocumentSchema` is now `TreeSchema`
1763
- - `toDocumentSchema` is now `intoSchema`
1932
+ - `DocumentSchema` is now `TreeSchema`
1933
+ - `toDocumentSchema` is now `intoSchema`
1764
1934
 
1765
- - tree2: Rename SchemaData, FieldSchema, and FieldStoredSchema ([#17888](https://github.com/microsoft/FluidFramework/issues/17888)) [27f5a5e24d](https://github.com/microsoft/FluidFramework/commits/27f5a5e24dda81eafe5678742d68cd7d8afdc060)
1935
+ - tree2: Rename SchemaData, FieldSchema, and FieldStoredSchema ([#17888](https://github.com/microsoft/FluidFramework/issues/17888)) [27f5a5e24d](https://github.com/microsoft/FluidFramework/commits/27f5a5e24dda81eafe5678742d68cd7d8afdc060)
1766
1936
 
1767
- The following APIs have been renamed:
1937
+ The following APIs have been renamed:
1768
1938
 
1769
- - `SchemaData` is now `TreeStoredSchema`
1770
- - `FieldSchema` is now `TreeFieldSchema`
1771
- - `FieldStoredSchema` is now `TreeFieldStoredSchema`
1939
+ - `SchemaData` is now `TreeStoredSchema`
1940
+ - `FieldSchema` is now `TreeFieldSchema`
1941
+ - `FieldStoredSchema` is now `TreeFieldStoredSchema`
1772
1942
 
1773
- - tree2: Add `null` to allowed leaf types ([#17781](https://github.com/microsoft/FluidFramework/issues/17781)) [040e28f3ab](https://github.com/microsoft/FluidFramework/commits/040e28f3aba415e086fe2661e97d984c97b85045)
1943
+ - tree2: Add `null` to allowed leaf types ([#17781](https://github.com/microsoft/FluidFramework/issues/17781)) [040e28f3ab](https://github.com/microsoft/FluidFramework/commits/040e28f3aba415e086fe2661e97d984c97b85045)
1774
1944
 
1775
- Replaced the jsonNull schema with a new null leaf schema, and added support for leaf values which are null.
1945
+ Replaced the jsonNull schema with a new null leaf schema, and added support for leaf values which are null.
1776
1946
 
1777
- - tree2: Rename TreeSchema ([#17845](https://github.com/microsoft/FluidFramework/issues/17845)) [908ee8921e](https://github.com/microsoft/FluidFramework/commits/908ee8921eb8d7fc21f64eee88a12c678e9756dd)
1947
+ - tree2: Rename TreeSchema ([#17845](https://github.com/microsoft/FluidFramework/issues/17845)) [908ee8921e](https://github.com/microsoft/FluidFramework/commits/908ee8921eb8d7fc21f64eee88a12c678e9756dd)
1778
1948
 
1779
- The following APIs have been renamed:
1949
+ The following APIs have been renamed:
1780
1950
 
1781
- - `TreeSchema` is now `TreeNodeSchema`
1951
+ - `TreeSchema` is now `TreeNodeSchema`
1782
1952
 
1783
- - tree2: Rename Struct ([#17899](https://github.com/microsoft/FluidFramework/issues/17899)) [d90af254fe](https://github.com/microsoft/FluidFramework/commits/d90af254fe4224dd6391908e88055f3c98cc1d18)
1953
+ - tree2: Rename Struct ([#17899](https://github.com/microsoft/FluidFramework/issues/17899)) [d90af254fe](https://github.com/microsoft/FluidFramework/commits/d90af254fe4224dd6391908e88055f3c98cc1d18)
1784
1954
 
1785
- The following APIs have been renamed:
1955
+ The following APIs have been renamed:
1786
1956
 
1787
- - `Struct` is now `ObjectNode`
1957
+ - `Struct` is now `ObjectNode`
1788
1958
 
1789
1959
  ## 2.0.0-internal.7.1.0
1790
1960
 
1791
1961
  ### Major Changes
1792
1962
 
1793
- - tree2: Regressions and new node removal model ([#17304](https://github.com/microsoft/FluidFramework/issues/17304)) [935bae84a5](https://github.com/microsoft/FluidFramework/commits/935bae84a513c7184025784e485ad64d23514f92)
1963
+ - tree2: Regressions and new node removal model ([#17304](https://github.com/microsoft/FluidFramework/issues/17304)) [935bae84a5](https://github.com/microsoft/FluidFramework/commits/935bae84a513c7184025784e485ad64d23514f92)
1794
1964
 
1795
- Regression 1: All changes are atomized by the `visitDelta` function. This means that, if you insert/remove/move 2 contiguous nodes, the `visitDelta` function will call the `DeltaVisitor` twice (once for each node) instead of once for both nodes. Anything that sits downstream from the `DeltaVisitor` will therefore also see those changes as atomized.
1965
+ Regression 1: All changes are atomized by the `visitDelta` function. This means that, if you insert/remove/move 2 contiguous nodes, the `visitDelta` function will call the `DeltaVisitor` twice (once for each node) instead of once for both nodes. Anything that sits downstream from the `DeltaVisitor` will therefore also see those changes as atomized.
1796
1966
 
1797
- Regression 2: The forest never forgets removed content so the memory will grow unbounded.
1967
+ Regression 2: The forest never forgets removed content so the memory will grow unbounded.
1798
1968
 
1799
- Removed nodes are preserved as detached in the forest instead of deleted. Anchors to removed nodes remain valid.
1969
+ Removed nodes are preserved as detached in the forest instead of deleted. Anchors to removed nodes remain valid.
1800
1970
 
1801
- Change notification for node replacement in optional and required fields are now atomic.
1971
+ Change notification for node replacement in optional and required fields are now atomic.
1802
1972
 
1803
- Updated `PathVisitor` API.
1973
+ Updated `PathVisitor` API.
1804
1974
 
1805
- Forest and AnchorSet are now updated in lockstep.
1975
+ Forest and AnchorSet are now updated in lockstep.
1806
1976
 
1807
1977
  ### Minor Changes
1808
1978
 
1809
- - tree2: Allow ImplicitFieldSchema for non-recursive schema building ([#17683](https://github.com/microsoft/FluidFramework/issues/17683)) [c11e1ce593](https://github.com/microsoft/FluidFramework/commits/c11e1ce59310c820117d06e4065bf42bed6b823d)
1979
+ - tree2: Allow ImplicitFieldSchema for non-recursive schema building ([#17683](https://github.com/microsoft/FluidFramework/issues/17683)) [c11e1ce593](https://github.com/microsoft/FluidFramework/commits/c11e1ce59310c820117d06e4065bf42bed6b823d)
1810
1980
 
1811
- SchemaBuilder now accepts `ImplicitFieldSchema` in many places which used to require `FieldSchema`.
1812
- This allows `Required` fields to be implicitly specified from just their AllowedTypes.
1813
- Additionally in these cases the AllowedTypes can be implicitly specified from a single `Any` or `TreeSchema`.
1981
+ SchemaBuilder now accepts `ImplicitFieldSchema` in many places which used to require `FieldSchema`.
1982
+ This allows `Required` fields to be implicitly specified from just their AllowedTypes.
1983
+ Additionally in these cases the AllowedTypes can be implicitly specified from a single `Any` or `TreeSchema`.
1814
1984
 
1815
- - Remove SchemaBuilder.leaf ([#17773](https://github.com/microsoft/FluidFramework/issues/17773)) [674565130f](https://github.com/microsoft/FluidFramework/commits/674565130ffdcf8d23dae858273b303d123587c4)
1985
+ - Remove SchemaBuilder.leaf ([#17773](https://github.com/microsoft/FluidFramework/issues/17773)) [674565130f](https://github.com/microsoft/FluidFramework/commits/674565130ffdcf8d23dae858273b303d123587c4)
1816
1986
 
1817
- Custom schema should use the predefined leaf domain, or wrap its leaf types instead of defining new leaf schema.
1987
+ Custom schema should use the predefined leaf domain, or wrap its leaf types instead of defining new leaf schema.
1818
1988
 
1819
- - tree2: Forest summaries now include detached fields ([#17391](https://github.com/microsoft/FluidFramework/issues/17391)) [5b6bc74ca8](https://github.com/microsoft/FluidFramework/commits/5b6bc74ca85470783c6f48c061385f128f4fc6f9)
1989
+ - tree2: Forest summaries now include detached fields ([#17391](https://github.com/microsoft/FluidFramework/issues/17391)) [5b6bc74ca8](https://github.com/microsoft/FluidFramework/commits/5b6bc74ca85470783c6f48c061385f128f4fc6f9)
1820
1990
 
1821
- Forest summaries now include detached fields. This breaks existing documents.
1991
+ Forest summaries now include detached fields. This breaks existing documents.
1822
1992
 
1823
- - tree2: Rename "Value" Multiplicity and FieldKind ([#17622](https://github.com/microsoft/FluidFramework/issues/17622)) [bb68aeb30c](https://github.com/microsoft/FluidFramework/commits/bb68aeb30cfb3d4e0e82f04f1771ad4cb69e23af)
1993
+ - tree2: Rename "Value" Multiplicity and FieldKind ([#17622](https://github.com/microsoft/FluidFramework/issues/17622)) [bb68aeb30c](https://github.com/microsoft/FluidFramework/commits/bb68aeb30cfb3d4e0e82f04f1771ad4cb69e23af)
1824
1994
 
1825
- `Multiplicity.Value` has been renamed to `Multiplicity.Single` and `FieldKinds.value` has been renamed to `FieldKinds.required`.
1995
+ `Multiplicity.Value` has been renamed to `Multiplicity.Single` and `FieldKinds.value` has been renamed to `FieldKinds.required`.
1826
1996
 
1827
- - tree2: SharedTreeFactory type changed ([#17588](https://github.com/microsoft/FluidFramework/issues/17588)) [7ebe2b7a79](https://github.com/microsoft/FluidFramework/commits/7ebe2b7a7962e4b9a87c305cc48ffc00b1e57583)
1997
+ - tree2: SharedTreeFactory type changed ([#17588](https://github.com/microsoft/FluidFramework/issues/17588)) [7ebe2b7a79](https://github.com/microsoft/FluidFramework/commits/7ebe2b7a7962e4b9a87c305cc48ffc00b1e57583)
1828
1998
 
1829
- The 'type' field for @fluid-experimental/tree2's exported `IChannelFactory`s has been changed to not overlap with @fluid-experimental/tree's channel type.
1830
- This breaks existing tree2 documents: upon loading them, an error with message "Channel Factory SharedTree not registered" will be thrown.
1831
- If using the typed-tree API, the message will instead be "Channel Factory SharedTree:<subtype> not registered" where <subtype> is the subtype used by
1832
- the application when constructing their `TypedTreeFactory`.
1999
+ The 'type' field for @fluid-experimental/tree2's exported `IChannelFactory`s has been changed to not overlap with @fluid-experimental/tree's channel type.
2000
+ This breaks existing tree2 documents: upon loading them, an error with message "Channel Factory SharedTree not registered" will be thrown.
2001
+ If using the typed-tree API, the message will instead be "Channel Factory SharedTree:<subtype> not registered" where <subtype> is the subtype used by
2002
+ the application when constructing their `TypedTreeFactory`.
1833
2003
 
1834
- Applications which want to support such documents could add an explicit registry entry to their `ISharedObjectRegistry` which maps the type shown in the error message to a factory producing @fluid-experimental/tree2.
2004
+ Applications which want to support such documents could add an explicit registry entry to their `ISharedObjectRegistry` which maps the type shown in the error message to a factory producing @fluid-experimental/tree2.
1835
2005
 
1836
2006
  ## 2.0.0-internal.7.0.0
1837
2007
 
1838
2008
  ### Major Changes
1839
2009
 
1840
- - Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
1841
-
1842
- This included the following changes from the protocol-definitions release:
1843
-
1844
- - Updating signal interfaces for some planned improvements. The intention is split the interface between signals
1845
- submitted by clients to the server and the resulting signals sent from the server to clients.
1846
- - A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
1847
- been added, which will be the typing for signals sent from the client to the server. Both extend a new
1848
- ISignalMessageBase interface that contains common members.
1849
- - The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
1850
-
1851
- - Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
1852
-
1853
- Dependencies on the following Fluid server package have been updated to version 2.0.1:
1854
-
1855
- - @fluidframework/gitresources: 2.0.1
1856
- - @fluidframework/server-kafka-orderer: 2.0.1
1857
- - @fluidframework/server-lambdas: 2.0.1
1858
- - @fluidframework/server-lambdas-driver: 2.0.1
1859
- - @fluidframework/server-local-server: 2.0.1
1860
- - @fluidframework/server-memory-orderer: 2.0.1
1861
- - @fluidframework/protocol-base: 2.0.1
1862
- - @fluidframework/server-routerlicious: 2.0.1
1863
- - @fluidframework/server-routerlicious-base: 2.0.1
1864
- - @fluidframework/server-services: 2.0.1
1865
- - @fluidframework/server-services-client: 2.0.1
1866
- - @fluidframework/server-services-core: 2.0.1
1867
- - @fluidframework/server-services-ordering-kafkanode: 2.0.1
1868
- - @fluidframework/server-services-ordering-rdkafka: 2.0.1
1869
- - @fluidframework/server-services-ordering-zookeeper: 2.0.1
1870
- - @fluidframework/server-services-shared: 2.0.1
1871
- - @fluidframework/server-services-telemetry: 2.0.1
1872
- - @fluidframework/server-services-utils: 2.0.1
1873
- - @fluidframework/server-test-utils: 2.0.1
1874
- - tinylicious: 2.0.1
1875
-
1876
- - Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
1877
-
1878
- The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
2010
+ - Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
2011
+
2012
+ This included the following changes from the protocol-definitions release:
2013
+
2014
+ - Updating signal interfaces for some planned improvements. The intention is split the interface between signals
2015
+ submitted by clients to the server and the resulting signals sent from the server to clients.
2016
+ - A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
2017
+ been added, which will be the typing for signals sent from the client to the server. Both extend a new
2018
+ ISignalMessageBase interface that contains common members.
2019
+ - The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
2020
+
2021
+ - Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
2022
+
2023
+ Dependencies on the following Fluid server package have been updated to version 2.0.1:
2024
+
2025
+ - @fluidframework/gitresources: 2.0.1
2026
+ - @fluidframework/server-kafka-orderer: 2.0.1
2027
+ - @fluidframework/server-lambdas: 2.0.1
2028
+ - @fluidframework/server-lambdas-driver: 2.0.1
2029
+ - @fluidframework/server-local-server: 2.0.1
2030
+ - @fluidframework/server-memory-orderer: 2.0.1
2031
+ - @fluidframework/protocol-base: 2.0.1
2032
+ - @fluidframework/server-routerlicious: 2.0.1
2033
+ - @fluidframework/server-routerlicious-base: 2.0.1
2034
+ - @fluidframework/server-services: 2.0.1
2035
+ - @fluidframework/server-services-client: 2.0.1
2036
+ - @fluidframework/server-services-core: 2.0.1
2037
+ - @fluidframework/server-services-ordering-kafkanode: 2.0.1
2038
+ - @fluidframework/server-services-ordering-rdkafka: 2.0.1
2039
+ - @fluidframework/server-services-ordering-zookeeper: 2.0.1
2040
+ - @fluidframework/server-services-shared: 2.0.1
2041
+ - @fluidframework/server-services-telemetry: 2.0.1
2042
+ - @fluidframework/server-services-utils: 2.0.1
2043
+ - @fluidframework/server-test-utils: 2.0.1
2044
+ - tinylicious: 2.0.1
2045
+
2046
+ - Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
2047
+
2048
+ The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
1879
2049
 
1880
2050
  ## 2.0.0-internal.6.4.0
1881
2051
 
1882
2052
  ### Minor Changes
1883
2053
 
1884
- - tree2: Replace ValueSchema.Serializable with FluidHandle ([#17306](https://github.com/microsoft/FluidFramework/issues/17306)) [99b1f7192e](https://github.com/microsoft/FluidFramework/commits/99b1f7192ec9fed19e2a76d9251c3fd123ae90e0)
2054
+ - tree2: Replace ValueSchema.Serializable with FluidHandle ([#17306](https://github.com/microsoft/FluidFramework/issues/17306)) [99b1f7192e](https://github.com/microsoft/FluidFramework/commits/99b1f7192ec9fed19e2a76d9251c3fd123ae90e0)
1885
2055
 
1886
- Replace ValueSchema.Serializable with FluidHandle, removing support for arbitrary objects as tree values and preventing "any" type from Serializable from infecting TreeValue.
2056
+ Replace ValueSchema.Serializable with FluidHandle, removing support for arbitrary objects as tree values and preventing "any" type from Serializable from infecting TreeValue.
1887
2057
 
1888
- - tree2: Restrict struct field names to avoid collisions with schema2 names ([#17089](https://github.com/microsoft/FluidFramework/issues/17089)) [8f8294188f](https://github.com/microsoft/FluidFramework/commits/8f8294188f554e6cc708d6cbbde4ea1dd2e52728)
2058
+ - tree2: Restrict struct field names to avoid collisions with schema2 names ([#17089](https://github.com/microsoft/FluidFramework/issues/17089)) [8f8294188f](https://github.com/microsoft/FluidFramework/commits/8f8294188f554e6cc708d6cbbde4ea1dd2e52728)
1889
2059
 
1890
- Struct field names are now restricted to avoid collisions with schema2 names.
2060
+ Struct field names are now restricted to avoid collisions with schema2 names.
1891
2061
 
1892
2062
  ## 2.0.0-internal.6.3.0
1893
2063
 
1894
2064
  ### Minor Changes
1895
2065
 
1896
- - Decouple Forest and Schema. ([#17139](https://github.com/microsoft/FluidFramework/issues/17139)) [c6b69f5c19](https://github.com/microsoft/FluidFramework/commits/c6b69f5c1957ceda7bebe6a31a570b49505e298b)
2066
+ - Decouple Forest and Schema. ([#17139](https://github.com/microsoft/FluidFramework/issues/17139)) [c6b69f5c19](https://github.com/microsoft/FluidFramework/commits/c6b69f5c1957ceda7bebe6a31a570b49505e298b)
1897
2067
 
1898
- Forest no longer exports the schema, nor invalidates when schema changes.
2068
+ Forest no longer exports the schema, nor invalidates when schema changes.
1899
2069
 
1900
2070
  ## 2.0.0-internal.6.2.0
1901
2071
 
1902
2072
  ### Minor Changes
1903
2073
 
1904
- - Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
1905
-
1906
- The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
1907
- imported from the **@fluidframework/core-interfaces** package:
1908
-
1909
- - interface IDisposable
1910
- - interface IErrorEvent
1911
- - interface IErrorEvent
1912
- - interface IEvent
1913
- - interface IEventProvider
1914
- - interface ILoggingError
1915
- - interface ITaggedTelemetryPropertyType
1916
- - interface ITelemetryBaseEvent
1917
- - interface ITelemetryBaseLogger
1918
- - interface ITelemetryErrorEvent
1919
- - interface ITelemetryGenericEvent
1920
- - interface ITelemetryLogger
1921
- - interface ITelemetryPerformanceEvent
1922
- - interface ITelemetryProperties
1923
- - type ExtendEventProvider
1924
- - type IEventThisPlaceHolder
1925
- - type IEventTransformer
1926
- - type ReplaceIEventThisPlaceHolder
1927
- - type ReplaceIEventThisPlaceHolder
1928
- - type TelemetryEventCategory
1929
- - type TelemetryEventPropertyType
2074
+ - Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
2075
+
2076
+ The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
2077
+ imported from the **@fluidframework/core-interfaces** package:
2078
+
2079
+ - interface IDisposable
2080
+ - interface IErrorEvent
2081
+ - interface IErrorEvent
2082
+ - interface IEvent
2083
+ - interface IEventProvider
2084
+ - interface ILoggingError
2085
+ - interface ITaggedTelemetryPropertyType
2086
+ - interface ITelemetryBaseEvent
2087
+ - interface ITelemetryBaseLogger
2088
+ - interface ITelemetryErrorEvent
2089
+ - interface ITelemetryGenericEvent
2090
+ - interface ITelemetryLogger
2091
+ - interface ITelemetryPerformanceEvent
2092
+ - interface ITelemetryProperties
2093
+ - type ExtendEventProvider
2094
+ - type IEventThisPlaceHolder
2095
+ - type IEventTransformer
2096
+ - type ReplaceIEventThisPlaceHolder
2097
+ - type ReplaceIEventThisPlaceHolder
2098
+ - type TelemetryEventCategory
2099
+ - type TelemetryEventPropertyType
1930
2100
 
1931
2101
  ## 2.0.0-internal.6.1.0
1932
2102
 
@@ -1936,32 +2106,32 @@ Dependency updates only.
1936
2106
 
1937
2107
  ### Major Changes
1938
2108
 
1939
- - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
2109
+ - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
1940
2110
 
1941
- Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
2111
+ Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
1942
2112
 
1943
2113
  ## 2.0.0-internal.5.4.0
1944
2114
 
1945
2115
  ### Minor Changes
1946
2116
 
1947
- - Remove support for Global Fields ([#16546](https://github.com/microsoft/FluidFramework/issues/16546)) [cade66e2fd](https://github.com/microsoft/FluidFramework/commits/cade66e2fd55e92109e337ad1801e8751000c2bf)
2117
+ - Remove support for Global Fields ([#16546](https://github.com/microsoft/FluidFramework/issues/16546)) [cade66e2fd](https://github.com/microsoft/FluidFramework/commits/cade66e2fd55e92109e337ad1801e8751000c2bf)
1948
2118
 
1949
- Support for Global fields has been removed.
2119
+ Support for Global fields has been removed.
1950
2120
 
1951
- - Old SchemaBuilder APIs removed ([#16373](https://github.com/microsoft/FluidFramework/issues/16373)) [38bcf98635](https://github.com/microsoft/FluidFramework/commits/38bcf98635f35c4e0994798e18ae62389da2a773)
2121
+ - Old SchemaBuilder APIs removed ([#16373](https://github.com/microsoft/FluidFramework/issues/16373)) [38bcf98635](https://github.com/microsoft/FluidFramework/commits/38bcf98635f35c4e0994798e18ae62389da2a773)
1952
2122
 
1953
- Remove old SchemaBuilder APIs in favor of Schema2 design.
2123
+ Remove old SchemaBuilder APIs in favor of Schema2 design.
1954
2124
 
1955
2125
  ## 2.0.0-internal.5.3.0
1956
2126
 
1957
2127
  ### Minor Changes
1958
2128
 
1959
- - Move closeAndGetPendingLocalState to IContainerExperimental ([#16302](https://github.com/microsoft/FluidFramework/issues/16302)) [93151af787](https://github.com/microsoft/FluidFramework/commits/93151af787b76e547cf3460df47f81832131db8c)
2129
+ - Move closeAndGetPendingLocalState to IContainerExperimental ([#16302](https://github.com/microsoft/FluidFramework/issues/16302)) [93151af787](https://github.com/microsoft/FluidFramework/commits/93151af787b76e547cf3460df47f81832131db8c)
1960
2130
 
1961
- This change deprecates the experimental method closeAndGetPendingLocalState on IContainer and moves it to IContainerExperimental.
1962
- IContainerExperimental is an interface that is easily casted to, which enables partners to access experimental features for testing and evaluation.
1963
- Moving the experimental method off IContainer will reduce exposure and churn on that production interface as we iterate on and finalize our experimental features.
1964
- Experimental features should not be used in production environments.
2131
+ This change deprecates the experimental method closeAndGetPendingLocalState on IContainer and moves it to IContainerExperimental.
2132
+ IContainerExperimental is an interface that is easily casted to, which enables partners to access experimental features for testing and evaluation.
2133
+ Moving the experimental method off IContainer will reduce exposure and churn on that production interface as we iterate on and finalize our experimental features.
2134
+ Experimental features should not be used in production environments.
1965
2135
 
1966
2136
  ## 2.0.0-internal.5.2.0
1967
2137
 
@@ -1983,33 +2153,33 @@ Dependency updates only.
1983
2153
 
1984
2154
  ### Major Changes
1985
2155
 
1986
- - Renamed from `@fluid-internal/tree` to `@fluid-experimental/tree2` so that this package will be included in releases for experimental use.
2156
+ - Renamed from `@fluid-internal/tree` to `@fluid-experimental/tree2` so that this package will be included in releases for experimental use.
1987
2157
 
1988
2158
  ### Minor Changes
1989
2159
 
1990
- - Op compression is enabled by default ([#14856](https://github.com/microsoft/FluidFramework/pull-requests/14856)) [439c21f31f](https://github.com/microsoft/FluidFramework/commits/439c21f31f4a3ea6515f01d2b2be7f35c04910ce)
2160
+ - Op compression is enabled by default ([#14856](https://github.com/microsoft/FluidFramework/pull-requests/14856)) [439c21f31f](https://github.com/microsoft/FluidFramework/commits/439c21f31f4a3ea6515f01d2b2be7f35c04910ce)
1991
2161
 
1992
- If the size of a batch is larger than 614kb, the ops will be compressed. After upgrading to this version, if batches exceed the size threshold, the runtime will produce a new type of op with the compression properties. To open a document which contains this type of op, the client's runtime version needs to be at least `client_v2.0.0-internal.2.3.0`. Older clients will close with assert `0x3ce` ("Runtime message of unknown type") and will not be able to open the documents until they upgrade. To minimize the risk, it is recommended to audit existing session and ensure that at least 99.9% of them are using a runtime version equal or greater than `client_v2.0.0-internal.2.3.0`, before upgrading to `2.0.0-internal.4.1.0`.
2162
+ If the size of a batch is larger than 614kb, the ops will be compressed. After upgrading to this version, if batches exceed the size threshold, the runtime will produce a new type of op with the compression properties. To open a document which contains this type of op, the client's runtime version needs to be at least `client_v2.0.0-internal.2.3.0`. Older clients will close with assert `0x3ce` ("Runtime message of unknown type") and will not be able to open the documents until they upgrade. To minimize the risk, it is recommended to audit existing session and ensure that at least 99.9% of them are using a runtime version equal or greater than `client_v2.0.0-internal.2.3.0`, before upgrading to `2.0.0-internal.4.1.0`.
1993
2163
 
1994
- More information about op compression can be found
1995
- [here](./packages/runtime/container-runtime/src/opLifecycle/README.md).
2164
+ More information about op compression can be found
2165
+ [here](./packages/runtime/container-runtime/src/opLifecycle/README.md).
1996
2166
 
1997
- - @fluidframework/garbage-collector deprecated ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
2167
+ - @fluidframework/garbage-collector deprecated ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
1998
2168
 
1999
- The `@fluidframework/garbage-collector` package is deprecated with the following functions, interfaces, and types in it.
2000
- These are internal implementation details and have been deprecated for public use. They will be removed in an upcoming
2001
- release.
2169
+ The `@fluidframework/garbage-collector` package is deprecated with the following functions, interfaces, and types in it.
2170
+ These are internal implementation details and have been deprecated for public use. They will be removed in an upcoming
2171
+ release.
2002
2172
 
2003
- - `cloneGCData`
2004
- - `concatGarbageCollectionData`
2005
- - `concatGarbageCollectionStates`
2006
- - `GCDataBuilder`
2007
- - `getGCDataFromSnapshot`
2008
- - `IGCResult`
2009
- - `removeRouteFromAllNodes`
2010
- - `runGarbageCollection`
2011
- - `trimLeadingAndTrailingSlashes`
2012
- - `trimLeadingSlashes`
2013
- - `trimTrailingSlashes`
2014
- - `unpackChildNodesGCDetails`
2015
- - `unpackChildNodesUsedRoutes`
2173
+ - `cloneGCData`
2174
+ - `concatGarbageCollectionData`
2175
+ - `concatGarbageCollectionStates`
2176
+ - `GCDataBuilder`
2177
+ - `getGCDataFromSnapshot`
2178
+ - `IGCResult`
2179
+ - `removeRouteFromAllNodes`
2180
+ - `runGarbageCollection`
2181
+ - `trimLeadingAndTrailingSlashes`
2182
+ - `trimLeadingSlashes`
2183
+ - `trimTrailingSlashes`
2184
+ - `unpackChildNodesGCDetails`
2185
+ - `unpackChildNodesUsedRoutes`