@fluidframework/tree 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (866) hide show
  1. package/.dependency-cruiser-known-violations.json +28 -40
  2. package/.vscode/Tree.code-workspace +0 -2
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +6 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  10. package/api-extractor/api-extractor.current.json +8 -0
  11. package/api-extractor/api-extractor.legacy.json +4 -0
  12. package/api-extractor.json +1 -1
  13. package/api-report/tree.alpha.api.md +21 -6
  14. package/api-report/tree.beta.api.md +21 -6
  15. package/api-report/tree.legacy.alpha.api.md +562 -0
  16. package/api-report/tree.legacy.public.api.md +559 -0
  17. package/api-report/tree.public.api.md +6 -6
  18. package/dist/alpha.d.ts +102 -0
  19. package/dist/beta.d.ts +6 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +2 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  25. package/dist/core/revertible.d.ts.map +1 -0
  26. package/dist/core/revertible.js.map +1 -0
  27. package/dist/core/schema-stored/format.d.ts +3 -3
  28. package/dist/core/schema-stored/format.js +1 -1
  29. package/dist/core/schema-stored/format.js.map +1 -1
  30. package/dist/core/schema-stored/schema.d.ts +2 -7
  31. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  32. package/dist/core/schema-stored/schema.js +4 -6
  33. package/dist/core/schema-stored/schema.js.map +1 -1
  34. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  35. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  36. package/dist/core/tree/anchorSet.d.ts +4 -6
  37. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  38. package/dist/core/tree/anchorSet.js +15 -1
  39. package/dist/core/tree/anchorSet.js.map +1 -1
  40. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  41. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndex.js +1 -0
  43. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  44. package/dist/core/tree/visitDelta.d.ts +7 -2
  45. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  46. package/dist/core/tree/visitDelta.js.map +1 -1
  47. package/dist/events/emitter.d.ts +127 -0
  48. package/dist/events/emitter.d.ts.map +1 -0
  49. package/dist/events/{events.js → emitter.js} +49 -28
  50. package/dist/events/emitter.js.map +1 -0
  51. package/dist/events/index.d.ts +2 -1
  52. package/dist/events/index.d.ts.map +1 -1
  53. package/dist/events/index.js +4 -5
  54. package/dist/events/index.js.map +1 -1
  55. package/dist/events/interop.d.ts +36 -0
  56. package/dist/events/interop.d.ts.map +1 -0
  57. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  58. package/dist/events/interop.js.map +1 -0
  59. package/dist/events/listeners.d.ts +65 -0
  60. package/dist/events/listeners.d.ts.map +1 -0
  61. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  62. package/dist/events/listeners.js.map +1 -0
  63. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  64. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  66. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  68. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  70. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  72. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  74. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  75. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  76. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  77. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  78. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  79. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  80. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  81. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  82. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  83. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -35
  84. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  85. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -115
  86. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  87. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  88. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  89. package/dist/feature-libraries/flex-tree/context.js +10 -7
  90. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -32
  94. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  95. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  96. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/flex-tree/index.js +1 -3
  98. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  99. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  100. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  102. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -29
  104. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyField.js +11 -17
  106. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
  108. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  109. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -159
  110. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  111. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  112. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  113. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  114. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  116. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  117. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  118. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  120. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  121. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  122. package/dist/feature-libraries/index.d.ts +3 -5
  123. package/dist/feature-libraries/index.d.ts.map +1 -1
  124. package/dist/feature-libraries/index.js +5 -13
  125. package/dist/feature-libraries/index.js.map +1 -1
  126. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  127. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  128. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  129. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  130. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  131. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  136. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  137. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  138. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  139. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  140. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  141. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  142. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  143. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  144. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  145. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  146. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  147. package/dist/feature-libraries/typed-schema/index.js +2 -2
  148. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  149. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  150. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  151. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  154. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  155. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  156. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  157. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  158. package/dist/feature-libraries/typed-schema/view.js +5 -4
  159. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  160. package/dist/index.d.ts +3 -3
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +3 -1
  163. package/dist/index.js.map +1 -1
  164. package/dist/legacy.d.ts +83 -0
  165. package/dist/packageVersion.d.ts +1 -1
  166. package/dist/packageVersion.js +1 -1
  167. package/dist/packageVersion.js.map +1 -1
  168. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  169. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  170. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  171. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  172. package/dist/shared-tree/index.d.ts +3 -3
  173. package/dist/shared-tree/index.d.ts.map +1 -1
  174. package/dist/shared-tree/index.js +2 -2
  175. package/dist/shared-tree/index.js.map +1 -1
  176. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  177. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  178. package/dist/shared-tree/schematizeTree.js +7 -8
  179. package/dist/shared-tree/schematizeTree.js.map +1 -1
  180. package/dist/shared-tree/schematizingTreeView.d.ts +9 -4
  181. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/schematizingTreeView.js +25 -12
  183. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  184. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  185. package/dist/shared-tree/sharedTree.js +2 -2
  186. package/dist/shared-tree/sharedTree.js.map +1 -1
  187. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  188. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  189. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  190. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  191. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  192. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  193. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  194. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  195. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  196. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  197. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  198. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  199. package/dist/shared-tree/treeApi.d.ts +1 -3
  200. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  201. package/dist/shared-tree/treeApi.js +6 -4
  202. package/dist/shared-tree/treeApi.js.map +1 -1
  203. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  204. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  205. package/dist/shared-tree/treeCheckout.js +17 -1
  206. package/dist/shared-tree/treeCheckout.js.map +1 -1
  207. package/dist/shared-tree-core/branch.js +1 -1
  208. package/dist/shared-tree-core/branch.js.map +1 -1
  209. package/dist/simple-tree/api/create.d.ts.map +1 -1
  210. package/dist/simple-tree/api/create.js +1 -1
  211. package/dist/simple-tree/api/create.js.map +1 -1
  212. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  213. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  214. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  215. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  216. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  217. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  218. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  219. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  220. package/dist/simple-tree/api/index.d.ts +5 -0
  221. package/dist/simple-tree/api/index.d.ts.map +1 -1
  222. package/dist/simple-tree/api/index.js +7 -1
  223. package/dist/simple-tree/api/index.js.map +1 -1
  224. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +1 -1
  225. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  226. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  227. package/dist/simple-tree/api/schemaFactory.d.ts +45 -14
  228. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  229. package/dist/simple-tree/api/schemaFactory.js +43 -12
  230. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  231. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  232. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  233. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  235. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  236. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  237. package/dist/simple-tree/api/tree.d.ts +1 -21
  238. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  239. package/dist/simple-tree/api/tree.js +3 -38
  240. package/dist/simple-tree/api/tree.js.map +1 -1
  241. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  242. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  243. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  244. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  245. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  246. package/dist/simple-tree/api/treeNodeApi.js +51 -21
  247. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  248. package/dist/simple-tree/api/verboseTree.js +2 -2
  249. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  250. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  251. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  252. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  253. package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
  254. package/dist/simple-tree/arrayNode.d.ts +2 -2
  255. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  256. package/dist/simple-tree/arrayNode.js +33 -38
  257. package/dist/simple-tree/arrayNode.js.map +1 -1
  258. package/dist/simple-tree/core/index.d.ts +2 -2
  259. package/dist/simple-tree/core/index.d.ts.map +1 -1
  260. package/dist/simple-tree/core/index.js +4 -1
  261. package/dist/simple-tree/core/index.js.map +1 -1
  262. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  263. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  264. package/dist/simple-tree/core/schemaCaching.js +10 -1
  265. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  266. package/dist/simple-tree/core/treeNodeKernel.d.ts +78 -7
  267. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  268. package/dist/simple-tree/core/treeNodeKernel.js +219 -30
  269. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  270. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  271. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  272. package/dist/simple-tree/core/types.d.ts +23 -8
  273. package/dist/simple-tree/core/types.d.ts.map +1 -1
  274. package/dist/simple-tree/core/types.js.map +1 -1
  275. package/dist/simple-tree/core/withType.d.ts +3 -2
  276. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  277. package/dist/simple-tree/core/withType.js.map +1 -1
  278. package/dist/simple-tree/index.d.ts +7 -9
  279. package/dist/simple-tree/index.d.ts.map +1 -1
  280. package/dist/simple-tree/index.js +15 -6
  281. package/dist/simple-tree/index.js.map +1 -1
  282. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  283. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  284. package/dist/simple-tree/leafNodeSchema.js +13 -11
  285. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  286. package/dist/simple-tree/mapNode.d.ts +1 -1
  287. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  288. package/dist/simple-tree/mapNode.js +38 -29
  289. package/dist/simple-tree/mapNode.js.map +1 -1
  290. package/dist/simple-tree/objectNode.d.ts +9 -7
  291. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  292. package/dist/simple-tree/objectNode.js +37 -31
  293. package/dist/simple-tree/objectNode.js.map +1 -1
  294. package/dist/simple-tree/proxies.d.ts +1 -14
  295. package/dist/simple-tree/proxies.d.ts.map +1 -1
  296. package/dist/simple-tree/proxies.js +12 -15
  297. package/dist/simple-tree/proxies.js.map +1 -1
  298. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  299. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  300. package/dist/simple-tree/proxyBinding.js +8 -181
  301. package/dist/simple-tree/proxyBinding.js.map +1 -1
  302. package/dist/simple-tree/schemaTypes.d.ts +7 -7
  303. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  304. package/dist/simple-tree/schemaTypes.js +4 -4
  305. package/dist/simple-tree/schemaTypes.js.map +1 -1
  306. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  307. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  308. package/dist/simple-tree/toFlexSchema.js +54 -31
  309. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  310. package/dist/simple-tree/toMapTree.d.ts +25 -37
  311. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  312. package/dist/simple-tree/toMapTree.js +53 -16
  313. package/dist/simple-tree/toMapTree.js.map +1 -1
  314. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  315. package/dist/simple-tree/treeNodeValid.js +7 -10
  316. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  317. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  318. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  319. package/dist/simple-tree/walkSchema.d.ts +26 -0
  320. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  321. package/dist/simple-tree/walkSchema.js +49 -0
  322. package/dist/simple-tree/walkSchema.js.map +1 -0
  323. package/dist/treeFactory.d.ts +2 -1
  324. package/dist/treeFactory.d.ts.map +1 -1
  325. package/dist/treeFactory.js +2 -1
  326. package/dist/treeFactory.js.map +1 -1
  327. package/dist/util/typeUtils.d.ts +2 -2
  328. package/dist/util/typeUtils.js.map +1 -1
  329. package/legacy.d.ts +11 -0
  330. package/lib/alpha.d.ts +102 -0
  331. package/lib/beta.d.ts +6 -1
  332. package/lib/core/index.d.ts +1 -1
  333. package/lib/core/index.d.ts.map +1 -1
  334. package/lib/core/index.js +1 -1
  335. package/lib/core/index.js.map +1 -1
  336. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  337. package/lib/core/revertible.d.ts.map +1 -0
  338. package/lib/core/revertible.js.map +1 -0
  339. package/lib/core/schema-stored/format.d.ts +3 -3
  340. package/lib/core/schema-stored/format.js +1 -1
  341. package/lib/core/schema-stored/format.js.map +1 -1
  342. package/lib/core/schema-stored/schema.d.ts +2 -7
  343. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  344. package/lib/core/schema-stored/schema.js +4 -6
  345. package/lib/core/schema-stored/schema.js.map +1 -1
  346. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  347. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  348. package/lib/core/tree/anchorSet.d.ts +4 -6
  349. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  350. package/lib/core/tree/anchorSet.js +15 -1
  351. package/lib/core/tree/anchorSet.js.map +1 -1
  352. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  353. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  354. package/lib/core/tree/detachedFieldIndex.js +1 -0
  355. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  356. package/lib/core/tree/visitDelta.d.ts +7 -2
  357. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  358. package/lib/core/tree/visitDelta.js.map +1 -1
  359. package/lib/events/emitter.d.ts +127 -0
  360. package/lib/events/emitter.d.ts.map +1 -0
  361. package/lib/events/{events.js → emitter.js} +49 -27
  362. package/lib/events/emitter.js.map +1 -0
  363. package/lib/events/index.d.ts +2 -1
  364. package/lib/events/index.d.ts.map +1 -1
  365. package/lib/events/index.js +1 -1
  366. package/lib/events/index.js.map +1 -1
  367. package/lib/events/interop.d.ts +36 -0
  368. package/lib/events/interop.d.ts.map +1 -0
  369. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  370. package/lib/events/interop.js.map +1 -0
  371. package/lib/events/listeners.d.ts +65 -0
  372. package/lib/events/listeners.d.ts.map +1 -0
  373. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  374. package/lib/events/listeners.js.map +1 -0
  375. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  376. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  377. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  378. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  379. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  380. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  381. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  382. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  384. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  385. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  386. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  388. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  390. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  391. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  392. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  394. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  395. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -35
  396. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  397. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -116
  398. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  399. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  400. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  401. package/lib/feature-libraries/flex-tree/context.js +10 -7
  402. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  403. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
  404. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  405. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -31
  406. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  407. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  408. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  409. package/lib/feature-libraries/flex-tree/index.js +2 -2
  410. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  411. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  412. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  413. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  414. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  415. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -29
  416. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  417. package/lib/feature-libraries/flex-tree/lazyField.js +11 -16
  418. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  419. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
  420. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  421. package/lib/feature-libraries/flex-tree/lazyNode.js +24 -156
  422. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  423. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  424. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  425. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  426. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  427. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  428. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  429. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  430. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  431. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  432. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  433. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  434. package/lib/feature-libraries/index.d.ts +3 -5
  435. package/lib/feature-libraries/index.d.ts.map +1 -1
  436. package/lib/feature-libraries/index.js +5 -5
  437. package/lib/feature-libraries/index.js.map +1 -1
  438. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  439. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  440. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  441. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  442. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  443. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  444. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  445. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  446. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  447. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  448. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  449. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  450. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  451. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  452. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  453. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  454. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  455. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  456. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  457. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  458. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  459. package/lib/feature-libraries/typed-schema/index.js +2 -2
  460. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  461. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  462. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  463. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  464. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  465. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  466. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  467. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  468. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  469. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  470. package/lib/feature-libraries/typed-schema/view.js +5 -4
  471. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  472. package/lib/index.d.ts +3 -3
  473. package/lib/index.d.ts.map +1 -1
  474. package/lib/index.js +3 -1
  475. package/lib/index.js.map +1 -1
  476. package/lib/legacy.d.ts +83 -0
  477. package/lib/packageVersion.d.ts +1 -1
  478. package/lib/packageVersion.js +1 -1
  479. package/lib/packageVersion.js.map +1 -1
  480. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  481. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  482. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  483. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  484. package/lib/shared-tree/index.d.ts +3 -3
  485. package/lib/shared-tree/index.d.ts.map +1 -1
  486. package/lib/shared-tree/index.js +1 -1
  487. package/lib/shared-tree/index.js.map +1 -1
  488. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  489. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  490. package/lib/shared-tree/schematizeTree.js +8 -9
  491. package/lib/shared-tree/schematizeTree.js.map +1 -1
  492. package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
  493. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  494. package/lib/shared-tree/schematizingTreeView.js +26 -13
  495. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  496. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  497. package/lib/shared-tree/sharedTree.js +2 -2
  498. package/lib/shared-tree/sharedTree.js.map +1 -1
  499. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  500. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  501. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  502. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  503. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  504. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  505. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  506. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  507. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  508. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  509. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  510. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  511. package/lib/shared-tree/treeApi.d.ts +1 -3
  512. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  513. package/lib/shared-tree/treeApi.js +7 -5
  514. package/lib/shared-tree/treeApi.js.map +1 -1
  515. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  516. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  517. package/lib/shared-tree/treeCheckout.js +18 -2
  518. package/lib/shared-tree/treeCheckout.js.map +1 -1
  519. package/lib/shared-tree-core/branch.js +1 -1
  520. package/lib/shared-tree-core/branch.js.map +1 -1
  521. package/lib/simple-tree/api/create.d.ts.map +1 -1
  522. package/lib/simple-tree/api/create.js +2 -2
  523. package/lib/simple-tree/api/create.js.map +1 -1
  524. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  525. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  526. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  527. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  528. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  529. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  530. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  531. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  532. package/lib/simple-tree/api/index.d.ts +5 -0
  533. package/lib/simple-tree/api/index.d.ts.map +1 -1
  534. package/lib/simple-tree/api/index.js +3 -0
  535. package/lib/simple-tree/api/index.js.map +1 -1
  536. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
  537. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  538. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  539. package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
  540. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  541. package/lib/simple-tree/api/schemaFactory.js +43 -12
  542. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  543. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  544. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  545. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  546. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  547. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  548. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  549. package/lib/simple-tree/api/tree.d.ts +1 -21
  550. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  551. package/lib/simple-tree/api/tree.js +2 -34
  552. package/lib/simple-tree/api/tree.js.map +1 -1
  553. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  554. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  555. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  556. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  557. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  558. package/lib/simple-tree/api/treeNodeApi.js +53 -23
  559. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  560. package/lib/simple-tree/api/verboseTree.js +1 -1
  561. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  562. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  563. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  564. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  565. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  566. package/lib/simple-tree/arrayNode.d.ts +2 -2
  567. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  568. package/lib/simple-tree/arrayNode.js +36 -41
  569. package/lib/simple-tree/arrayNode.js.map +1 -1
  570. package/lib/simple-tree/core/index.d.ts +2 -2
  571. package/lib/simple-tree/core/index.d.ts.map +1 -1
  572. package/lib/simple-tree/core/index.js +2 -2
  573. package/lib/simple-tree/core/index.js.map +1 -1
  574. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  575. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  576. package/lib/simple-tree/core/schemaCaching.js +8 -0
  577. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  578. package/lib/simple-tree/core/treeNodeKernel.d.ts +78 -7
  579. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  580. package/lib/simple-tree/core/treeNodeKernel.js +211 -24
  581. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  582. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  583. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  584. package/lib/simple-tree/core/types.d.ts +23 -8
  585. package/lib/simple-tree/core/types.d.ts.map +1 -1
  586. package/lib/simple-tree/core/types.js.map +1 -1
  587. package/lib/simple-tree/core/withType.d.ts +3 -2
  588. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  589. package/lib/simple-tree/core/withType.js.map +1 -1
  590. package/lib/simple-tree/index.d.ts +7 -9
  591. package/lib/simple-tree/index.d.ts.map +1 -1
  592. package/lib/simple-tree/index.js +5 -5
  593. package/lib/simple-tree/index.js.map +1 -1
  594. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  595. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  596. package/lib/simple-tree/leafNodeSchema.js +14 -12
  597. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  598. package/lib/simple-tree/mapNode.d.ts +1 -1
  599. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  600. package/lib/simple-tree/mapNode.js +38 -29
  601. package/lib/simple-tree/mapNode.js.map +1 -1
  602. package/lib/simple-tree/objectNode.d.ts +9 -7
  603. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  604. package/lib/simple-tree/objectNode.js +40 -34
  605. package/lib/simple-tree/objectNode.js.map +1 -1
  606. package/lib/simple-tree/proxies.d.ts +1 -14
  607. package/lib/simple-tree/proxies.d.ts.map +1 -1
  608. package/lib/simple-tree/proxies.js +11 -14
  609. package/lib/simple-tree/proxies.js.map +1 -1
  610. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  611. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  612. package/lib/simple-tree/proxyBinding.js +6 -174
  613. package/lib/simple-tree/proxyBinding.js.map +1 -1
  614. package/lib/simple-tree/schemaTypes.d.ts +7 -7
  615. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  616. package/lib/simple-tree/schemaTypes.js +4 -4
  617. package/lib/simple-tree/schemaTypes.js.map +1 -1
  618. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  619. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  620. package/lib/simple-tree/toFlexSchema.js +29 -8
  621. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  622. package/lib/simple-tree/toMapTree.d.ts +25 -37
  623. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  624. package/lib/simple-tree/toMapTree.js +54 -17
  625. package/lib/simple-tree/toMapTree.js.map +1 -1
  626. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  627. package/lib/simple-tree/treeNodeValid.js +8 -11
  628. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  629. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  630. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  631. package/lib/simple-tree/walkSchema.d.ts +26 -0
  632. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  633. package/lib/simple-tree/walkSchema.js +43 -0
  634. package/lib/simple-tree/walkSchema.js.map +1 -0
  635. package/lib/treeFactory.d.ts +2 -1
  636. package/lib/treeFactory.d.ts.map +1 -1
  637. package/lib/treeFactory.js +2 -1
  638. package/lib/treeFactory.js.map +1 -1
  639. package/lib/tsdoc-metadata.json +1 -1
  640. package/lib/util/typeUtils.d.ts +2 -2
  641. package/lib/util/typeUtils.js.map +1 -1
  642. package/package.json +58 -36
  643. package/src/core/index.ts +1 -1
  644. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  645. package/src/core/schema-stored/format.ts +1 -1
  646. package/src/core/schema-stored/schema.ts +6 -13
  647. package/src/core/tree/anchorSet.ts +35 -9
  648. package/src/core/tree/detachedFieldIndex.ts +6 -5
  649. package/src/core/tree/visitDelta.ts +7 -2
  650. package/src/events/{events.ts → emitter.ts} +55 -134
  651. package/src/events/index.ts +7 -7
  652. package/src/events/interop.ts +49 -0
  653. package/src/events/listeners.ts +68 -0
  654. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  655. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  656. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  657. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  658. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  659. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -231
  660. package/src/feature-libraries/flex-tree/README.md +4 -75
  661. package/src/feature-libraries/flex-tree/context.ts +37 -16
  662. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -458
  663. package/src/feature-libraries/flex-tree/index.ts +7 -29
  664. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  665. package/src/feature-libraries/flex-tree/lazyField.ts +49 -79
  666. package/src/feature-libraries/flex-tree/lazyNode.ts +26 -306
  667. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  668. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  669. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  670. package/src/feature-libraries/index.ts +2 -41
  671. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  672. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  673. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  674. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
  675. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  676. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  677. package/src/feature-libraries/typed-schema/index.ts +1 -3
  678. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  679. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  680. package/src/feature-libraries/typed-schema/view.ts +4 -13
  681. package/src/index.ts +5 -1
  682. package/src/packageVersion.ts +1 -1
  683. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  684. package/src/shared-tree/index.ts +2 -7
  685. package/src/shared-tree/schematizeTree.ts +23 -12
  686. package/src/shared-tree/schematizingTreeView.ts +34 -24
  687. package/src/shared-tree/sharedTree.ts +6 -1
  688. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  689. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  690. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  691. package/src/shared-tree/treeApi.ts +10 -10
  692. package/src/shared-tree/treeCheckout.ts +26 -15
  693. package/src/shared-tree-core/branch.ts +1 -1
  694. package/src/simple-tree/ProxyBinding.md +23 -23
  695. package/src/simple-tree/api/create.ts +8 -3
  696. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  697. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  698. package/src/simple-tree/api/index.ts +20 -0
  699. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
  700. package/src/simple-tree/api/schemaFactory.ts +44 -13
  701. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
  702. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
  703. package/src/simple-tree/api/tree.ts +2 -71
  704. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  705. package/src/simple-tree/api/treeNodeApi.ts +63 -22
  706. package/src/simple-tree/api/verboseTree.ts +1 -1
  707. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
  708. package/src/simple-tree/arrayNode.ts +38 -41
  709. package/src/simple-tree/core/index.ts +4 -0
  710. package/src/simple-tree/core/schemaCaching.ts +10 -0
  711. package/src/simple-tree/core/treeNodeKernel.ts +279 -27
  712. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  713. package/src/simple-tree/core/types.ts +23 -8
  714. package/src/simple-tree/core/withType.ts +3 -1
  715. package/src/simple-tree/index.ts +29 -20
  716. package/src/simple-tree/leafNodeSchema.ts +24 -28
  717. package/src/simple-tree/mapNode.ts +47 -29
  718. package/src/simple-tree/objectNode.ts +51 -46
  719. package/src/simple-tree/proxies.ts +22 -51
  720. package/src/simple-tree/proxyBinding.ts +3 -254
  721. package/src/simple-tree/schemaTypes.ts +8 -8
  722. package/src/simple-tree/toFlexSchema.ts +40 -7
  723. package/src/simple-tree/toMapTree.ts +113 -79
  724. package/src/simple-tree/treeNodeValid.ts +10 -13
  725. package/src/simple-tree/typesUnsafe.ts +13 -13
  726. package/src/simple-tree/walkSchema.ts +81 -0
  727. package/src/treeFactory.ts +2 -1
  728. package/src/util/typeUtils.ts +2 -2
  729. package/dist/core/revertible/index.d.ts.map +0 -1
  730. package/dist/core/revertible/index.js +0 -10
  731. package/dist/core/revertible/index.js.map +0 -1
  732. package/dist/core/revertible/revertible.d.ts.map +0 -1
  733. package/dist/core/revertible/revertible.js.map +0 -1
  734. package/dist/domains/index.d.ts +0 -8
  735. package/dist/domains/index.d.ts.map +0 -1
  736. package/dist/domains/index.js +0 -20
  737. package/dist/domains/index.js.map +0 -1
  738. package/dist/domains/json/index.d.ts +0 -7
  739. package/dist/domains/json/index.d.ts.map +0 -1
  740. package/dist/domains/json/index.js +0 -17
  741. package/dist/domains/json/index.js.map +0 -1
  742. package/dist/domains/json/jsonCursor.d.ts +0 -52
  743. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  744. package/dist/domains/json/jsonCursor.js +0 -197
  745. package/dist/domains/json/jsonCursor.js.map +0 -1
  746. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  747. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  748. package/dist/domains/json/jsonDomainSchema.js +0 -32
  749. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  750. package/dist/domains/leafDomain.d.ts +0 -72
  751. package/dist/domains/leafDomain.d.ts.map +0 -1
  752. package/dist/domains/leafDomain.js +0 -88
  753. package/dist/domains/leafDomain.js.map +0 -1
  754. package/dist/domains/schemaBuilder.d.ts +0 -103
  755. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  756. package/dist/domains/schemaBuilder.js +0 -121
  757. package/dist/domains/schemaBuilder.js.map +0 -1
  758. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  759. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  760. package/dist/domains/testRecursiveDomain.js +0 -35
  761. package/dist/domains/testRecursiveDomain.js.map +0 -1
  762. package/dist/events/events.d.ts +0 -201
  763. package/dist/events/events.d.ts.map +0 -1
  764. package/dist/events/events.js.map +0 -1
  765. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  766. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  767. package/dist/feature-libraries/schemaBuilder.js +0 -40
  768. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  769. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  770. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  771. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  772. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  773. package/dist/shared-tree/treeView.d.ts +0 -73
  774. package/dist/shared-tree/treeView.d.ts.map +0 -1
  775. package/dist/shared-tree/treeView.js.map +0 -1
  776. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  777. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  778. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  779. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  780. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  781. package/dist/simple-tree/jsonSchema.js.map +0 -1
  782. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  783. package/dist/simple-tree/simpleSchema.js.map +0 -1
  784. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  785. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  786. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  787. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  788. package/lib/core/revertible/index.d.ts.map +0 -1
  789. package/lib/core/revertible/index.js.map +0 -1
  790. package/lib/core/revertible/revertible.d.ts.map +0 -1
  791. package/lib/core/revertible/revertible.js.map +0 -1
  792. package/lib/domains/index.d.ts +0 -8
  793. package/lib/domains/index.d.ts.map +0 -1
  794. package/lib/domains/index.js +0 -8
  795. package/lib/domains/index.js.map +0 -1
  796. package/lib/domains/json/index.d.ts +0 -7
  797. package/lib/domains/json/index.d.ts.map +0 -1
  798. package/lib/domains/json/index.js +0 -7
  799. package/lib/domains/json/index.js.map +0 -1
  800. package/lib/domains/json/jsonCursor.d.ts +0 -52
  801. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  802. package/lib/domains/json/jsonCursor.js +0 -192
  803. package/lib/domains/json/jsonCursor.js.map +0 -1
  804. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  805. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  806. package/lib/domains/json/jsonDomainSchema.js +0 -29
  807. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  808. package/lib/domains/leafDomain.d.ts +0 -72
  809. package/lib/domains/leafDomain.d.ts.map +0 -1
  810. package/lib/domains/leafDomain.js +0 -85
  811. package/lib/domains/leafDomain.js.map +0 -1
  812. package/lib/domains/schemaBuilder.d.ts +0 -103
  813. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  814. package/lib/domains/schemaBuilder.js +0 -117
  815. package/lib/domains/schemaBuilder.js.map +0 -1
  816. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  817. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  818. package/lib/domains/testRecursiveDomain.js +0 -32
  819. package/lib/domains/testRecursiveDomain.js.map +0 -1
  820. package/lib/events/events.d.ts +0 -201
  821. package/lib/events/events.d.ts.map +0 -1
  822. package/lib/events/events.js.map +0 -1
  823. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  824. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  825. package/lib/feature-libraries/schemaBuilder.js +0 -36
  826. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  827. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  828. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  829. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  830. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  831. package/lib/shared-tree/treeView.d.ts +0 -73
  832. package/lib/shared-tree/treeView.d.ts.map +0 -1
  833. package/lib/shared-tree/treeView.js.map +0 -1
  834. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  835. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  836. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  837. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  838. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  839. package/lib/simple-tree/jsonSchema.js.map +0 -1
  840. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  841. package/lib/simple-tree/simpleSchema.js.map +0 -1
  842. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  843. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  844. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  845. package/src/domains/README.md +0 -6
  846. package/src/domains/fence.json +0 -5
  847. package/src/domains/index.ts +0 -19
  848. package/src/domains/json/fence.json +0 -5
  849. package/src/domains/json/index.ts +0 -13
  850. package/src/domains/json/jsonCursor.ts +0 -247
  851. package/src/domains/json/jsonDomainSchema.ts +0 -47
  852. package/src/domains/leafDomain.ts +0 -97
  853. package/src/domains/schemaBuilder.ts +0 -153
  854. package/src/domains/testRecursiveDomain.ts +0 -38
  855. package/src/events/fence.json +0 -5
  856. package/src/feature-libraries/schemaBuilder.ts +0 -45
  857. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  858. package/src/shared-tree/treeView.ts +0 -113
  859. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  860. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  861. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  862. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  863. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  864. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  865. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  866. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type Anchor, type AnchorNode, type FieldKey, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type TreeValue, type Value } from "../../core/index.js";
