@fluidframework/tree 2.3.0-288113 → 2.4.0-294316

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 (900) hide show
  1. package/.dependency-cruiser-known-violations.json +28 -40
  2. package/.vscode/Tree.code-workspace +0 -2
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +6 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  10. package/api-extractor/api-extractor.current.json +8 -0
  11. package/api-extractor/api-extractor.legacy.json +4 -0
  12. package/api-extractor.json +1 -1
  13. package/api-report/tree.alpha.api.md +42 -54
  14. package/api-report/tree.beta.api.md +35 -16
  15. package/api-report/tree.legacy.alpha.api.md +571 -0
  16. package/api-report/tree.legacy.public.api.md +568 -0
  17. package/api-report/tree.public.api.md +22 -18
  18. package/dist/alpha.d.ts +103 -0
  19. package/dist/beta.d.ts +7 -2
  20. package/dist/core/index.d.ts +2 -2
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +4 -3
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/rebase/index.d.ts +1 -1
  25. package/dist/core/rebase/index.d.ts.map +1 -1
  26. package/dist/core/rebase/index.js +2 -1
  27. package/dist/core/rebase/index.js.map +1 -1
  28. package/dist/core/rebase/types.d.ts +1 -0
  29. package/dist/core/rebase/types.d.ts.map +1 -1
  30. package/dist/core/rebase/types.js +8 -1
  31. package/dist/core/rebase/types.js.map +1 -1
  32. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  33. package/dist/core/revertible.d.ts.map +1 -0
  34. package/dist/core/revertible.js.map +1 -0
  35. package/dist/core/schema-stored/format.d.ts +3 -3
  36. package/dist/core/schema-stored/format.js +1 -1
  37. package/dist/core/schema-stored/format.js.map +1 -1
  38. package/dist/core/schema-stored/schema.d.ts +2 -7
  39. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  40. package/dist/core/schema-stored/schema.js +4 -6
  41. package/dist/core/schema-stored/schema.js.map +1 -1
  42. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  43. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  44. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  45. package/dist/core/tree/anchorSet.js +6 -2
  46. package/dist/core/tree/anchorSet.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  48. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndex.js +1 -0
  50. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  51. package/dist/core/tree/visitDelta.d.ts +7 -2
  52. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  53. package/dist/core/tree/visitDelta.js.map +1 -1
  54. package/dist/events/emitter.d.ts +127 -0
  55. package/dist/events/emitter.d.ts.map +1 -0
  56. package/dist/events/{events.js → emitter.js} +48 -30
  57. package/dist/events/emitter.js.map +1 -0
  58. package/dist/events/index.d.ts +2 -1
  59. package/dist/events/index.d.ts.map +1 -1
  60. package/dist/events/index.js +4 -5
  61. package/dist/events/index.js.map +1 -1
  62. package/dist/events/interop.d.ts +36 -0
  63. package/dist/events/interop.d.ts.map +1 -0
  64. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  65. package/dist/events/interop.js.map +1 -0
  66. package/dist/events/listeners.d.ts +65 -0
  67. package/dist/events/listeners.d.ts.map +1 -0
  68. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  69. package/dist/events/listeners.js.map +1 -0
  70. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  71. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  73. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  75. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  81. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  83. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  85. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  87. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  89. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  90. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  91. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -103
  93. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  95. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/context.js +10 -7
  97. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  98. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  99. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  100. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -3
  101. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  102. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  103. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  104. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  106. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  108. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  110. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/lazyField.js +11 -14
  112. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  113. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  114. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  115. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -74
  116. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  117. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  118. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  119. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  120. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  121. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  122. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  123. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  124. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  126. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  127. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  128. package/dist/feature-libraries/index.d.ts +3 -5
  129. package/dist/feature-libraries/index.d.ts.map +1 -1
  130. package/dist/feature-libraries/index.js +5 -11
  131. package/dist/feature-libraries/index.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  133. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  134. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  135. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  136. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  137. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  138. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  139. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  140. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  141. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  142. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +73 -22
  143. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  144. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  145. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  146. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  147. package/dist/feature-libraries/sequence-field/compose.js +3 -0
  148. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  149. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  150. package/dist/feature-libraries/sequence-field/utils.js +1 -4
  151. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  152. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  153. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  154. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  155. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  156. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  157. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  158. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  159. package/dist/feature-libraries/typed-schema/index.js +2 -2
  160. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  161. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  162. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  163. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  164. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  165. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  166. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  167. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  168. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  169. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  170. package/dist/feature-libraries/typed-schema/view.js +5 -4
  171. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  172. package/dist/index.d.ts +4 -4
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +33 -36
  175. package/dist/index.js.map +1 -1
  176. package/dist/legacy.d.ts +84 -0
  177. package/dist/packageVersion.d.ts +1 -1
  178. package/dist/packageVersion.js +1 -1
  179. package/dist/packageVersion.js.map +1 -1
  180. package/dist/public.d.ts +1 -1
  181. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  182. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  183. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  184. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  185. package/dist/shared-tree/index.d.ts +3 -3
  186. package/dist/shared-tree/index.d.ts.map +1 -1
  187. package/dist/shared-tree/index.js +2 -2
  188. package/dist/shared-tree/index.js.map +1 -1
  189. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  190. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  191. package/dist/shared-tree/schematizeTree.js +7 -8
  192. package/dist/shared-tree/schematizeTree.js.map +1 -1
  193. package/dist/shared-tree/schematizingTreeView.d.ts +10 -4
  194. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  195. package/dist/shared-tree/schematizingTreeView.js +28 -12
  196. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  197. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  198. package/dist/shared-tree/sharedTree.js +2 -2
  199. package/dist/shared-tree/sharedTree.js.map +1 -1
  200. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  201. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  202. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  203. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  204. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  205. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  206. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  207. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  208. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  209. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  210. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  211. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  212. package/dist/shared-tree/treeApi.d.ts +1 -3
  213. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  214. package/dist/shared-tree/treeApi.js +6 -4
  215. package/dist/shared-tree/treeApi.js.map +1 -1
  216. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  217. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  218. package/dist/shared-tree/treeCheckout.js +17 -1
  219. package/dist/shared-tree/treeCheckout.js.map +1 -1
  220. package/dist/shared-tree-core/branch.js +1 -1
  221. package/dist/shared-tree-core/branch.js.map +1 -1
  222. package/dist/simple-tree/api/create.d.ts.map +1 -1
  223. package/dist/simple-tree/api/create.js +1 -1
  224. package/dist/simple-tree/api/create.js.map +1 -1
  225. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  226. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  227. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  228. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  229. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  230. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  231. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  232. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  233. package/dist/simple-tree/api/index.d.ts +5 -0
  234. package/dist/simple-tree/api/index.d.ts.map +1 -1
  235. package/dist/simple-tree/api/index.js +7 -1
  236. package/dist/simple-tree/api/index.js.map +1 -1
  237. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +14 -15
  238. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  239. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  240. package/dist/simple-tree/api/schemaFactory.d.ts +53 -16
  241. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  242. package/dist/simple-tree/api/schemaFactory.js +49 -12
  243. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  244. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +8 -4
  245. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  246. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  247. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  248. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +34 -21
  249. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  250. package/dist/simple-tree/api/tree.d.ts +5 -21
  251. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  252. package/dist/simple-tree/api/tree.js +3 -38
  253. package/dist/simple-tree/api/tree.js.map +1 -1
  254. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  255. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  256. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  257. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  258. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -1
  259. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  260. package/dist/simple-tree/api/treeNodeApi.js +21 -19
  261. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  262. package/dist/simple-tree/api/verboseTree.js +2 -2
  263. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  264. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  265. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  266. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +8 -4
  267. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  268. package/dist/simple-tree/arrayNode.d.ts +2 -2
  269. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  270. package/dist/simple-tree/arrayNode.js +30 -21
  271. package/dist/simple-tree/arrayNode.js.map +1 -1
  272. package/dist/simple-tree/core/index.d.ts +3 -3
  273. package/dist/simple-tree/core/index.d.ts.map +1 -1
  274. package/dist/simple-tree/core/index.js +4 -1
  275. package/dist/simple-tree/core/index.js.map +1 -1
  276. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  277. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  278. package/dist/simple-tree/core/schemaCaching.js +10 -1
  279. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  280. package/dist/simple-tree/core/treeNodeKernel.d.ts +61 -3
  281. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  282. package/dist/simple-tree/core/treeNodeKernel.js +166 -13
  283. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  284. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  285. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  286. package/dist/simple-tree/core/types.d.ts +17 -20
  287. package/dist/simple-tree/core/types.d.ts.map +1 -1
  288. package/dist/simple-tree/core/types.js.map +1 -1
  289. package/dist/simple-tree/core/withType.d.ts +3 -2
  290. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  291. package/dist/simple-tree/core/withType.js.map +1 -1
  292. package/dist/simple-tree/index.d.ts +8 -10
  293. package/dist/simple-tree/index.d.ts.map +1 -1
  294. package/dist/simple-tree/index.js +15 -6
  295. package/dist/simple-tree/index.js.map +1 -1
  296. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  297. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  298. package/dist/simple-tree/leafNodeSchema.js +13 -11
  299. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  300. package/dist/simple-tree/mapNode.d.ts +1 -1
  301. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  302. package/dist/simple-tree/mapNode.js +38 -29
  303. package/dist/simple-tree/mapNode.js.map +1 -1
  304. package/dist/simple-tree/objectNode.d.ts +9 -7
  305. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  306. package/dist/simple-tree/objectNode.js +37 -31
  307. package/dist/simple-tree/objectNode.js.map +1 -1
  308. package/dist/simple-tree/proxies.d.ts +1 -14
  309. package/dist/simple-tree/proxies.d.ts.map +1 -1
  310. package/dist/simple-tree/proxies.js +12 -15
  311. package/dist/simple-tree/proxies.js.map +1 -1
  312. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  313. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  314. package/dist/simple-tree/proxyBinding.js +8 -181
  315. package/dist/simple-tree/proxyBinding.js.map +1 -1
  316. package/dist/simple-tree/schemaTypes.d.ts +51 -11
  317. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  318. package/dist/simple-tree/schemaTypes.js +14 -4
  319. package/dist/simple-tree/schemaTypes.js.map +1 -1
  320. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  321. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  322. package/dist/simple-tree/toFlexSchema.js +54 -31
  323. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  324. package/dist/simple-tree/toMapTree.d.ts +25 -37
  325. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  326. package/dist/simple-tree/toMapTree.js +53 -16
  327. package/dist/simple-tree/toMapTree.js.map +1 -1
  328. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  329. package/dist/simple-tree/treeNodeValid.js +7 -10
  330. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  331. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  332. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  333. package/dist/simple-tree/walkSchema.d.ts +26 -0
  334. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  335. package/dist/simple-tree/walkSchema.js +49 -0
  336. package/dist/simple-tree/walkSchema.js.map +1 -0
  337. package/dist/treeFactory.d.ts +2 -1
  338. package/dist/treeFactory.d.ts.map +1 -1
  339. package/dist/treeFactory.js +2 -1
  340. package/dist/treeFactory.js.map +1 -1
  341. package/dist/util/typeUtils.d.ts +2 -2
  342. package/dist/util/typeUtils.js.map +1 -1
  343. package/legacy.d.ts +11 -0
  344. package/lib/alpha.d.ts +103 -0
  345. package/lib/beta.d.ts +7 -2
  346. package/lib/core/index.d.ts +2 -2
  347. package/lib/core/index.d.ts.map +1 -1
  348. package/lib/core/index.js +2 -2
  349. package/lib/core/index.js.map +1 -1
  350. package/lib/core/rebase/index.d.ts +1 -1
  351. package/lib/core/rebase/index.d.ts.map +1 -1
  352. package/lib/core/rebase/index.js +1 -1
  353. package/lib/core/rebase/index.js.map +1 -1
  354. package/lib/core/rebase/types.d.ts +1 -0
  355. package/lib/core/rebase/types.d.ts.map +1 -1
  356. package/lib/core/rebase/types.js +6 -0
  357. package/lib/core/rebase/types.js.map +1 -1
  358. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  359. package/lib/core/revertible.d.ts.map +1 -0
  360. package/lib/core/revertible.js.map +1 -0
  361. package/lib/core/schema-stored/format.d.ts +3 -3
  362. package/lib/core/schema-stored/format.js +1 -1
  363. package/lib/core/schema-stored/format.js.map +1 -1
  364. package/lib/core/schema-stored/schema.d.ts +2 -7
  365. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  366. package/lib/core/schema-stored/schema.js +4 -6
  367. package/lib/core/schema-stored/schema.js.map +1 -1
  368. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  369. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  370. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  371. package/lib/core/tree/anchorSet.js +6 -2
  372. package/lib/core/tree/anchorSet.js.map +1 -1
  373. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  374. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  375. package/lib/core/tree/detachedFieldIndex.js +1 -0
  376. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  377. package/lib/core/tree/visitDelta.d.ts +7 -2
  378. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  379. package/lib/core/tree/visitDelta.js.map +1 -1
  380. package/lib/events/emitter.d.ts +127 -0
  381. package/lib/events/emitter.d.ts.map +1 -0
  382. package/lib/events/{events.js → emitter.js} +48 -29
  383. package/lib/events/emitter.js.map +1 -0
  384. package/lib/events/index.d.ts +2 -1
  385. package/lib/events/index.d.ts.map +1 -1
  386. package/lib/events/index.js +1 -1
  387. package/lib/events/index.js.map +1 -1
  388. package/lib/events/interop.d.ts +36 -0
  389. package/lib/events/interop.d.ts.map +1 -0
  390. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  391. package/lib/events/interop.js.map +1 -0
  392. package/lib/events/listeners.d.ts +65 -0
  393. package/lib/events/listeners.d.ts.map +1 -0
  394. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  395. package/lib/events/listeners.js.map +1 -0
  396. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  397. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  398. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  399. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  400. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  401. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  402. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  403. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  404. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  405. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  406. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  407. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  408. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  409. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  410. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  411. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  412. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  413. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  414. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  415. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  416. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  417. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  418. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -104
  419. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  420. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  421. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  422. package/lib/feature-libraries/flex-tree/context.js +10 -7
  423. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  424. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  425. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  426. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -2
  427. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  428. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  429. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  430. package/lib/feature-libraries/flex-tree/index.js +1 -1
  431. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  432. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  433. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  434. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  435. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  436. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  437. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  438. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  439. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  440. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  441. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  442. package/lib/feature-libraries/flex-tree/lazyNode.js +23 -72
  443. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  444. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  445. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  446. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  447. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  448. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  449. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  450. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  451. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  452. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  453. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  454. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  455. package/lib/feature-libraries/index.d.ts +3 -5
  456. package/lib/feature-libraries/index.d.ts.map +1 -1
  457. package/lib/feature-libraries/index.js +5 -5
  458. package/lib/feature-libraries/index.js.map +1 -1
  459. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  460. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  461. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  462. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  463. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  464. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  465. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  466. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  467. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  468. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  469. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +74 -23
  470. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  471. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  472. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  473. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  474. package/lib/feature-libraries/sequence-field/compose.js +3 -0
  475. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  476. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  477. package/lib/feature-libraries/sequence-field/utils.js +2 -5
  478. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  479. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  480. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  481. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  482. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  483. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  484. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  485. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  486. package/lib/feature-libraries/typed-schema/index.js +2 -2
  487. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  488. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  489. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  490. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  491. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  492. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  493. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  494. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  495. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  496. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  497. package/lib/feature-libraries/typed-schema/view.js +5 -4
  498. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  499. package/lib/index.d.ts +4 -4
  500. package/lib/index.d.ts.map +1 -1
  501. package/lib/index.js +3 -5
  502. package/lib/index.js.map +1 -1
  503. package/lib/legacy.d.ts +84 -0
  504. package/lib/packageVersion.d.ts +1 -1
  505. package/lib/packageVersion.js +1 -1
  506. package/lib/packageVersion.js.map +1 -1
  507. package/lib/public.d.ts +1 -1
  508. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  509. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  510. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  511. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  512. package/lib/shared-tree/index.d.ts +3 -3
  513. package/lib/shared-tree/index.d.ts.map +1 -1
  514. package/lib/shared-tree/index.js +1 -1
  515. package/lib/shared-tree/index.js.map +1 -1
  516. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  517. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  518. package/lib/shared-tree/schematizeTree.js +8 -9
  519. package/lib/shared-tree/schematizeTree.js.map +1 -1
  520. package/lib/shared-tree/schematizingTreeView.d.ts +10 -4
  521. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  522. package/lib/shared-tree/schematizingTreeView.js +29 -13
  523. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  524. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  525. package/lib/shared-tree/sharedTree.js +2 -2
  526. package/lib/shared-tree/sharedTree.js.map +1 -1
  527. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  528. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  529. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  530. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  531. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  532. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  533. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  534. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  535. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  536. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  537. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  538. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  539. package/lib/shared-tree/treeApi.d.ts +1 -3
  540. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  541. package/lib/shared-tree/treeApi.js +7 -5
  542. package/lib/shared-tree/treeApi.js.map +1 -1
  543. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  544. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  545. package/lib/shared-tree/treeCheckout.js +18 -2
  546. package/lib/shared-tree/treeCheckout.js.map +1 -1
  547. package/lib/shared-tree-core/branch.js +1 -1
  548. package/lib/shared-tree-core/branch.js.map +1 -1
  549. package/lib/simple-tree/api/create.d.ts.map +1 -1
  550. package/lib/simple-tree/api/create.js +2 -2
  551. package/lib/simple-tree/api/create.js.map +1 -1
  552. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  553. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  554. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  555. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  556. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  557. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  558. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  559. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  560. package/lib/simple-tree/api/index.d.ts +5 -0
  561. package/lib/simple-tree/api/index.d.ts.map +1 -1
  562. package/lib/simple-tree/api/index.js +3 -0
  563. package/lib/simple-tree/api/index.js.map +1 -1
  564. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +14 -15
  565. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  566. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  567. package/lib/simple-tree/api/schemaFactory.d.ts +53 -16
  568. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  569. package/lib/simple-tree/api/schemaFactory.js +49 -12
  570. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  571. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +8 -4
  572. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  573. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  574. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  575. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +35 -22
  576. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  577. package/lib/simple-tree/api/tree.d.ts +5 -21
  578. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  579. package/lib/simple-tree/api/tree.js +2 -34
  580. package/lib/simple-tree/api/tree.js.map +1 -1
  581. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  582. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  583. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  584. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  585. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -1
  586. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  587. package/lib/simple-tree/api/treeNodeApi.js +23 -21
  588. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  589. package/lib/simple-tree/api/verboseTree.js +1 -1
  590. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  591. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  592. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  593. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +8 -4
  594. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  595. package/lib/simple-tree/arrayNode.d.ts +2 -2
  596. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  597. package/lib/simple-tree/arrayNode.js +33 -24
  598. package/lib/simple-tree/arrayNode.js.map +1 -1
  599. package/lib/simple-tree/core/index.d.ts +3 -3
  600. package/lib/simple-tree/core/index.d.ts.map +1 -1
  601. package/lib/simple-tree/core/index.js +2 -2
  602. package/lib/simple-tree/core/index.js.map +1 -1
  603. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  604. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  605. package/lib/simple-tree/core/schemaCaching.js +8 -0
  606. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  607. package/lib/simple-tree/core/treeNodeKernel.d.ts +61 -3
  608. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  609. package/lib/simple-tree/core/treeNodeKernel.js +156 -5
  610. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  611. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  612. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  613. package/lib/simple-tree/core/types.d.ts +17 -20
  614. package/lib/simple-tree/core/types.d.ts.map +1 -1
  615. package/lib/simple-tree/core/types.js.map +1 -1
  616. package/lib/simple-tree/core/withType.d.ts +3 -2
  617. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  618. package/lib/simple-tree/core/withType.js.map +1 -1
  619. package/lib/simple-tree/index.d.ts +8 -10
  620. package/lib/simple-tree/index.d.ts.map +1 -1
  621. package/lib/simple-tree/index.js +5 -5
  622. package/lib/simple-tree/index.js.map +1 -1
  623. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  624. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  625. package/lib/simple-tree/leafNodeSchema.js +14 -12
  626. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  627. package/lib/simple-tree/mapNode.d.ts +1 -1
  628. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  629. package/lib/simple-tree/mapNode.js +38 -29
  630. package/lib/simple-tree/mapNode.js.map +1 -1
  631. package/lib/simple-tree/objectNode.d.ts +9 -7
  632. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  633. package/lib/simple-tree/objectNode.js +40 -34
  634. package/lib/simple-tree/objectNode.js.map +1 -1
  635. package/lib/simple-tree/proxies.d.ts +1 -14
  636. package/lib/simple-tree/proxies.d.ts.map +1 -1
  637. package/lib/simple-tree/proxies.js +11 -14
  638. package/lib/simple-tree/proxies.js.map +1 -1
  639. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  640. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  641. package/lib/simple-tree/proxyBinding.js +6 -174
  642. package/lib/simple-tree/proxyBinding.js.map +1 -1
  643. package/lib/simple-tree/schemaTypes.d.ts +51 -11
  644. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  645. package/lib/simple-tree/schemaTypes.js +14 -4
  646. package/lib/simple-tree/schemaTypes.js.map +1 -1
  647. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  648. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  649. package/lib/simple-tree/toFlexSchema.js +29 -8
  650. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  651. package/lib/simple-tree/toMapTree.d.ts +25 -37
  652. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  653. package/lib/simple-tree/toMapTree.js +54 -17
  654. package/lib/simple-tree/toMapTree.js.map +1 -1
  655. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  656. package/lib/simple-tree/treeNodeValid.js +8 -11
  657. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  658. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  659. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  660. package/lib/simple-tree/walkSchema.d.ts +26 -0
  661. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  662. package/lib/simple-tree/walkSchema.js +43 -0
  663. package/lib/simple-tree/walkSchema.js.map +1 -0
  664. package/lib/treeFactory.d.ts +2 -1
  665. package/lib/treeFactory.d.ts.map +1 -1
  666. package/lib/treeFactory.js +2 -1
  667. package/lib/treeFactory.js.map +1 -1
  668. package/lib/tsdoc-metadata.json +1 -1
  669. package/lib/util/typeUtils.d.ts +2 -2
  670. package/lib/util/typeUtils.js.map +1 -1
  671. package/package.json +68 -26
  672. package/src/core/index.ts +2 -1
  673. package/src/core/rebase/index.ts +1 -0
  674. package/src/core/rebase/types.ts +11 -0
  675. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  676. package/src/core/schema-stored/format.ts +1 -1
  677. package/src/core/schema-stored/schema.ts +7 -13
  678. package/src/core/tree/anchorSet.ts +18 -3
  679. package/src/core/tree/detachedFieldIndex.ts +6 -5
  680. package/src/core/tree/visitDelta.ts +7 -2
  681. package/src/events/{events.ts → emitter.ts} +52 -139
  682. package/src/events/index.ts +7 -7
  683. package/src/events/interop.ts +49 -0
  684. package/src/events/listeners.ts +68 -0
  685. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  686. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  687. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  688. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  689. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  690. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -210
  691. package/src/feature-libraries/flex-tree/README.md +4 -75
  692. package/src/feature-libraries/flex-tree/context.ts +37 -16
  693. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -291
  694. package/src/feature-libraries/flex-tree/index.ts +7 -13
  695. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  696. package/src/feature-libraries/flex-tree/lazyField.ts +49 -73
  697. package/src/feature-libraries/flex-tree/lazyNode.ts +25 -154
  698. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  699. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  700. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  701. package/src/feature-libraries/index.ts +2 -27
  702. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  703. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  704. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  705. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +111 -14
  706. package/src/feature-libraries/sequence-field/compose.ts +3 -0
  707. package/src/feature-libraries/sequence-field/utils.ts +2 -4
  708. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  709. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  710. package/src/feature-libraries/typed-schema/index.ts +1 -3
  711. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  712. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  713. package/src/feature-libraries/typed-schema/view.ts +4 -13
  714. package/src/index.ts +5 -8
  715. package/src/packageVersion.ts +1 -1
  716. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  717. package/src/shared-tree/index.ts +2 -7
  718. package/src/shared-tree/schematizeTree.ts +23 -12
  719. package/src/shared-tree/schematizingTreeView.ts +38 -24
  720. package/src/shared-tree/sharedTree.ts +6 -1
  721. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  722. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  723. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  724. package/src/shared-tree/treeApi.ts +10 -10
  725. package/src/shared-tree/treeCheckout.ts +26 -15
  726. package/src/shared-tree-core/branch.ts +1 -1
  727. package/src/simple-tree/ProxyBinding.md +23 -23
  728. package/src/simple-tree/api/create.ts +8 -3
  729. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  730. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  731. package/src/simple-tree/api/index.ts +20 -0
  732. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +20 -18
  733. package/src/simple-tree/api/schemaFactory.ts +56 -19
  734. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +9 -4
  735. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +43 -22
  736. package/src/simple-tree/api/tree.ts +7 -71
  737. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  738. package/src/simple-tree/api/treeNodeApi.ts +32 -23
  739. package/src/simple-tree/api/verboseTree.ts +1 -1
  740. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +11 -6
  741. package/src/simple-tree/arrayNode.ts +37 -31
  742. package/src/simple-tree/core/index.ts +4 -1
  743. package/src/simple-tree/core/schemaCaching.ts +10 -0
  744. package/src/simple-tree/core/treeNodeKernel.ts +198 -5
  745. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  746. package/src/simple-tree/core/types.ts +16 -27
  747. package/src/simple-tree/core/withType.ts +3 -1
  748. package/src/simple-tree/index.ts +30 -21
  749. package/src/simple-tree/leafNodeSchema.ts +24 -28
  750. package/src/simple-tree/mapNode.ts +47 -29
  751. package/src/simple-tree/objectNode.ts +51 -46
  752. package/src/simple-tree/proxies.ts +22 -51
  753. package/src/simple-tree/proxyBinding.ts +3 -254
  754. package/src/simple-tree/schemaTypes.ts +63 -13
  755. package/src/simple-tree/toFlexSchema.ts +40 -7
  756. package/src/simple-tree/toMapTree.ts +113 -79
  757. package/src/simple-tree/treeNodeValid.ts +10 -13
  758. package/src/simple-tree/typesUnsafe.ts +13 -13
  759. package/src/simple-tree/walkSchema.ts +81 -0
  760. package/src/treeFactory.ts +2 -1
  761. package/src/util/typeUtils.ts +2 -2
  762. package/dist/core/revertible/index.d.ts.map +0 -1
  763. package/dist/core/revertible/index.js +0 -10
  764. package/dist/core/revertible/index.js.map +0 -1
  765. package/dist/core/revertible/revertible.d.ts.map +0 -1
  766. package/dist/core/revertible/revertible.js.map +0 -1
  767. package/dist/domains/index.d.ts +0 -8
  768. package/dist/domains/index.d.ts.map +0 -1
  769. package/dist/domains/index.js +0 -20
  770. package/dist/domains/index.js.map +0 -1
  771. package/dist/domains/json/index.d.ts +0 -7
  772. package/dist/domains/json/index.d.ts.map +0 -1
  773. package/dist/domains/json/index.js +0 -17
  774. package/dist/domains/json/index.js.map +0 -1
  775. package/dist/domains/json/jsonCursor.d.ts +0 -52
  776. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  777. package/dist/domains/json/jsonCursor.js +0 -197
  778. package/dist/domains/json/jsonCursor.js.map +0 -1
  779. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  780. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  781. package/dist/domains/json/jsonDomainSchema.js +0 -32
  782. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  783. package/dist/domains/leafDomain.d.ts +0 -72
  784. package/dist/domains/leafDomain.d.ts.map +0 -1
  785. package/dist/domains/leafDomain.js +0 -88
  786. package/dist/domains/leafDomain.js.map +0 -1
  787. package/dist/domains/schemaBuilder.d.ts +0 -103
  788. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  789. package/dist/domains/schemaBuilder.js +0 -121
  790. package/dist/domains/schemaBuilder.js.map +0 -1
  791. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  792. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  793. package/dist/domains/testRecursiveDomain.js +0 -35
  794. package/dist/domains/testRecursiveDomain.js.map +0 -1
  795. package/dist/events/events.d.ts +0 -207
  796. package/dist/events/events.d.ts.map +0 -1
  797. package/dist/events/events.js.map +0 -1
  798. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  799. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  800. package/dist/feature-libraries/schemaBuilder.js +0 -40
  801. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  802. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  803. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  804. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  805. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  806. package/dist/shared-tree/treeView.d.ts +0 -73
  807. package/dist/shared-tree/treeView.d.ts.map +0 -1
  808. package/dist/shared-tree/treeView.js.map +0 -1
  809. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  810. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  811. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  812. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  813. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  814. package/dist/simple-tree/jsonSchema.js.map +0 -1
  815. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  816. package/dist/simple-tree/simpleSchema.js.map +0 -1
  817. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  818. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  819. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  820. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  821. package/lib/core/revertible/index.d.ts.map +0 -1
  822. package/lib/core/revertible/index.js.map +0 -1
  823. package/lib/core/revertible/revertible.d.ts.map +0 -1
  824. package/lib/core/revertible/revertible.js.map +0 -1
  825. package/lib/domains/index.d.ts +0 -8
  826. package/lib/domains/index.d.ts.map +0 -1
  827. package/lib/domains/index.js +0 -8
  828. package/lib/domains/index.js.map +0 -1
  829. package/lib/domains/json/index.d.ts +0 -7
  830. package/lib/domains/json/index.d.ts.map +0 -1
  831. package/lib/domains/json/index.js +0 -7
  832. package/lib/domains/json/index.js.map +0 -1
  833. package/lib/domains/json/jsonCursor.d.ts +0 -52
  834. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  835. package/lib/domains/json/jsonCursor.js +0 -192
  836. package/lib/domains/json/jsonCursor.js.map +0 -1
  837. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  838. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  839. package/lib/domains/json/jsonDomainSchema.js +0 -29
  840. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  841. package/lib/domains/leafDomain.d.ts +0 -72
  842. package/lib/domains/leafDomain.d.ts.map +0 -1
  843. package/lib/domains/leafDomain.js +0 -85
  844. package/lib/domains/leafDomain.js.map +0 -1
  845. package/lib/domains/schemaBuilder.d.ts +0 -103
  846. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  847. package/lib/domains/schemaBuilder.js +0 -117
  848. package/lib/domains/schemaBuilder.js.map +0 -1
  849. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  850. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  851. package/lib/domains/testRecursiveDomain.js +0 -32
  852. package/lib/domains/testRecursiveDomain.js.map +0 -1
  853. package/lib/events/events.d.ts +0 -207
  854. package/lib/events/events.d.ts.map +0 -1
  855. package/lib/events/events.js.map +0 -1
  856. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  857. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  858. package/lib/feature-libraries/schemaBuilder.js +0 -36
  859. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  860. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  861. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  862. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  863. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  864. package/lib/shared-tree/treeView.d.ts +0 -73
  865. package/lib/shared-tree/treeView.d.ts.map +0 -1
  866. package/lib/shared-tree/treeView.js.map +0 -1
  867. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  868. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  869. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  870. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  871. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  872. package/lib/simple-tree/jsonSchema.js.map +0 -1
  873. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  874. package/lib/simple-tree/simpleSchema.js.map +0 -1
  875. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  876. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  877. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  878. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  879. package/src/domains/README.md +0 -6
  880. package/src/domains/fence.json +0 -5
  881. package/src/domains/index.ts +0 -19
  882. package/src/domains/json/fence.json +0 -5
  883. package/src/domains/json/index.ts +0 -13
  884. package/src/domains/json/jsonCursor.ts +0 -247
  885. package/src/domains/json/jsonDomainSchema.ts +0 -47
  886. package/src/domains/leafDomain.ts +0 -97
  887. package/src/domains/schemaBuilder.ts +0 -153
  888. package/src/domains/testRecursiveDomain.ts +0 -38
  889. package/src/events/fence.json +0 -5
  890. package/src/feature-libraries/schemaBuilder.ts +0 -45
  891. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  892. package/src/shared-tree/treeView.ts +0 -113
  893. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  894. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  895. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  896. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  897. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  898. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  899. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  900. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -5,15 +5,14 @@
