@fluidframework/tree 2.111.0 → 2.112.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 (375) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/api-report/tree.alpha.api.md +48 -5
  3. package/api-report/tree.beta.api.md +1 -1
  4. package/api-report/tree.legacy.beta.api.md +1 -1
  5. package/api-report/tree.legacy.public.api.md +1 -1
  6. package/api-report/tree.public.api.md +1 -1
  7. package/dist/componentApi.d.ts +198 -0
  8. package/dist/componentApi.d.ts.map +1 -0
  9. package/dist/componentApi.js +138 -0
  10. package/dist/componentApi.js.map +1 -0
  11. package/dist/entrypoints/alpha.d.ts +1 -1
  12. package/dist/entrypoints/alpha.d.ts.map +1 -1
  13. package/dist/entrypoints/alpha.js +4 -2
  14. package/dist/entrypoints/alpha.js.map +1 -1
  15. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
  16. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  17. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  19. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  20. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  21. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
  22. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  23. package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -16
  24. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  25. package/dist/feature-libraries/index.d.ts +2 -2
  26. package/dist/feature-libraries/index.d.ts.map +1 -1
  27. package/dist/feature-libraries/index.js +3 -2
  28. package/dist/feature-libraries/index.js.map +1 -1
  29. package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
  30. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  31. package/dist/feature-libraries/modular-schema/index.js +3 -1
  32. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  33. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  34. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  35. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
  36. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  37. package/dist/feature-libraries/schemaChecker.d.ts +22 -3
  38. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  39. package/dist/feature-libraries/schemaChecker.js +48 -5
  40. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  41. package/dist/index.d.ts +2 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +5 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/packageVersion.d.ts +1 -1
  46. package/dist/packageVersion.js +1 -1
  47. package/dist/packageVersion.js.map +1 -1
  48. package/dist/shared-tree/independentView.d.ts +17 -4
  49. package/dist/shared-tree/independentView.d.ts.map +1 -1
  50. package/dist/shared-tree/independentView.js +11 -5
  51. package/dist/shared-tree/independentView.js.map +1 -1
  52. package/dist/shared-tree/index.d.ts +2 -1
  53. package/dist/shared-tree/index.d.ts.map +1 -1
  54. package/dist/shared-tree/index.js +3 -1
  55. package/dist/shared-tree/index.js.map +1 -1
  56. package/dist/shared-tree/schematizingTreeView.d.ts +1 -0
  57. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  58. package/dist/shared-tree/schematizingTreeView.js +6 -3
  59. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  60. package/dist/shared-tree/serializedChange.d.ts +41 -0
  61. package/dist/shared-tree/serializedChange.d.ts.map +1 -0
  62. package/dist/shared-tree/serializedChange.js +87 -0
  63. package/dist/shared-tree/serializedChange.js.map +1 -0
  64. package/dist/shared-tree/sharedTree.d.ts +13 -0
  65. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  66. package/dist/shared-tree/sharedTree.js +2 -0
  67. package/dist/shared-tree/sharedTree.js.map +1 -1
  68. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  69. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  70. package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
  71. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  72. package/dist/shared-tree/transactionMinimize.d.ts +35 -0
  73. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
  74. package/dist/shared-tree/transactionMinimize.js +65 -0
  75. package/dist/shared-tree/transactionMinimize.js.map +1 -0
  76. package/dist/shared-tree/treeCheckout.d.ts +3 -1
  77. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  78. package/dist/shared-tree/treeCheckout.js +36 -62
  79. package/dist/shared-tree/treeCheckout.js.map +1 -1
  80. package/dist/shared-tree-core/editManager.d.ts +6 -3
  81. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  82. package/dist/shared-tree-core/editManager.js +35 -14
  83. package/dist/shared-tree-core/editManager.js.map +1 -1
  84. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  85. package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
  86. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  87. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  88. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  89. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  90. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  91. package/dist/shared-tree-core/messageFormat.d.ts +1 -1
  92. package/dist/shared-tree-core/messageFormat.js +1 -1
  93. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  94. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  95. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  96. package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  97. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  98. package/dist/shared-tree-core/messageTypes.d.ts +1 -0
  99. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  100. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  101. package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
  102. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  103. package/dist/shared-tree-core/sharedTreeCore.js +24 -11
  104. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  105. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  106. package/dist/shared-tree-core/transaction.js +16 -2
  107. package/dist/shared-tree-core/transaction.js.map +1 -1
  108. package/dist/simple-tree/api/index.d.ts +1 -1
  109. package/dist/simple-tree/api/index.d.ts.map +1 -1
  110. package/dist/simple-tree/api/index.js +2 -2
  111. package/dist/simple-tree/api/index.js.map +1 -1
  112. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  113. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  114. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
  115. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  116. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  117. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  118. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  119. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  120. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  121. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  122. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  123. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +1 -2
  124. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  125. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  126. package/dist/simple-tree/api/storedSchema.js +1 -2
  127. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  128. package/dist/simple-tree/api/tree.d.ts +22 -2
  129. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  130. package/dist/simple-tree/api/tree.js.map +1 -1
  131. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
  132. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  133. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  134. package/dist/simple-tree/index.d.ts +1 -1
  135. package/dist/simple-tree/index.d.ts.map +1 -1
  136. package/dist/simple-tree/index.js +2 -2
  137. package/dist/simple-tree/index.js.map +1 -1
  138. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  139. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  140. package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
  141. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
  143. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  144. package/dist/treeFactory.js +1 -1
  145. package/dist/treeFactory.js.map +1 -1
  146. package/dist/util/breakable.d.ts +16 -1
  147. package/dist/util/breakable.d.ts.map +1 -1
  148. package/dist/util/breakable.js +9 -1
  149. package/dist/util/breakable.js.map +1 -1
  150. package/dist/util/compressedIds.d.ts +69 -2
  151. package/dist/util/compressedIds.d.ts.map +1 -1
  152. package/dist/util/compressedIds.js +32 -1
  153. package/dist/util/compressedIds.js.map +1 -1
  154. package/dist/util/index.d.ts +2 -2
  155. package/dist/util/index.d.ts.map +1 -1
  156. package/dist/util/index.js +2 -2
  157. package/dist/util/index.js.map +1 -1
  158. package/dist/util/nestedMap.d.ts.map +1 -1
  159. package/dist/util/nestedMap.js +16 -3
  160. package/dist/util/nestedMap.js.map +1 -1
  161. package/dist/util/nestedSet.d.ts +1 -1
  162. package/dist/util/nestedSet.d.ts.map +1 -1
  163. package/dist/util/nestedSet.js.map +1 -1
  164. package/dist/util/utils.d.ts +0 -6
  165. package/dist/util/utils.d.ts.map +1 -1
  166. package/dist/util/utils.js +1 -15
  167. package/dist/util/utils.js.map +1 -1
  168. package/lib/componentApi.d.ts +198 -0
  169. package/lib/componentApi.d.ts.map +1 -0
  170. package/lib/componentApi.js +135 -0
  171. package/lib/componentApi.js.map +1 -0
  172. package/lib/entrypoints/alpha.d.ts +1 -1
  173. package/lib/entrypoints/alpha.d.ts.map +1 -1
  174. package/lib/entrypoints/alpha.js +1 -1
  175. package/lib/entrypoints/alpha.js.map +1 -1
  176. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
  177. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  178. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
  179. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  180. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  181. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  183. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
  184. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  185. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -17
  186. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  187. package/lib/feature-libraries/index.d.ts +2 -2
  188. package/lib/feature-libraries/index.d.ts.map +1 -1
  189. package/lib/feature-libraries/index.js +1 -1
  190. package/lib/feature-libraries/index.js.map +1 -1
  191. package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
  192. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/index.js +1 -0
  194. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  195. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  196. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  197. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
  198. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  199. package/lib/feature-libraries/schemaChecker.d.ts +22 -3
  200. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  201. package/lib/feature-libraries/schemaChecker.js +48 -5
  202. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  203. package/lib/index.d.ts +2 -1
  204. package/lib/index.d.ts.map +1 -1
  205. package/lib/index.js +2 -1
  206. package/lib/index.js.map +1 -1
  207. package/lib/packageVersion.d.ts +1 -1
  208. package/lib/packageVersion.js +1 -1
  209. package/lib/packageVersion.js.map +1 -1
  210. package/lib/shared-tree/independentView.d.ts +17 -4
  211. package/lib/shared-tree/independentView.d.ts.map +1 -1
  212. package/lib/shared-tree/independentView.js +9 -3
  213. package/lib/shared-tree/independentView.js.map +1 -1
  214. package/lib/shared-tree/index.d.ts +2 -1
  215. package/lib/shared-tree/index.d.ts.map +1 -1
  216. package/lib/shared-tree/index.js +1 -0
  217. package/lib/shared-tree/index.js.map +1 -1
  218. package/lib/shared-tree/schematizingTreeView.d.ts +1 -0
  219. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  220. package/lib/shared-tree/schematizingTreeView.js +7 -4
  221. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  222. package/lib/shared-tree/serializedChange.d.ts +41 -0
  223. package/lib/shared-tree/serializedChange.d.ts.map +1 -0
  224. package/lib/shared-tree/serializedChange.js +84 -0
  225. package/lib/shared-tree/serializedChange.js.map +1 -0
  226. package/lib/shared-tree/sharedTree.d.ts +13 -0
  227. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  228. package/lib/shared-tree/sharedTree.js +2 -0
  229. package/lib/shared-tree/sharedTree.js.map +1 -1
  230. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  231. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  232. package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
  233. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  234. package/lib/shared-tree/transactionMinimize.d.ts +35 -0
  235. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
  236. package/lib/shared-tree/transactionMinimize.js +62 -0
  237. package/lib/shared-tree/transactionMinimize.js.map +1 -0
  238. package/lib/shared-tree/treeCheckout.d.ts +3 -1
  239. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  240. package/lib/shared-tree/treeCheckout.js +18 -44
  241. package/lib/shared-tree/treeCheckout.js.map +1 -1
  242. package/lib/shared-tree-core/editManager.d.ts +6 -3
  243. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  244. package/lib/shared-tree-core/editManager.js +36 -15
  245. package/lib/shared-tree-core/editManager.js.map +1 -1
  246. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  247. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  248. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  249. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  250. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  251. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  252. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  253. package/lib/shared-tree-core/messageFormat.d.ts +1 -1
  254. package/lib/shared-tree-core/messageFormat.js +1 -1
  255. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  256. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  257. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  258. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  259. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  260. package/lib/shared-tree-core/messageTypes.d.ts +1 -0
  261. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  262. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  263. package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
  264. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  265. package/lib/shared-tree-core/sharedTreeCore.js +25 -12
  266. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  267. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  268. package/lib/shared-tree-core/transaction.js +16 -2
  269. package/lib/shared-tree-core/transaction.js.map +1 -1
  270. package/lib/simple-tree/api/index.d.ts +1 -1
  271. package/lib/simple-tree/api/index.d.ts.map +1 -1
  272. package/lib/simple-tree/api/index.js +1 -1
  273. package/lib/simple-tree/api/index.js.map +1 -1
  274. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  275. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  276. package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
  277. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  278. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  279. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  280. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  281. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  282. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  283. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  284. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  285. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -3
  286. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  287. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  288. package/lib/simple-tree/api/storedSchema.js +2 -3
  289. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  290. package/lib/simple-tree/api/tree.d.ts +22 -2
  291. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  292. package/lib/simple-tree/api/tree.js.map +1 -1
  293. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
  294. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  295. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  296. package/lib/simple-tree/index.d.ts +1 -1
  297. package/lib/simple-tree/index.d.ts.map +1 -1
  298. package/lib/simple-tree/index.js +1 -1
  299. package/lib/simple-tree/index.js.map +1 -1
  300. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  301. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  302. package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
  303. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  304. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  305. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  306. package/lib/treeFactory.js +1 -1
  307. package/lib/treeFactory.js.map +1 -1
  308. package/lib/util/breakable.d.ts +16 -1
  309. package/lib/util/breakable.d.ts.map +1 -1
  310. package/lib/util/breakable.js +9 -1
  311. package/lib/util/breakable.js.map +1 -1
  312. package/lib/util/compressedIds.d.ts +69 -2
  313. package/lib/util/compressedIds.d.ts.map +1 -1
  314. package/lib/util/compressedIds.js +30 -0
  315. package/lib/util/compressedIds.js.map +1 -1
  316. package/lib/util/index.d.ts +2 -2
  317. package/lib/util/index.d.ts.map +1 -1
  318. package/lib/util/index.js +2 -2
  319. package/lib/util/index.js.map +1 -1
  320. package/lib/util/nestedMap.d.ts.map +1 -1
  321. package/lib/util/nestedMap.js +17 -4
  322. package/lib/util/nestedMap.js.map +1 -1
  323. package/lib/util/nestedSet.d.ts +1 -1
  324. package/lib/util/nestedSet.d.ts.map +1 -1
  325. package/lib/util/nestedSet.js.map +1 -1
  326. package/lib/util/utils.d.ts +0 -6
  327. package/lib/util/utils.d.ts.map +1 -1
  328. package/lib/util/utils.js +0 -13
  329. package/lib/util/utils.js.map +1 -1
  330. package/package.json +22 -22
  331. package/src/componentApi.ts +354 -0
  332. package/src/entrypoints/alpha.ts +3 -0
  333. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -27
  334. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
  335. package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -44
  336. package/src/feature-libraries/index.ts +2 -0
  337. package/src/feature-libraries/modular-schema/index.ts +1 -0
  338. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
  339. package/src/feature-libraries/schemaChecker.ts +86 -9
  340. package/src/index.ts +3 -0
  341. package/src/packageVersion.ts +1 -1
  342. package/src/shared-tree/independentView.ts +35 -5
  343. package/src/shared-tree/index.ts +3 -0
  344. package/src/shared-tree/schematizingTreeView.ts +15 -5
  345. package/src/shared-tree/serializedChange.ts +127 -0
  346. package/src/shared-tree/sharedTree.ts +16 -0
  347. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  348. package/src/shared-tree/transactionMinimize.ts +74 -0
  349. package/src/shared-tree/treeCheckout.ts +42 -57
  350. package/src/shared-tree-core/editManager.ts +42 -6
  351. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
  352. package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
  353. package/src/shared-tree-core/messageFormat.ts +1 -1
  354. package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
  355. package/src/shared-tree-core/messageTypes.ts +1 -0
  356. package/src/shared-tree-core/sharedTreeCore.ts +33 -10
  357. package/src/shared-tree-core/transaction.ts +19 -2
  358. package/src/simple-tree/api/index.ts +1 -1
  359. package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
  360. package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
  361. package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
  362. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -3
  363. package/src/simple-tree/api/storedSchema.ts +2 -3
  364. package/src/simple-tree/api/tree.ts +24 -2
  365. package/src/simple-tree/api/typesUnsafe.ts +2 -1
  366. package/src/simple-tree/index.ts +1 -1
  367. package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
  368. package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
  369. package/src/treeFactory.ts +1 -1
  370. package/src/util/breakable.ts +8 -1
  371. package/src/util/compressedIds.ts +90 -2
  372. package/src/util/index.ts +3 -1
  373. package/src/util/nestedMap.ts +21 -4
  374. package/src/util/nestedSet.ts +1 -1
  375. package/src/util/utils.ts +0 -18