6
- import { type FlexMapNodeSchema, type FlexObjectNodeSchema, type FlexTreeNodeSchema, type LeafNodeSchema } from "../typed-schema/index.js";
5
+ import { type Anchor, type AnchorNode, type FieldKey, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type Value } from "../../core/index.js";
6
+ import { type FlexTreeNodeSchema } from "../typed-schema/index.js";
7
7
  import type { Context } from "./context.js";
8
- import { FlexTreeEntityKind, type FlexTreeField, type FlexTreeLeafNode, type FlexTreeMapNode, type FlexTreeNode, type FlexTreeObjectNodeTyped, type FlexTreeTypedField, type FlexTreeTypedNode, type FlexTreeUnboxField, type PropertyNameFromFieldKey, flexTreeMarker } from "./flexTreeTypes.js";
8
+ import { FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, flexTreeMarker } from "./flexTreeTypes.js";
9
9
  import { LazyEntity, forgetAnchorSymbol, tryMoveCursorToAnchorSymbol } from "./lazyEntity.js";
10
10
  /**
11
11
  * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.
@@ -14,16 +14,13 @@ export declare function makeTree(context: Context, cursor: ITreeSubscriptionCurs
14
14
  /**
15
15
  * Lazy implementation of {@link FlexTreeNode}.
16
16
  */