5
5
  */
6
6
  var _a, _b;
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.unsupportedUsageError = exports.getOrCreateMapTreeNode = exports.tryGetMapTreeNode = exports.EagerMapTreeMapNode = exports.EagerMapTreeNode = exports.isMapTreeSequenceField = exports.isMapTreeNode = void 0;
8
+ exports.unsupportedUsageError = exports.getOrCreateMapTreeNode = exports.tryGetMapTreeNode = exports.UnhydratedContext = exports.EagerMapTreeNode = exports.isMapTreeSequenceField = exports.isMapTreeNode = void 0;
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
+ const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
11
  const index_js_1 = require("../../core/index.js");
11
12
  const index_js_2 = require("../../util/index.js");
12
13
  const index_js_3 = require("../flex-tree/index.js");
13
14
  const index_js_4 = require("../typed-schema/index.js");
14
- const schemaBuilderBase_js_1 = require("../schemaBuilderBase.js");
15
15
  const index_js_5 = require("../default-schema/index.js");
16
- const internal_2 = require("@fluidframework/telemetry-utils/internal");
17
16
  /**
18
17
  * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.
19
18
  */
@@ -36,6 +35,9 @@ exports.isMapTreeSequenceField = isMapTreeSequenceField;
36
35
  * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.
37
36
  */