@@ -178,6 +178,7 @@ export {
178
178
  ChangeMetadata,
179
179
  CodecName,
180
180
  CodecWriteOptions,
181
+ Component,
181
182
  CreateIndependentTreeAlphaOptions,
182
183
  DirtyTreeMap,
183
184
  DirtyTreeStatus,
@@ -201,6 +202,7 @@ export {
201
202
  ITreeAlpha,
202
203
  IncrementalEncodingPolicy,
203
204
  IndependentViewOptions,
205
+ IndependentViewTelemetryOptions,
204
206
  Insertable,
205
207
  InsertableContent,
206
208
  InsertableField,
@@ -316,6 +318,7 @@ export {
316
318
  incrementalSummaryHint,
317
319
  independentInitializedView,
318
320
  independentView,
321
+ minimize,
319
322
  normalizeAllowedTypes,
320
323
  persistedToSimpleSchema,
321
324
  replaceConciseTreeHandles,
@@ -5,7 +5,6 @@
5
5
 
6
6
  import { assert, unreachableCase, oob } from "@fluidframework/core-utils/internal";
7
7
  import type {
8
- IIdCompressor,
9
8
  OpSpaceCompressedId,
10
9
  SessionSpaceCompressedId,
11
10
  } from "@fluidframework/id-compressor";
@@ -17,7 +16,12 @@ import type {
17
16
  Value,
18
17
  TreeChunk,
19
18
  } from "../../../core/index.js";
20
- import { assertValidIndex, brand, decompressIdentifierIfNeeded } from "../../../util/index.js";
19
+ import {
20
+ assertValidIndex,
21
+ brand,
22
+ decompressIdentifierIfNeeded,
23
+ type IdDecodingContext,
24
+ } from "../../../util/index.js";
21
25
  import { BasicChunk } from "../basicChunk.js";
22
26
  import { emptyChunk } from "../emptyChunk.js";
23
27
  import { SequenceChunk } from "../sequenceChunk.js";
@@ -55,31 +59,6 @@ import {
55
59
  supportsIncrementalEncoding,
56
60
  } from "./format/index.js";
57
61
 
58
- /**
59
- * Context for decoding identifiers.
60
- * @remarks
61
- * See {@link FieldBatchDecodingContext} for the production implementation of this.
62
- *
63
- * This intentionally avoids exposing anything which depends on the underlying id-compressor's session ID to avoid confusion with the session ID of the compressor which encoded the data.
64
- * If the session ID of the encoder which encoded the data is known, that information is baked into `resolveEncodedId`.
65
- */
66
- export interface IdDecodingContext {
67
- /**
68
- * Compressor which can decompress session-space identifiers from {@link resolveEncodedId} as needed.
69
- */
70
- readonly idCompressor: Pick<IIdCompressor, "decompress">;
71
- /**
72
- * Resolves an encoded op-space identifier to either a session-space ID
73
- * (which {@link idCompressor} can decompress if needed)
74
- * or a string (which passes through unchanged).
75
- * @remarks
76
- * In contexts where non-final identifiers can't be supported (where no originator session is available),
77
- * if a non-final identifier is encountered, this may throw or perform a data healing workaround.
78
- * See {@link FieldBatchDecodingContext.forOp} and {@link FieldBatchDecodingContext.forSummary} for details.
79
- */
80
- readonly resolveEncodedId: (id: OpSpaceCompressedId) => SessionSpaceCompressedId | string;
81
- }
82
-
83
62
  /**
84
63
  * Decode `chunk` into a TreeChunk.
85
64
  */
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import type { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
9
9
  import type { TreeChunk } from "../../../core/index.js";
10
- import type { BrandedType } from "../../../util/index.js";
10
+ import type { BrandedType, IdDecodingContext } from "../../../util/index.js";
11
11
 
12
12
  import {
13
13
  type ChunkDecoder,
@@ -15,7 +15,6 @@ import {
15
15
  getChecked,
16
16
  readStream,
17
17
  } from "./chunkCodecUtilities.js";
18
- import type { IdDecodingContext } from "./chunkDecoding.js";
19
18
  import type { IncrementalDecoder } from "./codecs.js";
20
19
  import type { EncodedFieldBatchGeneric, IdentifierOrIndex } from "./format/index.js";
21
20
 
@@ -4,12 +4,7 @@
4
4
  */
5
5
 
6
6
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
- import type {
8
- IIdCompressor,
9
- OpSpaceCompressedId,
10
- SessionId,
11
- SessionSpaceCompressedId,
12
- } from "@fluidframework/id-compressor";
7
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
13
8
  import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
14
9
  import type { TSchema } from "@sinclair/typebox";
15
10
 
@@ -29,13 +24,14 @@ import {
29
24
  } from "../../../core/index.js";
30
25
  import {
31
26
  brandedNumberType,
32
- forceDecodeEncodedIdWithoutSession,
27
+ IdDecodingContext,
33
28
  type Brand,
34
- type IdentifierHealingConfig,
29
+ type IdDecoderOptionsOriginatorless,
30
+ type IdDecoderOptionsWithOriginator,
35
31
  } from "../../../util/index.js";
36
32
  import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
37
33
 
38
- import { decode, type IdDecodingContext } from "./chunkDecoding.js";
34
+ import { decode } from "./chunkDecoding.js";
39
35
  import type { FieldBatch } from "./fieldBatch.js";
40
36
  import {
41
37
  EncodedFieldBatchV1,
@@ -148,26 +144,18 @@ export interface FieldBatchEncodingContext {
148
144
  * op-style and summary-style decoding is load-bearing (different invariants
149
145
  * apply, and bugs in this area are typically the result of conflating them).
150
146
  */
151
- export class FieldBatchDecodingContext implements IdDecodingContext {
147
+ export class FieldBatchDecodingContext extends IdDecodingContext {
152
148
  private constructor(
153
- /**
154
- * Used internally to prevent the use of this decoder in incremental chunks if it has a session id (which would be wrong in those chunks).
155
- */
156
- private readonly hasOriginatorSessionId: boolean,
157
-
158
- public readonly idCompressor: Pick<IIdCompressor, "decompress">,
159
-
160
- public readonly resolveEncodedId: (
161
- id: OpSpaceCompressedId,
162
- ) => SessionSpaceCompressedId | string,
163
-
149
+ private readonly options: IdDecoderOptionsOriginatorless | IdDecoderOptionsWithOriginator,
164
150
  /**
165
151
  * Decoder for incremental fields. Defined when the encoded batch contains
166
152
  * incremental chunks. Only populated on summary-style contexts; op-style
167
153
  * contexts always have this undefined.
168
154
  */
169
155
  public readonly incrementalDecoder?: IncrementalDecoder,
170
- ) {}
156
+ ) {
157
+ super(options);
158
+ }
171
159
 
172
160
  /**
173
161
  * Construct a decode context for an op.
@@ -178,14 +166,8 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
178
166
  * not a recoverable state, so the resolver throws rather than synthesizing
179
167
  * a UUID. Incremental decoding is not used for ops.
180
168
  */
181
- public static forOp(opts: {
182
- readonly idCompressor: IIdCompressor;
183
- readonly originatorId: SessionId;
184
- }): FieldBatchDecodingContext {
185
- const { idCompressor, originatorId } = opts;
186
- return new FieldBatchDecodingContext(true, idCompressor, (id) =>
187
- idCompressor.normalizeToSessionSpace(id, originatorId),
188
- );
169
+ public static forOp(options: IdDecoderOptionsWithOriginator): FieldBatchDecodingContext {
170
+ return new FieldBatchDecodingContext(options);
189
171
  }
190
172
 
191
173
  /**
@@ -204,14 +186,10 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
204
186
  * `withIncrementalDecoder` has logic to guard against cases which expect session-relative identifiers in incremental chunks,
205
187
  * as does the encoding-side assert in the {@link EncoderContext}.
206
188
  */
207
- public static forSummary(opts: {
208
- readonly idCompressor: IIdCompressor;
209
- readonly healing?: IdentifierHealingConfig;
210
- }): FieldBatchDecodingContext {
211
- const { idCompressor, healing } = opts;
212
- return new FieldBatchDecodingContext(false, idCompressor, (id) =>
213
- forceDecodeEncodedIdWithoutSession(id, idCompressor, healing),
214
- );
189
+ public static forSummary(
190
+ options: IdDecoderOptionsOriginatorless | IdDecoderOptionsWithOriginator,
191
+ ): FieldBatchDecodingContext {
192
+ return new FieldBatchDecodingContext(options);
215
193
  }
216
194
 
217
195
  /**
@@ -231,12 +209,7 @@ export class FieldBatchDecodingContext implements IdDecodingContext {
231
209
  !this.hasOriginatorSessionId,
232
210
  0xd0c /* withIncrementalDecoder can only be called on contexts without an originator session ID */,
233
211
  );
234
- return new FieldBatchDecodingContext(
235
- false,
236
- this.idCompressor,
237
- this.resolveEncodedId,
238
- incrementalDecoder,
239
- );
212
+ return new FieldBatchDecodingContext(this.options, incrementalDecoder);
240
213
  }
241
214
  }
242
215
 
@@ -93,6 +93,7 @@ export {
93
93
  isNeverTree,
94
94
  DefaultRevisionReplacer,
95
95
  ModularChangeFormatVersion,
96
+ minimizeModularChangeset,
96
97
  } from "./modular-schema/index.js";
97
98
 
98
99
  export { mapRootChanges } from "./deltaUtils.js";
@@ -149,6 +150,7 @@ export {
149
150
 
150
151
  export {
151
152
  SchemaValidationError,
153
+ type SchemaValidationErrorContext,
152
154
  isNodeInSchema,
153
155
  isFieldInSchema,
154
156
  throwOutOfSchema,
@@ -83,3 +83,4 @@ export type {
83
83
  FieldKindConfigurationEntry,
84
84
  } from "./fieldKindConfiguration.js";
85
85
  export { DefaultRevisionReplacer } from "./defaultRevisionReplacer.js";
86
+ export { minimizeModularChangeset } from "./minimizeModularChange.js";
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { FieldKindIdentifier } from "../../core/index.js";
7
+
8
+ import type { FlexFieldKind } from "./fieldKind.js";
9
+ import type { ModularChangeset } from "./modularChangeTypes.js";
10
+
11
+ /**
12
+ * "Minimizes" a {@link ModularChangeset} so that it contains no extraneous
13
+ * information, i.e. no new content that isn't observable from document tree
14
+ * and no edits without net observed effect on the document tree.
15
+ * @remarks
16
+ * "Extraneous information" includes, for example, data for nodes that were both created and removed within the same
17
+ * transaction, or changes whose effects cancel out to nothing. Minimizing reduces the size of an edit without altering
18
+ * its observable effect.
19
+ *
20
+ * This is the eventual home of the minimization algorithm, colocated with {@link ModularChangeFamily} so it can use its
21
+ * internals. It is currently a no-op that returns the change unchanged; a real implementation will be provided in a
22
+ * future change.
23
+ *
24
+ * @param change - The change to minimize.
25
+ * @param fieldKinds - The field kinds to delegate to when computing the change's delta.
26
+ */
27
+ export function minimizeModularChangeset(
28
+ change: ModularChangeset,
29
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
30
+ ): ModularChangeset {
31
+ // TODO: Actually minimize the change. For now this is a no-op that returns the change unchanged.
32
+ return change;
33
+ }
@@ -32,13 +32,82 @@ export enum SchemaValidationError {
32
32
  Node_MissingSchema,
33
33
  }
34
34
 
35
+ /**
36
+ * Additional context about a schema validation error.
37
+ * @remarks
38
+ * Not all fields are populated for every error type — only those relevant to the specific error.
39
+ */
40
+ export interface SchemaValidationErrorContext {
41
+ /**
42
+ * The type identifier of the node that failed validation.
43
+ */
44
+ readonly nodeType?: string;
45
+ /**
46
+ * The set of type identifiers allowed in the field, if applicable.
47
+ */
48
+ readonly allowedTypes?: ReadonlySet<string>;
49
+ /**
50
+ * Field keys on the node that were not recognized by its schema.
51
+ */
52
+ readonly unexpectedFields?: ReadonlySet<string>;
53
+ }
54
+
35
55
  /**
36
56
  * Throws a UsageError indicating a tree is out of schema.
37
57
  */
38
- export function throwOutOfSchema(maybeError: SchemaValidationError): never {
39
- throw new UsageError(
40
- `Tree does not conform to schema: ${SchemaValidationError[maybeError]}`,
41
- );
58
+ export function throwOutOfSchema(
59
+ maybeError: SchemaValidationError,
60
+ context?: SchemaValidationErrorContext,
61
+ ): never {
62
+ throw new UsageError(formatSchemaValidationError(maybeError, context));
63
+ }
64
+
65
+ // Not exported: internal helper used by throwOutOfSchema.
66
+ function formatSchemaValidationError(
67
+ error: SchemaValidationError,
68
+ context: SchemaValidationErrorContext | undefined,
69
+ ): string {
70
+ switch (error) {
71
+ case SchemaValidationError.Field_NodeTypeNotAllowed: {
72
+ const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
73
+ const allowedDesc =
74
+ context?.allowedTypes === undefined
75
+ ? "unknown"
76
+ : `[${[...context.allowedTypes].map((t) => `"${t}"`).join(", ")}]`;
77
+ return (
78
+ `Tree does not conform to schema. ` +
79
+ `A node of type ${nodeDesc} is not allowed in this field. Allowed types: ${allowedDesc}. ` +
80
+ `If using a staged allowed type, the stored schema has not been upgraded to include this type yet. ` +
81
+ `Either upgrade the schema to enable the staged type or avoid inserting content of this type until the schema is upgraded.`
82
+ );
83
+ }
84
+ case SchemaValidationError.Node_MissingSchema: {
85
+ const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
86
+ return (
87
+ `Tree does not conform to schema. ` +
88
+ `No schema definition was found for node type ${nodeDesc}. ` +
89
+ `Ensure the node's type is included in the schema and that the stored schema has been upgraded if needed.`
90
+ );
91
+ }
92
+ case SchemaValidationError.ObjectNode_FieldNotInSchema: {
93
+ const nodeDesc = context?.nodeType === undefined ? "unknown" : `"${context.nodeType}"`;
94
+ const fieldsDesc =
95
+ context?.unexpectedFields === undefined || context.unexpectedFields.size === 0
96
+ ? undefined
97
+ : `[${[...context.unexpectedFields].map((f) => `"${f}"`).join(", ")}]`;
98
+ const fieldsPart =
99
+ fieldsDesc === undefined
100
+ ? "The node has fields that are not defined in its schema."
101
+ : `Unexpected fields: ${fieldsDesc}.`;
102
+ return (
103
+ `Tree does not conform to schema. ` +
104
+ `A node of type ${nodeDesc} has fields not defined in its schema. ${fieldsPart}`
105
+ );
106
+ }
107
+ default: {
108
+ return `Tree does not conform to schema: ${SchemaValidationError[error]}.`;
109
+ }
110
+ }
42
111
  }
43
112
 
44
113
  type NotUndefined = number | string | boolean | bigint | symbol | object;
@@ -53,12 +122,14 @@ type NotUndefined = number | string | boolean | bigint | symbol | object;
53
122
  export function isNodeInSchema<T extends NotUndefined>(
54
123
  node: MinimalMapTreeNodeView,
55
124
  schemaAndPolicy: SchemaAndPolicy,
56
- onError: (error: SchemaValidationError) => T,
125
+ onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
57
126
  ): T | undefined {
58
127
  // Validate the schema declared by the node exists
59
128
  const schema = schemaAndPolicy.schema.nodeSchema.get(node.type);
60
129
  if (schema === undefined) {
61
- return onError(SchemaValidationError.Node_MissingSchema);
130
+ return onError(SchemaValidationError.Node_MissingSchema, {
131
+ nodeType: node.type,
132
+ });
62
133
  }
63
134
 
64
135
  // Validate the node is well formed according to its schema
@@ -95,7 +166,10 @@ export function isNodeInSchema<T extends NotUndefined>(
95
166
  // Code using this with a stored schema derived from a view schema rather than the document can be problematic because it may be missing unknown fields that the actual document has.
96
167
  // Other schema evolution features like "staged" allowed types will likely cause similar issues elsewhere in this checker.
97
168
  if (uncheckedFieldsFromNode.size > 0) {
98
- return onError(SchemaValidationError.ObjectNode_FieldNotInSchema);
169
+ return onError(SchemaValidationError.ObjectNode_FieldNotInSchema, {
170
+ nodeType: node.type,
171
+ unexpectedFields: uncheckedFieldsFromNode,
172
+ });
99
173
  }
100
174
  } else if (schema instanceof MapNodeStoredSchema) {
101
175
  for (const [_key, field] of node.fields) {
@@ -128,7 +202,7 @@ export function isFieldInSchema<T extends NotUndefined>(
128
202
  childNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,
129
203
  schema: TreeFieldStoredSchema,
130
204
  schemaAndPolicy: SchemaAndPolicy,
131
- onError: (error: SchemaValidationError) => T,
205
+ onError: (error: SchemaValidationError, context?: SchemaValidationErrorContext) => T,
132
206
  ): T | undefined {
133
207
  // Validate that the field kind is handled by the schema policy
134
208
  const kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);
@@ -147,7 +221,10 @@ export function isFieldInSchema<T extends NotUndefined>(
147
221
  for (const node of childNodes) {
148
222
  // Validate the type declared by the node is allowed in this field
149
223
  if (schema.types !== undefined && !schema.types.has(node.type)) {
150
- return onError(SchemaValidationError.Field_NodeTypeNotAllowed);
224
+ return onError(SchemaValidationError.Field_NodeTypeNotAllowed, {
225
+ nodeType: node.type,
226
+ allowedTypes: schema.types,
227
+ });
151
228
  }
152
229
 
153
230
  // Validate the node complies with the type it declares to be.
package/src/index.ts CHANGED
@@ -78,12 +78,14 @@ export {
78
78
  type TreeIdentifierUtils,
79
79
  independentView,
80
80
  type IndependentViewOptions,
81
+ type IndependentViewTelemetryOptions,
81
82
  createIndependentTreeBeta,
82
83
  createIndependentTreeAlpha,
83
84
  type CreateIndependentTreeAlphaOptions,
84
85
  ForestTypeOptimized,
85
86
  ForestTypeExpensiveDebug,
86
87
  ForestTypeReference,
88
+ minimize,
87
89
  } from "./shared-tree/index.js";
88
90
 
89
91
  export {
@@ -415,3 +417,4 @@ export {
415
417
  utf16LengthForCodePoints,
416
418
  } from "./text/index.js";
417
419
  export { ExtensibleUnionNode } from "./extensibleUnionNode.js";
420
+ export { Component } from "./componentApi.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.111.0";
9
+ export const pkgVersion = "2.112.0";
@@ -3,12 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import type { IFluidHandle, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
8
  import {
9
9
  type IIdCompressor,
10
10
  createIdCompressor,
11
11
  } from "@fluidframework/id-compressor/internal";
12
+ import {
13
+ createChildLogger,
14
+ extractTelemetryLoggerExt,
15
+ } from "@fluidframework/telemetry-utils/internal";
12
16
 
13
17
  import type { CodecWriteOptions, ICodecOptions } from "../codec/index.js";
14
18
  import {
@@ -22,8 +26,8 @@ import {
22
26
  FieldBatchDecodingContext,
23
27
  defaultIncrementalEncodingPolicy,
24
28
  schemaCodecBuilder,
29
+ combineChunks,
25
30
  } from "../feature-libraries/index.js";
26
- import { combineChunks } from "../feature-libraries/index.js";
27
31
  import type {
28
32
  TreeViewConfiguration,
29
33
  ImplicitFieldSchema,
@@ -52,11 +56,28 @@ import {
52
56
  } from "./sharedTree.js";
53
57
  import { createTreeCheckout } from "./treeCheckout.js";
54
58
 
59
+ /**
60
+ * Options for supplying a telemetry logger to an independent tree view.
61
+ * @remarks
62
+ * Events emitted by the independent tree are tagged with the `independentView` namespace.
63
+ * If no logger is provided, telemetry events are dropped.
64
+ * @alpha @input
65
+ */
66
+ export interface IndependentViewTelemetryOptions {
67
+ /**
68
+ * Optional logger for telemetry.
69
+ */
70
+ readonly logger?: ITelemetryBaseLogger | undefined;
71
+ }
72
+
55
73
  /**
56
74
  * {@link independentView} options.
57
75
  * @alpha @input
58
76
  */
59
- export interface IndependentViewOptions extends ForestOptions, Partial<CodecWriteOptions> {
77
+ export interface IndependentViewOptions
78
+ extends ForestOptions,
79
+ Partial<CodecWriteOptions>,
80
+ IndependentViewTelemetryOptions {
60
81
  /**
61
82
  * Optional ID compressor for generating and compressing identifiers.
62
83
  * If not provided, a new one will be created.
@@ -69,6 +90,7 @@ export interface IndependentViewOptions extends ForestOptions, Partial<CodecWrit
69
90
  * @alpha
70
91
  */
71
92
  export type CreateIndependentTreeAlphaOptions = ForestOptions &
93
+ IndependentViewTelemetryOptions &
72
94
  (
73
95
  | (IndependentViewOptions & {
74
96
  /**
@@ -120,7 +142,7 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
120
142
  */
121
143
  export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(
122
144
  config: TreeViewConfiguration<TSchema>,
123
- options: ForestOptions & ICodecOptions,
145
+ options: ForestOptions & ICodecOptions & IndependentViewTelemetryOptions,
124
146
  content: ViewContent,
125
147
  ): TreeViewAlpha<TSchema> {
126
148
  return createIndependentTreeAlpha({ ...options, content }).viewWith(
@@ -202,7 +224,13 @@ export function createIndependentTreeBeta<const TSchema extends ImplicitFieldSch
202
224
  export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSchema>(
203
225
  options?: CreateIndependentTreeAlphaOptions,
204
226
  ): ViewableTree & Pick<ITreeAlpha, "exportVerbose" | "exportSimpleSchema"> {
205
- const breaker = new Breakable("independentView");
227
+ const logger = extractTelemetryLoggerExt(
228
+ createChildLogger({
229
+ logger: options?.logger,
230
+ namespace: "independentView",
231
+ }),
232
+ );
233
+ const breaker = new Breakable("independentView", logger);
206
234
  const idCompressor: IIdCompressor =
207
235
  options?.idCompressor ?? options?.content?.idCompressor ?? createIdCompressor();
208
236
  const mintRevisionTag = (): RevisionTag => idCompressor.generateCompressedId();
@@ -223,6 +251,7 @@ export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSc
223
251
  forest,
224
252
  schema: schemaRepository,
225
253
  breaker,
254
+ logger,
226
255
  codecOptions: options,
227
256
  });
228
257
 
@@ -235,6 +264,7 @@ export function createIndependentTreeAlpha<const TSchema extends ImplicitFieldSc
235
264
  // (finalized compressed ids or strings), so summary-style decode is correct.
236
265
  const context = FieldBatchDecodingContext.forSummary({
237
266
  idCompressor,
267
+ healing: undefined,
238
268
  });
239
269
  const fieldCursors = fieldBatchCodec.decode(
240
270
  options.content.tree as JsonCompatibleReadOnly,
@@ -43,6 +43,8 @@ export type {
43
43
  SharedTreeEditBuilder,
44
44
  } from "./sharedTreeEditBuilder.js";
45
45
 
46
+ export { minimize } from "./transactionMinimize.js";
47
+
46
48
  export { Tree } from "./tree.js";
47
49
  export type { RunTransaction } from "./tree.js";
48
50
 
@@ -57,6 +59,7 @@ export {
57
59
  type ViewContent,
58
60
  independentView,
59
61
  type IndependentViewOptions,
62
+ type IndependentViewTelemetryOptions,
60
63
  createIndependentTreeBeta,
61
64
  createIndependentTreeAlpha,
62
65
  type CreateIndependentTreeAlphaOptions,
@@ -32,7 +32,7 @@ import {
32
32
  tryGetTreeNodeForField,
33
33
  setField,
34
34
  normalizeFieldSchema,
35
- SchemaCompatibilityTester,
35
+ checkSchemaCompatibility,
36
36
  type InsertableContent,
37
37
  type TreeViewConfiguration,
38
38
  type TreeViewAlpha,
@@ -57,6 +57,7 @@ import {
57
57
  toInitialSchema,
58
58
  toUpgradeSchema,
59
59
  type TreeBranchAlpha,
60
+ type TreeSchema,
60
61
  } from "../simple-tree/index.js";
61
62
  import {
62
63
  type Breakable,
@@ -98,7 +99,7 @@ export class SchematizingSimpleTreeView<
98
99
  IEmitter<TreeViewEvents & TreeBranchEvents> &
99
100
  HasListeners<TreeViewEvents & TreeBranchEvents> = createEmitter();
100
101
 
101
- private readonly viewSchema: SchemaCompatibilityTester;
102
+ private readonly viewSchema: TreeSchema;
102
103
 
103
104
  /**
104
105
  * Events to unregister upon flex-tree view disposal.
@@ -143,7 +144,7 @@ export class SchematizingSimpleTreeView<
143
144
 
144
145
  const configAlpha = new TreeViewConfigurationAlpha({ schema: config.schema });
145
146
 
146
- this.viewSchema = new SchemaCompatibilityTester(configAlpha);
147
+ this.viewSchema = configAlpha;
147
148
  // This must be initialized before `update` can be called.
148
149
  this.currentCompatibility = {
149
150
  canView: false,
@@ -258,7 +259,7 @@ export class SchematizingSimpleTreeView<
258
259
  );
259
260
  }
260
261
 
261
- const newSchema = toUpgradeSchema(this.viewSchema.viewSchema.root);
262
+ const newSchema = toUpgradeSchema(this.viewSchema.root);
262
263
  this.runSchemaEdit(() => this.checkout.updateSchema(newSchema));
263
264
  }
264
265
 
@@ -347,7 +348,10 @@ export class SchematizingSimpleTreeView<
347
348
  private update(): void {
348
349
  this.disposeFlexView();
349
350
 
350
- const compatibility = this.viewSchema.checkCompatibility(this.checkout.storedSchema);
351
+ const compatibility = checkSchemaCompatibility(
352
+ this.viewSchema,
353
+ this.checkout.storedSchema,
354
+ );
351
355
 
352
356
  this.currentCompatibility = {
353
357
  ...compatibility,
@@ -533,5 +537,11 @@ export class SchematizingSimpleTreeView<
533
537
  return this.checkout.isMissingEditsFrom(context);
534
538
  }
535
539
 
540
+ public computeNetChangeIfRebasedOnto(
541
+ context: TreeBranchAlpha,
542
+ ): JsonCompatibleReadOnly | undefined {
543
+ return this.checkout.computeNetChangeIfRebasedOnto(context);
544
+ }
545
+
536
546
  // #endregion Branching
537
547
  }