17
- export declare abstract class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema> extends LazyEntity<TSchema, Anchor> implements FlexTreeNode {
17
+ export declare class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema> extends LazyEntity<TSchema, Anchor> implements FlexTreeNode {
18
18
  #private;
19
19
  readonly anchorNode: AnchorNode;
20
20
  get [flexTreeMarker](): FlexTreeEntityKind.Node;
21
- /**
22
- * Enumerable own property providing a more JS object friendly alternative to "schema".
23
- */
24
- readonly type: TreeNodeSchemaIdentifier;
21
+ get schema(): TreeNodeSchemaIdentifier;
25
22
  constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
26
- is<TSchemaInner extends FlexTreeNodeSchema>(schema: TSchemaInner): this is FlexTreeTypedNode<TSchemaInner>;
23
+ is(schema: FlexTreeNodeSchema): boolean;
27
24
  protected [tryMoveCursorToAnchorSymbol](cursor: ITreeSubscriptionCursor): TreeNavigationResult;
28
25
  protected [forgetAnchorSymbol](): void;
29
26
  get value(): Value;
@@ -34,31 +31,6 @@ export declare abstract class LazyTreeNode<TSchema extends FlexTreeNodeSchema =
34
31
  readonly parent: FlexTreeField;
35
32
  readonly index: number;
36
33
  };
37
- }
38
- export declare class LazyMap<TSchema extends FlexMapNodeSchema> extends LazyTreeNode<TSchema> implements FlexTreeMapNode<TSchema> {
39
- constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
40
34
  keys(): IterableIterator<FieldKey>;
41
- values(): IterableIterator<FlexTreeUnboxField<TSchema["info"], "notEmpty">>;
42
- entries(): IterableIterator<[
43
- FieldKey,
44
- FlexTreeUnboxField<TSchema["info"], "notEmpty">
45
- ]>;
46
- forEach(callbackFn: (value: FlexTreeUnboxField<TSchema["info"], "notEmpty">, key: FieldKey, map: FlexTreeMapNode<TSchema>) => void, thisArg?: unknown): void;
47
- getBoxed(key: string): FlexTreeTypedField<TSchema["info"]>;
48
- boxedIterator(): IterableIterator<FlexTreeTypedField<TSchema["info"]>>;
49
- [Symbol.iterator](): IterableIterator<[
50
- FieldKey,
51
- FlexTreeUnboxField<TSchema["info"], "notEmpty">
52
- ]>;
53
- }
54
- export declare class LazyLeaf<TSchema extends LeafNodeSchema> extends LazyTreeNode<TSchema> implements FlexTreeLeafNode<TSchema> {
55
- constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
56
- get value(): TreeValue<TSchema["info"]>;
57
35
  }