38
37
  class EagerMapTreeNode {
38
+ get schema() {
39
+ return this.flexSchema.name;
40
+ }
39
41
  /**
40
42
  * Create a new MapTreeNode.
41
43
  * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not
@@ -44,14 +46,14 @@ class EagerMapTreeNode {
44
46
  * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.
45
47
  * Instead, it should always be acquired via {@link getOrCreateNode}.
46
48
  */
47
- constructor(schema,
49
+ constructor(context, flexSchema,
48
50
  /** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */
49
51
  mapTree, location = unparentedLocation) {
50
- this.schema = schema;
52
+ this.context = context;
53
+ this.flexSchema = flexSchema;
51
54
  this.mapTree = mapTree;
52
55
  this.location = location;
53
56
  this[_a] = index_js_3.FlexTreeEntityKind.Node;
54
- this.context = undefined;
55
57
  (0, internal_1.assert)(!nodeCache.has(mapTree), 0x98b /* A node already exists for the given MapTree */);
56
58
  nodeCache.set(mapTree, this);
57
59
  // Fully demand the tree to ensure that parent pointers are present and accurate on all nodes.
@@ -64,7 +66,7 @@ class EagerMapTreeNode {
64
66
  this.walkTree();
65
67
  }
66
68
  get type() {
67
- return this.schema.name;
69
+ return this.flexSchema.name;
68
70
  }
69
71
  adoptBy(parent, index) {
70
72
  if (parent !== undefined) {
@@ -85,21 +87,25 @@ class EagerMapTreeNode {
85
87
  return this.location;
86
88
  }
87
89
  is(schema) {
88
- return schema === this.schema;
90
+ return schema === this.flexSchema;
89
91
  }
90
92
  tryGetField(key) {
91
93
  const field = this.mapTree.fields.get(key);
92
94
  // Only return the field if it is not empty, in order to fulfill the contract of `tryGetField`.
93
95
  if (field !== undefined && field.length > 0) {
94
- return getOrCreateField(this, key, this.schema.getFieldSchema(key));
96
+ return getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));
95
97
  }
96
98
  }
97
99
  getBoxed(key) {
98
100
  const fieldKey = (0, index_js_2.brand)(key);
99
- return getOrCreateField(this, fieldKey, this.schema.getFieldSchema(fieldKey));
101
+ return getOrCreateField(this, fieldKey, this.flexSchema.getFieldSchema(fieldKey));
100
102
  }
101
103
  boxedIterator() {
102
- return (0, index_js_2.mapIterable)(this.mapTree.fields.entries(), ([key]) => getOrCreateField(this, key, this.schema.getFieldSchema(key)));
104
+ return (0, index_js_2.mapIterable)(this.mapTree.fields.entries(), ([key]) => getOrCreateField(this, key, this.flexSchema.getFieldSchema(key)));
105
+ }
106
+ keys() {
107
+ // TODO: how this should handle missing defaults (and empty keys if they end up being allowed) needs to be determined.
108
+ return this.mapTree.fields.keys();
103
109
  }
104
110
  get value() {
105
111
  return this.mapTree.value;
@@ -111,9 +117,9 @@ class EagerMapTreeNode {
111
117
  }
112
118
  walkTree() {
113
119
  for (const [key, mapTrees] of this.mapTree.fields) {
114
- const field = getOrCreateField(this, key, this.schema.getFieldSchema(key));
120
+ const field = getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));
115
121
  for (let index = 0; index < field.length; index++) {
116
- const child = getOrCreateChild(mapTrees[index] ?? (0, internal_1.oob)(), this.schema.getFieldSchema(key).allowedTypes, { parent: field, index });
122
+ const child = getOrCreateChild(this.context, mapTrees[index] ?? (0, internal_1.oob)(), this.flexSchema.getFieldSchema(key).allowedTypes, { parent: field, index });
117
123
  // These next asserts detect the case where `getOrCreateChild` gets a cache hit of a different node than the one we're trying to create
118
124
  (0, internal_1.assert)(child.location !== undefined, 0x98d /* Expected node to have parent */);
119
125
  (0, internal_1.assert)(child.location.parent.parent === this, 0x98e /* Node may not be multi-parented */);
@@ -125,35 +131,34 @@ class EagerMapTreeNode {
125
131
  }
126
132
  exports.EagerMapTreeNode = EagerMapTreeNode;
127
133
  _a = index_js_3.flexTreeMarker;
134
+ // #endregion Nodes
128
135
  /**
129
- * The implementation of a map node created by {@link getOrCreateNode}.
136
+ * Implementation of `FlexTreeContext`.
137
+ *
138
+ * @remarks An editor is required to edit the FlexTree.
130
139
  */
131
- class EagerMapTreeMapNode extends EagerMapTreeNode {
132
- keys() {
133
- return this.mapTree.fields.keys();
134
- }
135
- values() {
136
- return (0, index_js_2.mapIterable)(this.mapTree.fields.keys(), (key) => unboxedField(this.tryGetField(key) ?? (0, index_js_2.fail)("Unexpected empty map field"), key, this.mapTree, this));
137
- }
138
- entries() {
139
- return (0, index_js_2.mapIterable)(this.mapTree.fields.keys(), (key) => [
140
- key,
141
- unboxedField(this.tryGetField(key) ?? (0, index_js_2.fail)("Unexpected empty map field"), key, this.mapTree, this),
142
- ]);
143
- }
144
- getBoxed(key) {
145
- return super.getBoxed(key);
146
- }
147
- [Symbol.iterator]() {
148
- return this.entries();
140
+ class UnhydratedContext {
141
+ /**
142
+ * @param flexSchema - Schema to use when working with the tree.
143
+ */
144
+ constructor(flexSchema) {
145
+ this.flexSchema = flexSchema;
146
+ this.schema = {
147
+ rootFieldSchema: flexSchema.rootFieldSchema.stored,
148
+ ...(0, index_js_4.intoStoredSchemaCollection)(flexSchema),
149
+ };
149
150
  }
150
- }
151
- exports.EagerMapTreeMapNode = EagerMapTreeMapNode;
152
- class EagerMapTreeLeafNode extends EagerMapTreeNode {
153
- get value() {
154
- return super.value;
151
+ isHydrated() {
152
+ return false;
155
153
  }
156
154
  }
155
+ exports.UnhydratedContext = UnhydratedContext;
156
+ const emptyContext = new UnhydratedContext({
157
+ adapters: {},
158
+ nodeSchema: new Map(),
159
+ policy: index_js_5.defaultSchemaPolicy,
160
+ rootFieldSchema: index_js_4.FlexFieldSchema.empty,
161
+ });
157
162
  /**
158
163
  * A special singleton that is the implicit {@link LocationInField} of all un-parented {@link EagerMapTreeNode}s.
159
164
  * @remarks This exists because {@link EagerMapTreeNode.parentField} must return a field.
@@ -168,8 +173,8 @@ const unparentedLocation = {
168
173
  length: 0,
169
174
  key: index_js_1.EmptyKey,
170
175
  parent: undefined,
171
- is(schema) {
172
- return schema === index_js_4.FlexFieldSchema.empty;
176
+ is(kind) {
177
+ return this.schema.kind === kind.identifier;
173
178
  },
174
179
  boxedIterator() {
175
180
  return [].values();
@@ -177,15 +182,22 @@ const unparentedLocation = {
177
182
  boxedAt(index) {
178
183
  return undefined;
179
184
  },
180
- schema: index_js_4.FlexFieldSchema.empty,
181
- context: undefined,
185
+ schema: index_js_4.FlexFieldSchema.empty.stored,
186
+ context: emptyContext,
182
187
  mapTrees: [],
188
+ getFieldPath() {
189
+ (0, index_js_2.fail)("unsupported");
190
+ },
183
191
  },
184
192
  index: -1,
185
193
  };
186
194
  class EagerMapTreeField {
187
- constructor(schema, key, parent) {
188
- this.schema = schema;
195
+ get schema() {
196
+ return this.flexSchema.stored;
197
+ }
198
+ constructor(context, flexSchema, key, parent) {
199
+ this.context = context;
200
+ this.flexSchema = flexSchema;
189
201
  this.key = key;
190
202
  this.parent = parent;
191
203
  this[_b] = index_js_3.FlexTreeEntityKind.Field;
@@ -210,12 +222,12 @@ class EagerMapTreeField {
210
222
  get length() {
211
223
  return this.mapTrees.length;
212
224
  }
213
- is(schema) {
214
- return this.schema.equals(schema);
225
+ is(kind) {
226
+ return this.schema.kind === kind.identifier;
215
227
  }
216
228
  boxedIterator() {
217
229
  return this.mapTrees
218
- .map((m, index) => getOrCreateChild(m, this.schema.allowedTypes, {
230
+ .map((m, index) => getOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {
219
231
  parent: this,
220
232
  index,
221
233
  }))
@@ -228,7 +240,7 @@ class EagerMapTreeField {
228
240
  }
229
241
  const m = this.mapTrees[i];
230
242
  if (m !== undefined) {
231
- return getOrCreateChild(m, this.schema.allowedTypes, {
243
+ return getOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {
232
244
  parent: this,
233
245
  index: i,
234
246
  });
@@ -252,6 +264,9 @@ class EagerMapTreeField {
252
264
  this.parent.mapTree.fields.delete(this.key);
253
265
  }
254
266
  }
267
+ getFieldPath() {
268
+ throw unsupportedUsageError("Editing an array");
269
+ }
255
270
  }
256
271
  _b = index_js_3.flexTreeMarker;
257
272
  class EagerMapTreeOptionalField extends EagerMapTreeField {
@@ -282,7 +297,7 @@ class EagerMapTreeOptionalField extends EagerMapTreeField {
282
297
  get content() {
283
298
  const value = this.mapTrees[0];
284
299
  if (value !== undefined) {
285
- return unboxedUnion(this.schema, value, {
300
+ return unboxed(this.flexSchema, value, {
286
301
  parent: this,
287
302
  index: 0,
288
303
  });
@@ -335,19 +350,16 @@ class EagerMapTreeSequenceField extends EagerMapTreeField {
335
350
  if (i === undefined) {
336
351
  return undefined;
337
352
  }
338
- return unboxedUnion(this.schema, this.mapTrees[i] ?? (0, internal_1.oob)(), { parent: this, index: i });
353
+ return unboxed(this.flexSchema, this.mapTrees[i] ?? (0, internal_1.oob)(), { parent: this, index: i });
339
354
  }
340
355
  map(callbackfn) {
341
356
  return Array.from(this, callbackfn);
342
357
  }
343
358
  *[Symbol.iterator]() {
344
359
  for (const [i, mapTree] of this.mapTrees.entries()) {
345
- yield unboxedUnion(this.schema, mapTree, { parent: this, index: i });
360
+ yield unboxed(this.flexSchema, mapTree, { parent: this, index: i });
346
361
  }
347
362
  }
348
- getFieldPath() {
349
- throw unsupportedUsageError("Editing an array");
350
- }
351
363
  }
352
364
  // #endregion Fields
353
365
  // #region Caching and unboxing utilities
@@ -371,37 +383,27 @@ exports.tryGetMapTreeNode = tryGetMapTreeNode;
371
383
  * @param mapTree - the {@link MapTree} containing the data for this node.
372
384
  * @remarks It must conform to the `nodeSchema`.
373
385
  */
374
- function getOrCreateMapTreeNode(nodeSchema, mapTree) {
375
- return nodeCache.get(mapTree) ?? createNode(nodeSchema, mapTree, undefined);
386
+ function getOrCreateMapTreeNode(context, nodeSchema, mapTree) {
387
+ return nodeCache.get(mapTree) ?? createNode(context, nodeSchema, mapTree, undefined);
376
388
  }
377
389
  exports.getOrCreateMapTreeNode = getOrCreateMapTreeNode;
378
390
  /** Helper for creating a `MapTreeNode` given the parent field (e.g. when "walking down") */
379
- function getOrCreateChild(mapTree, implicitAllowedTypes, parent) {
391
+ function getOrCreateChild(context, mapTree, allowedTypes, parent) {
380
392
  const cached = nodeCache.get(mapTree);
381
393
  if (cached !== undefined) {
382
394
  return cached;
383
395
  }
384
- const allowedTypes = (0, schemaBuilderBase_js_1.normalizeAllowedTypes)(implicitAllowedTypes);
396
+ (0, internal_1.assert)((0, index_js_2.isReadonlyArray)(allowedTypes), 0xa25 /* invalid types */);
385
397
  const nodeSchema = allowedTypes
386
398
  .map((t) => ((0, index_js_4.isLazy)(t) ? t() : t))
387
399
  .find((t) => {
388
- (0, internal_1.assert)(t !== "Any", 0x993 /* 'Any' type is not supported */);
389
400
  return t.name === mapTree.type;
390
401
  }) ?? (0, index_js_2.fail)("Unsupported node schema");
391
- return createNode(nodeSchema, mapTree, parent);
402
+ return createNode(context, nodeSchema, mapTree, parent);
392
403
  }
393
404
  /** Always constructs a new node, therefore may not be called twice for the same `MapTree`. */
394
- function createNode(nodeSchema, mapTree, parentField) {
395
- if ((0, index_js_4.schemaIsLeaf)(nodeSchema)) {
396
- return new EagerMapTreeLeafNode(nodeSchema, mapTree, parentField);
397
- }
398
- if ((0, index_js_4.schemaIsMap)(nodeSchema)) {
399
- return new EagerMapTreeMapNode(nodeSchema, mapTree, parentField);
400
- }
401
- if ((0, index_js_4.schemaIsObjectNode)(nodeSchema)) {
402
- return new EagerMapTreeNode(nodeSchema, mapTree, parentField);
403
- }
404
- (0, internal_1.assert)(false, 0x994 /* Unrecognized node kind */);
405
+ function createNode(context, nodeSchema, mapTree, parentField) {
406
+ return new EagerMapTreeNode(context, nodeSchema, mapTree, parentField);
405
407
  }
406
408
  /** Creates a field with the given attributes, or returns a cached field if there is one */
407
409
  function getOrCreateField(parent, key, schema) {
@@ -411,46 +413,23 @@ function getOrCreateField(parent, key, schema) {
411
413
  }
412
414
  if (schema.kind.identifier === index_js_5.FieldKinds.required.identifier ||
413
415
  schema.kind.identifier === index_js_5.FieldKinds.identifier.identifier) {
414
- return new EagerMapTreeRequiredField(schema, key, parent);
416
+ return new EagerMapTreeRequiredField(parent.context, schema, key, parent);
415
417
  }
416
418
  if (schema.kind.identifier === index_js_5.FieldKinds.optional.identifier) {
417
- return new EagerMapTreeOptionalField(schema, key, parent);
419
+ return new EagerMapTreeOptionalField(parent.context, schema, key, parent);
418
420
  }
419
421
  if (schema.kind.identifier === index_js_5.FieldKinds.sequence.identifier) {
420
- return new EagerMapTreeSequenceField(schema, key, parent);
422
+ return new EagerMapTreeSequenceField(parent.context, schema, key, parent);
421
423
  }
422
- return new EagerMapTreeField(schema, key, parent);
424
+ return new EagerMapTreeField(parent.context, schema, key, parent);
423
425
  }
424
- /** Unboxes non-polymorphic leaf nodes to their values, if applicable */
425
- function unboxedUnion(schema, mapTree, parent) {
426
- const type = schema.monomorphicChildType;
427
- if (type !== undefined) {
428
- if ((0, index_js_4.schemaIsLeaf)(type)) {
429
- return mapTree.value;
430
- }
431
- return getOrCreateChild(mapTree, type, parent);
432
- }
433
- return getOrCreateChild(mapTree, schema.allowedTypes, parent);
434
- }
435
- /** Unboxes non-polymorphic required and optional fields holding leaf nodes to their values, if applicable */
436
- function unboxedField(field, key, mapTree, parentNode) {
437
- const fieldSchema = field.schema;
438
- const mapTrees = mapTree.fields.get(key) ?? (0, index_js_2.fail)("Key does not exist in unhydrated map tree");
439
- if (fieldSchema.kind === index_js_5.FieldKinds.required) {
440
- return unboxedUnion(fieldSchema, mapTrees[0] ?? (0, internal_1.oob)(), {
441
- parent: field,
442
- index: 0,
443
- });
444
- }
445
- if (fieldSchema.kind === index_js_5.FieldKinds.optional) {
446
- return (mapTrees.length > 0
447
- ? unboxedUnion(fieldSchema, mapTrees[0] ?? (0, internal_1.oob)(), {
448
- parent: field,
449
- index: 0,
450
- })
451
- : undefined);
426
+ /** Unboxes leaf nodes to their values */
427
+ function unboxed(schema, mapTree, parent) {
428
+ const value = mapTree.value;
429
+ if (value !== undefined) {
430
+ return value;
452
431
  }
453
- return getOrCreateField(parentNode, key, fieldSchema);
432
+ return getOrCreateChild(parent.parent.context, mapTree, schema.allowedTypes, parent);
454
433
  }
455
434
  // #endregion Caching and unboxing utilities
456
435
  function unsupportedUsageError(message) {
@@ -1 +1 @@
1
- {"version":3,"file":"mapTreeNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/mapTreeNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAkE;AAClE,kDAU6B;AAC7B,kDAA4E;AAC5E,oDAgB+B;AAC/B,uDAUkC;AAClC,kEAA+F;AAE/F,yDAAuF;AACvF,uEAAsE;AAatE;;GAEG;AACH,SAAgB,aAAa,CAAC,QAAsB;IACnD,OAAO,QAAQ,YAAY,gBAAgB,CAAC;AAC7C,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CACrC,KAA+C;IAE/C,OAAO,KAAK,YAAY,yBAAyB,CAAC;AACnD,CAAC;AAJD,wDAIC;AA4BD;;;;;;GAMG;AACH,MAAa,gBAAgB;IAG5B;;;;;;;OAOG;IACH,YACiB,MAAe;IAC/B,iFAAiF;IACjE,OAAyB,EACjC,WAAW,kBAAkB;QAHrB,WAAM,GAAN,MAAM,CAAS;QAEf,YAAO,GAAP,OAAO,CAAkB;QACjC,aAAQ,GAAR,QAAQ,C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D,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,CAAC;SACR,CAAqC,CAAC;IACxC,CAAC;IACD,IAAI,WAAW,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,CACN,QAAQ,CAAC,MAAM,GAAG,CAAC;YAClB,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAA,cAAG,GAAE,EAAE;gBAChD,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,CAAC;aACR,CAAC;YACH,CAAC,CAAC,SAAS,CACwB,CAAC;IACvC,CAAC;IAED,OAAO,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,WAAW,CAAqC,CAAC;AAC3F,CAAC;AAED,4CAA4C;AAE5C,SAAgB,qBAAqB,CAAC,OAAgB;IACrD,OAAO,IAAI,qBAAU,CACpB,GACC,OAAO,IAAI,WACZ,4EAA4E,CAC5E,CAAC;AACH,CAAC;AAND,sDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype AnchorNode,\n\tEmptyKey,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype MapTree,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype Value,\n} from \"../../core/index.js\";\nimport { brand, fail, getOrCreate, mapIterable } from \"../../util/index.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeLeafNode,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeTypedNode,\n\ttype FlexTreeTypedNodeUnion,\n\ttype FlexTreeUnboxField,\n\ttype FlexTreeUnboxNodeUnion,\n\tflexTreeMarker,\n\tindexForAt,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype LeafNodeSchema,\n\tisLazy,\n\tschemaIsLeaf,\n\tschemaIsMap,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\nimport { type FlexImplicitAllowedTypes, normalizeAllowedTypes } from \"../schemaBuilderBase.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport { FieldKinds, type SequenceFieldEditBuilder } from \"../default-schema/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n// #region Nodes\n\n/**\n * A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.\n * Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.\n */\nexport interface MapTreeNode extends FlexTreeNode {\n\treadonly mapTree: MapTree;\n}\n\n/**\n * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.\n */\nexport function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode {\n\treturn flexNode instanceof EagerMapTreeNode;\n}\n\n/**\n * Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.\n */\nexport function isMapTreeSequenceField<T extends FlexAllowedTypes>(\n\tfield: FlexTreeSequenceField<T> | FlexTreeField,\n): field is MapTreeSequenceField<T> {\n\treturn field instanceof EagerMapTreeSequenceField;\n}\n\n/**\n * An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.\n * @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.\n */\nexport interface MapTreeSequenceField<T extends FlexAllowedTypes>\n\textends FlexTreeSequenceField<T> {\n\treadonly editor: MapTreeSequenceFieldEditBuilder;\n}\n\ninterface MapTreeSequenceFieldEditBuilder\n\textends SequenceFieldEditBuilder<ExclusiveMapTree[]> {\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t * @returns the MapTrees that were removed\n\t */\n\tremove(index: number, count: number): ExclusiveMapTree[];\n}\n\n/** A node's parent field and its index in that field */\ninterface LocationInField {\n\treadonly parent: MapTreeField;\n\treadonly index: number;\n}\n\n/**\n * A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Any methods that would mutate the node will fail,\n * as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).\n * MapTreeNodes are unconditionally cached -\n * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.\n */\nexport class EagerMapTreeNode<TSchema extends FlexTreeNodeSchema> implements MapTreeNode {\n\tpublic readonly [flexTreeMarker] = FlexTreeEntityKind.Node as const;\n\n\t/**\n\t * Create a new MapTreeNode.\n\t * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not\n\t * @remarks This class (and its subclasses) should not be directly constructed outside of this module.\n\t * Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.\n\t * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.\n\t * Instead, it should always be acquired via {@link getOrCreateNode}.\n\t */\n\tpublic constructor(\n\t\tpublic readonly schema: TSchema,\n\t\t/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */\n\t\tpublic readonly mapTree: ExclusiveMapTree,\n\t\tprivate location = unparentedLocation,\n\t) {\n\t\tassert(!nodeCache.has(mapTree), 0x98b /* A node already exists for the given MapTree */);\n\t\tnodeCache.set(mapTree, this);\n\n\t\t// Fully demand the tree to ensure that parent pointers are present and accurate on all nodes.\n\t\t// When a MapTreeNode is constructed, its MapTree may contain nodes (anywhere below) that map (via the `nodeCache`) to pre-existing MapTreeNodes.\n\t\t// Put another way, for a given MapTree, some ancestor MapTreeNode can be created after any number of its descendant MapTreeNodes already exist.\n\t\t// In such a case, the spine of nodes between the descendant and ancestor need to exist in order for the ancestor to be able to walk upwards via the `parentField` property.\n\t\t// This needs to happen for all MapTreeNodes that are descendants of the ancestor MapTreeNode.\n\t\t// Demanding the entire tree is overkill to solve this problem since not all descendant MapTree nodes will have corresponding MapTreeNodes.\n\t\t// However, demanding the full tree also lets us eagerly validate that there are no duplicate MapTrees (i.e. same MapTree object) anywhere in the tree.\n\t\tthis.walkTree();\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.schema.name;\n\t}\n\n\t/**\n\t * Set this node's parentage (see {@link FlexTreeNode.parentField}).\n\t * @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).\n\t * However, a node with a parent may not be directly re-assigned a different parent.\n\t * That likely indicates either an attempted multi-parenting or an attempt to \"move\" the node, neither of which are supported.\n\t * Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.\n\t */\n\tpublic adoptBy(parent: undefined): void;\n\tpublic adoptBy(parent: MapTreeField, index: number): void;\n\tpublic adoptBy(parent: MapTreeField | undefined, index?: number): void {\n\t\tif (parent !== undefined) {\n\t\t\tassert(\n\t\t\t\tthis.location === unparentedLocation,\n\t\t\t\t0x98c /* Node may not be adopted if it already has a parent */,\n\t\t\t);\n\t\t\tassert(index !== undefined, 0xa08 /* Expected index */);\n\t\t\tthis.location = { parent, index };\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.location !== unparentedLocation,\n\t\t\t\t0xa09 /* Node may not be un-adopted if it does not have a parent */,\n\t\t\t);\n\t\t\tthis.location = unparentedLocation;\n\t\t}\n\t}\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t * @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.\n\t */\n\tpublic get parentField(): LocationInField {\n\t\treturn this.location;\n\t}\n\n\tpublic is<TSchemaInner extends FlexTreeNodeSchema>(\n\t\tschema: TSchemaInner,\n\t): this is FlexTreeTypedNode<TSchemaInner> {\n\t\treturn (schema as unknown) === this.schema;\n\t}\n\n\tpublic tryGetField(key: FieldKey): EagerMapTreeField<FlexAllowedTypes> | undefined {\n\t\tconst field = this.mapTree.fields.get(key);\n\t\t// Only return the field if it is not empty, in order to fulfill the contract of `tryGetField`.\n\t\tif (field !== undefined && field.length > 0) {\n\t\t\treturn getOrCreateField(this, key, this.schema.getFieldSchema(key));\n\t\t}\n\t}\n\n\tpublic getBoxed(key: string): FlexTreeField {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\treturn getOrCreateField(this, fieldKey, this.schema.getFieldSchema(fieldKey));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapIterable(this.mapTree.fields.entries(), ([key]) =>\n\t\t\tgetOrCreateField(this, key, this.schema.getFieldSchema(key)),\n\t\t);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.mapTree.value;\n\t}\n\n\tpublic context = undefined;\n\n\tpublic get anchorNode(): AnchorNode {\n\t\t// This API is relevant to `LazyTreeNode`s, but not `MapTreeNode`s.\n\t\t// TODO: Refactor the FlexTreeNode interface so that stubbing this out isn't necessary.\n\t\treturn fail(\"MapTreeNode does not implement anchorNode\");\n\t}\n\n\tprivate walkTree(): void {\n\t\tfor (const [key, mapTrees] of this.mapTree.fields) {\n\t\t\tconst field = getOrCreateField(this, key, this.schema.getFieldSchema(key));\n\t\t\tfor (let index = 0; index < field.length; index++) {\n\t\t\t\tconst child = getOrCreateChild(\n\t\t\t\t\tmapTrees[index] ?? oob(),\n\t\t\t\t\tthis.schema.getFieldSchema(key).allowedTypes,\n\t\t\t\t\t{ parent: field, index },\n\t\t\t\t);\n\t\t\t\t// These next asserts detect the case where `getOrCreateChild` gets a cache hit of a different node than the one we're trying to create\n\t\t\t\tassert(child.location !== undefined, 0x98d /* Expected node to have parent */);\n\t\t\t\tassert(\n\t\t\t\t\tchild.location.parent.parent === this,\n\t\t\t\t\t0x98e /* Node may not be multi-parented */,\n\t\t\t\t);\n\t\t\t\tassert(child.location.index === index, 0x98f /* Node may not be multi-parented */);\n\t\t\t\tchild.walkTree();\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * The implementation of a map node created by {@link getOrCreateNode}.\n */\nexport class EagerMapTreeMapNode<TSchema extends FlexMapNodeSchema>\n\textends EagerMapTreeNode<TSchema>\n\timplements FlexTreeMapNode<TSchema>\n{\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn this.mapTree.fields.keys();\n\t}\n\n\tpublic values(): IterableIterator<FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">> {\n\t\treturn mapIterable(\n\t\t\tthis.mapTree.fields.keys(),\n\t\t\t(key) =>\n\t\t\t\tunboxedField(\n\t\t\t\t\tthis.tryGetField(key) ?? fail(\"Unexpected empty map field\"),\n\t\t\t\t\tkey,\n\t\t\t\t\tthis.mapTree,\n\t\t\t\t\tthis,\n\t\t\t\t) as FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">,\n\t\t);\n\t}\n\n\tpublic entries(): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn mapIterable(this.mapTree.fields.keys(), (key) => [\n\t\t\tkey,\n\t\t\tunboxedField(\n\t\t\t\tthis.tryGetField(key) ?? fail(\"Unexpected empty map field\"),\n\t\t\t\tkey,\n\t\t\t\tthis.mapTree,\n\t\t\t\tthis,\n\t\t\t) as FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">,\n\t\t]);\n\t}\n\n\tpublic override getBoxed(key: string): FlexTreeTypedField<TSchema[\"info\"]> {\n\t\treturn super.getBoxed(key) as FlexTreeTypedField<TSchema[\"info\"]>;\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn this.entries();\n\t}\n}\n\nclass EagerMapTreeLeafNode<TSchema extends LeafNodeSchema>\n\textends EagerMapTreeNode<TSchema>\n\timplements FlexTreeLeafNode<TSchema>\n{\n\tpublic override get value(): TreeValue<TSchema[\"info\"]> {\n\t\treturn super.value as TreeValue<TSchema[\"info\"]>;\n\t}\n}\n\n// #endregion Nodes\n\n// #region Fields\n\n/**\n * A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.\n * @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.\n * Create a `MapTreeField` by calling {@link getOrCreateField}.\n */\ninterface MapTreeField extends FlexTreeField {\n\treadonly mapTrees: readonly MapTree[];\n}\n\n/**\n * A special singleton that is the implicit {@link LocationInField} of all un-parented {@link EagerMapTreeNode}s.\n * @remarks This exists because {@link EagerMapTreeNode.parentField} must return a field.\n * If a {@link EagerMapTreeNode} is created without a parent, its {@link EagerMapTreeNode.parentField} property will point to this object.\n * However, this field cannot be used in any practical way because it is empty, i.e. it does not actually contain the children that claim to be parented under it.\n * It has the \"empty\" schema and it will always contain zero children if queried.\n * Any nodes with this location will have a dummy parent index of `-1`.\n */\nconst unparentedLocation: LocationInField = {\n\tparent: {\n\t\t[flexTreeMarker]: FlexTreeEntityKind.Field as const,\n\t\tlength: 0,\n\t\tkey: EmptyKey,\n\t\tparent: undefined,\n\t\tis<TSchema extends FlexFieldSchema>(schema: TSchema) {\n\t\t\treturn schema === (FlexFieldSchema.empty as FlexFieldSchema);\n\t\t},\n\t\tboxedIterator(): IterableIterator<FlexTreeNode> {\n\t\t\treturn [].values();\n\t\t},\n\t\tboxedAt(index: number): FlexTreeNode | undefined {\n\t\t\treturn undefined;\n\t\t},\n\t\tschema: FlexFieldSchema.empty,\n\t\tcontext: undefined,\n\t\tmapTrees: [],\n\t},\n\tindex: -1,\n};\n\nclass EagerMapTreeField<T extends FlexAllowedTypes> implements MapTreeField {\n\tpublic [flexTreeMarker] = FlexTreeEntityKind.Field as const;\n\n\tpublic constructor(\n\t\tpublic readonly schema: FlexFieldSchema<FlexFieldKind, T>,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly parent: EagerMapTreeNode<FlexTreeNodeSchema>,\n\t) {\n\t\tconst fieldKeyCache = getFieldKeyCache(parent);\n\t\tassert(!fieldKeyCache.has(key), 0x990 /* A field already exists for the given MapTrees */);\n\t\tfieldKeyCache.set(key, this);\n\n\t\t// When this field is created (which only happens one time, because it is cached), all the children become parented for the first time.\n\t\t// \"Adopt\" each child by updating its parent information to point to this field.\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tconst mapTreeNodeChild = nodeCache.get(mapTree);\n\t\t\tif (mapTreeNodeChild !== undefined) {\n\t\t\t\tif (mapTreeNodeChild.parentField !== unparentedLocation) {\n\t\t\t\t\tthrow new UsageError(\"A node may not be in more than one place in the tree\");\n\t\t\t\t}\n\t\t\t\tmapTreeNodeChild.adoptBy(this, i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get mapTrees(): readonly ExclusiveMapTree[] {\n\t\treturn this.parent.mapTree.fields.get(this.key) ?? [];\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.mapTrees.length;\n\t}\n\n\tpublic is<TSchemaInner extends FlexFieldSchema>(\n\t\tschema: TSchemaInner,\n\t): this is FlexTreeTypedField<TSchemaInner> {\n\t\treturn this.schema.equals(schema);\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeTypedNodeUnion<T>> {\n\t\treturn this.mapTrees\n\t\t\t.map(\n\t\t\t\t(m, index) =>\n\t\t\t\t\tgetOrCreateChild(m, this.schema.allowedTypes, {\n\t\t\t\t\t\tparent: this,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t}) as FlexTreeNode as FlexTreeTypedNodeUnion<T>,\n\t\t\t)\n\t\t\t.values();\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeTypedNodeUnion<T> | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst m = this.mapTrees[i];\n\t\tif (m !== undefined) {\n\t\t\treturn getOrCreateChild(m, this.schema.allowedTypes, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: i,\n\t\t\t}) as FlexTreeNode as FlexTreeTypedNodeUnion<T>;\n\t\t}\n\t}\n\n\tpublic context: undefined;\n\n\t/**\n\t * Mutate this field.\n\t * @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.\n\t * The function may mutate the array in place or return a new array.\n\t * If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.\n\t * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.\n\t * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.\n\t */\n\tprotected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void {\n\t\tconst oldMapTrees = this.parent.mapTree.fields.get(this.key) ?? [];\n\t\tconst newMapTrees = edit(oldMapTrees) ?? oldMapTrees;\n\t\tif (newMapTrees.length > 0) {\n\t\t\tthis.parent.mapTree.fields.set(this.key, newMapTrees);\n\t\t} else {\n\t\t\tthis.parent.mapTree.fields.delete(this.key);\n\t\t}\n\t}\n}\n\nclass EagerMapTreeOptionalField<T extends FlexAllowedTypes>\n\textends EagerMapTreeField<T>\n\timplements FlexTreeOptionalField<T>\n{\n\tpublic readonly editor = {\n\t\tset: (newContent: ExclusiveMapTree | undefined): void => {\n\t\t\t// If the new content is a MapTreeNode, it needs to have its parent pointer updated\n\t\t\tif (newContent !== undefined) {\n\t\t\t\tnodeCache.get(newContent)?.adoptBy(this, 0);\n\t\t\t}\n\t\t\t// If the old content is a MapTreeNode, it needs to have its parent pointer unset\n\t\t\tconst oldContent = this.mapTrees[0];\n\t\t\tif (oldContent !== undefined) {\n\t\t\t\tnodeCache.get(oldContent)?.adoptBy(undefined);\n\t\t\t}\n\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent !== undefined) {\n\t\t\t\t\tmapTrees[0] = newContent;\n\t\t\t\t} else {\n\t\t\t\t\tmapTrees.length = 0;\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnboxNodeUnion<T> | undefined {\n\t\tconst value = this.mapTrees[0];\n\t\tif (value !== undefined) {\n\t\t\treturn unboxedUnion(this.schema, value, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: 0,\n\t\t\t});\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nclass EagerMapTreeRequiredField<T extends FlexAllowedTypes>\n\textends EagerMapTreeOptionalField<T>\n\timplements FlexTreeRequiredField<T>\n{\n\tpublic override get content(): FlexTreeUnboxNodeUnion<T> {\n\t\treturn super.content ?? fail(\"Expected EagerMapTree required field to have a value\");\n\t}\n}\n\nclass EagerMapTreeSequenceField<T extends FlexAllowedTypes>\n\textends EagerMapTreeField<T>\n\timplements FlexTreeSequenceField<T>\n{\n\tpublic readonly editor: MapTreeSequenceFieldEditBuilder = {\n\t\tinsert: (index, newContent): void => {\n\t\t\tfor (let i = 0; i < newContent.length; i++) {\n\t\t\t\tconst c = newContent[i];\n\t\t\t\tassert(c !== undefined, 0xa0a /* Unexpected sparse array content */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(this, index + i);\n\t\t\t}\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent.length < 1000) {\n\t\t\t\t\t// For \"smallish arrays\" (`1000` is not empirically derived), the `splice` function is appropriate...\n\t\t\t\t\tmapTrees.splice(index, 0, ...newContent);\n\t\t\t\t} else {\n\t\t\t\t\t// ...but we avoid using `splice` + spread for very large input arrays since there is a limit on how many elements can be spread (too many will overflow the stack).\n\t\t\t\t\treturn mapTrees.slice(0, index).concat(newContent, mapTrees.slice(index));\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tremove: (index, count): ExclusiveMapTree[] => {\n\t\t\tfor (let i = index; i < index + count; i++) {\n\t\t\t\tconst c = this.mapTrees[i];\n\t\t\t\tassert(c !== undefined, 0xa0b /* Unexpected sparse array */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(undefined);\n\t\t\t}\n\t\t\tlet removed: ExclusiveMapTree[] | undefined;\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tremoved = mapTrees.splice(index, count);\n\t\t\t});\n\t\t\treturn removed ?? fail(\"Expected removed to be set by edit\");\n\t\t},\n\t};\n\n\tpublic at(index: number): FlexTreeUnboxNodeUnion<T> | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn unboxedUnion(this.schema, this.mapTrees[i] ?? oob(), { parent: this, index: i });\n\t}\n\tpublic map<U>(callbackfn: (value: FlexTreeUnboxNodeUnion<T>, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<FlexTreeUnboxNodeUnion<T>> {\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tyield unboxedUnion(this.schema, mapTree, { parent: this, index: i });\n\t\t}\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\tthrow unsupportedUsageError(\"Editing an array\");\n\t}\n}\n\n// #endregion Fields\n\n// #region Caching and unboxing utilities\n\nconst nodeCache = new WeakMap<MapTree, EagerMapTreeNode<FlexTreeNodeSchema>>();\n/** Node Parent -\\> Field Key -\\> Field */\nconst fieldCache = new WeakMap<\n\tMapTreeNode,\n\tMap<FieldKey, EagerMapTreeField<FlexAllowedTypes>>\n>();\nfunction getFieldKeyCache(\n\tparent: MapTreeNode,\n): WeakMap<FieldKey, EagerMapTreeField<FlexAllowedTypes>> {\n\treturn getOrCreate(fieldCache, parent, () => new Map());\n}\n\n/**\n * If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.\n * @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.\n */\nexport function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined {\n\treturn nodeCache.get(mapTree);\n}\n\n/**\n * Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.\n * @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to\n * @param mapTree - the {@link MapTree} containing the data for this node.\n * @remarks It must conform to the `nodeSchema`.\n */\nexport function getOrCreateMapTreeNode(\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n): EagerMapTreeNode<FlexTreeNodeSchema> {\n\treturn nodeCache.get(mapTree) ?? createNode(nodeSchema, mapTree, undefined);\n}\n\n/** Helper for creating a `MapTreeNode` given the parent field (e.g. when \"walking down\") */\nfunction getOrCreateChild(\n\tmapTree: ExclusiveMapTree,\n\timplicitAllowedTypes: FlexImplicitAllowedTypes,\n\tparent: LocationInField | undefined,\n): EagerMapTreeNode<FlexTreeNodeSchema> {\n\tconst cached = nodeCache.get(mapTree);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tconst allowedTypes = normalizeAllowedTypes(implicitAllowedTypes);\n\tconst nodeSchema =\n\t\tallowedTypes\n\t\t\t.map((t) => (isLazy(t) ? t() : t))\n\t\t\t.find((t): t is FlexTreeNodeSchema => {\n\t\t\t\tassert(t !== \"Any\", 0x993 /* 'Any' type is not supported */);\n\t\t\t\treturn t.name === mapTree.type;\n\t\t\t}) ?? fail(\"Unsupported node schema\");\n\n\treturn createNode(nodeSchema, mapTree, parent);\n}\n\n/** Always constructs a new node, therefore may not be called twice for the same `MapTree`. */\nfunction createNode<TSchema extends FlexTreeNodeSchema>(\n\tnodeSchema: TSchema,\n\tmapTree: ExclusiveMapTree,\n\tparentField: LocationInField | undefined,\n): EagerMapTreeNode<TSchema> {\n\tif (schemaIsLeaf(nodeSchema)) {\n\t\treturn new EagerMapTreeLeafNode(nodeSchema, mapTree, parentField);\n\t}\n\tif (schemaIsMap(nodeSchema)) {\n\t\treturn new EagerMapTreeMapNode(nodeSchema, mapTree, parentField);\n\t}\n\tif (schemaIsObjectNode(nodeSchema)) {\n\t\treturn new EagerMapTreeNode(nodeSchema, mapTree, parentField);\n\t}\n\tassert(false, 0x994 /* Unrecognized node kind */);\n}\n\n/** Creates a field with the given attributes, or returns a cached field if there is one */\nfunction getOrCreateField(\n\tparent: EagerMapTreeNode<FlexTreeNodeSchema>,\n\tkey: FieldKey,\n\tschema: FlexFieldSchema,\n): EagerMapTreeField<FlexFieldSchema[\"allowedTypes\"]> {\n\tconst cached = getFieldKeyCache(parent).get(key);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tif (\n\t\tschema.kind.identifier === FieldKinds.required.identifier ||\n\t\tschema.kind.identifier === FieldKinds.identifier.identifier\n\t) {\n\t\treturn new EagerMapTreeRequiredField(schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.optional.identifier) {\n\t\treturn new EagerMapTreeOptionalField(schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.sequence.identifier) {\n\t\treturn new EagerMapTreeSequenceField(schema, key, parent);\n\t}\n\n\treturn new EagerMapTreeField(schema, key, parent);\n}\n\n/** Unboxes non-polymorphic leaf nodes to their values, if applicable */\nfunction unboxedUnion<TTypes extends FlexAllowedTypes>(\n\tschema: FlexFieldSchema<FlexFieldKind, TTypes>,\n\tmapTree: ExclusiveMapTree,\n\tparent: LocationInField,\n): FlexTreeUnboxNodeUnion<TTypes> {\n\tconst type = schema.monomorphicChildType;\n\tif (type !== undefined) {\n\t\tif (schemaIsLeaf(type)) {\n\t\t\treturn mapTree.value as FlexTreeUnboxNodeUnion<TTypes>;\n\t\t}\n\t\treturn getOrCreateChild(mapTree, type, parent) as FlexTreeUnboxNodeUnion<TTypes>;\n\t}\n\n\treturn getOrCreateChild(\n\t\tmapTree,\n\t\tschema.allowedTypes,\n\t\tparent,\n\t) as FlexTreeUnboxNodeUnion<TTypes>;\n}\n\n/** Unboxes non-polymorphic required and optional fields holding leaf nodes to their values, if applicable */\nfunction unboxedField<TFieldSchema extends FlexFieldSchema>(\n\tfield: EagerMapTreeField<FlexAllowedTypes>,\n\tkey: FieldKey,\n\tmapTree: ExclusiveMapTree,\n\tparentNode: EagerMapTreeNode<FlexTreeNodeSchema>,\n): FlexTreeUnboxField<TFieldSchema> {\n\tconst fieldSchema = field.schema;\n\tconst mapTrees =\n\t\tmapTree.fields.get(key) ?? fail(\"Key does not exist in unhydrated map tree\");\n\n\tif (fieldSchema.kind === FieldKinds.required) {\n\t\treturn unboxedUnion(fieldSchema, mapTrees[0] ?? oob(), {\n\t\t\tparent: field,\n\t\t\tindex: 0,\n\t\t}) as FlexTreeUnboxField<TFieldSchema>;\n\t}\n\tif (fieldSchema.kind === FieldKinds.optional) {\n\t\treturn (\n\t\t\tmapTrees.length > 0\n\t\t\t\t? unboxedUnion(fieldSchema, mapTrees[0] ?? oob(), {\n\t\t\t\t\t\tparent: field,\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t})\n\t\t\t\t: undefined\n\t\t) as FlexTreeUnboxField<TFieldSchema>;\n\t}\n\n\treturn getOrCreateField(parentNode, key, fieldSchema) as FlexTreeUnboxField<TFieldSchema>;\n}\n\n// #endregion Caching and unboxing utilities\n\nexport function unsupportedUsageError(message?: string): Error {\n\treturn new UsageError(\n\t\t`${\n\t\t\tmessage ?? \"Operation\"\n\t\t} is not supported for content that has not yet been inserted into the tree`,\n\t);\n}\n"]}
1
+ {"version":3,"file":"mapTreeNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/mapTreeNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAAkE;AAClE,uEAAsE;AAEtE,kDAW6B;AAC7B,kDAA6F;AAC7F,oDAa+B;AAC/B,uDAOkC;AAElC,yDAIoC;AAapC;;GAEG;AACH,SAAgB,aAAa,CAAC,QAAsB;IACnD,OAAO,QAAQ,YAAY,gBAAgB,CAAC;AAC7C,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CACrC,KAA4C;IAE5C,OAAO,KAAK,YAAY,yB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I,CAAC,UAAU,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC/D,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnE,CAAC;AAED,yCAAyC;AACzC,SAAS,OAAO,CACf,MAAuB,EACvB,OAAyB,EACzB,MAAuB;IAEvB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC;AAED,4CAA4C;AAE5C,SAAgB,qBAAqB,CAAC,OAAgB;IACrD,OAAO,IAAI,qBAAU,CACpB,GACC,OAAO,IAAI,WACZ,4EAA4E,CAC5E,CAAC;AACH,CAAC;AAND,sDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype AnchorNode,\n\tEmptyKey,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype MapTree,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n\ttype Value,\n} from \"../../core/index.js\";\nimport { brand, fail, getOrCreate, isReadonlyArray, mapIterable } from \"../../util/index.js\";\nimport {\n\ttype FlexTreeContext,\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tindexForAt,\n\ttype FlexTreeHydratedContext,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\tintoStoredSchemaCollection,\n\tisLazy,\n} from \"../typed-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tFieldKinds,\n\ttype SequenceFieldEditBuilder,\n} from \"../default-schema/index.js\";\n\n// #region Nodes\n\n/**\n * A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.\n * Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.\n */\nexport interface MapTreeNode extends FlexTreeNode {\n\treadonly mapTree: MapTree;\n}\n\n/**\n * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.\n */\nexport function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode {\n\treturn flexNode instanceof EagerMapTreeNode;\n}\n\n/**\n * Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.\n */\nexport function isMapTreeSequenceField(\n\tfield: FlexTreeSequenceField | FlexTreeField,\n): field is MapTreeSequenceField {\n\treturn field instanceof EagerMapTreeSequenceField;\n}\n\n/**\n * An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.\n * @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.\n */\nexport interface MapTreeSequenceField extends FlexTreeSequenceField {\n\treadonly editor: MapTreeSequenceFieldEditBuilder;\n}\n\ninterface MapTreeSequenceFieldEditBuilder\n\textends SequenceFieldEditBuilder<ExclusiveMapTree[]> {\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t * @returns the MapTrees that were removed\n\t */\n\tremove(index: number, count: number): ExclusiveMapTree[];\n}\n\n/** A node's parent field and its index in that field */\ninterface LocationInField {\n\treadonly parent: MapTreeField;\n\treadonly index: number;\n}\n\n/**\n * A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Any methods that would mutate the node will fail,\n * as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).\n * MapTreeNodes are unconditionally cached -\n * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.\n */\nexport class EagerMapTreeNode implements MapTreeNode {\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\tpublic readonly [flexTreeMarker] = FlexTreeEntityKind.Node as const;\n\n\t/**\n\t * Create a new MapTreeNode.\n\t * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not\n\t * @remarks This class (and its subclasses) should not be directly constructed outside of this module.\n\t * Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.\n\t * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.\n\t * Instead, it should always be acquired via {@link getOrCreateNode}.\n\t */\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexTreeNodeSchema,\n\t\t/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */\n\t\tpublic readonly mapTree: ExclusiveMapTree,\n\t\tprivate location = unparentedLocation,\n\t) {\n\t\tassert(!nodeCache.has(mapTree), 0x98b /* A node already exists for the given MapTree */);\n\t\tnodeCache.set(mapTree, this);\n\n\t\t// Fully demand the tree to ensure that parent pointers are present and accurate on all nodes.\n\t\t// When a MapTreeNode is constructed, its MapTree may contain nodes (anywhere below) that map (via the `nodeCache`) to pre-existing MapTreeNodes.\n\t\t// Put another way, for a given MapTree, some ancestor MapTreeNode can be created after any number of its descendant MapTreeNodes already exist.\n\t\t// In such a case, the spine of nodes between the descendant and ancestor need to exist in order for the ancestor to be able to walk upwards via the `parentField` property.\n\t\t// This needs to happen for all MapTreeNodes that are descendants of the ancestor MapTreeNode.\n\t\t// Demanding the entire tree is overkill to solve this problem since not all descendant MapTree nodes will have corresponding MapTreeNodes.\n\t\t// However, demanding the full tree also lets us eagerly validate that there are no duplicate MapTrees (i.e. same MapTree object) anywhere in the tree.\n\t\tthis.walkTree();\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\t/**\n\t * Set this node's parentage (see {@link FlexTreeNode.parentField}).\n\t * @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).\n\t * However, a node with a parent may not be directly re-assigned a different parent.\n\t * That likely indicates either an attempted multi-parenting or an attempt to \"move\" the node, neither of which are supported.\n\t * Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.\n\t */\n\tpublic adoptBy(parent: undefined): void;\n\tpublic adoptBy(parent: MapTreeField, index: number): void;\n\tpublic adoptBy(parent: MapTreeField | undefined, index?: number): void {\n\t\tif (parent !== undefined) {\n\t\t\tassert(\n\t\t\t\tthis.location === unparentedLocation,\n\t\t\t\t0x98c /* Node may not be adopted if it already has a parent */,\n\t\t\t);\n\t\t\tassert(index !== undefined, 0xa08 /* Expected index */);\n\t\t\tthis.location = { parent, index };\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.location !== unparentedLocation,\n\t\t\t\t0xa09 /* Node may not be un-adopted if it does not have a parent */,\n\t\t\t);\n\t\t\tthis.location = unparentedLocation;\n\t\t}\n\t}\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t * @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.\n\t */\n\tpublic get parentField(): LocationInField {\n\t\treturn this.location;\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\treturn (schema as unknown) === this.flexSchema;\n\t}\n\n\tpublic tryGetField(key: FieldKey): EagerMapTreeField | undefined {\n\t\tconst field = this.mapTree.fields.get(key);\n\t\t// Only return the field if it is not empty, in order to fulfill the contract of `tryGetField`.\n\t\tif (field !== undefined && field.length > 0) {\n\t\t\treturn getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t}\n\t}\n\n\tpublic getBoxed(key: string): FlexTreeField {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\treturn getOrCreateField(this, fieldKey, this.flexSchema.getFieldSchema(fieldKey));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapIterable(this.mapTree.fields.entries(), ([key]) =>\n\t\t\tgetOrCreateField(this, key, this.flexSchema.getFieldSchema(key)),\n\t\t);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\t// TODO: how this should handle missing defaults (and empty keys if they end up being allowed) needs to be determined.\n\t\treturn this.mapTree.fields.keys();\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.mapTree.value;\n\t}\n\n\tpublic get anchorNode(): AnchorNode {\n\t\t// This API is relevant to `LazyTreeNode`s, but not `MapTreeNode`s.\n\t\t// TODO: Refactor the FlexTreeNode interface so that stubbing this out isn't necessary.\n\t\treturn fail(\"MapTreeNode does not implement anchorNode\");\n\t}\n\n\tprivate walkTree(): void {\n\t\tfor (const [key, mapTrees] of this.mapTree.fields) {\n\t\t\tconst field = getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t\tfor (let index = 0; index < field.length; index++) {\n\t\t\t\tconst child = getOrCreateChild(\n\t\t\t\t\tthis.context,\n\t\t\t\t\tmapTrees[index] ?? oob(),\n\t\t\t\t\tthis.flexSchema.getFieldSchema(key).allowedTypes,\n\t\t\t\t\t{ parent: field, index },\n\t\t\t\t);\n\t\t\t\t// These next asserts detect the case where `getOrCreateChild` gets a cache hit of a different node than the one we're trying to create\n\t\t\t\tassert(child.location !== undefined, 0x98d /* Expected node to have parent */);\n\t\t\t\tassert(\n\t\t\t\t\tchild.location.parent.parent === this,\n\t\t\t\t\t0x98e /* Node may not be multi-parented */,\n\t\t\t\t);\n\t\t\t\tassert(child.location.index === index, 0x98f /* Node may not be multi-parented */);\n\t\t\t\tchild.walkTree();\n\t\t\t}\n\t\t}\n\t}\n}\n\n// #endregion Nodes\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class UnhydratedContext implements FlexTreeContext {\n\tpublic readonly schema: TreeStoredSchema;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t */\n\tpublic constructor(public readonly flexSchema: FlexTreeSchema) {\n\t\tthis.schema = {\n\t\t\trootFieldSchema: flexSchema.rootFieldSchema.stored,\n\t\t\t...intoStoredSchemaCollection(flexSchema),\n\t\t};\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn false;\n\t}\n}\n\n// #region Fields\n\n/**\n * A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.\n * @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.\n * Create a `MapTreeField` by calling {@link getOrCreateField}.\n */\ninterface MapTreeField extends FlexTreeField {\n\treadonly mapTrees: readonly MapTree[];\n}\n\nconst emptyContext = new UnhydratedContext({\n\tadapters: {},\n\tnodeSchema: new Map(),\n\tpolicy: defaultSchemaPolicy,\n\trootFieldSchema: FlexFieldSchema.empty,\n});\n\n/**\n * A special singleton that is the implicit {@link LocationInField} of all un-parented {@link EagerMapTreeNode}s.\n * @remarks This exists because {@link EagerMapTreeNode.parentField} must return a field.\n * If a {@link EagerMapTreeNode} is created without a parent, its {@link EagerMapTreeNode.parentField} property will point to this object.\n * However, this field cannot be used in any practical way because it is empty, i.e. it does not actually contain the children that claim to be parented under it.\n * It has the \"empty\" schema and it will always contain zero children if queried.\n * Any nodes with this location will have a dummy parent index of `-1`.\n */\nconst unparentedLocation: LocationInField = {\n\tparent: {\n\t\t[flexTreeMarker]: FlexTreeEntityKind.Field as const,\n\t\tlength: 0,\n\t\tkey: EmptyKey,\n\t\tparent: undefined,\n\t\tis<TKind2 extends FlexFieldKind>(kind: TKind2) {\n\t\t\treturn this.schema.kind === kind.identifier;\n\t\t},\n\t\tboxedIterator(): IterableIterator<FlexTreeNode> {\n\t\t\treturn [].values();\n\t\t},\n\t\tboxedAt(index: number): FlexTreeNode | undefined {\n\t\t\treturn undefined;\n\t\t},\n\t\tschema: FlexFieldSchema.empty.stored,\n\t\tcontext: emptyContext,\n\t\tmapTrees: [],\n\t\tgetFieldPath() {\n\t\t\tfail(\"unsupported\");\n\t\t},\n\t},\n\tindex: -1,\n};\n\nclass EagerMapTreeField implements MapTreeField {\n\tpublic [flexTreeMarker] = FlexTreeEntityKind.Field as const;\n\n\tpublic get schema(): TreeFieldStoredSchema {\n\t\treturn this.flexSchema.stored;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexFieldSchema,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly parent: EagerMapTreeNode,\n\t) {\n\t\tconst fieldKeyCache = getFieldKeyCache(parent);\n\t\tassert(!fieldKeyCache.has(key), 0x990 /* A field already exists for the given MapTrees */);\n\t\tfieldKeyCache.set(key, this);\n\n\t\t// When this field is created (which only happens one time, because it is cached), all the children become parented for the first time.\n\t\t// \"Adopt\" each child by updating its parent information to point to this field.\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tconst mapTreeNodeChild = nodeCache.get(mapTree);\n\t\t\tif (mapTreeNodeChild !== undefined) {\n\t\t\t\tif (mapTreeNodeChild.parentField !== unparentedLocation) {\n\t\t\t\t\tthrow new UsageError(\"A node may not be in more than one place in the tree\");\n\t\t\t\t}\n\t\t\t\tmapTreeNodeChild.adoptBy(this, i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get mapTrees(): readonly ExclusiveMapTree[] {\n\t\treturn this.parent.mapTree.fields.get(this.key) ?? [];\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.mapTrees.length;\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\treturn this.schema.kind === kind.identifier;\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeNode> {\n\t\treturn this.mapTrees\n\t\t\t.map(\n\t\t\t\t(m, index) =>\n\t\t\t\t\tgetOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\t\t\tparent: this,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t}) as FlexTreeNode,\n\t\t\t)\n\t\t\t.values();\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeNode | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst m = this.mapTrees[i];\n\t\tif (m !== undefined) {\n\t\t\treturn getOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: i,\n\t\t\t}) as FlexTreeNode;\n\t\t}\n\t}\n\n\t/**\n\t * Mutate this field.\n\t * @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.\n\t * The function may mutate the array in place or return a new array.\n\t * If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.\n\t * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.\n\t * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.\n\t */\n\tprotected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void {\n\t\tconst oldMapTrees = this.parent.mapTree.fields.get(this.key) ?? [];\n\t\tconst newMapTrees = edit(oldMapTrees) ?? oldMapTrees;\n\t\tif (newMapTrees.length > 0) {\n\t\t\tthis.parent.mapTree.fields.set(this.key, newMapTrees);\n\t\t} else {\n\t\t\tthis.parent.mapTree.fields.delete(this.key);\n\t\t}\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\tthrow unsupportedUsageError(\"Editing an array\");\n\t}\n}\n\nclass EagerMapTreeOptionalField extends EagerMapTreeField implements FlexTreeOptionalField {\n\tpublic readonly editor = {\n\t\tset: (newContent: ExclusiveMapTree | undefined): void => {\n\t\t\t// If the new content is a MapTreeNode, it needs to have its parent pointer updated\n\t\t\tif (newContent !== undefined) {\n\t\t\t\tnodeCache.get(newContent)?.adoptBy(this, 0);\n\t\t\t}\n\t\t\t// If the old content is a MapTreeNode, it needs to have its parent pointer unset\n\t\t\tconst oldContent = this.mapTrees[0];\n\t\t\tif (oldContent !== undefined) {\n\t\t\t\tnodeCache.get(oldContent)?.adoptBy(undefined);\n\t\t\t}\n\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent !== undefined) {\n\t\t\t\t\tmapTrees[0] = newContent;\n\t\t\t\t} else {\n\t\t\t\t\tmapTrees.length = 0;\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\tconst value = this.mapTrees[0];\n\t\tif (value !== undefined) {\n\t\t\treturn unboxed(this.flexSchema, value, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: 0,\n\t\t\t});\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nclass EagerMapTreeRequiredField\n\textends EagerMapTreeOptionalField\n\timplements FlexTreeRequiredField\n{\n\tpublic override get content(): FlexTreeUnknownUnboxed {\n\t\treturn super.content ?? fail(\"Expected EagerMapTree required field to have a value\");\n\t}\n}\n\nclass EagerMapTreeSequenceField extends EagerMapTreeField implements FlexTreeSequenceField {\n\tpublic readonly editor: MapTreeSequenceFieldEditBuilder = {\n\t\tinsert: (index, newContent): void => {\n\t\t\tfor (let i = 0; i < newContent.length; i++) {\n\t\t\t\tconst c = newContent[i];\n\t\t\t\tassert(c !== undefined, 0xa0a /* Unexpected sparse array content */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(this, index + i);\n\t\t\t}\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent.length < 1000) {\n\t\t\t\t\t// For \"smallish arrays\" (`1000` is not empirically derived), the `splice` function is appropriate...\n\t\t\t\t\tmapTrees.splice(index, 0, ...newContent);\n\t\t\t\t} else {\n\t\t\t\t\t// ...but we avoid using `splice` + spread for very large input arrays since there is a limit on how many elements can be spread (too many will overflow the stack).\n\t\t\t\t\treturn mapTrees.slice(0, index).concat(newContent, mapTrees.slice(index));\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tremove: (index, count): ExclusiveMapTree[] => {\n\t\t\tfor (let i = index; i < index + count; i++) {\n\t\t\t\tconst c = this.mapTrees[i];\n\t\t\t\tassert(c !== undefined, 0xa0b /* Unexpected sparse array */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(undefined);\n\t\t\t}\n\t\t\tlet removed: ExclusiveMapTree[] | undefined;\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tremoved = mapTrees.splice(index, count);\n\t\t\t});\n\t\t\treturn removed ?? fail(\"Expected removed to be set by edit\");\n\t\t},\n\t};\n\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn unboxed(this.flexSchema, this.mapTrees[i] ?? oob(), { parent: this, index: i });\n\t}\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tyield unboxed(this.flexSchema, mapTree, { parent: this, index: i });\n\t\t}\n\t}\n}\n\n// #endregion Fields\n\n// #region Caching and unboxing utilities\n\nconst nodeCache = new WeakMap<MapTree, EagerMapTreeNode>();\n/** Node Parent -\\> Field Key -\\> Field */\nconst fieldCache = new WeakMap<MapTreeNode, Map<FieldKey, EagerMapTreeField>>();\nfunction getFieldKeyCache(parent: MapTreeNode): WeakMap<FieldKey, EagerMapTreeField> {\n\treturn getOrCreate(fieldCache, parent, () => new Map());\n}\n\n/**\n * If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.\n * @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.\n */\nexport function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined {\n\treturn nodeCache.get(mapTree);\n}\n\n/**\n * Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.\n * @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to\n * @param mapTree - the {@link MapTree} containing the data for this node.\n * @remarks It must conform to the `nodeSchema`.\n */\nexport function getOrCreateMapTreeNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n): EagerMapTreeNode {\n\treturn nodeCache.get(mapTree) ?? createNode(context, nodeSchema, mapTree, undefined);\n}\n\n/** Helper for creating a `MapTreeNode` given the parent field (e.g. when \"walking down\") */\nfunction getOrCreateChild(\n\tcontext: UnhydratedContext,\n\tmapTree: ExclusiveMapTree,\n\tallowedTypes: FlexAllowedTypes,\n\tparent: LocationInField | undefined,\n): EagerMapTreeNode {\n\tconst cached = nodeCache.get(mapTree);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tassert(isReadonlyArray(allowedTypes), 0xa25 /* invalid types */);\n\tconst nodeSchema =\n\t\tallowedTypes\n\t\t\t.map((t) => (isLazy(t) ? t() : t))\n\t\t\t.find((t): t is FlexTreeNodeSchema => {\n\t\t\t\treturn t.name === mapTree.type;\n\t\t\t}) ?? fail(\"Unsupported node schema\");\n\n\treturn createNode(context, nodeSchema, mapTree, parent);\n}\n\n/** Always constructs a new node, therefore may not be called twice for the same `MapTree`. */\nfunction createNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n\tparentField: LocationInField | undefined,\n): EagerMapTreeNode {\n\treturn new EagerMapTreeNode(context, nodeSchema, mapTree, parentField);\n}\n\n/** Creates a field with the given attributes, or returns a cached field if there is one */\nfunction getOrCreateField(\n\tparent: EagerMapTreeNode,\n\tkey: FieldKey,\n\tschema: FlexFieldSchema,\n): EagerMapTreeField {\n\tconst cached = getFieldKeyCache(parent).get(key);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tif (\n\t\tschema.kind.identifier === FieldKinds.required.identifier ||\n\t\tschema.kind.identifier === FieldKinds.identifier.identifier\n\t) {\n\t\treturn new EagerMapTreeRequiredField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.optional.identifier) {\n\t\treturn new EagerMapTreeOptionalField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.sequence.identifier) {\n\t\treturn new EagerMapTreeSequenceField(parent.context, schema, key, parent);\n\t}\n\n\treturn new EagerMapTreeField(parent.context, schema, key, parent);\n}\n\n/** Unboxes leaf nodes to their values */\nfunction unboxed(\n\tschema: FlexFieldSchema,\n\tmapTree: ExclusiveMapTree,\n\tparent: LocationInField,\n): FlexTreeUnknownUnboxed {\n\tconst value = mapTree.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\treturn getOrCreateChild(parent.parent.context, mapTree, schema.allowedTypes, parent);\n}\n\n// #endregion Caching and unboxing utilities\n\nexport function unsupportedUsageError(message?: string): Error {\n\treturn new UsageError(\n\t\t`${\n\t\t\tmessage ?? \"Operation\"\n\t\t} is not supported for content that has not yet been inserted into the tree`,\n\t);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type FieldKey, type ForestEvents, type TreeFieldStoredSchema } from "../../core/index.js";
5
+ import { type FieldKey, type ForestEvents, type TreeFieldStoredSchema, type TreeStoredSchema } from "../../core/index.js";
6
6
  import type { Listenable } from "../../events/index.js";
7
7
  import { type IDisposable, disposeSymbol } from "../../util/index.js";
8
8
  import type { FieldGenerator } from "../fieldGenerator.js";
@@ -12,19 +12,36 @@ import type { FlexTreeField } from "./flexTreeTypes.js";
12
12
  import { type LazyEntity } from "./lazyEntity.js";
13
13
  import type { ITreeCheckout } from "../../shared-tree/index.js";
14
14
  /**
15
- * A common context of a "forest" of FlexTrees.
16
- * It handles group operations like transforming cursors into anchors for edits.
15
+ * Context for FlexTrees.
17
16
  */
18
- export interface FlexTreeContext extends Listenable<ForestEvents> {
17
+ export interface FlexTreeContext {
19
18
  /**
20
- * Gets the root field of the tree.
19
+ * Schema used within this context.
20
+ * All data must conform to these schema.
21
21
  */
22
- get root(): FlexTreeField;
22
+ readonly flexSchema: FlexTreeSchema;
23
23
  /**
24
24
  * Schema used within this context.
25
25
  * All data must conform to these schema.
26
26
  */
27
- readonly schema: FlexTreeSchema;
27
+ readonly schema: TreeStoredSchema;
28
+ /**
29
+ * If true, this context is the canonical context instance for a given view,
30
+ * and its schema include all schema from the document.
31
+ *
32
+ * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.
33
+ */
34
+ isHydrated(): this is FlexTreeHydratedContext;
35
+ }
36
+ /**
37
+ * A common context of a "forest" of FlexTrees.
38
+ * It handles group operations like transforming cursors into anchors for edits.
39
+ */
40
+ export interface FlexTreeHydratedContext extends FlexTreeContext, Listenable<ForestEvents> {
41
+ /**
42
+ * Gets the root field of the tree.
43
+ */
44
+ get root(): FlexTreeField;
28
45
  readonly nodeKeyManager: NodeKeyManager;
29
46
  /**
30
47
  * The checkout object associated with this context.
@@ -34,9 +51,6 @@ export interface FlexTreeContext extends Listenable<ForestEvents> {
34
51
  /**
35
52
  * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.
36
53
  * This slot is used to detect if one already exists and error if creating a second.
37
- *
38
- * TODO:
39
- * 1. API docs need to reflect this limitation or the limitation has to be removed.
40
54
  */
41
55
  export declare const ContextSlot: import("../../core/index.js").AnchorSlot<Context>;
42
56
  /**
@@ -44,8 +58,8 @@ export declare const ContextSlot: import("../../core/index.js").AnchorSlot<Conte
44
58
  *
45
59
  * @remarks An editor is required to edit the FlexTree.
46
60
  */
47
- export declare class Context implements FlexTreeContext, IDisposable {
48
- readonly schema: FlexTreeSchema;
61
+ export declare class Context implements FlexTreeHydratedContext, IDisposable {
62
+ readonly flexSchema: FlexTreeSchema;
49
63
  readonly checkout: ITreeCheckout;
50
64
  readonly nodeKeyManager: NodeKeyManager;
51
65
  readonly withCursors: Set<LazyEntity>;
@@ -53,11 +67,13 @@ export declare class Context implements FlexTreeContext, IDisposable {
53
67
  private readonly eventUnregister;
54
68
  private disposed;
55
69
  /**
56
- * @param schema - Schema to use when working with the tree.
70
+ * @param flexSchema - Schema to use when working with the tree.
57
71
  * @param checkout - The checkout.
58
72
  * @param nodeKeyManager - An object which handles node key generation and conversion
59
73
  */
60
- constructor(schema: FlexTreeSchema, checkout: ITreeCheckout, nodeKeyManager: NodeKeyManager);
74
+ constructor(flexSchema: FlexTreeSchema, checkout: ITreeCheckout, nodeKeyManager: NodeKeyManager);
75
+ isHydrated(): this is FlexTreeHydratedContext;
76
+ get schema(): TreeStoredSchema;
61
77
  /**
62
78
  * Called before editing.
63
79
  * Clears all cursors so editing can proceed.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAG1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,WAAW,E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