@fluidframework/tree 2.2.0 → 2.3.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 (866) hide show
  1. package/.dependency-cruiser-known-violations.json +28 -40
  2. package/.vscode/Tree.code-workspace +0 -2
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +6 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  10. package/api-extractor/api-extractor.current.json +8 -0
  11. package/api-extractor/api-extractor.legacy.json +4 -0
  12. package/api-extractor.json +1 -1
  13. package/api-report/tree.alpha.api.md +21 -6
  14. package/api-report/tree.beta.api.md +21 -6
  15. package/api-report/tree.legacy.alpha.api.md +562 -0
  16. package/api-report/tree.legacy.public.api.md +559 -0
  17. package/api-report/tree.public.api.md +6 -6
  18. package/dist/alpha.d.ts +102 -0
  19. package/dist/beta.d.ts +6 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +2 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  25. package/dist/core/revertible.d.ts.map +1 -0
  26. package/dist/core/revertible.js.map +1 -0
  27. package/dist/core/schema-stored/format.d.ts +3 -3
  28. package/dist/core/schema-stored/format.js +1 -1
  29. package/dist/core/schema-stored/format.js.map +1 -1
  30. package/dist/core/schema-stored/schema.d.ts +2 -7
  31. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  32. package/dist/core/schema-stored/schema.js +4 -6
  33. package/dist/core/schema-stored/schema.js.map +1 -1
  34. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  35. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  36. package/dist/core/tree/anchorSet.d.ts +4 -6
  37. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  38. package/dist/core/tree/anchorSet.js +15 -1
  39. package/dist/core/tree/anchorSet.js.map +1 -1
  40. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  41. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndex.js +1 -0
  43. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  44. package/dist/core/tree/visitDelta.d.ts +7 -2
  45. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  46. package/dist/core/tree/visitDelta.js.map +1 -1
  47. package/dist/events/emitter.d.ts +127 -0
  48. package/dist/events/emitter.d.ts.map +1 -0
  49. package/dist/events/{events.js → emitter.js} +49 -28
  50. package/dist/events/emitter.js.map +1 -0
  51. package/dist/events/index.d.ts +2 -1
  52. package/dist/events/index.d.ts.map +1 -1
  53. package/dist/events/index.js +4 -5
  54. package/dist/events/index.js.map +1 -1
  55. package/dist/events/interop.d.ts +36 -0
  56. package/dist/events/interop.d.ts.map +1 -0
  57. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  58. package/dist/events/interop.js.map +1 -0
  59. package/dist/events/listeners.d.ts +65 -0
  60. package/dist/events/listeners.d.ts.map +1 -0
  61. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  62. package/dist/events/listeners.js.map +1 -0
  63. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  64. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  66. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  68. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  70. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  72. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  74. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  75. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  76. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  77. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  78. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  79. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  80. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  81. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  82. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  83. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -35
  84. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  85. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -115
  86. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  87. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  88. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  89. package/dist/feature-libraries/flex-tree/context.js +10 -7
  90. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -32
  94. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  95. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  96. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/flex-tree/index.js +1 -3
  98. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  99. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  100. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  102. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -29
  104. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyField.js +11 -17
  106. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
  108. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  109. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -159
  110. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  111. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  112. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  113. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  114. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  116. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  117. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  118. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  120. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  121. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  122. package/dist/feature-libraries/index.d.ts +3 -5
  123. package/dist/feature-libraries/index.d.ts.map +1 -1
  124. package/dist/feature-libraries/index.js +5 -13
  125. package/dist/feature-libraries/index.js.map +1 -1
  126. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  127. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  128. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  129. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  130. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  131. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  136. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  137. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  138. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  139. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  140. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  141. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  142. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  143. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  144. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  145. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  146. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  147. package/dist/feature-libraries/typed-schema/index.js +2 -2
  148. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  149. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  150. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  151. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  154. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  155. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  156. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  157. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  158. package/dist/feature-libraries/typed-schema/view.js +5 -4
  159. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  160. package/dist/index.d.ts +3 -3
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +3 -1
  163. package/dist/index.js.map +1 -1
  164. package/dist/legacy.d.ts +83 -0
  165. package/dist/packageVersion.d.ts +1 -1
  166. package/dist/packageVersion.js +1 -1
  167. package/dist/packageVersion.js.map +1 -1
  168. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  169. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  170. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  171. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  172. package/dist/shared-tree/index.d.ts +3 -3
  173. package/dist/shared-tree/index.d.ts.map +1 -1
  174. package/dist/shared-tree/index.js +2 -2
  175. package/dist/shared-tree/index.js.map +1 -1
  176. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  177. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  178. package/dist/shared-tree/schematizeTree.js +7 -8
  179. package/dist/shared-tree/schematizeTree.js.map +1 -1
  180. package/dist/shared-tree/schematizingTreeView.d.ts +9 -4
  181. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/schematizingTreeView.js +25 -12
  183. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  184. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  185. package/dist/shared-tree/sharedTree.js +2 -2
  186. package/dist/shared-tree/sharedTree.js.map +1 -1
  187. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  188. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  189. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  190. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  191. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  192. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  193. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  194. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  195. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  196. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  197. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  198. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  199. package/dist/shared-tree/treeApi.d.ts +1 -3
  200. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  201. package/dist/shared-tree/treeApi.js +6 -4
  202. package/dist/shared-tree/treeApi.js.map +1 -1
  203. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  204. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  205. package/dist/shared-tree/treeCheckout.js +17 -1
  206. package/dist/shared-tree/treeCheckout.js.map +1 -1
  207. package/dist/shared-tree-core/branch.js +1 -1
  208. package/dist/shared-tree-core/branch.js.map +1 -1
  209. package/dist/simple-tree/api/create.d.ts.map +1 -1
  210. package/dist/simple-tree/api/create.js +1 -1
  211. package/dist/simple-tree/api/create.js.map +1 -1
  212. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  213. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  214. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  215. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  216. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  217. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  218. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  219. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  220. package/dist/simple-tree/api/index.d.ts +5 -0
  221. package/dist/simple-tree/api/index.d.ts.map +1 -1
  222. package/dist/simple-tree/api/index.js +7 -1
  223. package/dist/simple-tree/api/index.js.map +1 -1
  224. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +1 -1
  225. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  226. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  227. package/dist/simple-tree/api/schemaFactory.d.ts +45 -14
  228. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  229. package/dist/simple-tree/api/schemaFactory.js +43 -12
  230. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  231. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  232. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  233. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  235. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  236. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  237. package/dist/simple-tree/api/tree.d.ts +1 -21
  238. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  239. package/dist/simple-tree/api/tree.js +3 -38
  240. package/dist/simple-tree/api/tree.js.map +1 -1
  241. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  242. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  243. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  244. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  245. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  246. package/dist/simple-tree/api/treeNodeApi.js +51 -21
  247. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  248. package/dist/simple-tree/api/verboseTree.js +2 -2
  249. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  250. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  251. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  252. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  253. package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
  254. package/dist/simple-tree/arrayNode.d.ts +2 -2
  255. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  256. package/dist/simple-tree/arrayNode.js +33 -38
  257. package/dist/simple-tree/arrayNode.js.map +1 -1
  258. package/dist/simple-tree/core/index.d.ts +2 -2
  259. package/dist/simple-tree/core/index.d.ts.map +1 -1
  260. package/dist/simple-tree/core/index.js +4 -1
  261. package/dist/simple-tree/core/index.js.map +1 -1
  262. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  263. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  264. package/dist/simple-tree/core/schemaCaching.js +10 -1
  265. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  266. package/dist/simple-tree/core/treeNodeKernel.d.ts +78 -7
  267. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  268. package/dist/simple-tree/core/treeNodeKernel.js +219 -30
  269. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  270. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  271. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  272. package/dist/simple-tree/core/types.d.ts +23 -8
  273. package/dist/simple-tree/core/types.d.ts.map +1 -1
  274. package/dist/simple-tree/core/types.js.map +1 -1
  275. package/dist/simple-tree/core/withType.d.ts +3 -2
  276. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  277. package/dist/simple-tree/core/withType.js.map +1 -1
  278. package/dist/simple-tree/index.d.ts +7 -9
  279. package/dist/simple-tree/index.d.ts.map +1 -1
  280. package/dist/simple-tree/index.js +15 -6
  281. package/dist/simple-tree/index.js.map +1 -1
  282. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  283. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  284. package/dist/simple-tree/leafNodeSchema.js +13 -11
  285. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  286. package/dist/simple-tree/mapNode.d.ts +1 -1
  287. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  288. package/dist/simple-tree/mapNode.js +38 -29
  289. package/dist/simple-tree/mapNode.js.map +1 -1
  290. package/dist/simple-tree/objectNode.d.ts +9 -7
  291. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  292. package/dist/simple-tree/objectNode.js +37 -31
  293. package/dist/simple-tree/objectNode.js.map +1 -1
  294. package/dist/simple-tree/proxies.d.ts +1 -14
  295. package/dist/simple-tree/proxies.d.ts.map +1 -1
  296. package/dist/simple-tree/proxies.js +12 -15
  297. package/dist/simple-tree/proxies.js.map +1 -1
  298. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  299. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  300. package/dist/simple-tree/proxyBinding.js +8 -181
  301. package/dist/simple-tree/proxyBinding.js.map +1 -1
  302. package/dist/simple-tree/schemaTypes.d.ts +7 -7
  303. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  304. package/dist/simple-tree/schemaTypes.js +4 -4
  305. package/dist/simple-tree/schemaTypes.js.map +1 -1
  306. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  307. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  308. package/dist/simple-tree/toFlexSchema.js +54 -31
  309. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  310. package/dist/simple-tree/toMapTree.d.ts +25 -37
  311. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  312. package/dist/simple-tree/toMapTree.js +53 -16
  313. package/dist/simple-tree/toMapTree.js.map +1 -1
  314. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  315. package/dist/simple-tree/treeNodeValid.js +7 -10
  316. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  317. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  318. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  319. package/dist/simple-tree/walkSchema.d.ts +26 -0
  320. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  321. package/dist/simple-tree/walkSchema.js +49 -0
  322. package/dist/simple-tree/walkSchema.js.map +1 -0
  323. package/dist/treeFactory.d.ts +2 -1
  324. package/dist/treeFactory.d.ts.map +1 -1
  325. package/dist/treeFactory.js +2 -1
  326. package/dist/treeFactory.js.map +1 -1
  327. package/dist/util/typeUtils.d.ts +2 -2
  328. package/dist/util/typeUtils.js.map +1 -1
  329. package/legacy.d.ts +11 -0
  330. package/lib/alpha.d.ts +102 -0
  331. package/lib/beta.d.ts +6 -1
  332. package/lib/core/index.d.ts +1 -1
  333. package/lib/core/index.d.ts.map +1 -1
  334. package/lib/core/index.js +1 -1
  335. package/lib/core/index.js.map +1 -1
  336. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  337. package/lib/core/revertible.d.ts.map +1 -0
  338. package/lib/core/revertible.js.map +1 -0
  339. package/lib/core/schema-stored/format.d.ts +3 -3
  340. package/lib/core/schema-stored/format.js +1 -1
  341. package/lib/core/schema-stored/format.js.map +1 -1
  342. package/lib/core/schema-stored/schema.d.ts +2 -7
  343. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  344. package/lib/core/schema-stored/schema.js +4 -6
  345. package/lib/core/schema-stored/schema.js.map +1 -1
  346. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  347. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  348. package/lib/core/tree/anchorSet.d.ts +4 -6
  349. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  350. package/lib/core/tree/anchorSet.js +15 -1
  351. package/lib/core/tree/anchorSet.js.map +1 -1
  352. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  353. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  354. package/lib/core/tree/detachedFieldIndex.js +1 -0
  355. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  356. package/lib/core/tree/visitDelta.d.ts +7 -2
  357. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  358. package/lib/core/tree/visitDelta.js.map +1 -1
  359. package/lib/events/emitter.d.ts +127 -0
  360. package/lib/events/emitter.d.ts.map +1 -0
  361. package/lib/events/{events.js → emitter.js} +49 -27
  362. package/lib/events/emitter.js.map +1 -0
  363. package/lib/events/index.d.ts +2 -1
  364. package/lib/events/index.d.ts.map +1 -1
  365. package/lib/events/index.js +1 -1
  366. package/lib/events/index.js.map +1 -1
  367. package/lib/events/interop.d.ts +36 -0
  368. package/lib/events/interop.d.ts.map +1 -0
  369. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  370. package/lib/events/interop.js.map +1 -0
  371. package/lib/events/listeners.d.ts +65 -0
  372. package/lib/events/listeners.d.ts.map +1 -0
  373. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  374. package/lib/events/listeners.js.map +1 -0
  375. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  376. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  377. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  378. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  379. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  380. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  381. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  382. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  384. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  385. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  386. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  388. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  390. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  391. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  392. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  394. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  395. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -35
  396. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  397. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -116
  398. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  399. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  400. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  401. package/lib/feature-libraries/flex-tree/context.js +10 -7
  402. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  403. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
  404. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  405. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -31
  406. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  407. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  408. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  409. package/lib/feature-libraries/flex-tree/index.js +2 -2
  410. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  411. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  412. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  413. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  414. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  415. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -29
  416. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  417. package/lib/feature-libraries/flex-tree/lazyField.js +11 -16
  418. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  419. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
  420. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  421. package/lib/feature-libraries/flex-tree/lazyNode.js +24 -156
  422. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  423. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  424. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  425. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  426. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  427. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  428. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  429. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  430. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  431. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  432. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  433. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  434. package/lib/feature-libraries/index.d.ts +3 -5
  435. package/lib/feature-libraries/index.d.ts.map +1 -1
  436. package/lib/feature-libraries/index.js +5 -5
  437. package/lib/feature-libraries/index.js.map +1 -1
  438. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  439. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  440. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  441. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  442. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  443. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  444. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  445. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  446. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  447. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  448. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  449. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  450. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  451. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  452. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  453. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  454. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  455. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  456. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  457. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  458. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  459. package/lib/feature-libraries/typed-schema/index.js +2 -2
  460. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  461. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  462. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  463. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  464. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  465. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  466. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  467. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  468. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  469. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  470. package/lib/feature-libraries/typed-schema/view.js +5 -4
  471. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  472. package/lib/index.d.ts +3 -3
  473. package/lib/index.d.ts.map +1 -1
  474. package/lib/index.js +3 -1
  475. package/lib/index.js.map +1 -1
  476. package/lib/legacy.d.ts +83 -0
  477. package/lib/packageVersion.d.ts +1 -1
  478. package/lib/packageVersion.js +1 -1
  479. package/lib/packageVersion.js.map +1 -1
  480. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  481. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  482. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  483. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  484. package/lib/shared-tree/index.d.ts +3 -3
  485. package/lib/shared-tree/index.d.ts.map +1 -1
  486. package/lib/shared-tree/index.js +1 -1
  487. package/lib/shared-tree/index.js.map +1 -1
  488. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  489. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  490. package/lib/shared-tree/schematizeTree.js +8 -9
  491. package/lib/shared-tree/schematizeTree.js.map +1 -1
  492. package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
  493. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  494. package/lib/shared-tree/schematizingTreeView.js +26 -13
  495. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  496. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  497. package/lib/shared-tree/sharedTree.js +2 -2
  498. package/lib/shared-tree/sharedTree.js.map +1 -1
  499. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  500. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  501. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  502. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  503. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  504. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  505. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  506. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  507. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  508. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  509. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  510. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  511. package/lib/shared-tree/treeApi.d.ts +1 -3
  512. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  513. package/lib/shared-tree/treeApi.js +7 -5
  514. package/lib/shared-tree/treeApi.js.map +1 -1
  515. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  516. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  517. package/lib/shared-tree/treeCheckout.js +18 -2
  518. package/lib/shared-tree/treeCheckout.js.map +1 -1
  519. package/lib/shared-tree-core/branch.js +1 -1
  520. package/lib/shared-tree-core/branch.js.map +1 -1
  521. package/lib/simple-tree/api/create.d.ts.map +1 -1
  522. package/lib/simple-tree/api/create.js +2 -2
  523. package/lib/simple-tree/api/create.js.map +1 -1
  524. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  525. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  526. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  527. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  528. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  529. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  530. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  531. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  532. package/lib/simple-tree/api/index.d.ts +5 -0
  533. package/lib/simple-tree/api/index.d.ts.map +1 -1
  534. package/lib/simple-tree/api/index.js +3 -0
  535. package/lib/simple-tree/api/index.js.map +1 -1
  536. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
  537. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  538. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  539. package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
  540. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  541. package/lib/simple-tree/api/schemaFactory.js +43 -12
  542. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  543. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  544. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  545. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  546. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  547. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  548. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  549. package/lib/simple-tree/api/tree.d.ts +1 -21
  550. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  551. package/lib/simple-tree/api/tree.js +2 -34
  552. package/lib/simple-tree/api/tree.js.map +1 -1
  553. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  554. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  555. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  556. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  557. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  558. package/lib/simple-tree/api/treeNodeApi.js +53 -23
  559. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  560. package/lib/simple-tree/api/verboseTree.js +1 -1
  561. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  562. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  563. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  564. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  565. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  566. package/lib/simple-tree/arrayNode.d.ts +2 -2
  567. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  568. package/lib/simple-tree/arrayNode.js +36 -41
  569. package/lib/simple-tree/arrayNode.js.map +1 -1
  570. package/lib/simple-tree/core/index.d.ts +2 -2
  571. package/lib/simple-tree/core/index.d.ts.map +1 -1
  572. package/lib/simple-tree/core/index.js +2 -2
  573. package/lib/simple-tree/core/index.js.map +1 -1
  574. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  575. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  576. package/lib/simple-tree/core/schemaCaching.js +8 -0
  577. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  578. package/lib/simple-tree/core/treeNodeKernel.d.ts +78 -7
  579. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  580. package/lib/simple-tree/core/treeNodeKernel.js +211 -24
  581. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  582. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  583. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  584. package/lib/simple-tree/core/types.d.ts +23 -8
  585. package/lib/simple-tree/core/types.d.ts.map +1 -1
  586. package/lib/simple-tree/core/types.js.map +1 -1
  587. package/lib/simple-tree/core/withType.d.ts +3 -2
  588. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  589. package/lib/simple-tree/core/withType.js.map +1 -1
  590. package/lib/simple-tree/index.d.ts +7 -9
  591. package/lib/simple-tree/index.d.ts.map +1 -1
  592. package/lib/simple-tree/index.js +5 -5
  593. package/lib/simple-tree/index.js.map +1 -1
  594. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  595. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  596. package/lib/simple-tree/leafNodeSchema.js +14 -12
  597. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  598. package/lib/simple-tree/mapNode.d.ts +1 -1
  599. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  600. package/lib/simple-tree/mapNode.js +38 -29
  601. package/lib/simple-tree/mapNode.js.map +1 -1
  602. package/lib/simple-tree/objectNode.d.ts +9 -7
  603. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  604. package/lib/simple-tree/objectNode.js +40 -34
  605. package/lib/simple-tree/objectNode.js.map +1 -1
  606. package/lib/simple-tree/proxies.d.ts +1 -14
  607. package/lib/simple-tree/proxies.d.ts.map +1 -1
  608. package/lib/simple-tree/proxies.js +11 -14
  609. package/lib/simple-tree/proxies.js.map +1 -1
  610. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  611. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  612. package/lib/simple-tree/proxyBinding.js +6 -174
  613. package/lib/simple-tree/proxyBinding.js.map +1 -1
  614. package/lib/simple-tree/schemaTypes.d.ts +7 -7
  615. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  616. package/lib/simple-tree/schemaTypes.js +4 -4
  617. package/lib/simple-tree/schemaTypes.js.map +1 -1
  618. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  619. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  620. package/lib/simple-tree/toFlexSchema.js +29 -8
  621. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  622. package/lib/simple-tree/toMapTree.d.ts +25 -37
  623. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  624. package/lib/simple-tree/toMapTree.js +54 -17
  625. package/lib/simple-tree/toMapTree.js.map +1 -1
  626. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  627. package/lib/simple-tree/treeNodeValid.js +8 -11
  628. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  629. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  630. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  631. package/lib/simple-tree/walkSchema.d.ts +26 -0
  632. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  633. package/lib/simple-tree/walkSchema.js +43 -0
  634. package/lib/simple-tree/walkSchema.js.map +1 -0
  635. package/lib/treeFactory.d.ts +2 -1
  636. package/lib/treeFactory.d.ts.map +1 -1
  637. package/lib/treeFactory.js +2 -1
  638. package/lib/treeFactory.js.map +1 -1
  639. package/lib/tsdoc-metadata.json +1 -1
  640. package/lib/util/typeUtils.d.ts +2 -2
  641. package/lib/util/typeUtils.js.map +1 -1
  642. package/package.json +58 -36
  643. package/src/core/index.ts +1 -1
  644. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  645. package/src/core/schema-stored/format.ts +1 -1
  646. package/src/core/schema-stored/schema.ts +6 -13
  647. package/src/core/tree/anchorSet.ts +35 -9
  648. package/src/core/tree/detachedFieldIndex.ts +6 -5
  649. package/src/core/tree/visitDelta.ts +7 -2
  650. package/src/events/{events.ts → emitter.ts} +55 -134
  651. package/src/events/index.ts +7 -7
  652. package/src/events/interop.ts +49 -0
  653. package/src/events/listeners.ts +68 -0
  654. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  655. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  656. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  657. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  658. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  659. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -231
  660. package/src/feature-libraries/flex-tree/README.md +4 -75
  661. package/src/feature-libraries/flex-tree/context.ts +37 -16
  662. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -458
  663. package/src/feature-libraries/flex-tree/index.ts +7 -29
  664. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  665. package/src/feature-libraries/flex-tree/lazyField.ts +49 -79
  666. package/src/feature-libraries/flex-tree/lazyNode.ts +26 -306
  667. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  668. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  669. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  670. package/src/feature-libraries/index.ts +2 -41
  671. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  672. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  673. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  674. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
  675. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  676. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  677. package/src/feature-libraries/typed-schema/index.ts +1 -3
  678. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  679. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  680. package/src/feature-libraries/typed-schema/view.ts +4 -13
  681. package/src/index.ts +5 -1
  682. package/src/packageVersion.ts +1 -1
  683. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  684. package/src/shared-tree/index.ts +2 -7
  685. package/src/shared-tree/schematizeTree.ts +23 -12
  686. package/src/shared-tree/schematizingTreeView.ts +34 -24
  687. package/src/shared-tree/sharedTree.ts +6 -1
  688. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  689. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  690. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  691. package/src/shared-tree/treeApi.ts +10 -10
  692. package/src/shared-tree/treeCheckout.ts +26 -15
  693. package/src/shared-tree-core/branch.ts +1 -1
  694. package/src/simple-tree/ProxyBinding.md +23 -23
  695. package/src/simple-tree/api/create.ts +8 -3
  696. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  697. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  698. package/src/simple-tree/api/index.ts +20 -0
  699. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
  700. package/src/simple-tree/api/schemaFactory.ts +44 -13
  701. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
  702. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
  703. package/src/simple-tree/api/tree.ts +2 -71
  704. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  705. package/src/simple-tree/api/treeNodeApi.ts +63 -22
  706. package/src/simple-tree/api/verboseTree.ts +1 -1
  707. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
  708. package/src/simple-tree/arrayNode.ts +38 -41
  709. package/src/simple-tree/core/index.ts +4 -0
  710. package/src/simple-tree/core/schemaCaching.ts +10 -0
  711. package/src/simple-tree/core/treeNodeKernel.ts +279 -27
  712. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  713. package/src/simple-tree/core/types.ts +23 -8
  714. package/src/simple-tree/core/withType.ts +3 -1
  715. package/src/simple-tree/index.ts +29 -20
  716. package/src/simple-tree/leafNodeSchema.ts +24 -28
  717. package/src/simple-tree/mapNode.ts +47 -29
  718. package/src/simple-tree/objectNode.ts +51 -46
  719. package/src/simple-tree/proxies.ts +22 -51
  720. package/src/simple-tree/proxyBinding.ts +3 -254
  721. package/src/simple-tree/schemaTypes.ts +8 -8
  722. package/src/simple-tree/toFlexSchema.ts +40 -7
  723. package/src/simple-tree/toMapTree.ts +113 -79
  724. package/src/simple-tree/treeNodeValid.ts +10 -13
  725. package/src/simple-tree/typesUnsafe.ts +13 -13
  726. package/src/simple-tree/walkSchema.ts +81 -0
  727. package/src/treeFactory.ts +2 -1
  728. package/src/util/typeUtils.ts +2 -2
  729. package/dist/core/revertible/index.d.ts.map +0 -1
  730. package/dist/core/revertible/index.js +0 -10
  731. package/dist/core/revertible/index.js.map +0 -1
  732. package/dist/core/revertible/revertible.d.ts.map +0 -1
  733. package/dist/core/revertible/revertible.js.map +0 -1
  734. package/dist/domains/index.d.ts +0 -8
  735. package/dist/domains/index.d.ts.map +0 -1
  736. package/dist/domains/index.js +0 -20
  737. package/dist/domains/index.js.map +0 -1
  738. package/dist/domains/json/index.d.ts +0 -7
  739. package/dist/domains/json/index.d.ts.map +0 -1
  740. package/dist/domains/json/index.js +0 -17
  741. package/dist/domains/json/index.js.map +0 -1
  742. package/dist/domains/json/jsonCursor.d.ts +0 -52
  743. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  744. package/dist/domains/json/jsonCursor.js +0 -197
  745. package/dist/domains/json/jsonCursor.js.map +0 -1
  746. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  747. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  748. package/dist/domains/json/jsonDomainSchema.js +0 -32
  749. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  750. package/dist/domains/leafDomain.d.ts +0 -72
  751. package/dist/domains/leafDomain.d.ts.map +0 -1
  752. package/dist/domains/leafDomain.js +0 -88
  753. package/dist/domains/leafDomain.js.map +0 -1
  754. package/dist/domains/schemaBuilder.d.ts +0 -103
  755. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  756. package/dist/domains/schemaBuilder.js +0 -121
  757. package/dist/domains/schemaBuilder.js.map +0 -1
  758. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  759. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  760. package/dist/domains/testRecursiveDomain.js +0 -35
  761. package/dist/domains/testRecursiveDomain.js.map +0 -1
  762. package/dist/events/events.d.ts +0 -201
  763. package/dist/events/events.d.ts.map +0 -1
  764. package/dist/events/events.js.map +0 -1
  765. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  766. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  767. package/dist/feature-libraries/schemaBuilder.js +0 -40
  768. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  769. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  770. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  771. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  772. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  773. package/dist/shared-tree/treeView.d.ts +0 -73
  774. package/dist/shared-tree/treeView.d.ts.map +0 -1
  775. package/dist/shared-tree/treeView.js.map +0 -1
  776. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  777. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  778. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  779. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  780. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  781. package/dist/simple-tree/jsonSchema.js.map +0 -1
  782. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  783. package/dist/simple-tree/simpleSchema.js.map +0 -1
  784. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  785. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  786. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  787. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  788. package/lib/core/revertible/index.d.ts.map +0 -1
  789. package/lib/core/revertible/index.js.map +0 -1
  790. package/lib/core/revertible/revertible.d.ts.map +0 -1
  791. package/lib/core/revertible/revertible.js.map +0 -1
  792. package/lib/domains/index.d.ts +0 -8
  793. package/lib/domains/index.d.ts.map +0 -1
  794. package/lib/domains/index.js +0 -8
  795. package/lib/domains/index.js.map +0 -1
  796. package/lib/domains/json/index.d.ts +0 -7
  797. package/lib/domains/json/index.d.ts.map +0 -1
  798. package/lib/domains/json/index.js +0 -7
  799. package/lib/domains/json/index.js.map +0 -1
  800. package/lib/domains/json/jsonCursor.d.ts +0 -52
  801. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  802. package/lib/domains/json/jsonCursor.js +0 -192
  803. package/lib/domains/json/jsonCursor.js.map +0 -1
  804. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  805. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  806. package/lib/domains/json/jsonDomainSchema.js +0 -29
  807. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  808. package/lib/domains/leafDomain.d.ts +0 -72
  809. package/lib/domains/leafDomain.d.ts.map +0 -1
  810. package/lib/domains/leafDomain.js +0 -85
  811. package/lib/domains/leafDomain.js.map +0 -1
  812. package/lib/domains/schemaBuilder.d.ts +0 -103
  813. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  814. package/lib/domains/schemaBuilder.js +0 -117
  815. package/lib/domains/schemaBuilder.js.map +0 -1
  816. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  817. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  818. package/lib/domains/testRecursiveDomain.js +0 -32
  819. package/lib/domains/testRecursiveDomain.js.map +0 -1
  820. package/lib/events/events.d.ts +0 -201
  821. package/lib/events/events.d.ts.map +0 -1
  822. package/lib/events/events.js.map +0 -1
  823. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  824. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  825. package/lib/feature-libraries/schemaBuilder.js +0 -36
  826. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  827. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  828. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  829. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  830. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  831. package/lib/shared-tree/treeView.d.ts +0 -73
  832. package/lib/shared-tree/treeView.d.ts.map +0 -1
  833. package/lib/shared-tree/treeView.js.map +0 -1
  834. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  835. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  836. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  837. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  838. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  839. package/lib/simple-tree/jsonSchema.js.map +0 -1
  840. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  841. package/lib/simple-tree/simpleSchema.js.map +0 -1
  842. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  843. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  844. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  845. package/src/domains/README.md +0 -6
  846. package/src/domains/fence.json +0 -5
  847. package/src/domains/index.ts +0 -19
  848. package/src/domains/json/fence.json +0 -5
  849. package/src/domains/json/index.ts +0 -13
  850. package/src/domains/json/jsonCursor.ts +0 -247
  851. package/src/domains/json/jsonDomainSchema.ts +0 -47
  852. package/src/domains/leafDomain.ts +0 -97
  853. package/src/domains/schemaBuilder.ts +0 -153
  854. package/src/domains/testRecursiveDomain.ts +0 -38
  855. package/src/events/fence.json +0 -5
  856. package/src/feature-libraries/schemaBuilder.ts +0 -45
  857. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  858. package/src/shared-tree/treeView.ts +0 -113
  859. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  860. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  861. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  862. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  863. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  864. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  865. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  866. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -4,21 +4,29 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.contextToTreeView = exports.CheckoutFlexTreeView = void 0;