58
- /**
59
- * {@link reservedObjectNodeFieldPropertyNames} but as a set.
60
- */
61
- export declare const reservedObjectNodeFieldPropertyNameSet: ReadonlySet<string>;
62
- export declare function propertyNameFromFieldKey<T extends string>(key: T): PropertyNameFromFieldKey<T>;
63
- export declare function buildLazyObjectNode<TSchema extends FlexObjectNodeSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor): LazyTreeNode<TSchema> & FlexTreeObjectNodeTyped<TSchema>;
64
36
  //# sourceMappingURL=lazyNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAIN,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAG5B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,KAAK,wBAAwB,EAC7B,cAAc,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,UAAU,EAGV,kBAAkB,EAClB,2BAA2B,EAC3B,MAAM,iBAAiB,CAAC;AAIzB;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB,GAAG,YAAY,CAcxF;AA4BD;;GAEG;AACH,8BAAsB,YAAY,CAAC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,CACzF,SAAQ,UAAU,CAAC,OAAO,EAAE,MAAM,CAClC,YAAW,YAAY;;aAiBN,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AAkB,GAAG,OAAO;cAQ3B,CAAC,2BAA2B,CAAC,CAC/C,MAAM,EAAE,uBAAuB,GAC7B,oBAAoB;cAIJ,CAAC,kBAAkB,CAAC,IAAI,IAAI;IAS/C,IAAW,KAAK,IAAI,KAAK,CAExB;IAEM,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS;IAU1D,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa;IAOtC,aAAa,IAAI,gBAAgB,CAAC,aAAa,CAAC;IAMvD,IAAW,WAAW,IAAI;QAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAgDnF;IAEM,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAAC;CAGzC"}
