@fluidframework/tree 2.4.0-294316 → 2.4.0-297385

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 (755) hide show
  1. package/api-report/tree.alpha.api.md +58 -28
  2. package/api-report/tree.beta.api.md +38 -27
  3. package/api-report/tree.legacy.alpha.api.md +38 -27
  4. package/api-report/tree.legacy.public.api.md +38 -27
  5. package/api-report/tree.public.api.md +38 -27
  6. package/dist/alpha.d.ts +6 -0
  7. package/dist/beta.d.ts +3 -0
  8. package/dist/core/change-family/changeFamily.d.ts +2 -2
  9. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  10. package/dist/core/change-family/changeFamily.js.map +1 -1
  11. package/dist/core/change-family/editBuilder.d.ts +3 -2
  12. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  13. package/dist/core/change-family/editBuilder.js.map +1 -1
  14. package/dist/core/rebase/changeRebaser.d.ts +2 -1
  15. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  16. package/dist/core/rebase/changeRebaser.js.map +1 -1
  17. package/dist/core/rebase/utils.js +1 -1
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/schema-stored/schema.d.ts +7 -0
  20. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  21. package/dist/core/schema-stored/schema.js +9 -0
  22. package/dist/core/schema-stored/schema.js.map +1 -1
  23. package/dist/core/tree/anchorSet.d.ts +1 -2
  24. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  25. package/dist/core/tree/anchorSet.js +2 -2
  26. package/dist/core/tree/anchorSet.js.map +1 -1
  27. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.js +13 -2
  29. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  31. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  32. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  33. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  34. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  35. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  36. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  37. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  38. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  39. package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
  40. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  41. package/dist/feature-libraries/editableTreeBinder.js +1 -539
  42. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  43. package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
  44. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  45. package/dist/feature-libraries/flex-tree/context.js +3 -3
  46. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  47. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  48. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  49. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  51. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  52. package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
  53. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  55. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  56. package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
  57. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  58. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  59. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  60. package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
  61. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  62. package/dist/feature-libraries/flex-tree/utilities.js +1 -1
  63. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  64. package/dist/feature-libraries/index.d.ts +4 -7
  65. package/dist/feature-libraries/index.d.ts.map +1 -1
  66. package/dist/feature-libraries/index.js +5 -31
  67. package/dist/feature-libraries/index.js.map +1 -1
  68. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  69. package/dist/feature-libraries/mitigatedChangeFamily.js +4 -4
  70. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  72. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  73. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  74. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  75. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +179 -60
  77. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  78. package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -9
  79. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  80. package/dist/feature-libraries/optional-field/optionalField.js +9 -7
  81. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  82. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  83. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  84. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  85. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  86. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  87. package/dist/feature-libraries/sequence-field/compose.js +32 -20
  88. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  89. package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  90. package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  91. package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  92. package/dist/feature-libraries/sequence-field/invert.d.ts +6 -1
  93. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  94. package/dist/feature-libraries/sequence-field/invert.js +25 -9
  95. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  96. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  97. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  98. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  99. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  100. package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
  101. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  102. package/dist/feature-libraries/typed-schema/flexList.js +1 -13
  103. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  104. package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
  105. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  106. package/dist/feature-libraries/typed-schema/index.js +1 -19
  107. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  108. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  109. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  110. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
  111. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +2 -1
  115. package/dist/index.js.map +1 -1
  116. package/dist/internalTypes.d.ts +1 -1
  117. package/dist/internalTypes.d.ts.map +1 -1
  118. package/dist/internalTypes.js.map +1 -1
  119. package/dist/legacy.d.ts +3 -0
  120. package/dist/packageVersion.d.ts +1 -1
  121. package/dist/packageVersion.js +1 -1
  122. package/dist/packageVersion.js.map +1 -1
  123. package/dist/public.d.ts +3 -0
  124. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  125. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  126. package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
  127. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  128. package/dist/shared-tree/index.d.ts +3 -3
  129. package/dist/shared-tree/index.d.ts.map +1 -1
  130. package/dist/shared-tree/index.js +2 -3
  131. package/dist/shared-tree/index.js.map +1 -1
  132. package/dist/shared-tree/schematizeTree.d.ts +1 -40
  133. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  134. package/dist/shared-tree/schematizeTree.js +2 -11
  135. package/dist/shared-tree/schematizeTree.js.map +1 -1
  136. package/dist/shared-tree/schematizingTreeView.d.ts +8 -7
  137. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  138. package/dist/shared-tree/schematizingTreeView.js +16 -8
  139. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  140. package/dist/shared-tree/sharedTree.d.ts +19 -2
  141. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  142. package/dist/shared-tree/sharedTree.js +11 -3
  143. package/dist/shared-tree/sharedTree.js.map +1 -1
  144. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  145. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  146. package/dist/shared-tree/sharedTreeChangeFamily.js +4 -4
  147. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  148. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  149. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  150. package/dist/shared-tree/sharedTreeEditBuilder.js +15 -11
  151. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  152. package/dist/shared-tree/treeCheckout.d.ts +71 -41
  153. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  154. package/dist/shared-tree/treeCheckout.js +119 -86
  155. package/dist/shared-tree/treeCheckout.js.map +1 -1
  156. package/dist/shared-tree-core/branch.d.ts +9 -13
  157. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  158. package/dist/shared-tree-core/branch.js +21 -25
  159. package/dist/shared-tree-core/branch.js.map +1 -1
  160. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  161. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  162. package/dist/shared-tree-core/defaultResubmitMachine.js +4 -4
  163. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  164. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManager.js +1 -1
  166. package/dist/shared-tree-core/editManager.js.map +1 -1
  167. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  168. package/dist/shared-tree-core/sharedTreeCore.js +2 -2
  169. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  170. package/dist/simple-tree/api/create.d.ts +1 -1
  171. package/dist/simple-tree/api/create.d.ts.map +1 -1
  172. package/dist/simple-tree/api/create.js +11 -13
  173. package/dist/simple-tree/api/create.js.map +1 -1
  174. package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
  175. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  176. package/dist/simple-tree/api/getJsonSchema.js +1 -1
  177. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  178. package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
  179. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  180. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  181. package/dist/simple-tree/api/index.d.ts +2 -1
  182. package/dist/simple-tree/api/index.d.ts.map +1 -1
  183. package/dist/simple-tree/api/index.js +3 -1
  184. package/dist/simple-tree/api/index.js.map +1 -1
  185. package/dist/simple-tree/api/schemaFactory.d.ts +6 -6
  186. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  187. package/dist/simple-tree/api/schemaFactory.js +15 -2
  188. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  189. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  190. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  191. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  192. package/dist/simple-tree/api/simpleSchema.d.ts +14 -10
  193. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  194. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  195. package/dist/simple-tree/api/tree.d.ts +12 -6
  196. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  197. package/dist/simple-tree/api/tree.js +4 -4
  198. package/dist/simple-tree/api/tree.js.map +1 -1
  199. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  200. package/dist/simple-tree/api/treeNodeApi.js +8 -6
  201. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  202. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  203. package/dist/simple-tree/api/verboseTree.js +6 -10
  204. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  205. package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
  206. package/dist/simple-tree/api/view.d.ts.map +1 -0
  207. package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  208. package/dist/simple-tree/api/view.js.map +1 -0
  209. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  210. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  211. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +7 -1
  212. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  213. package/dist/simple-tree/arrayNode.d.ts +147 -14
  214. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  215. package/dist/simple-tree/arrayNode.js +32 -20
  216. package/dist/simple-tree/arrayNode.js.map +1 -1
  217. package/dist/simple-tree/core/context.d.ts +55 -0
  218. package/dist/simple-tree/core/context.d.ts.map +1 -0
  219. package/dist/simple-tree/core/context.js +60 -0
  220. package/dist/simple-tree/core/context.js.map +1 -0
  221. package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
  222. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  223. package/dist/simple-tree/core/getOrCreateNode.js +36 -0
  224. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
  225. package/dist/simple-tree/core/index.d.ts +7 -3
  226. package/dist/simple-tree/core/index.d.ts.map +1 -1
  227. package/dist/simple-tree/core/index.js +16 -7
  228. package/dist/simple-tree/core/index.js.map +1 -1
  229. package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
  230. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  231. package/dist/simple-tree/core/schemaCaching.js +16 -45
  232. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  233. package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
  234. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  235. package/dist/simple-tree/core/treeNodeKernel.js +94 -58
  236. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  237. package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
  238. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  240. package/dist/simple-tree/core/types.d.ts +0 -5
  241. package/dist/simple-tree/core/types.d.ts.map +1 -1
  242. package/dist/simple-tree/core/types.js.map +1 -1
  243. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  244. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  245. package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
  246. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  247. package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  248. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
  249. package/dist/simple-tree/core/walkSchema.js +34 -0
  250. package/dist/simple-tree/core/walkSchema.js.map +1 -0
  251. package/dist/simple-tree/createContext.d.ts +11 -0
  252. package/dist/simple-tree/createContext.d.ts.map +1 -0
  253. package/dist/simple-tree/createContext.js +25 -0
  254. package/dist/simple-tree/createContext.js.map +1 -0
  255. package/dist/simple-tree/index.d.ts +3 -4
  256. package/dist/simple-tree/index.d.ts.map +1 -1
  257. package/dist/simple-tree/index.js +7 -7
  258. package/dist/simple-tree/index.js.map +1 -1
  259. package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
  260. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  261. package/dist/simple-tree/leafNodeSchema.js +1 -2
  262. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  263. package/dist/simple-tree/mapNode.d.ts +4 -4
  264. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  265. package/dist/simple-tree/mapNode.js +9 -5
  266. package/dist/simple-tree/mapNode.js.map +1 -1
  267. package/dist/simple-tree/objectNode.d.ts +8 -8
  268. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  269. package/dist/simple-tree/objectNode.js +33 -14
  270. package/dist/simple-tree/objectNode.js.map +1 -1
  271. package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
  272. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  273. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  274. package/dist/simple-tree/proxies.d.ts +1 -2
  275. package/dist/simple-tree/proxies.d.ts.map +1 -1
  276. package/dist/simple-tree/proxies.js +6 -22
  277. package/dist/simple-tree/proxies.js.map +1 -1
  278. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  279. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  280. package/dist/simple-tree/schemaTypes.js.map +1 -1
  281. package/dist/simple-tree/toFlexSchema.d.ts +6 -36
  282. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  283. package/dist/simple-tree/toFlexSchema.js +58 -142
  284. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  285. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  286. package/dist/simple-tree/toMapTree.js +2 -2
  287. package/dist/simple-tree/toMapTree.js.map +1 -1
  288. package/dist/simple-tree/treeNodeValid.d.ts +13 -5
  289. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  290. package/dist/simple-tree/treeNodeValid.js +19 -10
  291. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  292. package/dist/simple-tree/typesUnsafe.d.ts +4 -4
  293. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  294. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  295. package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
  296. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
  297. package/dist/simple-tree/walkFieldSchema.js +17 -0
  298. package/dist/simple-tree/walkFieldSchema.js.map +1 -0
  299. package/dist/util/index.d.ts +1 -1
  300. package/dist/util/index.d.ts.map +1 -1
  301. package/dist/util/index.js.map +1 -1
  302. package/dist/util/typeUtils.d.ts +14 -45
  303. package/dist/util/typeUtils.d.ts.map +1 -1
  304. package/dist/util/typeUtils.js.map +1 -1
  305. package/lib/alpha.d.ts +6 -0
  306. package/lib/beta.d.ts +3 -0
  307. package/lib/core/change-family/changeFamily.d.ts +2 -2
  308. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  309. package/lib/core/change-family/changeFamily.js.map +1 -1
  310. package/lib/core/change-family/editBuilder.d.ts +3 -2
  311. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  312. package/lib/core/change-family/editBuilder.js.map +1 -1
  313. package/lib/core/rebase/changeRebaser.d.ts +2 -1
  314. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  315. package/lib/core/rebase/changeRebaser.js.map +1 -1
  316. package/lib/core/rebase/utils.js +1 -1
  317. package/lib/core/rebase/utils.js.map +1 -1
  318. package/lib/core/schema-stored/schema.d.ts +7 -0
  319. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  320. package/lib/core/schema-stored/schema.js +9 -0
  321. package/lib/core/schema-stored/schema.js.map +1 -1
  322. package/lib/core/tree/anchorSet.d.ts +1 -2
  323. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  324. package/lib/core/tree/anchorSet.js +2 -2
  325. package/lib/core/tree/anchorSet.js.map +1 -1
  326. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  327. package/lib/core/tree/detachedFieldIndex.js +13 -2
  328. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  329. package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  330. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  331. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  332. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  333. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  334. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  335. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  336. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  337. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  338. package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
  339. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  340. package/lib/feature-libraries/editableTreeBinder.js +1 -532
  341. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  342. package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
  343. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  344. package/lib/feature-libraries/flex-tree/context.js +3 -3
  345. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  346. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  347. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  348. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  349. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  350. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  351. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
  352. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  353. package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  354. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  355. package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
  356. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  357. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  358. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  359. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
  360. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  361. package/lib/feature-libraries/flex-tree/utilities.js +1 -1
  362. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  363. package/lib/feature-libraries/index.d.ts +4 -7
  364. package/lib/feature-libraries/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/index.js +4 -6
  366. package/lib/feature-libraries/index.js.map +1 -1
  367. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  368. package/lib/feature-libraries/mitigatedChangeFamily.js +4 -4
  369. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  370. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  371. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  372. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  373. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  374. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  375. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +180 -61
  376. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  377. package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -9
  378. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  379. package/lib/feature-libraries/optional-field/optionalField.js +9 -7
  380. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  381. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  382. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  383. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  384. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  385. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  386. package/lib/feature-libraries/sequence-field/compose.js +32 -20
  387. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  388. package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  389. package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  390. package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  391. package/lib/feature-libraries/sequence-field/invert.d.ts +6 -1
  392. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  393. package/lib/feature-libraries/sequence-field/invert.js +25 -9
  394. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  395. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  396. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  397. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  398. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  399. package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
  400. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  401. package/lib/feature-libraries/typed-schema/flexList.js +0 -11
  402. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  403. package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
  404. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  405. package/lib/feature-libraries/typed-schema/index.js +0 -3
  406. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  407. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  408. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  409. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
  410. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  411. package/lib/index.d.ts +3 -3
  412. package/lib/index.d.ts.map +1 -1
  413. package/lib/index.js +1 -1
  414. package/lib/index.js.map +1 -1
  415. package/lib/internalTypes.d.ts +1 -1
  416. package/lib/internalTypes.d.ts.map +1 -1
  417. package/lib/internalTypes.js.map +1 -1
  418. package/lib/legacy.d.ts +3 -0
  419. package/lib/packageVersion.d.ts +1 -1
  420. package/lib/packageVersion.js +1 -1
  421. package/lib/packageVersion.js.map +1 -1
  422. package/lib/public.d.ts +3 -0
  423. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  424. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  425. package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
  426. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  427. package/lib/shared-tree/index.d.ts +3 -3
  428. package/lib/shared-tree/index.d.ts.map +1 -1
  429. package/lib/shared-tree/index.js +1 -2
  430. package/lib/shared-tree/index.js.map +1 -1
  431. package/lib/shared-tree/schematizeTree.d.ts +1 -40
  432. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  433. package/lib/shared-tree/schematizeTree.js +1 -9
  434. package/lib/shared-tree/schematizeTree.js.map +1 -1
  435. package/lib/shared-tree/schematizingTreeView.d.ts +8 -7
  436. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  437. package/lib/shared-tree/schematizingTreeView.js +19 -11
  438. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  439. package/lib/shared-tree/sharedTree.d.ts +19 -2
  440. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  441. package/lib/shared-tree/sharedTree.js +11 -4
  442. package/lib/shared-tree/sharedTree.js.map +1 -1
  443. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  444. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  445. package/lib/shared-tree/sharedTreeChangeFamily.js +4 -4
  446. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  447. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  448. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  449. package/lib/shared-tree/sharedTreeEditBuilder.js +15 -11
  450. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  451. package/lib/shared-tree/treeCheckout.d.ts +71 -41
  452. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  453. package/lib/shared-tree/treeCheckout.js +122 -89
  454. package/lib/shared-tree/treeCheckout.js.map +1 -1
  455. package/lib/shared-tree-core/branch.d.ts +9 -13
  456. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  457. package/lib/shared-tree-core/branch.js +22 -26
  458. package/lib/shared-tree-core/branch.js.map +1 -1
  459. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  460. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  461. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  462. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  463. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  464. package/lib/shared-tree-core/editManager.js +2 -2
  465. package/lib/shared-tree-core/editManager.js.map +1 -1
  466. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  467. package/lib/shared-tree-core/sharedTreeCore.js +2 -2
  468. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  469. package/lib/simple-tree/api/create.d.ts +1 -1
  470. package/lib/simple-tree/api/create.d.ts.map +1 -1
  471. package/lib/simple-tree/api/create.js +14 -16
  472. package/lib/simple-tree/api/create.js.map +1 -1
  473. package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
  474. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  475. package/lib/simple-tree/api/getJsonSchema.js +1 -1
  476. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  477. package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
  478. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  479. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  480. package/lib/simple-tree/api/index.d.ts +2 -1
  481. package/lib/simple-tree/api/index.d.ts.map +1 -1
  482. package/lib/simple-tree/api/index.js +1 -0
  483. package/lib/simple-tree/api/index.js.map +1 -1
  484. package/lib/simple-tree/api/schemaFactory.d.ts +6 -6
  485. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  486. package/lib/simple-tree/api/schemaFactory.js +15 -2
  487. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  488. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  489. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  490. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  491. package/lib/simple-tree/api/simpleSchema.d.ts +14 -10
  492. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  493. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  494. package/lib/simple-tree/api/tree.d.ts +12 -6
  495. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  496. package/lib/simple-tree/api/tree.js +4 -4
  497. package/lib/simple-tree/api/tree.js.map +1 -1
  498. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  499. package/lib/simple-tree/api/treeNodeApi.js +10 -8
  500. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  501. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  502. package/lib/simple-tree/api/verboseTree.js +6 -10
  503. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  504. package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
  505. package/lib/simple-tree/api/view.d.ts.map +1 -0
  506. package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  507. package/lib/simple-tree/api/view.js.map +1 -0
  508. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  509. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  510. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +7 -1
  511. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  512. package/lib/simple-tree/arrayNode.d.ts +147 -14
  513. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  514. package/lib/simple-tree/arrayNode.js +37 -25
  515. package/lib/simple-tree/arrayNode.js.map +1 -1
  516. package/lib/simple-tree/core/context.d.ts +55 -0
  517. package/lib/simple-tree/core/context.d.ts.map +1 -0
  518. package/lib/simple-tree/core/context.js +55 -0
  519. package/lib/simple-tree/core/context.js.map +1 -0
  520. package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
  521. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  522. package/lib/simple-tree/core/getOrCreateNode.js +32 -0
  523. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
  524. package/lib/simple-tree/core/index.d.ts +7 -3
  525. package/lib/simple-tree/core/index.d.ts.map +1 -1
  526. package/lib/simple-tree/core/index.js +6 -2
  527. package/lib/simple-tree/core/index.js.map +1 -1
  528. package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
  529. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  530. package/lib/simple-tree/core/schemaCaching.js +13 -39
  531. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  532. package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
  533. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  534. package/lib/simple-tree/core/treeNodeKernel.js +89 -54
  535. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  536. package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
  537. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  538. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  539. package/lib/simple-tree/core/types.d.ts +0 -5
  540. package/lib/simple-tree/core/types.d.ts.map +1 -1
  541. package/lib/simple-tree/core/types.js.map +1 -1
  542. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  543. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  544. package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
  545. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  546. package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  547. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
  548. package/lib/simple-tree/core/walkSchema.js +29 -0
  549. package/lib/simple-tree/core/walkSchema.js.map +1 -0
  550. package/lib/simple-tree/createContext.d.ts +11 -0
  551. package/lib/simple-tree/createContext.d.ts.map +1 -0
  552. package/lib/simple-tree/createContext.js +21 -0
  553. package/lib/simple-tree/createContext.js.map +1 -0
  554. package/lib/simple-tree/index.d.ts +3 -4
  555. package/lib/simple-tree/index.d.ts.map +1 -1
  556. package/lib/simple-tree/index.js +3 -4
  557. package/lib/simple-tree/index.js.map +1 -1
  558. package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
  559. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  560. package/lib/simple-tree/leafNodeSchema.js +3 -4
  561. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  562. package/lib/simple-tree/mapNode.d.ts +4 -4
  563. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  564. package/lib/simple-tree/mapNode.js +12 -8
  565. package/lib/simple-tree/mapNode.js.map +1 -1
  566. package/lib/simple-tree/objectNode.d.ts +8 -8
  567. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  568. package/lib/simple-tree/objectNode.js +36 -17
  569. package/lib/simple-tree/objectNode.js.map +1 -1
  570. package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
  571. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  572. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  573. package/lib/simple-tree/proxies.d.ts +1 -2
  574. package/lib/simple-tree/proxies.d.ts.map +1 -1
  575. package/lib/simple-tree/proxies.js +7 -22
  576. package/lib/simple-tree/proxies.js.map +1 -1
  577. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  578. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  579. package/lib/simple-tree/schemaTypes.js.map +1 -1
  580. package/lib/simple-tree/toFlexSchema.d.ts +6 -36
  581. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  582. package/lib/simple-tree/toFlexSchema.js +61 -142
  583. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  584. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  585. package/lib/simple-tree/toMapTree.js +4 -4
  586. package/lib/simple-tree/toMapTree.js.map +1 -1
  587. package/lib/simple-tree/treeNodeValid.d.ts +13 -5
  588. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  589. package/lib/simple-tree/treeNodeValid.js +21 -12
  590. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  591. package/lib/simple-tree/typesUnsafe.d.ts +4 -4
  592. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  593. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  594. package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
  595. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
  596. package/lib/simple-tree/walkFieldSchema.js +13 -0
  597. package/lib/simple-tree/walkFieldSchema.js.map +1 -0
  598. package/lib/util/index.d.ts +1 -1
  599. package/lib/util/index.d.ts.map +1 -1
  600. package/lib/util/index.js.map +1 -1
  601. package/lib/util/typeUtils.d.ts +14 -45
  602. package/lib/util/typeUtils.d.ts.map +1 -1
  603. package/lib/util/typeUtils.js.map +1 -1
  604. package/package.json +32 -23
  605. package/src/core/change-family/changeFamily.ts +5 -2
  606. package/src/core/change-family/editBuilder.ts +3 -2
  607. package/src/core/rebase/changeRebaser.ts +6 -1
  608. package/src/core/rebase/utils.ts +1 -1
  609. package/src/core/schema-stored/schema.ts +17 -0
  610. package/src/core/tree/anchorSet.ts +3 -4
  611. package/src/core/tree/detachedFieldIndex.ts +14 -3
  612. package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
  613. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +92 -47
  614. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +7 -7
  615. package/src/feature-libraries/editableTreeBinder.ts +2 -915
  616. package/src/feature-libraries/flex-tree/context.ts +7 -20
  617. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
  618. package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
  619. package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
  620. package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
  621. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  622. package/src/feature-libraries/index.ts +3 -71
  623. package/src/feature-libraries/mitigatedChangeFamily.ts +11 -4
  624. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -0
  625. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +218 -175
  626. package/src/feature-libraries/optional-field/optionalField.ts +21 -17
  627. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -10
  628. package/src/feature-libraries/sequence-field/compose.ts +67 -58
  629. package/src/feature-libraries/sequence-field/invert.ts +30 -6
  630. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +65 -19
  631. package/src/feature-libraries/typed-schema/flexList.ts +3 -84
  632. package/src/feature-libraries/typed-schema/index.ts +1 -33
  633. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
  634. package/src/index.ts +6 -0
  635. package/src/internalTypes.ts +0 -1
  636. package/src/packageVersion.ts +1 -1
  637. package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
  638. package/src/shared-tree/index.ts +4 -8
  639. package/src/shared-tree/schematizeTree.ts +2 -56
  640. package/src/shared-tree/schematizingTreeView.ts +34 -15
  641. package/src/shared-tree/sharedTree.ts +39 -9
  642. package/src/shared-tree/sharedTreeChangeFamily.ts +5 -1
  643. package/src/shared-tree/sharedTreeEditBuilder.ts +23 -12
  644. package/src/shared-tree/treeCheckout.ts +232 -134
  645. package/src/shared-tree-core/branch.ts +26 -40
  646. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  647. package/src/shared-tree-core/editManager.ts +2 -1
  648. package/src/shared-tree-core/sharedTreeCore.ts +4 -2
  649. package/src/simple-tree/api/create.ts +18 -20
  650. package/src/simple-tree/api/getJsonSchema.ts +3 -3
  651. package/src/simple-tree/api/getSimpleSchema.ts +2 -2
  652. package/src/simple-tree/api/index.ts +2 -0
  653. package/src/simple-tree/api/schemaFactory.ts +41 -12
  654. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
  655. package/src/simple-tree/api/simpleSchema.ts +15 -10
  656. package/src/simple-tree/api/tree.ts +15 -9
  657. package/src/simple-tree/api/treeNodeApi.ts +12 -10
  658. package/src/simple-tree/api/verboseTree.ts +6 -12
  659. package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
  660. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +11 -2
  661. package/src/simple-tree/arrayNode.ts +202 -53
  662. package/src/simple-tree/core/context.ts +78 -0
  663. package/src/simple-tree/core/getOrCreateNode.ts +38 -0
  664. package/src/simple-tree/core/index.ts +11 -7
  665. package/src/simple-tree/core/schemaCaching.ts +13 -50
  666. package/src/simple-tree/core/treeNodeKernel.ts +117 -78
  667. package/src/simple-tree/core/treeNodeSchema.ts +35 -1
  668. package/src/simple-tree/core/types.ts +0 -5
  669. package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
  670. package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
  671. package/src/simple-tree/createContext.ts +24 -0
  672. package/src/simple-tree/index.ts +5 -2
  673. package/src/simple-tree/leafNodeSchema.ts +3 -9
  674. package/src/simple-tree/mapNode.ts +20 -17
  675. package/src/simple-tree/objectNode.ts +63 -38
  676. package/src/simple-tree/objectNodeTypes.ts +8 -5
  677. package/src/simple-tree/proxies.ts +8 -26
  678. package/src/simple-tree/schemaTypes.ts +2 -2
  679. package/src/simple-tree/toFlexSchema.ts +71 -204
  680. package/src/simple-tree/toMapTree.ts +5 -5
  681. package/src/simple-tree/treeNodeValid.ts +28 -22
  682. package/src/simple-tree/typesUnsafe.ts +4 -4
  683. package/src/simple-tree/walkFieldSchema.ts +19 -0
  684. package/src/util/index.ts +1 -5
  685. package/src/util/typeUtils.ts +14 -56
  686. package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
  687. package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
  688. package/dist/feature-libraries/fieldGenerator.js +0 -13
  689. package/dist/feature-libraries/fieldGenerator.js.map +0 -1
  690. package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
  691. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  692. package/dist/feature-libraries/flex-map-tree/index.js +0 -14
  693. package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
  694. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  695. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  696. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  697. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
  698. package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  699. package/dist/feature-libraries/storedToViewSchema.js +0 -67
  700. package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
  701. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  702. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  703. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
  704. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  705. package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  706. package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  707. package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
  708. package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  709. package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
  710. package/dist/feature-libraries/typed-schema/view.js.map +0 -1
  711. package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  712. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  713. package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
  714. package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
  715. package/dist/simple-tree/walkSchema.d.ts.map +0 -1
  716. package/dist/simple-tree/walkSchema.js +0 -49
  717. package/dist/simple-tree/walkSchema.js.map +0 -1
  718. package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
  719. package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
  720. package/lib/feature-libraries/fieldGenerator.js +0 -12
  721. package/lib/feature-libraries/fieldGenerator.js.map +0 -1
  722. package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
  723. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  724. package/lib/feature-libraries/flex-map-tree/index.js +0 -6
  725. package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
  726. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  727. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  728. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  729. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
  730. package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  731. package/lib/feature-libraries/storedToViewSchema.js +0 -62
  732. package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
  733. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  734. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  735. package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
  736. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  737. package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  738. package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  739. package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
  740. package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  741. package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
  742. package/lib/feature-libraries/typed-schema/view.js.map +0 -1
  743. package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  744. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  745. package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
  746. package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
  747. package/lib/simple-tree/walkSchema.d.ts.map +0 -1
  748. package/lib/simple-tree/walkSchema.js +0 -43
  749. package/lib/simple-tree/walkSchema.js.map +0 -1
  750. package/src/feature-libraries/fieldGenerator.ts +0 -47
  751. package/src/feature-libraries/flex-map-tree/index.ts +0 -14
  752. package/src/feature-libraries/storedToViewSchema.ts +0 -100
  753. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
  754. package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
  755. package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Used by public types, but not part of the desired API surface.\n// Since these are used in the public API, changing them can still be a breaking change, but renaming or inlining them should not be.\n// Note that this should only contain types which are `@public` since this is reexported as a namespace and our rollup generator does not filter that.\n\nexport type { _InlineTrick, FlattenKeys } from \"./util/index.js\";\nexport type {\n\tApplyKind,\n\tNodeBuilderData,\n\tFieldHasDefault,\n\tTreeNodeSchemaNonClass,\n\tTreeArrayNodeBase,\n\tScopedSchemaName,\n\tDefaultProvider,\n\ttypeNameSymbol,\n\tInsertableObjectFromSchemaRecord,\n\tObjectFromSchemaRecord,\n\t// Recursive Schema APIs\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n} from \"./simple-tree/index.js\";\nexport type { FlexList, FlexListToUnion, ExtractItemType } from \"./feature-libraries/index.js\";\n\nexport type { TreeApi } from \"./shared-tree/index.js\";\n"]}