7
+ exports.getCheckoutFlexTreeView = exports.CheckoutFlexTreeView = void 0;
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
8
9
  const index_js_1 = require("../feature-libraries/index.js");
9
10
  const index_js_2 = require("../simple-tree/index.js");
10
11
  const index_js_3 = require("../util/index.js");
11
12
  /**
12
- * Implementation of FlexTreeView wrapping a ITreeCheckout.
13
+ * An editable view of a (version control style) branch of a shared tree.
13
14
  */
14
15
  class CheckoutFlexTreeView {
15
- constructor(checkout, schema, nodeKeyManager, onDispose) {
16
+ constructor(
17
+ /**
18
+ * Access non-view schema specific aspects of this branch.
19
+ *
20
+ * @remarks
21
+ * This is a non-owning reference: disposing of this view does not impact the branch.
22
+ */
23
+ checkout, schema, nodeKeyManager, onDispose) {
16
24
  this.checkout = checkout;
17
25
  this.schema = schema;
18
26
  this.nodeKeyManager = nodeKeyManager;
19
27
  this.onDispose = onDispose;
20
28
  this.context = (0, index_js_1.getTreeContext)(schema, this.checkout, nodeKeyManager);
21
- exports.contextToTreeView.set(this.context, this);
29
+ contextToTreeViewMap.set(this.context, this);
22
30
  this.flexTree = this.context.root;
23
31
  }
24
32
  [index_js_3.disposeSymbol]() {
@@ -28,6 +36,10 @@ class CheckoutFlexTreeView {
28
36
  this.context[index_js_3.disposeSymbol]();
29
37
  this.onDispose?.();
30
38
  }
39
+ /**
40
+ * Spawn a new view which is based off of the current state of this view.
41
+ * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.
42
+ */
31
43
  fork() {
32
44
  const branch = this.checkout.fork();
33
45
  return new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager);
@@ -38,5 +50,15 @@ exports.CheckoutFlexTreeView = CheckoutFlexTreeView;
38
50
  * Maps the context of every {@link CheckoutFlexTreeView} to the view.
39
51
  * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.
40
52
  */
41
- exports.contextToTreeView = new WeakMap();
42
- //# sourceMappingURL=treeView.js.map
53
+ const contextToTreeViewMap = new WeakMap();
54
+ /**
55
+ * Retrieve the {@link CheckoutFlexTreeView | view} for the given {@link FlexTreeHydratedContext | context}.
56
+ * @remarks Every {@link CheckoutFlexTreeView} is associated with its context upon creation.
57
+ */
58
+ function getCheckoutFlexTreeView(context) {
59
+ const view = contextToTreeViewMap.get(context);
60
+ (0, internal_1.assert)(view !== undefined, 0xa41 /* Expected view to be registered for context */);
61
+ return view;
62
+ }
63
+ exports.getCheckoutFlexTreeView = getCheckoutFlexTreeView;
64
+ //# sourceMappingURL=checkoutFlexTreeView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkoutFlexTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/checkoutFlexTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,4DAOuC;AACvC,sDAA6D;AAC7D,+CAAiD;AAIjD;;GAEG;AACH,MAAa,oBAAoB;IAchC;IACC;;;;;OAKG;IACa,QAAmB,EACnB,MAAsB,EACtB,cAA8B,EAC7B,SAAsB;QAHvB,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAgB;QACtB,mBAAc,GAAd,cAAc,CAAgB;QAC7B,cAAS,GAAT,SAAS,CAAa;QAEvC,IAAI,CAAC,OAAO,GAAG,IAAA,yBAAc,EAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACrE,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IACnC,CAAC;IAEM,CAAC,wBAAa,CAAC;QACrB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvD,IAAA,6BAAkB,EAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,wBAAa,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IACI,IAAI;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;CACD;AAhDD,oDAgDC;AAED;;;GAGG;AACH,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAiD,CAAC;AAE1F;;;GAGG;AACH,SAAgB,uBAAuB,CACtC,OAAgC;IAEhC,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAA,iBAAM,EAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC;AACb,CAAC;AAND,0DAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype Context,\n\ttype FlexTreeField,\n\ttype FlexTreeSchema,\n\ttype NodeKeyManager,\n\tgetTreeContext,\n\ttype FlexTreeHydratedContext,\n} from \"../feature-libraries/index.js\";\nimport { tryDisposeTreeNode } from \"../simple-tree/index.js\";\nimport { disposeSymbol } from \"../util/index.js\";\n\nimport type { ITreeCheckout, ITreeCheckoutFork } from \"./treeCheckout.js\";\n\n/**\n * An editable view of a (version control style) branch of a shared tree.\n */\nexport class CheckoutFlexTreeView<out TCheckout extends ITreeCheckout = ITreeCheckout> {\n\t/**\n\t * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.\n\t *\n\t * @remarks\n\t * This is an owning reference: disposing of this view disposes its context.\n\t */\n\tpublic readonly context: Context;\n\n\t/**\n\t * Get a typed view of the tree content using the flex-tree API.\n\t */\n\tpublic readonly flexTree: FlexTreeField;\n\n\tpublic constructor(\n\t\t/**\n\t\t * Access non-view schema specific aspects of this branch.\n\t\t *\n\t\t * @remarks\n\t\t * This is a non-owning reference: disposing of this view does not impact the branch.\n\t\t */\n\t\tpublic readonly checkout: TCheckout,\n\t\tpublic readonly schema: FlexTreeSchema,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.context = getTreeContext(schema, this.checkout, nodeKeyManager);\n\t\tcontextToTreeViewMap.set(this.context, this);\n\t\tthis.flexTree = this.context.root;\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tfor (const anchorNode of this.checkout.forest.anchors) {\n\t\t\ttryDisposeTreeNode(anchorNode);\n\t\t}\n\n\t\tthis.context[disposeSymbol]();\n\t\tthis.onDispose?.();\n\t}\n\n\t/**\n\t * Spawn a new view which is based off of the current state of this view.\n\t * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.\n\t */\n\tpublic fork(): CheckoutFlexTreeView<ITreeCheckout & ITreeCheckoutFork> {\n\t\tconst branch = this.checkout.fork();\n\t\treturn new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager);\n\t}\n}\n\n/**\n * Maps the context of every {@link CheckoutFlexTreeView} to the view.\n * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.\n */\nconst contextToTreeViewMap = new WeakMap<FlexTreeHydratedContext, CheckoutFlexTreeView>();\n\n/**\n * Retrieve the {@link CheckoutFlexTreeView | view} for the given {@link FlexTreeHydratedContext | context}.\n * @remarks Every {@link CheckoutFlexTreeView} is associated with its context upon creation.\n */\nexport function getCheckoutFlexTreeView(\n\tcontext: FlexTreeHydratedContext,\n): CheckoutFlexTreeView {\n\tconst view = contextToTreeViewMap.get(context);\n\tassert(view !== undefined, 0xa41 /* Expected view to be registered for context */);\n\treturn view;\n}\n"]}
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, } from "./sharedTree.js";
6
- export { createTreeCheckout, TreeCheckout, type ITreeCheckout, runSynchronous, type CheckoutEvents, type ITransaction, type ITreeCheckoutFork, type RevertibleFactory, } from "./treeCheckout.js";
7
- export { type SchematizeConfiguration, type TreeContent, type InitializeAndSchematizeConfiguration, type SchemaConfiguration, buildTreeConfiguration, } from "./schematizeTree.js";
8
- export { type FlexTreeView, CheckoutFlexTreeView, type ITreeViewFork, type FlexTreeViewGeneric, } from "./treeView.js";
6
+ export { createTreeCheckout, TreeCheckout, type ITreeCheckout, runSynchronous, type CheckoutEvents, type ITransaction, type ITreeCheckoutFork, } from "./treeCheckout.js";
7
+ export { type SchematizeConfiguration, type TreeContent, type TreeStoredContent, type InitializeAndSchematizeConfiguration, type SchemaConfiguration, buildTreeConfiguration, } from "./schematizeTree.js";
8
+ export { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
9
9
  export type { ISharedTreeEditor, ISchemaEditor } from "./sharedTreeEditBuilder.js";
10
10
  export { treeApi as Tree, type TreeApi, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, } from "./treeApi.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,uBAAuB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,oCAAoC,EAC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,8 @@ Object.defineProperty(exports, "TreeCheckout", { enumerable: true, get: function
16
16
  Object.defineProperty(exports, "runSynchronous", { enumerable: true, get: function () { return treeCheckout_js_1.runSynchronous; } });
17
17
  var schematizeTree_js_1 = require("./schematizeTree.js");
18
18
  Object.defineProperty(exports, "buildTreeConfiguration", { enumerable: true, get: function () { return schematizeTree_js_1.buildTreeConfiguration; } });
19
- var treeView_js_1 = require("./treeView.js");
20
- Object.defineProperty(exports, "CheckoutFlexTreeView", { enumerable: true, get: function () { return treeView_js_1.CheckoutFlexTreeView; } });
19
+ var checkoutFlexTreeView_js_1 = require("./checkoutFlexTreeView.js");
20
+ Object.defineProperty(exports, "CheckoutFlexTreeView", { enumerable: true, get: function () { return checkoutFlexTreeView_js_1.CheckoutFlexTreeView; } });
21
21
  var treeApi_js_1 = require("./treeApi.js");
22
22
  Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return treeApi_js_1.treeApi; } });