@@ -16,7 +16,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  };
17
17
  var _LazyTreeNode_removeDeleteCallback;
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.buildLazyObjectNode = exports.propertyNameFromFieldKey = exports.reservedObjectNodeFieldPropertyNameSet = exports.LazyLeaf = exports.LazyMap = exports.LazyTreeNode = exports.makeTree = void 0;
19
+ exports.LazyTreeNode = exports.makeTree = void 0;
20
20
  const internal_1 = require("@fluidframework/core-utils/internal");
21
21
  const index_js_1 = require("../../core/index.js");
22
22
  const index_js_2 = require("../../util/index.js");
@@ -25,7 +25,6 @@ const index_js_4 = require("../typed-schema/index.js");
25
25
  const flexTreeTypes_js_1 = require("./flexTreeTypes.js");
26
26
  const lazyEntity_js_1 = require("./lazyEntity.js");
27
27
  const lazyField_js_1 = require("./lazyField.js");
28
- const unboxed_js_1 = require("./unboxed.js");
29
28
  /**
30
29
  * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.
31
30
  */
@@ -40,8 +39,8 @@ function makeTree(context, cursor) {
40
39
  (0, internal_1.assert)(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);
41
40
  return cached;
42
41
  }
43
- const schema = context.schema.nodeSchema.get(cursor.type) ?? (0, index_js_2.fail)("missing schema");
44
- return buildSubclass(context, schema, cursor, anchorNode, anchor);
42
+ const schema = context.flexSchema.nodeSchema.get(cursor.type) ?? (0, index_js_2.fail)("missing schema");
43
+ return new LazyTreeNode(context, schema, cursor, anchorNode, anchor);
45
44
  }
46
45
  exports.makeTree = makeTree;
47
46
  function cleanupTree(anchor) {
@@ -49,19 +48,6 @@ function cleanupTree(anchor) {
49
48
  (0, internal_1.assert)(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
50
49
  cached[index_js_2.disposeSymbol]();
51
50
  }
52
- function buildSubclass(context, schema, cursor, anchorNode, anchor) {
53
- if ((0, index_js_4.schemaIsMap)(schema)) {
54
- return new LazyMap(context, schema, cursor, anchorNode, anchor);
55
- }
56
- if ((0, index_js_4.schemaIsLeaf)(schema)) {
57
- return new LazyLeaf(context, schema, cursor, anchorNode, anchor);
58
- }
59
- if ((0, index_js_4.schemaIsObjectNode)(schema)) {
60
- return buildLazyObjectNode(context, schema, cursor, anchorNode, anchor);
61
- }
62
- // TODO: there should be a common fallback that works for cases without a specialized implementation.
63
- (0, index_js_2.fail)("unrecognized node kind");
64
- }
65
51
  /**
66
52
  * Lazy implementation of {@link FlexTreeNode}.
67
53
  */
@@ -69,6 +55,9 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
69
55
  get [(_LazyTreeNode_removeDeleteCallback = new WeakMap(), flexTreeTypes_js_1.flexTreeMarker)]() {
70
56
  return flexTreeTypes_js_1.FlexTreeEntityKind.Node;
71
57
  }
58
+ get schema() {
59
+ return this.flexSchema.name;
60
+ }
72
61
  constructor(context, schema, cursor, anchorNode, anchor) {
73
62
  super(context, schema, cursor, anchor);
74
63
  this.anchorNode = anchorNode;
@@ -77,12 +66,11 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
77
66
  (0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0x783 /* must be in nodes mode */);
78
67
  anchorNode.slots.set(flexTreeTypes_js_1.flexTreeSlot, this);
79
68
  __classPrivateFieldSet(this, _LazyTreeNode_removeDeleteCallback, anchorNode.on("afterDestroy", cleanupTree), "f");
80
- (0, internal_1.assert)(this.context.schema.nodeSchema.get(this.schema.name) !== undefined, 0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */);
81
- this.type = schema.name;
69
+ (0, internal_1.assert)(this.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined, 0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */);
82
70
  }
83
71
  is(schema) {
84
- (0, internal_1.assert)(this.context.schema.nodeSchema.get(schema.name) === schema, 0x785 /* Narrowing must be done to a schema that exists in this context */);
85
- return this.schema === schema;
72
+ (0, internal_1.assert)(this.context.flexSchema.nodeSchema.get(schema.name) === schema, 0x785 /* Narrowing must be done to a schema that exists in this context */);
73
+ return this.flexSchema === schema;
86
74
  }
87
75
  [lazyEntity_js_1.tryMoveCursorToAnchorSymbol](cursor) {
88
76
  return this.context.checkout.forest.tryMoveCursorToNode(this[lazyEntity_js_1.anchorSymbol], cursor);
@@ -99,7 +87,7 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
99
87
  return this[lazyEntity_js_1.cursorSymbol].value;
100
88
  }
101
89
  tryGetField(fieldKey) {
102
- const schema = this.schema.getFieldSchema(fieldKey);
90
+ const schema = this.flexSchema.getFieldSchema(fieldKey);
103
91
  return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], fieldKey, (cursor) => {
104
92
  if (cursor.getFieldLength() === 0) {
105
93
  return undefined;
@@ -108,10 +96,13 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
108
96
  });
109
97
  }
110
98
  getBoxed(key) {
111
- return getBoxedField(this, key, this.schema.getFieldSchema(key));
99
+ const fieldSchema = this.flexSchema.getFieldSchema(key);
100
+ return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], key, (cursor) => {
101
+ return (0, lazyField_js_1.makeField)(this.context, fieldSchema, cursor);
102
+ });
112
103
  }
113
104
  boxedIterator() {
114
- return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, lazyField_js_1.makeField)(this.context, this.schema.getFieldSchema(cursor.getFieldKey()), cursor)).values();
105
+ return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, lazyField_js_1.makeField)(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor)).values();
115
106
  }
116
107
  get parentField() {
117
108
  const cursor = this[lazyEntity_js_1.cursorSymbol];
@@ -126,12 +117,12 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
126
117
  // Parent field is a detached sequence, and thus needs special handling for its schema.
127
118
  // eslint-disable-next-line unicorn/prefer-ternary
128
119
  if (key === index_js_1.rootFieldKey) {
129
- fieldSchema = this.context.schema.rootFieldSchema;
120
+ fieldSchema = this.context.flexSchema.rootFieldSchema;
130
121
  }
131
122
  else {
132
123
  // All fields (in the flex tree API) have a schema.
133
124
  // Since currently there is no known schema for detached field other than the special default root:
134
- // give all other detached fields a schema of sequence of any.
125
+ // give all other detached fields a schema of sequence of anything.
135
126
  // That schema is the only one that is safe since its the only field schema that allows any possible field content.
136
127
  //
137
128
  // TODO:
@@ -140,16 +131,18 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
140
131
  // 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.
141
132
  // 3. Possibly other unknown cases.
142
133
  // Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).
143
- // This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before s3ending the op).
134
+ // This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).
144
135
  // Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!
145
- fieldSchema = index_js_4.FlexFieldSchema.create(index_js_3.FieldKinds.sequence, [index_js_4.Any]);
136
+ fieldSchema = index_js_4.FlexFieldSchema.create(index_js_3.FieldKinds.sequence, [
137
+ ...this.context.flexSchema.nodeSchema.values(),
138
+ ]);
146
139
  }
147
140
  }
148
141
  else {
149
142
  cursor.exitField();
150
143
  const parentType = cursor.type;
151
144
  cursor.enterField(key);
152
- const nodeSchema = this.context.schema.nodeSchema.get(parentType) ??
145
+ const nodeSchema = this.context.flexSchema.nodeSchema.get(parentType) ??
153
146
  (0, index_js_2.fail)("requested schema that does not exist");
154
147
  fieldSchema = nodeSchema.getFieldSchema(key);
155
148
  }