1
+ {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Used by public types, but not part of the desired API surface.\n// Since these are used in the public API, changing them can still be a breaking change, but renaming or inlining them should not be.\n// Note that this should only contain types which are `@public` since this is reexported as a namespace and our rollup generator does not filter that.\n\nexport type { _InlineTrick, FlattenKeys } from \"./util/index.js\";\nexport type {\n\tApplyKind,\n\tNodeBuilderData,\n\tFieldHasDefault,\n\tTreeArrayNodeBase,\n\tScopedSchemaName,\n\tDefaultProvider,\n\ttypeNameSymbol,\n\tInsertableObjectFromSchemaRecord,\n\tObjectFromSchemaRecord,\n\t// Recursive Schema APIs\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n} from \"./simple-tree/index.js\";\nexport type { FlexList, FlexListToUnion, ExtractItemType } from \"./feature-libraries/index.js\";\n\nexport type { TreeApi } from \"./shared-tree/index.js\";\n"]}
package/lib/legacy.d.ts CHANGED
@@ -45,6 +45,7 @@ export {
45
45
  NodeKind,
46
46
  Off,
47
47
  RestrictiveReadonlyRecord,
48
+ RestrictiveStringRecord,
48
49
  Revertible,
49
50
  RevertibleFactory,
50
51
  RevertibleStatus,
@@ -66,6 +67,7 @@ export {
66
67
  TreeNodeSchema,
67
68
  TreeNodeSchemaClass,
68
69
  TreeNodeSchemaCore,
70
+ TreeNodeSchemaNonClass,
69
71
  TreeObjectNode,
70
72
  TreeObjectNodeUnsafe,
71
73
  TreeStatus,
@@ -75,6 +77,7 @@ export {
75
77
  Unenforced,
76
78
  Unhydrated,
77
79
  ValidateRecursiveSchema,
80
+ ViewableTree,
78
81
  WithType,
79
82
  rollback,
80
83
  typeSchemaSymbol,
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tree";
8
- export declare const pkgVersion = "2.4.0-294316";
8
+ export declare const pkgVersion = "2.4.0-297385";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/tree";
8
- export const pkgVersion = "2.4.0-294316";
8
+ export const pkgVersion = "2.4.0-297385";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.4.0-294316\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.4.0-297385\";\n"]}
package/lib/public.d.ts CHANGED
@@ -45,6 +45,7 @@ export {
45
45
  NodeKind,
46
46
  Off,
47
47
  RestrictiveReadonlyRecord,
48
+ RestrictiveStringRecord,
48
49
  Revertible,
49
50
  RevertibleFactory,
50
51
  RevertibleStatus,
@@ -66,6 +67,7 @@ export {
66
67
  TreeNodeSchema,
67
68
  TreeNodeSchemaClass,
68
69
  TreeNodeSchemaCore,
70
+ TreeNodeSchemaNonClass,
69
71
  TreeObjectNode,
70
72
  TreeObjectNodeUnsafe,
71
73
  TreeStatus,
@@ -75,6 +77,7 @@ export {
75
77
  Unenforced,
76
78
  Unhydrated,
77
79
  ValidateRecursiveSchema,
80
+ ViewableTree,
78
81
  WithType,
79
82
  rollback,
80
83
  typeSchemaSymbol
@@ -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 { type Context, type FlexTreeField, type FlexTreeSchema, type NodeKeyManager, type FlexTreeHydratedContext } from "../feature-libraries/index.js";
5
+ import { type Context, type FlexTreeField, type NodeKeyManager, type FlexTreeHydratedContext, type FullSchemaPolicy } from "../feature-libraries/index.js";
6
6
  import { disposeSymbol } from "../util/index.js";
7
7
  import type { ITreeCheckout, ITreeCheckoutFork } from "./treeCheckout.js";
8
8
  /**
@@ -16,7 +16,7 @@ export declare class CheckoutFlexTreeView<out TCheckout extends ITreeCheckout =
16
16
  * This is a non-owning reference: disposing of this view does not impact the branch.
17
17
  */
18
18
  readonly checkout: TCheckout;
19
- readonly schema: FlexTreeSchema;
19
+ readonly schema: FullSchemaPolicy;
20
20
  readonly nodeKeyManager: NodeKeyManager;
21
21
  private readonly onDispose?;
22
22
  /**
@@ -37,7 +37,7 @@ export declare class CheckoutFlexTreeView<out TCheckout extends ITreeCheckout =
37
37
  * @remarks
38
38
  * This is a non-owning reference: disposing of this view does not impact the branch.
39
39
  */
40
- checkout: TCheckout, schema: FlexTreeSchema, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
40
+ checkout: TCheckout, schema: FullSchemaPolicy, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
41
41
  [disposeSymbol](): void;
42
42
  /**
43
43
  * Spawn a new view which is based off of the current state of this view.
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutFlexTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/checkoutFlexTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EAEnB,KAAK,uBAAuB,EAC5B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;GAEG;AACH,qBAAa,oBAAoB,CAAC,GAAG,CAAC,SAAS,SAAS,aAAa,GAAG,aAAa;IAenF;;;;;OAKG;aACa,QAAQ,EAAE,SAAS;aACnB,MAAM,EAAE,cAAc;aACtB,cAAc,EAAE,cAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAvB5B;;;;;OAKG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAgB,QAAQ,EAAE,aAAa,CAAC;;IAGvC;;;;;OAKG;IACa,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,cAAc,EAC7B,SAAS,CAAC,SAAQ,IAAI,aAAA;IAOjC,CAAC,aAAa,CAAC,IAAI,IAAI;IAS9B;;;OAGG;IACI,IAAI,IAAI,oBAAoB,CAAC,aAAa,GAAG,iBAAiB,CAAC;CAItE;AAQD;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,uBAAuB,GAC9B,oBAAoB,CAItB"}
1
+ {"version":3,"file":"checkoutFlexTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/checkoutFlexTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;GAEG;AACH,qBAAa,oBAAoB,CAAC,GAAG,CAAC,SAAS,SAAS,aAAa,GAAG,aAAa;IAenF;;;;;OAKG;aACa,QAAQ,EAAE,SAAS;aACnB,MAAM,EAAE,gBAAgB;aACxB,cAAc,EAAE,cAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAvB5B;;;;;OAKG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAgB,QAAQ,EAAE,aAAa,CAAC;;IAGvC;;;;;OAKG;IACa,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,gBAAgB,EACxB,cAAc,EAAE,cAAc,EAC7B,SAAS,CAAC,SAAQ,IAAI,aAAA;IAOjC,CAAC,aAAa,CAAC,IAAI,IAAI;IAS9B;;;OAGG;IACI,IAAI,IAAI,oBAAoB,CAAC,aAAa,GAAG,iBAAiB,CAAC;CAItE;AAQD;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,uBAAuB,GAC9B,oBAAoB,CAItB"}
@@ -38,7 +38,7 @@ export class CheckoutFlexTreeView {
38
38
  * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.
39
39
  */
40
40
  fork() {
41
- const branch = this.checkout.fork();
41
+ const branch = this.checkout.branch();
42
42
  return new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager);
43
43
  }
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutFlexTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/checkoutFlexTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAKN,cAAc,GAEd,MAA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AAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC;AACb,CAAC","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"]}
1
+ {"version":3,"file":"checkoutFlexTreeView.js","sourceRoot":"","sources":["../../src/shared-tree/checkoutFlexTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAIN,cAAc,GAGd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAchC;IACC;;;;;OAKG;IACa,QAAmB,EACnB,MAAwB,EACxB,cAA8B,EAC7B,SAAsB;QAHvB,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAkB;QACxB,mBAAc,GAAd,cAAc,CAAgB;QAC7B,cAAS,GAAT,SAAS,CAAa;QAEvC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,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,aAAa,CAAC;QACrB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvD,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IACI,IAAI;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAiD,CAAC;AAE1F;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACtC,OAAgC;IAEhC,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC;AACb,CAAC","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 NodeKeyManager,\n\tgetTreeContext,\n\ttype FlexTreeHydratedContext,\n\ttype FullSchemaPolicy,\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: FullSchemaPolicy,\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.branch();\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"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
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, } from "./treeCheckout.js";
7
- export { type SchematizeConfiguration, type TreeContent, type TreeStoredContent, type InitializeAndSchematizeConfiguration, type SchemaConfiguration, buildTreeConfiguration, } from "./schematizeTree.js";
5
+ export { type ISharedTree, SharedTreeFactory, type SharedTreeOptions, SharedTree, getBranch, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, } from "./sharedTree.js";
6
+ export { createTreeCheckout, TreeCheckout, type ITreeCheckout, runSynchronous, type CheckoutEvents, type ITransaction, type ITreeCheckoutFork, type TreeBranch, type TreeBranchFork, } from "./treeCheckout.js";
7
+ export { type TreeStoredContent } from "./schematizeTree.js";
8
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";
@@ -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,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,oCAAoC,EACzC,KAAK,mBAAmB,EACxB,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,QAAQ,GACR,MAAM,cAAc,CAAC"}
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,SAAS,EACT,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,UAAU,EACf,KAAK,cAAc,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EACN,OAAO,IAAI,IAAI,EACf,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,QAAQ,GACR,MAAM,cAAc,CAAC"}
@@ -2,9 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { SharedTreeFactory, SharedTree, ForestType, SharedTreeFormatVersion, } from "./sharedTree.js";
5
+ export { SharedTreeFactory, SharedTree, getBranch, ForestType, SharedTreeFormatVersion, } from "./sharedTree.js";
6
6
  export { createTreeCheckout, TreeCheckout, runSynchronous, } from "./treeCheckout.js";
7
- export { buildTreeConfiguration, } from "./schematizeTree.js";
8
7
  export { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
9
8
  export { treeApi as Tree, rollback, } from "./treeApi.js";
10
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,iBAAiB,EAEjB,UAAU,EACV,UAAU,EAGV,uBAAuB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EAEZ,cAAc,GAId,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAMN,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EACN,OAAO,IAAI,IAAI,EAKf,QAAQ,GACR,MAAM,cAAc,CAAC","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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,iBAAiB,EAEjB,UAAU,EACV,SAAS,EACT,UAAU,EAGV,uBAAuB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,kBAAkB,EAClB,YAAY,EAEZ,cAAc,GAMd,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EACN,OAAO,IAAI,IAAI,EAKf,QAAQ,GACR,MAAM,cAAc,CAAC","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\tgetBranch,\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 TreeBranch,\n\ttype TreeBranchFork,\n} from \"./treeCheckout.js\";\n\nexport { type TreeStoredContent } 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"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { AllowedUpdateType, type ITreeCursorSynchronous, type TreeStoredSchema } from "../core/index.js";
6
- import { type FlexFieldSchema, type FlexTreeSchema, type ViewSchema } from "../feature-libraries/index.js";
7
6
  import type { ITreeCheckout } from "./treeCheckout.js";
7
+ import type { ViewSchema } from "../simple-tree/index.js";
8
8
  /**
9
9
  * Modify `storedSchema` and invoke `setInitialTree` when it's time to set the tree content.
10
10
  *
@@ -63,25 +63,6 @@ export declare function initialize(checkout: ITreeCheckout, treeContent: TreeSto
63
63
  * @returns true iff checkout now is compatible with `viewSchema`.
64
64
  */
65
65
  export declare function ensureSchema(viewSchema: ViewSchema, allowedSchemaModifications: AllowedUpdateType, checkout: ITreeCheckout, treeContent: TreeStoredContent | undefined): boolean;
66
- /**
67
- * View Schema for a `SharedTree`.
68
- */
69
- export interface SchemaConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema> {
70
- /**
71
- * The schema which the application wants to view the tree with.
72
- */
73
- readonly schema: FlexTreeSchema<TRoot>;
74
- }
75
- /**
76
- * Content that can populate a `SharedTree`.
77
- */
78
- export interface TreeContent<TRoot extends FlexFieldSchema = FlexFieldSchema> extends SchemaConfiguration<TRoot> {
79
- /**
80
- * Default tree content to initialize the tree with iff the tree is uninitialized
81
- * (meaning it does not even have any schema set at all).
82
- */
83
- readonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;
84
- }
85
66
  /**
86
67
  * Content that can populate a `SharedTree`.
87
68
  */
@@ -93,24 +74,4 @@ export interface TreeStoredContent {
93
74
  */
94
75
  readonly initialTree: readonly ITreeCursorSynchronous[] | ITreeCursorSynchronous | undefined;
95
76
  }
96
- /**
97
- * Options used to schematize a `SharedTree`.
98
- */
99
- export interface SchematizeConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema> extends SchemaConfiguration<TRoot> {
100
- /**
101
- * Controls if and how schema from existing documents can be updated to accommodate the view schema.
102
- */
103
- readonly allowedSchemaModifications: AllowedUpdateType;
104
- }
105
- /**
106
- * Options used to initialize (if needed) and schematize a `SharedTree`.
107
- */
108
- export interface InitializeAndSchematizeConfiguration<TRoot extends FlexFieldSchema = FlexFieldSchema> extends TreeContent<TRoot>, SchematizeConfiguration<TRoot> {
109
- }
110
- /**
111
- * Options used to initialize (if needed) and schematize a `SharedTree`.
112
- * @remarks
113
- * Using this builder improves type safety and error quality over just constructing the configuration as a object.
114
- */
115
- export declare function buildTreeConfiguration<T extends FlexFieldSchema>(config: InitializeAndSchematizeConfiguration<T>): InitializeAndSchematizeConfiguration<T>;
116
77
  //# sourceMappingURL=schematizeTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schematiz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EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAChC,gBAAgB,EAAE;IACjB,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5C,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC5C,EACD,SAAS,EAAE,gBAAgB,EAC3B,cAAc,EAAE,MAAM,IAAI,GACxB,IAAI,CA+CN;AAED,oBAAY,UAAU;IACrB;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,UAAU,IAAA;IACV;;OAEG;IACH,gBAAgB,IAAA;IAChB;;OAEG;IACH,YAAY,IAAA;CACZ;AAED,wBAAgB,cAAc,CAC7B,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,GACrB,UAAU,CA4BZ;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAG9D;AAoBD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CA+BxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC3B,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,iBAAiB,GAAG,SAAS,GACxC,OAAO,CAiCT;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,GAAG,sBAAsB,GAAG,SAAS,CAAC;CAC7F"}
@@ -177,7 +177,7 @@ export function ensureSchema(viewSchema, allowedSchemaModifications, checkout, t
177
177
  return false;
178
178
  }
179
179
  case UpdateType.SchemaCompatible: {
180
- checkout.updateSchema(viewSchema.storedSchema);
180
+ checkout.updateSchema(viewSchema.schema);
181
181
  return true;
182
182
  }
183
183
  case UpdateType.Initialize: {
@@ -195,12 +195,4 @@ export function ensureSchema(viewSchema, allowedSchemaModifications, checkout, t
195
195
  }
196
196
  }
197
197
  }
198
- /**
199
- * Options used to initialize (if needed) and schematize a `SharedTree`.
200
- * @remarks
201
- * Using this builder improves type safety and error quality over just constructing the configuration as a object.
202
- */
203
- export function buildTreeConfiguration(config) {
204
- return config;
205
- }
206
198
  //# sourceMappingURL=schematizeTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schematizeTree.js","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EACN,iBAAiB,EACjB,aAAa,EAIb,YAAY,EACZ,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,UAAU,EAIV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAChC,gBAGC,EACD,SAA2B,EAC3B,cAA0B;IAE1B,MAAM,CACL,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAChD,KAAK,CAAC,6CAA6C,CACnD,CAAC;IAEF,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;IAEjC,mJAAmJ;IACnJ,IAAI,uBAAyC,CAAC;IAC9C,IACC,QAAQ,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU;QAC3C,QAAQ,KAAK,UAAU,CAAC,QAAQ,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;YACT,eAAe,CAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC;AAwDD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,MAA+C;IAE/C,OAAO,MAAM,CAAC;AACf,CAAC","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"]}
1
+ {"version":3,"file":"schematizeTree.js","sourceRoot":"","sources":["../../src/shared-tree/schematizeTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EACN,iBAAiB,EACjB,aAAa,EAIb,YAAY,EACZ,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKzD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAChC,gBAGC,EACD,SAA2B,EAC3B,cAA0B;IAE1B,MAAM,CACL,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAChD,KAAK,CAAC,6CAA6C,CACnD,CAAC;IAEF,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,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AAQ;YACR,sFAAsF;YACtF,iGAAiG;YACjG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,eAAe,CAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;AACF,CAAC","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\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\";\nimport type { ViewSchema } from \"../simple-tree/index.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.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 * 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"]}
@@ -3,10 +3,10 @@
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 NodeKeyManager, ViewSchema, type FlexTreeSchema } from "../feature-libraries/index.js";
7
- import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type InsertableTreeFieldFromImplicitField, type TreeFieldFromImplicitField, type TreeView, type TreeViewEvents, type TreeViewConfiguration } from "../simple-tree/index.js";
6
+ import { type NodeKeyManager, type FullSchemaPolicy } from "../feature-libraries/index.js";
7
+ import { type ImplicitFieldSchema, type SchemaCompatibilityStatus, type InsertableTreeFieldFromImplicitField, type TreeFieldFromImplicitField, type TreeView, type TreeViewEvents, ViewSchema, type TreeViewConfiguration } from "../simple-tree/index.js";
8
8
  import { Breakable, type WithBreakable } from "../util/index.js";
9
- import type { ITreeCheckout } from "./treeCheckout.js";
9
+ import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
10
10
  import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
11
11
  /**
12
12
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
@@ -17,10 +17,11 @@ export declare const ViewSlot: import("../core/index.js").AnchorSlot<TreeView<Im
17
17
  * Implementation of TreeView wrapping a FlexTreeView.
18
18
  */
19
19
  export declare class SchematizingSimpleTreeView<in out TRootSchema extends ImplicitFieldSchema> implements TreeView<TRootSchema>, WithBreakable {
20
- readonly checkout: ITreeCheckout;
20
+ readonly checkout: TreeCheckout;
21
21
  readonly config: TreeViewConfiguration<TRootSchema>;
22
22
  readonly nodeKeyManager: NodeKeyManager;
23
23
  readonly breaker: Breakable;
24
+ private readonly onDispose?;
24
25
  /**
25
26
  * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
26
27
  *
@@ -31,7 +32,7 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
31
32
  * Undefined iff uninitialized or disposed.
32
33
  */
33
34
  private currentCompatibility;
34
- private readonly flexSchema;
35
+ private readonly schemaPolicy;
35
36
  readonly events: Listenable<TreeViewEvents> & IEmitter<TreeViewEvents> & HasListeners<TreeViewEvents>;
36
37
  private readonly viewSchema;
37
38
  private readonly unregisterCallbacks;
@@ -44,7 +45,7 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
44
45
  */
45
46
  private midUpgrade;
46
47
  private readonly rootFieldSchema;
47
- constructor(checkout: ITreeCheckout, config: TreeViewConfiguration<TRootSchema>, nodeKeyManager: NodeKeyManager, breaker?: Breakable);
48
+ constructor(checkout: TreeCheckout, config: TreeViewConfiguration<TRootSchema>, nodeKeyManager: NodeKeyManager, breaker?: Breakable, onDispose?: (() => void) | undefined);
48
49
  get schema(): TRootSchema;
49
50
  initialize(content: InsertableTreeFieldFromImplicitField<TRootSchema>): void;
50
51
  upgradeSchema(): void;
@@ -77,5 +78,5 @@ export declare class SchematizingSimpleTreeView<in out TRootSchema extends Impli
77
78
  * Creates a view that self-disposes whenenever the stored schema changes.
78
79
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
79
80
  */
80
- export declare function requireSchema(checkout: ITreeCheckout, viewSchema: ViewSchema, onDispose: () => void, nodeKeyManager: NodeKeyManager, flexTreeSchema: FlexTreeSchema): CheckoutFlexTreeView;
81
+ export declare function requireSchema(checkout: ITreeCheckout, viewSchema: ViewSchema, onDispose: () => void, nodeKeyManager: NodeKeyManager, schemaPolicy: FullSchemaPolicy): CheckoutFlexTreeView;
81
82
  //# sourceMappingURL=schematizingTreeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schematizingTreeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/schematizingTreeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,UAAU,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,cAAc,EACnB,UAAU,EAIV,KAAK,cAAc,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,0BAA0B,EAC/B,KAAK,QAAQ,EACb,KAAK,cAAc,EAMnB,KAAK,qBAAqB,EAG1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAgC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE;;;GAGG;AACH,eA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AE,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,YAAY,EAAE,gBAAgB,GAC5B,oBAAoB,CAiBtB"}
@@ -42,13 +42,14 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
42
42
  };
43
43
  import { assert } from "@fluidframework/core-utils/internal";
44
44
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
45
- import { AllowedUpdateType, anchorSlot, Compatibility } from "../core/index.js";
45
+ import { AllowedUpdateType, anchorSlot, Compatibility, } from "../core/index.js";
46
46
  import { createEmitter, } from "../events/index.js";
47
- import { ViewSchema, defaultSchemaPolicy, ContextSlot, cursorForMapTreeNode, intoStoredSchema, } from "../feature-libraries/index.js";
48
- import { getTreeNodeForField, toFlexSchema, setField, normalizeFieldSchema, mapTreeFromNodeData, prepareContentForHydration, } from "../simple-tree/index.js";
47
+ import { defaultSchemaPolicy, ContextSlot, cursorForMapTreeNode, } from "../feature-libraries/index.js";
48
+ import { getTreeNodeForField, setField, normalizeFieldSchema, ViewSchema, mapTreeFromNodeData, prepareContentForHydration, toStoredSchema, } from "../simple-tree/index.js";
49
49
  import { Breakable, breakingClass, disposeSymbol } from "../util/index.js";
50
50
  import { canInitialize, ensureSchema, initialize } from "./schematizeTree.js";
51
51
  import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
52
+ import { HydratedContext, SimpleContextSlot } from "../simple-tree/index.js";
52
53
  /**
53
54
  * Creating multiple tree views from the same checkout is not supported. This slot is used to detect if one already
54
55
  * exists and error if creating a second.
@@ -63,11 +64,12 @@ let SchematizingSimpleTreeView = (() => {
63
64
  let _classExtraInitializers = [];
64
65
  let _classThis;
65
66
  var SchematizingSimpleTreeView = _classThis = class {
66
- constructor(checkout, config, nodeKeyManager, breaker = new Breakable("SchematizingSimpleTreeView")) {
67
+ constructor(checkout, config, nodeKeyManager, breaker = new Breakable("SchematizingSimpleTreeView"), onDispose) {
67
68
  this.checkout = checkout;
68
69
  this.config = config;
69
70
  this.nodeKeyManager = nodeKeyManager;
70
71
  this.breaker = breaker;
72
+ this.onDispose = onDispose;
71
73
  this.events = createEmitter();
72
74
  this.unregisterCallbacks = new Set();
73
75
  this.disposed = false;
@@ -87,8 +89,8 @@ let SchematizingSimpleTreeView = (() => {
87
89
  validateSchema: config.enableSchemaValidation,
88
90
  };
89
91
  this.rootFieldSchema = normalizeFieldSchema(config.schema);
90
- this.flexSchema = toFlexSchema(config.schema);
91
- this.viewSchema = new ViewSchema(policy, {}, intoStoredSchema(this.flexSchema));
92
+ this.schemaPolicy = defaultSchemaPolicy;
93
+ this.viewSchema = new ViewSchema(policy, {}, toStoredSchema(this.rootFieldSchema));
92
94
  // This must be initialized before `update` can be called.
93
95
  this.currentCompatibility = {
94
96
  canView: false,
@@ -118,7 +120,7 @@ let SchematizingSimpleTreeView = (() => {
118
120
  });
119
121
  prepareContentForHydration(mapTree, this.checkout.forest);
120
122
  initialize(this.checkout, {
121
- schema: this.viewSchema.storedSchema,
123
+ schema: this.viewSchema.schema,
122
124
  initialTree: mapTree === undefined ? undefined : cursorForMapTreeNode(mapTree),
123
125
  });
124
126
  });
@@ -135,7 +137,7 @@ let SchematizingSimpleTreeView = (() => {
135
137
  }
136
138
  this.runSchemaEdit(() => {
137
139
  const result = ensureSchema(this.viewSchema, AllowedUpdateType.SchemaCompatible, this.checkout, {
138
- schema: this.viewSchema.storedSchema,
140
+ schema: this.viewSchema.schema,
139
141
  initialTree: undefined,
140
142
  });
141
143
  assert(result, 0x8bf /* Schema upgrade should always work if canUpgrade is set. */);
@@ -211,8 +213,10 @@ let SchematizingSimpleTreeView = (() => {
211
213
  this.update();
212
214
  }
213
215
  };
214
- const view = requireSchema(this.checkout, this.viewSchema, onViewDispose, this.nodeKeyManager, this.flexSchema);
216
+ const view = requireSchema(this.checkout, this.viewSchema, onViewDispose, this.nodeKeyManager, this.schemaPolicy);
215
217
  this.view = view;
218
+ assert(!this.checkout.forest.anchors.slots.has(SimpleContextSlot), "extra simple tree context");
219
+ this.checkout.forest.anchors.slots.set(SimpleContextSlot, new HydratedContext(this.rootFieldSchema.allowedTypeSet, view.context));
216
220
  const unregister = this.checkout.storedSchema.on("afterSchemaChange", () => {
217
221
  unregister();
218
222
  this.unregisterCallbacks.delete(unregister);
@@ -222,6 +226,7 @@ let SchematizingSimpleTreeView = (() => {
222
226
  }
223
227
  else {
224
228
  this.view = undefined;
229
+ this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
225
230
  const unregister = this.checkout.storedSchema.on("afterSchemaChange", () => {
226
231
  unregister();
227
232
  this.unregisterCallbacks.delete(unregister);
@@ -249,8 +254,10 @@ let SchematizingSimpleTreeView = (() => {
249
254
  if (this.view !== undefined) {
250
255
  this.view[disposeSymbol]();
251
256
  this.view = undefined;
257
+ this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
252
258
  this.unregisterCallbacks.forEach((unregister) => unregister());
253
259
  }
260
+ this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
254
261
  }
255
262
  get compatibility() {
256
263
  if (!this.currentCompatibility) {
@@ -263,6 +270,7 @@ let SchematizingSimpleTreeView = (() => {
263
270
  this.disposeView();
264
271
  this.checkout.forest.anchors.slots.delete(ViewSlot);
265
272
  this.currentCompatibility = undefined;
273
+ this.onDispose?.();
266
274
  }
267
275
  get root() {
268
276
  this.breaker.use();
@@ -296,7 +304,7 @@ export { SchematizingSimpleTreeView };
296
304
  * Creates a view that self-disposes whenenever the stored schema changes.
297
305
  * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
298
306
  */
299
- export function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager, flexTreeSchema) {
307
+ export function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager, schemaPolicy) {
300
308
  const slots = checkout.forest.anchors.slots;
301
309
  assert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);
302
310
  {
@@ -304,7 +312,7 @@ export function requireSchema(checkout, viewSchema, onDispose, nodeKeyManager, f
304
312
  assert(compatibility.write === Compatibility.Compatible &&
305
313
  compatibility.read === Compatibility.Compatible, 0x8c3 /* requireSchema invoked with incompatible schema */);
306
314
  }
307
- const view = new CheckoutFlexTreeView(checkout, flexTreeSchema, nodeKeyManager, onDispose);
315
+ const view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);
308
316
  assert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);
309
317
  return view;
310
318
  }