23
23
  Object.defineProperty(exports, "rollback", { enumerable: true, get: function () { return treeApi_js_1.rollback; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDASyB;AAPxB,kHAAA,iBAAiB,OAAA;AAEjB,2GAAA,UAAU,OAAA;AACV,2GAAA,UAAU,OAAA;AAGV,wHAAA,uBAAuB,OAAA;AAGxB,qDAS2B;AAR1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAEZ,iHAAA,cAAc,OAAA;AAOf,yDAM6B;AAD5B,2HAAA,sBAAsB,OAAA;AAGvB,6CAKuB;AAHtB,mHAAA,oBAAoB,OAAA;AAOrB,2CAOsB;AANrB,kGAAA,OAAO,OAAQ;AAKf,sGAAA,QAAQ,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\tSharedTreeFactory,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\trunSynchronous,\n\ttype CheckoutEvents,\n\ttype ITransaction,\n\ttype ITreeCheckoutFork,\n\ttype RevertibleFactory,\n} from \"./treeCheckout.js\";\n\nexport {\n\ttype SchematizeConfiguration,\n\ttype TreeContent,\n\ttype InitializeAndSchematizeConfiguration,\n\ttype SchemaConfiguration,\n\tbuildTreeConfiguration,\n} from \"./schematizeTree.js\";\n\nexport {\n\ttype FlexTreeView,\n\tCheckoutFlexTreeView,\n\ttype ITreeViewFork,\n\ttype FlexTreeViewGeneric,\n} from \"./treeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./treeApi.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDASyB;AAPxB,kHAAA,iBAAiB,OAAA;AAEjB,2GAAA,UAAU,OAAA;AACV,2GAAA,UAAU,OAAA;AAGV,wHAAA,uBAAuB,OAAA;AAGxB,qDAQ2B;AAP1B,qHAAA,kBAAkB,OAAA;AAClB,+GAAA,YAAY,OAAA;AAEZ,iHAAA,cAAc,OAAA;AAMf,yDAO6B;AAD5B,2HAAA,sBAAsB,OAAA;AAGvB,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAI7B,2CAOsB;AANrB,kGAAA,OAAO,OAAQ;AAKf,sGAAA,QAAQ,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ISharedTree,\n\tSharedTreeFactory,\n\ttype SharedTreeOptions,\n\tSharedTree,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n} from \"./sharedTree.js\";\n\nexport {\n\tcreateTreeCheckout,\n\tTreeCheckout,\n\ttype ITreeCheckout,\n\trunSynchronous,\n\ttype CheckoutEvents,\n\ttype ITransaction,\n\ttype ITreeCheckoutFork,\n} from \"./treeCheckout.js\";\n\nexport {\n\ttype SchematizeConfiguration,\n\ttype TreeContent,\n\ttype TreeStoredContent,\n\ttype InitializeAndSchematizeConfiguration,\n\ttype SchemaConfiguration,\n\tbuildTreeConfiguration,\n} from \"./schematizeTree.js\";\n\nexport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\nexport type { ISharedTreeEditor, ISchemaEditor } from \"./sharedTreeEditBuilder.js\";\n\nexport {\n\ttreeApi as Tree,\n\ttype TreeApi,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./treeApi.js\";\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { AllowedUpdateType, type ITreeCursorSynchronous } from "../core/index.js";
5
+ import { AllowedUpdateType, type ITreeCursorSynchronous, type TreeStoredSchema } from "../core/index.js";
6
6
  import { type FlexFieldSchema, type FlexTreeSchema, type ViewSchema } from "../feature-libraries/index.js";
7
7
  import type { ITreeCheckout } from "./treeCheckout.js";
8
8
  /**
@@ -20,7 +20,7 @@ import type { ITreeCheckout } from "./treeCheckout.js";
20
20
  export declare function initializeContent(schemaRepository: {
21
21
  storedSchema: ITreeCheckout["storedSchema"];
22
22
  updateSchema: ITreeCheckout["updateSchema"];
23
- }, newSchema: FlexTreeSchema, setInitialTree: () => void): void;
23
+ }, newSchema: TreeStoredSchema, setInitialTree: () => void): void;
24
24
  export declare enum UpdateType {
25
25
  /**
26
26
  * Already compatible, no update needed.
@@ -49,7 +49,7 @@ export declare function canInitialize(checkout: ITreeCheckout): boolean;
49
49
  * If the proposed schema (from `treeContent`) is not compatible with the emptry tree, this function handles using an intermediate schema
50
50
  * which supports the empty tree as well as the final tree content.
51
51
  */
52
- export declare function initialize(checkout: ITreeCheckout, treeContent: TreeContent): void;
52
+ export declare function initialize(checkout: ITreeCheckout, treeContent: TreeStoredContent): void;
53
53
  /**
54
54
  * Ensure a {@link ITreeCheckout} can be used with a given {@link ViewSchema}.
55
55
  *
@@ -62,7 +62,7 @@ export declare function initialize(checkout: ITreeCheckout, treeContent: TreeCon
62
62
  * @param treeContent - Content to be used to initialize `checkout`'s the tree if needed and allowed.
63
63
  * @returns true iff checkout now is compatible with `viewSchema`.
64
64
  */
65
- export declare function ensureSchema(viewSchema: ViewSchema, allowedSchemaModifications: AllowedUpdateType, checkout: ITreeCheckout, treeContent: TreeContent | undefined): boolean;
65
+ export declare function ensureSchema(viewSchema: ViewSchema, allowedSchemaModifications: AllowedUpdateType, checkout: ITreeCheckout, treeContent: TreeStoredContent | undefined): boolean;
66
66
  /**
67
67
  * View Schema for a `SharedTree`.
68
68
  */
@@ -82,6 +82,17 @@ export interface TreeContent<TRoot extends FlexFieldSchema = FlexFieldSchema> ex
82
82
  */
83
83
  readonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;
84
84
  }
85
+ /**
86
+ * Content that can populate a `SharedTree`.
87
+ */
88
+ export interface TreeStoredContent {
89
+ readonly schema: TreeStoredSchema;
90
+ /**
91
+ * Default tree content to initialize the tree with iff the tree is uninitialized
92
+ * (meaning it does not even have any schema set at all).
93
+ */
94
+ readonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;
95
+ }
85
96
  /**
86
97
  * Options used to schematize a `SharedTree`.
87
98
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schematizeTree.d.ts","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,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,GAAG,sBAAsB,GAAG,SAAS,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,CACvF,SAAQ,mBAAmB,CAAC,KAAK,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,0BAA0B,EAAE,iBAAiB,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,oCAAoC,CACpD,KAAK,SAAS,eAAe,GAAG,eAAe,CAC9C,SAAQ,WAAW,CAAC,KAAK,CAAC,EAC1B,uBAAuB,CAAC,KAAK,CAAC;CAAG;AAEnC;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,eAAe,EAC/D,MAAM,EAAE,oCAAoC,CAAC,CAAC,CAAC,GAC7C,oCAAoC,CAAC,CAAC,CAAC,CAEzC"}
@@ -23,21 +23,20 @@ const index_js_3 = require("../util/index.js");
23
23
  */
24
24
  function initializeContent(schemaRepository, newSchema, setInitialTree) {
25
25
  (0, internal_1.assert)((0, index_js_1.schemaDataIsEmpty)(schemaRepository.storedSchema), 0x743 /* cannot initialize after a schema is set */);
26
- const schema = (0, index_js_2.intoStoredSchema)(newSchema);
27
- const rootSchema = schema.rootFieldSchema;
26
+ const rootSchema = newSchema.rootFieldSchema;
28
27
  const rootKind = rootSchema.kind;
29
28
  // To keep the data in schema during the update, first define a schema that tolerates the current (empty) tree as well as the final (initial) tree.
30
29
  let incrementalSchemaUpdate;
31
30
  if (rootKind === index_js_2.FieldKinds.sequence.identifier ||
32
31
  rootKind === index_js_2.FieldKinds.optional.identifier) {
33
32
  // These kinds are known to tolerate empty, so use the schema as is:
34
- incrementalSchemaUpdate = schema;
33
+ incrementalSchemaUpdate = newSchema;
35
34
  }
36
35
  else {
37
36
  (0, internal_1.assert)(rootKind === index_js_2.FieldKinds.required.identifier, 0x5c8 /* Unexpected kind */);
38
37
  // Replace value kind with optional kind in root field schema:
39
38
  incrementalSchemaUpdate = {
40
- nodeSchema: schema.nodeSchema,
39
+ nodeSchema: newSchema.nodeSchema,
41
40
  rootFieldSchema: {
42
41
  kind: index_js_2.FieldKinds.optional.identifier,
43
42
  types: rootSchema.types,
@@ -49,14 +48,14 @@ function initializeContent(schemaRepository, newSchema, setInitialTree) {
49
48
  // allowsRepoSuperset(defaultSchemaPolicy, tree.storedSchema, incrementalSchemaUpdate),
50
49
  // "Incremental Schema update should support the existing empty tree",
51
50
  // );
52
- (0, internal_1.assert)((0, index_js_2.allowsRepoSuperset)(index_js_2.defaultSchemaPolicy, schema, incrementalSchemaUpdate), 0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */);
51
+ (0, internal_1.assert)((0, index_js_2.allowsRepoSuperset)(index_js_2.defaultSchemaPolicy, newSchema, incrementalSchemaUpdate), 0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */);
53
52
  // Update to intermediate schema
54
53
  schemaRepository.updateSchema(incrementalSchemaUpdate);
55
54
  // Insert initial tree
56
55
  setInitialTree();
57
56
  // If intermediate schema is not final desired schema, update to the final schema:
58
- if (incrementalSchemaUpdate !== schema) {
59
- schemaRepository.updateSchema(schema);
57
+ if (incrementalSchemaUpdate !== newSchema) {
58
+ schemaRepository.updateSchema(newSchema);
60
59
  }
61
60
  }
62
61
  exports.initializeContent = initializeContent;
@@ -185,7 +184,7 @@ function ensureSchema(viewSchema, allowedSchemaModifications, checkout, treeCont
185
184
  return false;
186
185
  }
187
186
  case UpdateType.SchemaCompatible: {
188
- checkout.updateSchema((0, index_js_2.intoStoredSchema)(viewSchema.schema));
187
+ checkout.updateSchema(viewSchema.storedSchema);
189
188
  return true;
190
189
  }
191
190
  case UpdateType.Initialize: {
@@ -1 +1 @@
1
- {"version":3,"file":"schematizeTree.js","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAE9E,+CAQ0B;AAC1B,4DAU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B,EAAE,QAAQ,CAAC,CAAC;IAClF,QAAQ,aAAa,EAAE,CAAC;QACvB,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAClC,QAAQ,CAAC,YAAY,CAAC,IAAA,2BAAgB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3D,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;YAC5B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACd,CAAC;YACD,QAAQ;YACR,sFAAsF;YACtF,iGAAiG;YACjG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAtCD,oCAsCC;AA2CD;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,MAA+C;IAE/C,OAAO,MAAM,CAAC;AACf,CAAC;AAJD,wDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tCompatibility,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype TreeStoredSchema,\n\trootFieldKey,\n\tschemaDataIsEmpty,\n} from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FlexFieldSchema,\n\ttype FlexTreeSchema,\n\ttype ViewSchema,\n\tallowsRepoSuperset,\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tintoStoredSchema,\n\tmapTreeFromCursor,\n} from \"../feature-libraries/index.js\";\nimport { fail, isReadonlyArray } from \"../util/index.js\";\n\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.\n *\n * Requires `storedSchema` to be in its default/empty state.\n *\n * This is done in such a way that if the content (implicitly assumed to start empty)\n * is never out of schema.\n * This means that if the root field of the new schema requires content (like a value field),\n * a temporary intermediate schema is used so the initial empty state is not out of schema.\n *\n * Since this makes multiple changes, callers may want to wrap it in a transaction.\n */\nexport function initializeContent(\n\tschemaRepository: {\n\t\tstoredSchema: ITreeCheckout[\"storedSchema\"];\n\t\tupdateSchema: ITreeCheckout[\"updateSchema\"];\n\t},\n\tnewSchema: FlexTreeSchema,\n\tsetInitialTree: () => void,\n): void {\n\tassert(\n\t\tschemaDataIsEmpty(schemaRepository.storedSchema),\n\t\t0x743 /* cannot initialize after a schema is set */,\n\t);\n\n\tconst schema = intoStoredSchema(newSchema);\n\tconst rootSchema = schema.rootFieldSchema;\n\tconst rootKind = rootSchema.kind;\n\n\t// To keep the data in schema during the update, first define a schema that tolerates the current (empty) tree as well as the final (initial) tree.\n\tlet incrementalSchemaUpdate: TreeStoredSchema;\n\tif (\n\t\trootKind === FieldKinds.sequence.identifier ||\n\t\trootKind === FieldKinds.optional.identifier\n\t) {\n\t\t// These kinds are known to tolerate empty, so use the schema as is:\n\t\tincrementalSchemaUpdate = schema;\n\t} else {\n\t\tassert(rootKind === FieldKinds.required.identifier, 0x5c8 /* Unexpected kind */);\n\t\t// Replace value kind with optional kind in root field schema:\n\t\tincrementalSchemaUpdate = {\n\t\t\tnodeSchema: schema.nodeSchema,\n\t\t\trootFieldSchema: {\n\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\ttypes: rootSchema.types,\n\t\t\t},\n\t\t};\n\t}\n\n\t// TODO: fix issues with schema comparison and enable this.\n\t// assert(\n\t// \tallowsRepoSuperset(defaultSchemaPolicy, tree.storedSchema, incrementalSchemaUpdate),\n\t// \t\"Incremental Schema update should support the existing empty tree\",\n\t// );\n\tassert(\n\t\tallowsRepoSuperset(defaultSchemaPolicy, schema, incrementalSchemaUpdate),\n\t\t0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */,\n\t);\n\t// Update to intermediate schema\n\tschemaRepository.updateSchema(incrementalSchemaUpdate);\n\t// Insert initial tree\n\tsetInitialTree();\n\n\t// If intermediate schema is not final desired schema, update to the final schema:\n\tif (incrementalSchemaUpdate !== schema) {\n\t\tschemaRepository.updateSchema(schema);\n\t}\n}\n\nexport enum UpdateType {\n\t/**\n\t * Already compatible, no update needed.\n\t */\n\tNone,\n\t/**\n\t * Empty: needs initializing.\n\t */\n\tInitialize,\n\t/**\n\t * Schema can be upgraded leaving tree as is.\n\t */\n\tSchemaCompatible,\n\t/**\n\t * No update currently supported.\n\t */\n\tIncompatible,\n}\n\nexport function evaluateUpdate(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n): UpdateType {\n\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\n\tif (\n\t\tcompatibility.read === Compatibility.Compatible &&\n\t\tcompatibility.write === Compatibility.Compatible\n\t) {\n\t\t// Compatible as is\n\t\treturn UpdateType.None;\n\t}\n\n\t// eslint-disable-next-line no-bitwise\n\tif (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {\n\t\treturn UpdateType.Initialize;\n\t}\n\n\tif (compatibility.read !== Compatibility.Compatible) {\n\t\t// Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated\n\t\treturn UpdateType.Incompatible;\n\t}\n\n\tassert(compatibility.write === Compatibility.Incompatible, 0x8bd /* unexpected case */);\n\tassert(compatibility.read === Compatibility.Compatible, 0x8be /* unexpected case */);\n\n\t// eslint-disable-next-line no-bitwise\n\treturn allowedSchemaModifications & AllowedUpdateType.SchemaCompatible\n\t\t? UpdateType.SchemaCompatible\n\t\t: UpdateType.Incompatible;\n}\n\nexport function canInitialize(checkout: ITreeCheckout): boolean {\n\t// Check for empty.\n\treturn checkout.forest.isEmpty && schemaDataIsEmpty(checkout.storedSchema);\n}\n\nfunction normalizeNewFieldContent(\n\tcontent: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined,\n): ITreeCursorSynchronous {\n\tif (content === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\n\tif (isReadonlyArray(content)) {\n\t\treturn cursorForMapTreeField(content.map((c) => mapTreeFromCursor(c)));\n\t}\n\n\tif (content.mode === CursorLocationType.Fields) {\n\t\treturn content;\n\t}\n\n\treturn cursorForMapTreeField([mapTreeFromCursor(content)]);\n}\n\n/**\n * Initialize a checkout with a schema and tree content.\n * This function should only be called when the tree is uninitialized (no schema or content).\n * @remarks\n *\n * If the proposed schema (from `treeContent`) is not compatible with the emptry tree, this function handles using an intermediate schema\n * which supports the empty tree as well as the final tree content.\n */\nexport function initialize(checkout: ITreeCheckout, treeContent: TreeContent): void {\n\tcheckout.transaction.start();\n\ttry {\n\t\tinitializeContent(checkout, treeContent.schema, () => {\n\t\t\tconst field = { field: rootFieldKey, parent: undefined };\n\t\t\tconst content = normalizeNewFieldContent(treeContent.initialTree);\n\n\t\t\tswitch (checkout.storedSchema.rootFieldSchema.kind) {\n\t\t\t\tcase FieldKinds.optional.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.optionalField(field);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontent.getFieldLength() <= 1,\n\t\t\t\t\t\t0x7f4 /* optional field content should normalize at most one item */,\n\t\t\t\t\t);\n\t\t\t\t\tfieldEditor.set(content.getFieldLength() === 0 ? undefined : content, true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase FieldKinds.sequence.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.sequenceField(field);\n\t\t\t\t\t// TODO: should do an idempotent edit here.\n\t\t\t\t\tfieldEditor.insert(0, content);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tfail(\"unexpected root field kind during initialize\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} finally {\n\t\tcheckout.transaction.commit();\n\t}\n}\n\n/**\n * Ensure a {@link ITreeCheckout} can be used with a given {@link ViewSchema}.\n *\n * @remarks\n * It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.\n *\n * @param viewSchema - View schema that `checkout` should be made compatible with.\n * @param allowedSchemaModifications - Flags enum describing the ways this is allowed to modify `checkout`.\n * @param checkout - To be modified as needed to be compatible with `viewSchema`.\n * @param treeContent - Content to be used to initialize `checkout`'s the tree if needed and allowed.\n * @returns true iff checkout now is compatible with `viewSchema`.\n */\nexport function ensureSchema(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n\ttreeContent: TreeContent | undefined,\n): boolean {\n\tlet possibleModifications = allowedSchemaModifications;\n\tif (treeContent === undefined) {\n\t\t// Clear bit for Initialize if initial tree is not provided.\n\t\t// eslint-disable-next-line no-bitwise\n\t\tpossibleModifications &= ~AllowedUpdateType.Initialize;\n\t}\n\tconst updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);\n\tswitch (updatedNeeded) {\n\t\tcase UpdateType.None: {\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Incompatible: {\n\t\t\treturn false;\n\t\t}\n\t\tcase UpdateType.SchemaCompatible: {\n\t\t\tcheckout.updateSchema(intoStoredSchema(viewSchema.schema));\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Initialize: {\n\t\t\tif (treeContent === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// TODO:\n\t\t\t// When this becomes a more proper out of schema adapter, editing should be made lazy.\n\t\t\t// This will improve support for readonly documents, cross version collaboration and attribution.\n\t\t\tinitialize(checkout, treeContent);\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(updatedNeeded);\n\t\t}\n\t}\n}\n\n/**\n * View Schema for a `SharedTree`.\n */\nexport interface SchemaConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema> {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: FlexTreeSchema<TRoot>;\n}\n\n/**\n * Content that can populate a `SharedTree`.\n */\nexport interface TreeContent<TRoot extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaConfiguration<TRoot> {\n\t/**\n\t * Default tree content to initialize the tree with iff the tree is uninitialized\n\t * (meaning it does not even have any schema set at all).\n\t */\n\treadonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;\n}\n\n/**\n * Options used to schematize a `SharedTree`.\n */\nexport interface SchematizeConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaConfiguration<TRoot> {\n\t/**\n\t * Controls if and how schema from existing documents can be updated to accommodate the view schema.\n\t */\n\treadonly allowedSchemaModifications: AllowedUpdateType;\n}\n\n/**\n * Options used to initialize (if needed) and schematize a `SharedTree`.\n */\nexport interface InitializeAndSchematizeConfiguration<\n\tTRoot extends FlexFieldSchema = FlexFieldSchema,\n> extends TreeContent<TRoot>,\n\t\tSchematizeConfiguration<TRoot> {}\n\n/**\n * Options used to initialize (if needed) and schematize a `SharedTree`.\n * @remarks\n * Using this builder improves type safety and error quality over just constructing the configuration as a object.\n */\nexport function buildTreeConfiguration<T extends FlexFieldSchema>(\n\tconfig: InitializeAndSchematizeConfiguration<T>,\n): InitializeAndSchematizeConfiguration<T> {\n\treturn config;\n}\n"]}
1
+ {"version":3,"file":"schematizeTree.js","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAE9E,+CAQ0B;AAC1B,4DASuC;AACvC,+CAAyD;AAIzD;;;;;;;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,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAClC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACb,CAAC;QACD,KAAK,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;YAC5B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACd,CAAC;YACD,QAAQ;YACR,sFAAsF;YACtF,iGAAiG;YACjG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAtCD,oCAsCC;AAwDD;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,MAA+C;IAE/C,OAAO,MAAM,CAAC;AACf,CAAC;AAJD,wDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tAllowedUpdateType,\n\tCompatibility,\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype TreeStoredSchema,\n\trootFieldKey,\n\tschemaDataIsEmpty,\n} from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FlexFieldSchema,\n\ttype FlexTreeSchema,\n\ttype ViewSchema,\n\tallowsRepoSuperset,\n\tcursorForMapTreeField,\n\tdefaultSchemaPolicy,\n\tmapTreeFromCursor,\n} from \"../feature-libraries/index.js\";\nimport { fail, isReadonlyArray } from \"../util/index.js\";\n\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.\n *\n * Requires `storedSchema` to be in its default/empty state.\n *\n * This is done in such a way that if the content (implicitly assumed to start empty)\n * is never out of schema.\n * This means that if the root field of the new schema requires content (like a value field),\n * a temporary intermediate schema is used so the initial empty state is not out of schema.\n *\n * Since this makes multiple changes, callers may want to wrap it in a transaction.\n */\nexport function initializeContent(\n\tschemaRepository: {\n\t\tstoredSchema: ITreeCheckout[\"storedSchema\"];\n\t\tupdateSchema: ITreeCheckout[\"updateSchema\"];\n\t},\n\tnewSchema: TreeStoredSchema,\n\tsetInitialTree: () => void,\n): void {\n\tassert(\n\t\tschemaDataIsEmpty(schemaRepository.storedSchema),\n\t\t0x743 /* cannot initialize after a schema is set */,\n\t);\n\n\tconst rootSchema = newSchema.rootFieldSchema;\n\tconst rootKind = rootSchema.kind;\n\n\t// To keep the data in schema during the update, first define a schema that tolerates the current (empty) tree as well as the final (initial) tree.\n\tlet incrementalSchemaUpdate: TreeStoredSchema;\n\tif (\n\t\trootKind === FieldKinds.sequence.identifier ||\n\t\trootKind === FieldKinds.optional.identifier\n\t) {\n\t\t// These kinds are known to tolerate empty, so use the schema as is:\n\t\tincrementalSchemaUpdate = newSchema;\n\t} else {\n\t\tassert(rootKind === FieldKinds.required.identifier, 0x5c8 /* Unexpected kind */);\n\t\t// Replace value kind with optional kind in root field schema:\n\t\tincrementalSchemaUpdate = {\n\t\t\tnodeSchema: newSchema.nodeSchema,\n\t\t\trootFieldSchema: {\n\t\t\t\tkind: FieldKinds.optional.identifier,\n\t\t\t\ttypes: rootSchema.types,\n\t\t\t},\n\t\t};\n\t}\n\n\t// TODO: fix issues with schema comparison and enable this.\n\t// assert(\n\t// \tallowsRepoSuperset(defaultSchemaPolicy, tree.storedSchema, incrementalSchemaUpdate),\n\t// \t\"Incremental Schema update should support the existing empty tree\",\n\t// );\n\tassert(\n\t\tallowsRepoSuperset(defaultSchemaPolicy, newSchema, incrementalSchemaUpdate),\n\t\t0x5c9 /* Incremental Schema during update should be a allow a superset of the final schema */,\n\t);\n\t// Update to intermediate schema\n\tschemaRepository.updateSchema(incrementalSchemaUpdate);\n\t// Insert initial tree\n\tsetInitialTree();\n\n\t// If intermediate schema is not final desired schema, update to the final schema:\n\tif (incrementalSchemaUpdate !== newSchema) {\n\t\tschemaRepository.updateSchema(newSchema);\n\t}\n}\n\nexport enum UpdateType {\n\t/**\n\t * Already compatible, no update needed.\n\t */\n\tNone,\n\t/**\n\t * Empty: needs initializing.\n\t */\n\tInitialize,\n\t/**\n\t * Schema can be upgraded leaving tree as is.\n\t */\n\tSchemaCompatible,\n\t/**\n\t * No update currently supported.\n\t */\n\tIncompatible,\n}\n\nexport function evaluateUpdate(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n): UpdateType {\n\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\n\tif (\n\t\tcompatibility.read === Compatibility.Compatible &&\n\t\tcompatibility.write === Compatibility.Compatible\n\t) {\n\t\t// Compatible as is\n\t\treturn UpdateType.None;\n\t}\n\n\t// eslint-disable-next-line no-bitwise\n\tif (allowedSchemaModifications & AllowedUpdateType.Initialize && canInitialize(checkout)) {\n\t\treturn UpdateType.Initialize;\n\t}\n\n\tif (compatibility.read !== Compatibility.Compatible) {\n\t\t// Existing stored schema permits trees which are incompatible with the view schema, so schema can not be updated\n\t\treturn UpdateType.Incompatible;\n\t}\n\n\tassert(compatibility.write === Compatibility.Incompatible, 0x8bd /* unexpected case */);\n\tassert(compatibility.read === Compatibility.Compatible, 0x8be /* unexpected case */);\n\n\t// eslint-disable-next-line no-bitwise\n\treturn allowedSchemaModifications & AllowedUpdateType.SchemaCompatible\n\t\t? UpdateType.SchemaCompatible\n\t\t: UpdateType.Incompatible;\n}\n\nexport function canInitialize(checkout: ITreeCheckout): boolean {\n\t// Check for empty.\n\treturn checkout.forest.isEmpty && schemaDataIsEmpty(checkout.storedSchema);\n}\n\nfunction normalizeNewFieldContent(\n\tcontent: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined,\n): ITreeCursorSynchronous {\n\tif (content === undefined) {\n\t\treturn cursorForMapTreeField([]);\n\t}\n\n\tif (isReadonlyArray(content)) {\n\t\treturn cursorForMapTreeField(content.map((c) => mapTreeFromCursor(c)));\n\t}\n\n\tif (content.mode === CursorLocationType.Fields) {\n\t\treturn content;\n\t}\n\n\treturn cursorForMapTreeField([mapTreeFromCursor(content)]);\n}\n\n/**\n * Initialize a checkout with a schema and tree content.\n * This function should only be called when the tree is uninitialized (no schema or content).\n * @remarks\n *\n * If the proposed schema (from `treeContent`) is not compatible with the emptry tree, this function handles using an intermediate schema\n * which supports the empty tree as well as the final tree content.\n */\nexport function initialize(checkout: ITreeCheckout, treeContent: TreeStoredContent): void {\n\tcheckout.transaction.start();\n\ttry {\n\t\tinitializeContent(checkout, treeContent.schema, () => {\n\t\t\tconst field = { field: rootFieldKey, parent: undefined };\n\t\t\tconst content = normalizeNewFieldContent(treeContent.initialTree);\n\n\t\t\tswitch (checkout.storedSchema.rootFieldSchema.kind) {\n\t\t\t\tcase FieldKinds.optional.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.optionalField(field);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontent.getFieldLength() <= 1,\n\t\t\t\t\t\t0x7f4 /* optional field content should normalize at most one item */,\n\t\t\t\t\t);\n\t\t\t\t\tfieldEditor.set(content.getFieldLength() === 0 ? undefined : content, true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase FieldKinds.sequence.identifier: {\n\t\t\t\t\tconst fieldEditor = checkout.editor.sequenceField(field);\n\t\t\t\t\t// TODO: should do an idempotent edit here.\n\t\t\t\t\tfieldEditor.insert(0, content);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tfail(\"unexpected root field kind during initialize\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} finally {\n\t\tcheckout.transaction.commit();\n\t}\n}\n\n/**\n * Ensure a {@link ITreeCheckout} can be used with a given {@link ViewSchema}.\n *\n * @remarks\n * It is up to the caller to ensure that compatibility is reevaluated if the checkout's stored schema is edited in the future.\n *\n * @param viewSchema - View schema that `checkout` should be made compatible with.\n * @param allowedSchemaModifications - Flags enum describing the ways this is allowed to modify `checkout`.\n * @param checkout - To be modified as needed to be compatible with `viewSchema`.\n * @param treeContent - Content to be used to initialize `checkout`'s the tree if needed and allowed.\n * @returns true iff checkout now is compatible with `viewSchema`.\n */\nexport function ensureSchema(\n\tviewSchema: ViewSchema,\n\tallowedSchemaModifications: AllowedUpdateType,\n\tcheckout: ITreeCheckout,\n\ttreeContent: TreeStoredContent | undefined,\n): boolean {\n\tlet possibleModifications = allowedSchemaModifications;\n\tif (treeContent === undefined) {\n\t\t// Clear bit for Initialize if initial tree is not provided.\n\t\t// eslint-disable-next-line no-bitwise\n\t\tpossibleModifications &= ~AllowedUpdateType.Initialize;\n\t}\n\tconst updatedNeeded = evaluateUpdate(viewSchema, possibleModifications, checkout);\n\tswitch (updatedNeeded) {\n\t\tcase UpdateType.None: {\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Incompatible: {\n\t\t\treturn false;\n\t\t}\n\t\tcase UpdateType.SchemaCompatible: {\n\t\t\tcheckout.updateSchema(viewSchema.storedSchema);\n\t\t\treturn true;\n\t\t}\n\t\tcase UpdateType.Initialize: {\n\t\t\tif (treeContent === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// TODO:\n\t\t\t// When this becomes a more proper out of schema adapter, editing should be made lazy.\n\t\t\t// This will improve support for readonly documents, cross version collaboration and attribution.\n\t\t\tinitialize(checkout, treeContent);\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(updatedNeeded);\n\t\t}\n\t}\n}\n\n/**\n * View Schema for a `SharedTree`.\n */\nexport interface SchemaConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema> {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: FlexTreeSchema<TRoot>;\n}\n\n/**\n * Content that can populate a `SharedTree`.\n */\nexport interface TreeContent<TRoot extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaConfiguration<TRoot> {\n\t/**\n\t * Default tree content to initialize the tree with iff the tree is uninitialized\n\t * (meaning it does not even have any schema set at all).\n\t */\n\treadonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;\n}\n\n/**\n * Content that can populate a `SharedTree`.\n */\nexport interface TreeStoredContent {\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * Default tree content to initialize the tree with iff the tree is uninitialized\n\t * (meaning it does not even have any schema set at all).\n\t */\n\treadonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;\n}\n\n/**\n * Options used to schematize a `SharedTree`.\n */\nexport interface SchematizeConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaConfiguration<TRoot> {\n\t/**\n\t * Controls if and how schema from existing documents can be updated to accommodate the view schema.\n\t */\n\treadonly allowedSchemaModifications: AllowedUpdateType;\n}\n\n/**\n * Options used to initialize (if needed) and schematize a `SharedTree`.\n */\nexport interface InitializeAndSchematizeConfiguration<\n\tTRoot extends FlexFieldSchema = FlexFieldSchema,\n> extends TreeContent<TRoot>,\n\t\tSchematizeConfiguration<TRoot> {}\n\n/**\n * Options used to initialize (if needed) and schematize a `SharedTree`.\n * @remarks\n * Using this builder improves type safety and error quality over just constructing the configuration as a object.\n */\nexport function buildTreeConfiguration<T extends FlexFieldSchema>(\n\tconfig: InitializeAndSchematizeConfiguration<T>,\n): InitializeAndSchematizeConfiguration<T> {\n\treturn config;\n}\n"]}
@@ -3,11 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type HasListeners, type IEmitter, type Listenable } from "../events/index.js";
6
- import { type FlexFieldSchema, type NodeKeyManager, ViewSchema } from "../feature-libraries/index.js";
6
+ import { type NodeKeyManager, ViewSchema, type FlexTreeSchema } from "../feature-libraries/index.js";
7
7
  import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type InsertableTreeFieldFromImplicitField, type TreeFieldFromImplicitField, type TreeView, type TreeViewEvents, type TreeViewConfiguration } from "../simple-tree/index.js";
8
8
  import { Breakable, type WithBreakable } from "../util/index.js";
9
9
  import type { ITreeCheckout } from "./treeCheckout.js";
10
- import { CheckoutFlexTreeView } from "./treeView.js";
10
+ import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
11
+ /**
12
+ * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
13
+ * exists and error if creating a second.
14
+ */
15
+ export declare const ViewSlot: import("../core/index.js").AnchorSlot<TreeView<ImplicitFieldSchema>>;
11
16
  /**
12
17
  * Implementation of TreeView wrapping a FlexTreeView.
13
18
  */
@@ -45,7 +50,7 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
45
50
  /**
46
51
  * Gets the view. Throws when disposed.
47
52
  */
48
- getView(): CheckoutFlexTreeView<FlexFieldSchema>;
53
+ getView(): CheckoutFlexTreeView;
49
54
  private ensureUndisposed;
50
55
  private failDisposed;
51
56
  /**
@@ -71,5 +76,5 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
71
76
  * Creates a view that self-disposes whenenever the stored schema changes.
72
77
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
73
78
  */
74
- export declare function requireSchema<TRoot extends FlexFieldSchema>(checkout: ITreeCheckout, viewSchema: ViewSchema<TRoot>, onDispose: () => void, nodeKeyManager: NodeKeyManager): CheckoutFlexTreeView<TRoot>;
79
+ export declare function requireSchema(checkout: ITreeCheckout, viewSchema: ViewSchema, onDispose: () => void, nodeKeyManager: NodeKeyManager, flexTreeSchema: FlexTreeSchema): CheckoutFlexTreeView;
75
80
  //# sourceMappingURL=schematizingTreeView.d.ts.map
@@ -1 +1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AAC,EAC1C,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,SAAuD;IA+B1E,UAAU,CAAC,OAAO,EAAE,oCAAoC,CAAC,WAAW,CAAC,GAAG,IAAI;IA8B5E,aAAa,IAAI,IAAI;IA6B5B;;OAEG;IACI,OAAO,IAAI,oBAAoB;IAMtC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM;IAkFd,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,WAAW;IAQnB,IAAW,aAAa,IAAI,yBAAyB,CAKpD;IAEM,OAAO,IAAI,IAAI;IAOtB,IAAW,IAAI,IAAI,0BAA0B,CAAC,WAAW,CAAC,CASzD;IAED,IAAW,IAAI,CAAC,OAAO,EAAE,oCAAoC,CAAC,WAAW,CAAC,EASzE;CACD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,IAAI,EACrB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC5B,oBAAoB,CAgBtB"}
@@ -42,7 +42,7 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
42
42
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.requireSchema = exports.SchematizingSimpleTreeView = void 0;
45
+ exports.requireSchema = exports.SchematizingSimpleTreeView = exports.ViewSlot = void 0;
46
46
  const internal_1 = require("@fluidframework/core-utils/internal");
47
47
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
48
48
  const index_js_1 = require("../core/index.js");
@@ -51,7 +51,12 @@ const index_js_3 = require("../feature-libraries/index.js");
51
51
  const index_js_4 = require("../simple-tree/index.js");
52
52
  const index_js_5 = require("../util/index.js");
53
53
  const schematizeTree_js_1 = require("./schematizeTree.js");
54
- const treeView_js_1 = require("./treeView.js");
54
+ const checkoutFlexTreeView_js_1 = require("./checkoutFlexTreeView.js");
55
+ /**
56
+ * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
57
+ * exists and error if creating a second.
58
+ */
59
+ exports.ViewSlot = (0, index_js_1.anchorSlot)();
55
60
  /**
56
61
  * Implementation of TreeView wrapping a FlexTreeView.
57
62
  */
@@ -76,13 +81,17 @@ let SchematizingSimpleTreeView = (() => {
76
81
  * which are implementation details and should not be exposed to the user.
77
82
  */
78
83
  this.midUpgrade = false;
84
+ if (checkout.forest.anchors.slots.has(exports.ViewSlot)) {
85
+ throw new internal_2.UsageError("Cannot create a second tree view from the same checkout");
86
+ }
87
+ checkout.forest.anchors.slots.set(exports.ViewSlot, this);
79
88
  const policy = {
80
89
  ...index_js_3.defaultSchemaPolicy,
81
90
  validateSchema: config.enableSchemaValidation,
82
91
  };
83
92
  this.rootFieldSchema = (0, index_js_4.normalizeFieldSchema)(config.schema);
84
93
  this.flexSchema = (0, index_js_4.toFlexSchema)(config.schema);
85
- this.viewSchema = new index_js_3.ViewSchema(policy, {}, this.flexSchema);
94
+ this.viewSchema = new index_js_3.ViewSchema(policy, {}, (0, index_js_3.intoStoredSchema)(this.flexSchema));
86
95
  // This must be initialized before `update` can be called.
87
96
  this.currentCompatibility = {
88
97
  canView: false,
@@ -109,7 +118,7 @@ let SchematizingSimpleTreeView = (() => {
109
118
  });
110
119
  (0, index_js_4.prepareContentForHydration)(mapTree, this.checkout.forest);
111
120
  (0, schematizeTree_js_1.initialize)(this.checkout, {
112
- schema: this.flexSchema,
121
+ schema: this.viewSchema.storedSchema,
113
122
  initialTree: mapTree === undefined ? undefined : (0, index_js_3.cursorForMapTreeNode)(mapTree),
114
123
  });
115
124
  });
@@ -126,7 +135,7 @@ let SchematizingSimpleTreeView = (() => {
126
135
  }
127
136
  this.runSchemaEdit(() => {
128
137
  const result = (0, schematizeTree_js_1.ensureSchema)(this.viewSchema, index_js_1.AllowedUpdateType.SchemaCompatible, this.checkout, {
129
- schema: this.flexSchema,
138
+ schema: this.viewSchema.storedSchema,
130
139
  initialTree: undefined,
131
140
  });
132
141
  (0, internal_1.assert)(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);
@@ -202,7 +211,14 @@ let SchematizingSimpleTreeView = (() => {
202
211
  this.update();
203
212
  }
204
213
  };
205
- this.view = requireSchema(this.checkout, this.viewSchema, onViewDispose, this.nodeKeyManager);
214
+ const view = requireSchema(this.checkout, this.viewSchema, onViewDispose, this.nodeKeyManager, this.flexSchema);
215
+ this.view = view;
216
+ const unregister = this.checkout.storedSchema.on("afterSchemaChange", () => {
217
+ unregister();
218
+ this.unregisterCallbacks.delete(unregister);
219
+ view[index_js_5.disposeSymbol]();
220
+ });
221
+ this.unregisterCallbacks.add(unregister);
206
222
  }
207
223
  else {
208
224
  this.view = undefined;
@@ -245,6 +261,7 @@ let SchematizingSimpleTreeView = (() => {
245
261
  dispose() {
246
262
  this.disposed = true;
247
263
  this.disposeView();
264
+ this.checkout.forest.anchors.slots.delete(exports.ViewSlot);
248
265
  this.currentCompatibility = undefined;
249
266
  }
250
267
  get root() {
@@ -279,7 +296,7 @@ exports.SchematizingSimpleTreeView = SchematizingSimpleTreeView;
279
296
  * Creates a view that self-disposes whenenever the stored schema changes.
280
297
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
281
298
  */
282
- function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager) {
299
+ function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager, flexTreeSchema) {
283
300
  const slots = checkout.forest.anchors.slots;
284
301
  (0, internal_1.assert)(!slots.has(index_js_3.ContextSlot), 0x8c2 /* Cannot create second view from checkout */);
285
302
  {
@@ -287,12 +304,8 @@ function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager) {
287
304
  (0, internal_1.assert)(compatibility.write === index_js_1.Compatibility.Compatible &&
288
305
  compatibility.read === index_js_1.Compatibility.Compatible, 0x8c3 /* requireSchema invoked with incompatible schema */);
289
306
  }
290
- const view = new treeView_js_1.CheckoutFlexTreeView(checkout, viewSchema.schema, nodeKeyManager, onDispose);
307
+ const view = new checkoutFlexTreeView_js_1.CheckoutFlexTreeView(checkout, flexTreeSchema, nodeKeyManager, onDispose);
291
308
  (0, internal_1.assert)(slots.has(index_js_3.ContextSlot), 0x90d /* Context should be tracked in slot */);
292
- const unregister = checkout.storedSchema.on("afterSchemaChange", () => {
293
- unregister();
294
- view[index_js_5.disposeSymbol]();
295
- });
296
309
  return view;
297
310
  }
298
311
  exports.requireSchema = requireSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAAoE;AACpE,iDAK4B;AAC5B,4DAQuC;AACvC,sDAgBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,+CAAqD;AAErD;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAmCb,YACiB,QAAuB,EACvB,MAA0C,EAC1C,cAA8B,EAC9B,UAAqB,IAAI,oBAAS,CAAC,4BAA4B,CAAC;YAHhE,aAAQ,GAAR,QAAQ,CAAe;YACvB,WAAM,GAAN,MAAM,CAAoC;YAC1C,mBAAc,GAAd,cAAc,CAAgB;YAC9B,YAAO,GAAP,OAAO,CAAyD;YAvBjE,WAAM,GAEU,IAAA,wBAAa,GAAE,CAAC;YAI/B,wBAAmB,GAAG,IAAI,GAAG,EAAc,CAAC;YAEtD,aAAQ,GAAG,KAAK,CAAC;YACxB;;;;;eAKG;YACK,eAAU,GAAG,KAAK,CAAC;YAU1B,MAAM,MAAM,GAAG;gBACd,GAAG,8BAAmB;gBACtB,cAAc,EAAE,MAAM,CAAC,sBAAsB;aAC7C,CAAC;YACF,IAAI,CAAC,eAAe,GAA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E,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACrE,UAAU,EAAE,CAAC;QACb,IAAI,CAAC,wBAAa,CAAC,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAhCD,sCAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, Compatibility } from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\ttype FlexFieldSchema,\n\ttype NodeKeyManager,\n\tViewSchema,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FlexTreeSchema,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\ttoFlexSchema,\n\tsetField,\n\tnormalizeFieldSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./treeView.js\";\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema>\n\timplements TreeView<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView<FlexFieldSchema> | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly flexSchema: FlexTreeSchema;\n\tpublic readonly events: Listenable<TreeViewEvents> &\n\t\tIEmitter<TreeViewEvents> &\n\t\tHasListeners<TreeViewEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<TRootSchema>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t) {\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.flexSchema = toFlexSchema(config.schema);\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, this.flexSchema);\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"commitApplied\", (data, getRevertible) =>\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic initialize(content: InsertableTreeFieldFromImplicitField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.flexSchema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.flexSchema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView<FlexFieldSchema> {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst result = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\t// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.\n\t\t// In the near term, this should support viewing documents with additional optional fields in their schema on object types.\n\t\t// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility\n\t\t// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)\n\t\tconst canView =\n\t\t\tresult.write === Compatibility.Compatible && result.read === Compatibility.Compatible;\n\t\tconst canUpgrade = result.read === Compatibility.Compatible;\n\t\tconst isEquivalent = canView && canUpgrade;\n\t\tconst compatibility: SchemaCompatibilityStatus = {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\n\t\t\tconst unregister = this.checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.currentCompatibility = undefined;\n\t}\n\n\tpublic get root(): TreeFieldFromImplicitField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getTreeNodeForField(view.flexTree) as TreeFieldFromImplicitField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableTreeFieldFromImplicitField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(view.context.root, this.rootFieldSchema, newRoot as InsertableContent);\n\t}\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema<TRoot extends FlexFieldSchema>(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema<TRoot>,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n): CheckoutFlexTreeView<TRoot> {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(\n\t\tcheckout,\n\t\tviewSchema.schema,\n\t\tnodeKeyManager,\n\t\tonDispose,\n\t);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\n\tconst unregister = checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\tunregister();\n\t\tview[disposeSymbol]();\n\t});\n\n\treturn view;\n}\n"]}
1
+ {"version":3,"file":"schematizingTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAAgF;AAChF,iDAK4B;AAC5B,4DAQuC;AACvC,sDAgBiC;AACjC,+CAA+F;AAE/F,2DAA8E;AAE9E,uEAAiE;AACjE;;;GAGG;AACU,QAAA,QAAQ,GAAG,IAAA,qBAAU,GAAiC,CAAC;AAEpE;;GAEG;IAEU,0BAA0B;4BADtC,wBAAa;;;;;QAmCb,YACiB,QAAuB,EACvB,MAA0C,EAC1C,cAA8B,EAC9B,UAAqB,IAAI,oBAAS,CAAC,4BAA4B,CAAC;YAHhE,aAAQ,GAAR,QAAQ,CAAe;YACvB,WAAM,GAAN,MAAM,CAAoC;YAC1C,mBAAc,GAAd,cAAc,CAAgB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,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;gBACjC,MAAM,IAAI,qBAAU,CACnB,yFAAyF,CACzF,CAAC;YACH,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5B,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,OAA4B,CAAC,CAAC;QACjF,CAAC;;;;;QArSF,6KAsSC;;;QAtSY,uDAA0B;;;;AAA1B,gEAA0B;AAwSvC;;;GAGG;AACH,SAAgB,aAAa,CAC5B,QAAuB,EACvB,UAAsB,EACtB,SAAqB,EACrB,cAA8B,EAC9B,cAA8B;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5C,IAAA,iBAAM,EAAC,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAErF,CAAC;QACA,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAA,iBAAM,EACL,aAAa,CAAC,KAAK,KAAK,wBAAa,CAAC,UAAU;YAC/C,aAAa,CAAC,IAAI,KAAK,wBAAa,CAAC,UAAU,EAChD,KAAK,CAAC,oDAAoD,CAC1D,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,8CAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAC3F,IAAA,iBAAM,EAAC,KAAK,CAAC,GAAG,CAAC,sBAAW,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC;AACb,CAAC;AAtBD,sCAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { AllowedUpdateType, anchorSlot, Compatibility } from \"../core/index.js\";\nimport {\n\ttype HasListeners,\n\ttype IEmitter,\n\ttype Listenable,\n\tcreateEmitter,\n} from \"../events/index.js\";\nimport {\n\ttype NodeKeyManager,\n\tViewSchema,\n\tdefaultSchemaPolicy,\n\tContextSlot,\n\tcursorForMapTreeNode,\n\ttype FlexTreeSchema,\n\tintoStoredSchema,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\ttype SchemaCompatibilityStatus,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tgetTreeNodeForField,\n\ttoFlexSchema,\n\tsetField,\n\tnormalizeFieldSchema,\n\ttype InsertableContent,\n\ttype TreeViewConfiguration,\n\tmapTreeFromNodeData,\n\tprepareContentForHydration,\n} from \"../simple-tree/index.js\";\nimport { Breakable, breakingClass, disposeSymbol, type WithBreakable } from \"../util/index.js\";\n\nimport { canInitialize, ensureSchema, initialize } from \"./schematizeTree.js\";\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { CheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n/**\n * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already\n * exists and error if creating a second.\n */\nexport const ViewSlot = anchorSlot<TreeView<ImplicitFieldSchema>>();\n\n/**\n * Implementation of TreeView wrapping a FlexTreeView.\n */\n@breakingClass\nexport class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema>\n\timplements TreeView<TRootSchema>, WithBreakable\n{\n\t/**\n\t * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.\n\t *\n\t * The view schema may be incompatible with the stored schema. Use `compatibility` to check.\n\t */\n\tprivate view: CheckoutFlexTreeView | undefined;\n\n\t/**\n\t * Undefined iff uninitialized or disposed.\n\t */\n\tprivate currentCompatibility: SchemaCompatibilityStatus | undefined;\n\tprivate readonly flexSchema: FlexTreeSchema;\n\tpublic readonly events: Listenable<TreeViewEvents> &\n\t\tIEmitter<TreeViewEvents> &\n\t\tHasListeners<TreeViewEvents> = createEmitter();\n\n\tprivate readonly viewSchema: ViewSchema;\n\n\tprivate readonly unregisterCallbacks = new Set<() => void>();\n\n\tpublic disposed = false;\n\t/**\n\t * This is set to true while an edit impacting the document schema is in progress.\n\t * This allows suppressing extra rootChanged / schemaChanged events until the edit concludes.\n\t * This is useful especially for some initialization edits, since document initialization can involve transient schemas\n\t * which are implementation details and should not be exposed to the user.\n\t */\n\tprivate midUpgrade = false;\n\n\tprivate readonly rootFieldSchema: FieldSchema;\n\n\tpublic constructor(\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly config: TreeViewConfiguration<TRootSchema>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tpublic readonly breaker: Breakable = new Breakable(\"SchematizingSimpleTreeView\"),\n\t) {\n\t\tif (checkout.forest.anchors.slots.has(ViewSlot)) {\n\t\t\tthrow new UsageError(\"Cannot create a second tree view from the same checkout\");\n\t\t}\n\t\tcheckout.forest.anchors.slots.set(ViewSlot, this);\n\n\t\tconst policy = {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tvalidateSchema: config.enableSchemaValidation,\n\t\t};\n\t\tthis.rootFieldSchema = normalizeFieldSchema(config.schema);\n\t\tthis.flexSchema = toFlexSchema(config.schema);\n\n\t\tthis.viewSchema = new ViewSchema(policy, {}, intoStoredSchema(this.flexSchema));\n\t\t// This must be initialized before `update` can be called.\n\t\tthis.currentCompatibility = {\n\t\t\tcanView: false,\n\t\t\tcanUpgrade: true,\n\t\t\tisEquivalent: false,\n\t\t\tcanInitialize: true,\n\t\t};\n\t\tthis.update();\n\n\t\tthis.unregisterCallbacks.add(\n\t\t\tthis.checkout.events.on(\"commitApplied\", (data, getRevertible) =>\n\t\t\t\tthis.events.emit(\"commitApplied\", data, getRevertible),\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic initialize(content: InsertableTreeFieldFromImplicitField<TRootSchema>): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (!compatibility.canInitialize) {\n\t\t\tthrow new UsageError(\"Tree cannot be initialized more than once.\");\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tcontent as InsertableContent,\n\t\t\t\tthis.rootFieldSchema,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\t{\n\t\t\t\t\tschema: this.checkout.storedSchema,\n\t\t\t\t\tpolicy: {\n\t\t\t\t\t\t...defaultSchemaPolicy,\n\t\t\t\t\t\tvalidateSchema: this.config.enableSchemaValidation,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, this.checkout.forest);\n\t\t\tinitialize(this.checkout, {\n\t\t\t\tschema: this.viewSchema.storedSchema,\n\t\t\t\tinitialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic upgradeSchema(): void {\n\t\tthis.ensureUndisposed();\n\n\t\tconst compatibility = this.compatibility;\n\t\tif (compatibility.isEquivalent) {\n\t\t\t// No-op\n\t\t\treturn;\n\t\t}\n\n\t\tif (!compatibility.canUpgrade) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).\",\n\t\t\t);\n\t\t}\n\n\t\tthis.runSchemaEdit(() => {\n\t\t\tconst result = ensureSchema(\n\t\t\t\tthis.viewSchema,\n\t\t\t\tAllowedUpdateType.SchemaCompatible,\n\t\t\t\tthis.checkout,\n\t\t\t\t{\n\t\t\t\t\tschema: this.viewSchema.storedSchema,\n\t\t\t\t\tinitialTree: undefined,\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);\n\t\t});\n\t}\n\n\t/**\n\t * Gets the view. Throws when disposed.\n\t */\n\tpublic getView(): CheckoutFlexTreeView {\n\t\tthis.ensureUndisposed();\n\t\tassert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);\n\t\treturn this.view;\n\t}\n\n\tprivate ensureUndisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t}\n\n\tprivate failDisposed(): never {\n\t\tthrow new UsageError(\"Accessed a disposed TreeView.\");\n\t}\n\n\t/**\n\t * Updates `this.view` and the current compatibility status.\n\t * Invoked during initialization and when `this.view` needs to be replaced due to stored schema changes.\n\t * Handles re-registering for events to call update in the future.\n\t * @remarks\n\t * This does not check if the view needs to be replaced, it replaces it unconditionally:\n\t * callers should do any checking to detect if it's really needed before calling `update`.\n\t * @privateRemarks\n\t * This implementation avoids making any edits, which prevents it from being invoked reentrantly.\n\t * If implicit initialization (or some other edit) is desired, it should be done outside of this method.\n\t */\n\tprivate update(): void {\n\t\tthis.disposeView();\n\n\t\tconst result = this.viewSchema.checkCompatibility(this.checkout.storedSchema);\n\n\t\t// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.\n\t\t// In the near term, this should support viewing documents with additional optional fields in their schema on object types.\n\t\t// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility\n\t\t// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)\n\t\tconst canView =\n\t\t\tresult.write === Compatibility.Compatible && result.read === Compatibility.Compatible;\n\t\tconst canUpgrade = result.read === Compatibility.Compatible;\n\t\tconst isEquivalent = canView && canUpgrade;\n\t\tconst compatibility: SchemaCompatibilityStatus = {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent,\n\t\t\tcanInitialize: canInitialize(this.checkout),\n\t\t};\n\t\tlet lastRoot =\n\t\t\tthis.compatibility.canView && this.view !== undefined ? this.root : undefined;\n\t\tthis.currentCompatibility = compatibility;\n\n\t\tif (compatibility.canView) {\n\t\t\t// Trigger \"rootChanged\" if the root changes in the future.\n\t\t\t// Currently there is no good way to do this as FlexTreeField has no events for changes.\n\t\t\t// this.view.flexTree.on(????)\n\t\t\t// As a workaround for the above, trigger \"rootChanged\" in \"afterBatch\"\n\t\t\t// which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.\n\t\t\t// TODO: provide a better event: this.view.flexTree.on(????)\n\t\t\tconst cleanupCheckOutEvents = this.checkout.events.on(\"afterBatch\", () => {\n\t\t\t\t// In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.\n\t\t\t\t// Accessing `this.root` in that case can throw. It's OK to ignore this because:\n\t\t\t\t// - The rootChanged event will already be raised at the end of the current upgrade\n\t\t\t\t// - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade\n\t\t\t\t// completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)\n\t\t\t\tif (!this.midUpgrade && lastRoot !== this.root) {\n\t\t\t\t\tlastRoot = this.root;\n\t\t\t\t\tthis.events.emit(\"rootChanged\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst onViewDispose = (): void => {\n\t\t\t\tcleanupCheckOutEvents();\n\t\t\t\tthis.view = undefined;\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.update();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst view = requireSchema(\n\t\t\t\tthis.checkout,\n\t\t\t\tthis.viewSchema,\n\t\t\t\tonViewDispose,\n\t\t\t\tthis.nodeKeyManager,\n\t\t\t\tthis.flexSchema,\n\t\t\t);\n\t\t\tthis.view = view;\n\n\t\t\tconst unregister = this.checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tview[disposeSymbol]();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t} else {\n\t\t\tthis.view = undefined;\n\n\t\t\tconst unregister = this.checkout.storedSchema.on(\"afterSchemaChange\", () => {\n\t\t\t\tunregister();\n\t\t\t\tthis.unregisterCallbacks.delete(unregister);\n\t\t\t\tthis.update();\n\t\t\t});\n\t\t\tthis.unregisterCallbacks.add(unregister);\n\t\t}\n\n\t\tif (!this.midUpgrade) {\n\t\t\tthis.events.emit(\"schemaChanged\");\n\t\t\tthis.events.emit(\"rootChanged\");\n\t\t}\n\t}\n\n\tprivate runSchemaEdit(edit: () => void): void {\n\t\tthis.midUpgrade = true;\n\t\ttry {\n\t\t\tedit();\n\t\t} finally {\n\t\t\tthis.midUpgrade = false;\n\t\t}\n\t\tthis.events.emit(\"schemaChanged\");\n\t\tthis.events.emit(\"rootChanged\");\n\t}\n\n\tprivate disposeView(): void {\n\t\tif (this.view !== undefined) {\n\t\t\tthis.view[disposeSymbol]();\n\t\t\tthis.view = undefined;\n\t\t\tthis.unregisterCallbacks.forEach((unregister) => unregister());\n\t\t}\n\t}\n\n\tpublic get compatibility(): SchemaCompatibilityStatus {\n\t\tif (!this.currentCompatibility) {\n\t\t\tthis.failDisposed();\n\t\t}\n\t\treturn this.currentCompatibility;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.disposeView();\n\t\tthis.checkout.forest.anchors.slots.delete(ViewSlot);\n\t\tthis.currentCompatibility = undefined;\n\t}\n\n\tpublic get root(): TreeFieldFromImplicitField<TRootSchema> {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\treturn getTreeNodeForField(view.flexTree) as TreeFieldFromImplicitField<TRootSchema>;\n\t}\n\n\tpublic set root(newRoot: InsertableTreeFieldFromImplicitField<TRootSchema>) {\n\t\tthis.breaker.use();\n\t\tif (!this.compatibility.canView) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.\",\n\t\t\t);\n\t\t}\n\t\tconst view = this.getView();\n\t\tsetField(view.context.root, this.rootFieldSchema, newRoot as InsertableContent);\n\t}\n}\n\n/**\n * Creates a view that self-disposes whenenever the stored schema changes.\n * This may only be called when the schema is already known to be compatible (typically via ensureSchema).\n */\nexport function requireSchema(\n\tcheckout: ITreeCheckout,\n\tviewSchema: ViewSchema,\n\tonDispose: () => void,\n\tnodeKeyManager: NodeKeyManager,\n\tflexTreeSchema: FlexTreeSchema,\n): CheckoutFlexTreeView {\n\tconst slots = checkout.forest.anchors.slots;\n\tassert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);\n\n\t{\n\t\tconst compatibility = viewSchema.checkCompatibility(checkout.storedSchema);\n\t\tassert(\n\t\t\tcompatibility.write === Compatibility.Compatible &&\n\t\t\t\tcompatibility.read === Compatibility.Compatible,\n\t\t\t0x8c3 /* requireSchema invoked with incompatible schema */,\n\t\t);\n\t}\n\n\tconst view = new CheckoutFlexTreeView(checkout, flexTreeSchema, nodeKeyManager, onDispose);\n\tassert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);\n\treturn view;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAGjF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,0BAA0B,EAG1B,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAIN,uBAAuB,EASvB,MAAM,+BAA+B,CAAC;AACv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