@@ -157,138 +150,9 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
157
150
  cursor.enterNode(index);
158
151
  return { parent: proxifiedField, index };
159
152
  }
160
- }
161
- exports.LazyTreeNode = LazyTreeNode;
162
- class LazyMap extends LazyTreeNode {
163
- constructor(context, schema, cursor, anchorNode, anchor) {
164
- super(context, schema, cursor, anchorNode, anchor);
165
- }
166
153
  keys() {
167
154
  return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => cursor.getFieldKey()).values();
168
155
  }
169
- values() {
170
- return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, unboxed_js_1.unboxedField)(this.context, this.schema.info, cursor)).values();
171
- }
172
- entries() {
173
- return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => {
174
- const entry = [
175
- cursor.getFieldKey(),
176
- (0, unboxed_js_1.unboxedField)(this.context, this.schema.info, cursor),
177
- ];
178
- return entry;
179
- }).values();
180
- }
181
- forEach(callbackFn, thisArg) {
182
- const fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;
183
- for (const [key, value] of this.entries()) {
184
- fn(value, key, this);
185
- }
186
- }
187
- getBoxed(key) {
188
- return super.getBoxed((0, index_js_2.brand)(key));
189
- }
190
- boxedIterator() {
191
- return super.boxedIterator();
192
- }
193
- [Symbol.iterator]() {
194
- return this.entries();
195
- }
196
- }
197
- exports.LazyMap = LazyMap;
198
- class LazyLeaf extends LazyTreeNode {
199
- constructor(context, schema, cursor, anchorNode, anchor) {
200
- super(context, schema, cursor, anchorNode, anchor);
201
- }
202
- get value() {
203
- return super.value;
204
- }
205
- }
206
- exports.LazyLeaf = LazyLeaf;
207
- /**
208
- * {@link reservedObjectNodeFieldPropertyNames} but as a set.
209
- */
210
- exports.reservedObjectNodeFieldPropertyNameSet = new Set(flexTreeTypes_js_1.reservedObjectNodeFieldPropertyNames);
211
- function propertyNameFromFieldKey(key) {
212
- if (exports.reservedObjectNodeFieldPropertyNameSet.has(key)) {
213
- return `field${(0, index_js_2.capitalize)(key)}`;
214
- }
215
- for (const prefix of flexTreeTypes_js_1.reservedObjectNodeFieldPropertyNamePrefixes) {
216
- if (key.startsWith(prefix)) {
217
- const afterPrefix = key.slice(prefix.length);
218
- if (afterPrefix === (0, index_js_2.capitalize)(afterPrefix)) {
219
- return `field${(0, index_js_2.capitalize)(key)}`;
220
- }
221
- }
222
- }
223
- return key;
224
- }
225
- exports.propertyNameFromFieldKey = propertyNameFromFieldKey;
226
- function buildLazyObjectNode(context, schema, cursor, anchorNode, anchor) {
227
- const objectNodeClass = (0, index_js_2.getOrCreate)(cachedStructClasses, schema, () => buildStructClass(schema));
228
- return new objectNodeClass(context, cursor, anchorNode, anchor);
229
- }
230
- exports.buildLazyObjectNode = buildLazyObjectNode;
231
- const cachedStructClasses = new WeakMap();
232
- function getBoxedField(objectNode, key, fieldSchema) {
233
- return (0, index_js_1.inCursorField)(objectNode[lazyEntity_js_1.cursorSymbol], key, (cursor) => {
234
- return (0, lazyField_js_1.makeField)(objectNode.context, fieldSchema, cursor);
235
- });
236
- }
237
- function buildStructClass(schema) {
238
- const propertyDescriptorMap = {};
239
- for (const [key, fieldSchema] of schema.objectNodeFields) {
240
- const escapedKey = propertyNameFromFieldKey(key);
241
- let setter;
242
- switch (fieldSchema.kind) {
243
- case index_js_3.FieldKinds.optional: {
244
- setter = function (newContent) {
245
- const field = getBoxedField(this, key, fieldSchema);
246
- field.editor.set(newContent, field.length === 0);
247
- };
248
- break;
249
- }
250
- case index_js_3.FieldKinds.required: {
251
- setter = function (newContent) {
252
- const field = getBoxedField(this, key, fieldSchema);
253
- field.editor.set(newContent);
254
- };
255
- break;
256
- }
257
- default:
258
- setter = undefined;
259
- break;
260
- }
261
- // Create getter and setter (when appropriate) for property
262
- propertyDescriptorMap[escapedKey] = {
263
- enumerable: true,
264
- get() {
265
- return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], key, (cursor) => (0, unboxed_js_1.unboxedField)(this.context, fieldSchema, cursor));
266
- },
267
- set: setter,
268
- };
269
- // Create set method for property (when appropriate)
270
- if (setter !== undefined) {
271
- propertyDescriptorMap[`set${(0, index_js_2.capitalize)(escapedKey)}`] = {
272
- enumerable: false,
273
- get() {
274
- return setter;
275
- },
276
- };
277
- }
278
- propertyDescriptorMap[`boxed${(0, index_js_2.capitalize)(escapedKey)}`] = {
279
- enumerable: false,
280
- get() {
281
- return getBoxedField(this, key, fieldSchema);
282
- },
283
- };
284
- }
285
- // This must implement `StructTyped<TSchema>`, but TypeScript can't constrain it to do so.
286
- class CustomStruct extends LazyTreeNode {
287
- constructor(context, cursor, anchorNode, anchor) {
288
- super(context, schema, cursor, anchorNode, anchor);
289
- }
290
- }
291
- Object.defineProperties(CustomStruct.prototype, propertyDescriptorMap);
292
- return CustomStruct;
293
156
  }
157
+ exports.LazyTreeNode = LazyTreeNode;
294
158
  //# sourceMappingURL=lazyNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode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AAqB;QAC/C,YACC,OAAgB,EAChB,MAA+B,EAC/B,UAAsB,EACtB,MAAc;YAEd,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;KACD;IAED,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEvE,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { brand, capitalize, disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport {\n\tAny,\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype LeafNodeSchema,\n\tschemaIsLeaf,\n\tschemaIsMap,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeLeafNode,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeObjectNodeTyped,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeTypedNode,\n\ttype FlexTreeUnboxField,\n\ttype FlexibleNodeContent,\n\ttype PropertyNameFromFieldKey,\n\tflexTreeMarker,\n\tflexTreeSlot,\n\treservedObjectNodeFieldPropertyNamePrefixes,\n\treservedObjectNodeFieldPropertyNames,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport { unboxedField } from \"./unboxed.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(\"cursor should point to a node that is not the root of the AnchorSet\");\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached as LazyTreeNode;\n\t}\n\tconst schema = context.schema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn buildSubclass(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\nfunction buildSubclass(\n\tcontext: Context,\n\tschema: FlexTreeNodeSchema,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n): LazyTreeNode {\n\tif (schemaIsMap(schema)) {\n\t\treturn new LazyMap(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsLeaf(schema)) {\n\t\treturn new LazyLeaf(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsObjectNode(schema)) {\n\t\treturn buildLazyObjectNode(context, schema, cursor, anchorNode, anchor);\n\t}\n\t// TODO: there should be a common fallback that works for cases without a specialized implementation.\n\tfail(\"unrecognized node kind\");\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport abstract class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\t/**\n\t * Enumerable own property providing a more JS object friendly alternative to \"schema\".\n\t */\n\tpublic readonly type: TreeNodeSchemaIdentifier;\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(this.schema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\n\t\tthis.type = schema.name;\n\t}\n\n\tpublic is<TSchemaInner extends FlexTreeNodeSchema>(\n\t\tschema: TSchemaInner,\n\t): this is FlexTreeTypedNode<TSchemaInner> {\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.schema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.schema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\treturn getBoxedField(this, key, this.schema.getFieldSchema(key));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.schema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FlexFieldSchema;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of any.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before s3ending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [Any]);\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n}\n\nexport class LazyMap<TSchema extends FlexMapNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeMapNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n\n\tpublic values(): IterableIterator<FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">> {\n\t\treturn mapCursorFields(\n\t\t\tthis[cursorSymbol],\n\t\t\t(cursor) =>\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t).values();\n\t}\n\n\tpublic entries(): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => {\n\t\t\tconst entry: [FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">] = [\n\t\t\t\tcursor.getFieldKey(),\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t\t];\n\t\t\treturn entry;\n\t\t}).values();\n\t}\n\n\tpublic forEach(\n\t\tcallbackFn: (\n\t\t\tvalue: FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">,\n\t\t\tkey: FieldKey,\n\t\t\tmap: FlexTreeMapNode<TSchema>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tconst fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tfn(value, key, this);\n\t\t}\n\t}\n\n\tpublic override getBoxed(key: string): FlexTreeTypedField<TSchema[\"info\"]> {\n\t\treturn super.getBoxed(brand(key)) as FlexTreeTypedField<TSchema[\"info\"]>;\n\t}\n\n\tpublic override boxedIterator(): IterableIterator<FlexTreeTypedField<TSchema[\"info\"]>> {\n\t\treturn super.boxedIterator() as IterableIterator<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\nexport class LazyLeaf<TSchema extends LeafNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeLeafNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic override get value(): TreeValue<TSchema[\"info\"]> {\n\t\treturn super.value as TreeValue<TSchema[\"info\"]>;\n\t}\n}\n\n/**\n * {@link reservedObjectNodeFieldPropertyNames} but as a set.\n */\nexport const reservedObjectNodeFieldPropertyNameSet: ReadonlySet<string> = new Set(\n\treservedObjectNodeFieldPropertyNames,\n);\n\nexport function propertyNameFromFieldKey<T extends string>(\n\tkey: T,\n): PropertyNameFromFieldKey<T> {\n\tif (reservedObjectNodeFieldPropertyNameSet.has(key)) {\n\t\treturn `field${capitalize(key)}` as PropertyNameFromFieldKey<T>;\n\t}\n\tfor (const prefix of reservedObjectNodeFieldPropertyNamePrefixes) {\n\t\tif (key.startsWith(prefix)) {\n\t\t\tconst afterPrefix = key.slice(prefix.length);\n\t\t\tif (afterPrefix === capitalize(afterPrefix)) {\n\t\t\t\treturn `field${capitalize(key)}` as PropertyNameFromFieldKey<T>;\n\t\t\t}\n\t\t}\n\t}\n\treturn key as PropertyNameFromFieldKey<T>;\n}\n\nexport function buildLazyObjectNode<TSchema extends FlexObjectNodeSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n): LazyTreeNode<TSchema> & FlexTreeObjectNodeTyped<TSchema> {\n\tconst objectNodeClass = getOrCreate(cachedStructClasses, schema, () =>\n\t\tbuildStructClass(schema),\n\t);\n\treturn new objectNodeClass(context, cursor, anchorNode, anchor) as LazyTreeNode<TSchema> &\n\t\tFlexTreeObjectNodeTyped<TSchema>;\n}\n\nconst cachedStructClasses = new WeakMap<\n\tFlexObjectNodeSchema,\n\tnew (\n\t\tcontext: Context,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) => LazyTreeNode<FlexObjectNodeSchema>\n>();\n\nfunction getBoxedField(\n\tobjectNode: LazyTreeNode,\n\tkey: FieldKey,\n\tfieldSchema: FlexFieldSchema,\n): FlexTreeField {\n\treturn inCursorField(objectNode[cursorSymbol], key, (cursor) => {\n\t\treturn makeField(objectNode.context, fieldSchema, cursor);\n\t});\n}\n\nfunction buildStructClass<TSchema extends FlexObjectNodeSchema>(\n\tschema: TSchema,\n): new (\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n) => LazyTreeNode<TSchema> {\n\tconst propertyDescriptorMap: PropertyDescriptorMap = {};\n\n\tfor (const [key, fieldSchema] of schema.objectNodeFields) {\n\t\tconst escapedKey = propertyNameFromFieldKey(key);\n\t\tlet setter: ((newContent: FlexibleNodeContent) => void) | undefined;\n\t\tswitch (fieldSchema.kind) {\n\t\t\tcase FieldKinds.optional: {\n\t\t\t\tsetter = function (\n\t\t\t\t\tthis: CustomStruct,\n\t\t\t\t\tnewContent: FlexibleNodeContent | undefined,\n\t\t\t\t): void {\n\t\t\t\t\tconst field = getBoxedField(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t) as FlexTreeOptionalField<FlexAllowedTypes>;\n\t\t\t\t\tfield.editor.set(newContent, field.length === 0);\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase FieldKinds.required: {\n\t\t\t\tsetter = function (this: CustomStruct, newContent: FlexibleNodeContent): void {\n\t\t\t\t\tconst field = getBoxedField(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t) as FlexTreeRequiredField<FlexAllowedTypes>;\n\t\t\t\t\tfield.editor.set(newContent);\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tsetter = undefined;\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Create getter and setter (when appropriate) for property\n\t\tpropertyDescriptorMap[escapedKey] = {\n\t\t\tenumerable: true,\n\t\t\tget(this: CustomStruct): unknown {\n\t\t\t\treturn inCursorField(this[cursorSymbol], key, (cursor) =>\n\t\t\t\t\tunboxedField(this.context, fieldSchema, cursor),\n\t\t\t\t);\n\t\t\t},\n\t\t\tset: setter,\n\t\t};\n\n\t\t// Create set method for property (when appropriate)\n\t\tif (setter !== undefined) {\n\t\t\tpropertyDescriptorMap[`set${capitalize(escapedKey)}`] = {\n\t\t\t\tenumerable: false,\n\t\t\t\tget(this: CustomStruct) {\n\t\t\t\t\treturn setter;\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tpropertyDescriptorMap[`boxed${capitalize(escapedKey)}`] = {\n\t\t\tenumerable: false,\n\t\t\tget(this: CustomStruct) {\n\t\t\t\treturn getBoxedField(this, key, fieldSchema);\n\t\t\t},\n\t\t};\n\t}\n\n\t// This must implement `StructTyped<TSchema>`, but TypeScript can't constrain it to do so.\n\tclass CustomStruct extends LazyTreeNode<TSchema> {\n\t\tpublic constructor(\n\t\t\tcontext: Context,\n\t\t\tcursor: ITreeSubscriptionCursor,\n\t\t\tanchorNode: AnchorNode,\n\t\t\tanchor: Anchor,\n\t\t) {\n\t\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t\t}\n\t}\n\n\tObject.defineProperties(CustomStruct.prototype, propertyDescriptorMap);\n\n\treturn CustomStruct;\n}\n"]}
1
+ {"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA6D;AAE7D,kDAY6B;AAC7B,kDAA0D;AAC1D,yDAAwD;AACxD,uDAAoF;AAGpF,yDAM4B;AAC5B,mDAMyB;AACzB,iDAA2C;AAE3C;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAgB,EAAE,MAA+B;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,UAAU,GACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9C,IAAA,eAAI,EAAC,qEAAqE,CAAC,CAAC;IAC7E,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;IAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAA,iBAAM,EAAC,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACpE,IAAA,iBAAM,EAAC,MAAM,YAAY,YAAY,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC1E,OAAO,MAAsB,CAAC;IAC/B,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,eAAI,EAAC,gBAAgB,CAAC,CAAC;IACxF,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,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AwIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport { FlexFieldSchema, type FlexTreeNodeSchema } from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(\"cursor should point to a node that is not the root of the AnchorSet\");\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached as LazyTreeNode;\n\t}\n\tconst schema = context.flexSchema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn new LazyTreeNode(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.flexSchema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.flexSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.flexSchema.getFieldSchema(key);\n\t\treturn inCursorField(this[cursorSymbol], key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema, cursor);\n\t\t});\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FlexFieldSchema;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.flexSchema.rootFieldSchema;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [\n\t\t\t\t\t...this.context.flexSchema.nodeSchema.values(),\n\t\t\t\t]);\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.flexSchema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
@@ -2,23 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ITreeSubscriptionCursor } from "../../core/index.js";
6
- import type { FlexFieldKind } from "../modular-schema/index.js";
7
- import { type FlexAllowedTypes, type FlexFieldSchema, type FlexTreeNodeSchema } from "../typed-schema/index.js";
5
+ import type { ITreeSubscriptionCursor } from "../../core/index.js";
8
6
  import type { Context } from "./context.js";
9
- import type { FlexTreeUnboxField, FlexTreeUnboxNode, FlexTreeUnboxNodeUnion } from "./flexTreeTypes.js";
7
+ import type { FlexTreeUnknownUnboxed } from "./flexTreeTypes.js";
10
8
  /**
11
- * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.
9
+ * Returns the flex tree node, of the value if it has one.
12
10
  */
13
- export declare function unboxedTree<TSchema extends FlexTreeNodeSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor): FlexTreeUnboxNode<TSchema>;
14
- /**
15
- * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
16
- */
17
- export declare function unboxedUnion<TTypes extends FlexAllowedTypes>(context: Context, schema: FlexFieldSchema<FlexFieldKind, TTypes>, cursor: ITreeSubscriptionCursor): FlexTreeUnboxNodeUnion<TTypes>;
18
- /**
19
- * @param context - the common context of the field.
20
- * @param schema - the TreeFieldStoredSchema of the field.
21
- * @param cursor - the cursor, which must point to the field being proxified.
22
- */
23
- export declare function unboxedField<TSchema extends FlexFieldSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor): FlexTreeUnboxField<TSchema>;
11
+ export declare function unboxedFlexNode(context: Context, cursor: ITreeSubscriptionCursor): FlexTreeUnknownUnboxed;
24
12
  //# sourceMappingURL=unboxed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAgB,MAAM,qBAAqB,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAEX,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,kBAAkB,EAC7D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,uBAAuB,GAC7B,iBAAiB,CAAC,OAAO,CAAC,CAM5B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,gBAAgB,EAC3D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAAC,MAAM,CAAC,CAMhC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAS,eAAe,EAC3D,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,uBAAuB,GAC7B,kBAAkB,CAAC,OAAO,CAAC,CAkB7B"}
1
+ {"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAMxB"}
@@ -4,51 +4,17 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.unboxedField = exports.unboxedUnion = exports.unboxedTree = void 0;
8
- const index_js_1 = require("../../core/index.js");
9
- const index_js_2 = require("../default-schema/index.js");
10
- const index_js_3 = require("../typed-schema/index.js");
11
- const lazyField_js_1 = require("./lazyField.js");
7
+ exports.unboxedFlexNode = void 0;
12
8
  const lazyNode_js_1 = require("./lazyNode.js");
13
9
  /**
14
- * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.
10
+ * Returns the flex tree node, of the value if it has one.
15
11
  */
16
- function unboxedTree(context, schema, cursor) {
17
- if ((0, index_js_3.schemaIsLeaf)(schema)) {
18
- return cursor.value;
12
+ function unboxedFlexNode(context, cursor) {
13
+ const value = cursor.value;
14
+ if (value !== undefined) {
15
+ return value;
19
16
  }
20
17
  return (0, lazyNode_js_1.makeTree)(context, cursor);
21
18
  }
22
- exports.unboxedTree = unboxedTree;
23
- /**
24
- * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
25
- */
26
- function unboxedUnion(context, schema, cursor) {
27
- const type = schema.monomorphicChildType;
28
- if (type !== undefined) {
29
- return unboxedTree(context, type, cursor);
30
- }
31
- return (0, lazyNode_js_1.makeTree)(context, cursor);
32
- }
33
- exports.unboxedUnion = unboxedUnion;
34
- /**
35
- * @param context - the common context of the field.
36
- * @param schema - the TreeFieldStoredSchema of the field.
37
- * @param cursor - the cursor, which must point to the field being proxified.
38
- */
39
- function unboxedField(context, schema, cursor) {
40
- const kind = schema.kind;
41
- if (kind === index_js_2.FieldKinds.required) {
42
- return (0, index_js_1.inCursorNode)(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
43
- }
44
- if (kind === index_js_2.FieldKinds.optional) {
45
- if (cursor.getFieldLength() === 0) {
46
- return undefined;
47
- }
48
- return (0, index_js_1.inCursorNode)(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
49
- }
50
- // TODO: forbidden and nodeKey
51
- return (0, lazyField_js_1.makeField)(context, schema, cursor);
52
- }
53
- exports.unboxedField = unboxedField;
19
+ exports.unboxedFlexNode = unboxedFlexNode;
54
20
  //# sourceMappingURL=unboxed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAAiF;AACjF,yDAAwD;AAExD,uDAKkC;AASlC,iDAA2C;AAC3C,+CAAyC;AAEzC;;GAEG;AACH,SAAgB,WAAW,CAC1B,OAAgB,EAChB,MAAe,EACf,MAA+B;IAE/B,IAAI,IAAA,uBAAY,EAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,KAAmC,CAAC;IACnD,CAAC;IAED,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAA+C,CAAC;AAChF,CAAC;AAVD,kCAUC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC3B,OAAgB,EAChB,MAA8C,EAC9C,MAA+B;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC;IACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAmC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAmC,CAAC;AACpE,CAAC;AAVD,oCAUC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAC3B,OAAgB,EAChB,MAAe,EACf,MAA+B;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,IAAI,IAAI,KAAK,qBAAU,CAAC,QAAQ,EAAE,CAAC;QAClC,OAAO,IAAA,uBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAC9C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CACX,CAAC;IAClC,CAAC;IACD,IAAI,IAAI,KAAK,qBAAU,CAAC,QAAQ,EAAE,CAAC;QAClC,IAAI,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,SAAwC,CAAC;QACjD,CAAC;QACD,OAAO,IAAA,uBAAY,EAAC,MAAM,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,CAC9C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CACX,CAAC;IAClC,CAAC;IAED,8BAA8B;IAC9B,OAAO,IAAA,wBAAS,EAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAgC,CAAC;AAC1E,CAAC;AAtBD,oCAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ITreeSubscriptionCursor, inCursorNode } from \"../../core/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\ttype FlexFieldSchema,\n\ttype FlexTreeNodeSchema,\n\tschemaIsLeaf,\n} from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type {\n\tFlexTreeNode,\n\tFlexTreeUnboxField,\n\tFlexTreeUnboxNode,\n\tFlexTreeUnboxNodeUnion,\n} from \"./flexTreeTypes.js\";\nimport { makeField } from \"./lazyField.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * See {@link FlexTreeUnboxNode} for documentation on what unwrapping this performs.\n */\nexport function unboxedTree<TSchema extends FlexTreeNodeSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxNode<TSchema> {\n\tif (schemaIsLeaf(schema)) {\n\t\treturn cursor.value as FlexTreeUnboxNode<TSchema>;\n\t}\n\n\treturn makeTree(context, cursor) as FlexTreeNode as FlexTreeUnboxNode<TSchema>;\n}\n\n/**\n * See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.\n */\nexport function unboxedUnion<TTypes extends FlexAllowedTypes>(\n\tcontext: Context,\n\tschema: FlexFieldSchema<FlexFieldKind, TTypes>,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxNodeUnion<TTypes> {\n\tconst type = schema.monomorphicChildType;\n\tif (type !== undefined) {\n\t\treturn unboxedTree(context, type, cursor) as FlexTreeUnboxNodeUnion<TTypes>;\n\t}\n\treturn makeTree(context, cursor) as FlexTreeUnboxNodeUnion<TTypes>;\n}\n\n/**\n * @param context - the common context of the field.\n * @param schema - the TreeFieldStoredSchema of the field.\n * @param cursor - the cursor, which must point to the field being proxified.\n */\nexport function unboxedField<TSchema extends FlexFieldSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnboxField<TSchema> {\n\tconst kind = schema.kind;\n\tif (kind === FieldKinds.required) {\n\t\treturn inCursorNode(cursor, 0, (innerCursor) =>\n\t\t\tunboxedUnion(context, schema, innerCursor),\n\t\t) as FlexTreeUnboxField<TSchema>;\n\t}\n\tif (kind === FieldKinds.optional) {\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\treturn undefined as FlexTreeUnboxField<TSchema>;\n\t\t}\n\t\treturn inCursorNode(cursor, 0, (innerCursor) =>\n\t\t\tunboxedUnion(context, schema, innerCursor),\n\t\t) as FlexTreeUnboxField<TSchema>;\n\t}\n\n\t// TODO: forbidden and nodeKey\n\treturn makeField(context, schema, cursor) as FlexTreeUnboxField<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,+CAAyC;AAEzC;;GAEG;AACH,SAAgB,eAAe,CAC9B,OAAgB,EAChB,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AATD,0CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITreeSubscriptionCursor } from \"../../core/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type { FlexTreeUnknownUnboxed } from \"./flexTreeTypes.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * Returns the flex tree node, of the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\treturn makeTree(context, cursor);\n}\n"]}
@@ -30,9 +30,9 @@ export interface DetachedFieldCache {
30
30
  * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
31
31
  * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
32
32
  * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
33
- * If the schema information is not available on the given node or field (e.g. because it is an unhydrated node), returns `undefined`.
33
+ * For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
34
34
  */
35
- export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy | undefined;
35
+ export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy;
36
36
  /**
37
37
  * Indexing for {@link FlexTreeField.boxedAt} and {@link FlexTreeSequenceField.at} supports the
38
38
  * usage of negative indices, which regular indexing using `[` and `]` does not.
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,GAAG,SAAS,CAS3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E"}
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,CAK/E;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E"}
@@ -59,15 +59,12 @@ exports.detachedFieldSlot = (0, index_js_1.anchorSlot)();
59
59
  * Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
60
60
  * @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
61
61
  * @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
62
- * If the schema information is not available on the given node or field (e.g. because it is an unhydrated node), returns `undefined`.
62
+ * For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
63
63
  */
64
64
  function getSchemaAndPolicy(nodeOrField) {
65
- if (nodeOrField.context === undefined) {
66
- return undefined;
67
- }
68
65
  return {
69
- schema: nodeOrField.context.checkout.storedSchema,
70
- policy: nodeOrField.context.schema.policy,
66
+ schema: nodeOrField.context.schema,
67
+ policy: nodeOrField.context.flexSchema.policy,
71
68
  };
72
69
  }
73
70
  exports.getSchemaAndPolicy = getSchemaAndPolicy;