@fluidframework/tree 2.3.0-288113 → 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 (869) 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 -42
  14. package/api-report/tree.beta.api.md +21 -11
  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 +8 -13
  18. package/dist/alpha.d.ts +102 -0
  19. package/dist/beta.d.ts +6 -2
  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.map +1 -1
  37. package/dist/core/tree/anchorSet.js +6 -2
  38. package/dist/core/tree/anchorSet.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  40. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndex.js +1 -0
  42. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  43. package/dist/core/tree/visitDelta.d.ts +7 -2
  44. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  45. package/dist/core/tree/visitDelta.js.map +1 -1
  46. package/dist/events/emitter.d.ts +127 -0
  47. package/dist/events/emitter.d.ts.map +1 -0
  48. package/dist/events/{events.js → emitter.js} +48 -30
  49. package/dist/events/emitter.js.map +1 -0
  50. package/dist/events/index.d.ts +2 -1
  51. package/dist/events/index.d.ts.map +1 -1
  52. package/dist/events/index.js +4 -5
  53. package/dist/events/index.js.map +1 -1
  54. package/dist/events/interop.d.ts +36 -0
  55. package/dist/events/interop.d.ts.map +1 -0
  56. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  57. package/dist/events/interop.js.map +1 -0
  58. package/dist/events/listeners.d.ts +65 -0
  59. package/dist/events/listeners.d.ts.map +1 -0
  60. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  61. package/dist/events/listeners.js.map +1 -0
  62. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  63. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  65. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  67. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  69. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  71. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  73. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  75. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  77. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  78. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  79. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  81. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  82. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  83. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  84. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -103
  85. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  87. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/context.js +10 -7
  89. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  90. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -3
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  95. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  97. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  98. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  99. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  100. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  102. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.js +11 -14
  104. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  106. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -74
  108. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  110. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  112. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  113. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  114. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  116. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  118. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  119. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  120. package/dist/feature-libraries/index.d.ts +3 -5
  121. package/dist/feature-libraries/index.d.ts.map +1 -1
  122. package/dist/feature-libraries/index.js +5 -11
  123. package/dist/feature-libraries/index.js.map +1 -1
  124. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  125. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  126. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  127. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  129. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  130. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  131. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  136. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  137. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  138. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  139. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  140. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  141. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  142. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  143. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  144. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  145. package/dist/feature-libraries/typed-schema/index.js +2 -2
  146. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  147. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  148. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  149. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  150. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  151. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  154. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  155. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  156. package/dist/feature-libraries/typed-schema/view.js +5 -4
  157. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  158. package/dist/index.d.ts +4 -4
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +33 -36
  161. package/dist/index.js.map +1 -1
  162. package/dist/legacy.d.ts +83 -0
  163. package/dist/packageVersion.d.ts +1 -1
  164. package/dist/packageVersion.d.ts.map +1 -1
  165. package/dist/packageVersion.js +1 -1
  166. package/dist/packageVersion.js.map +1 -1
  167. package/dist/public.d.ts +0 -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 +1 -1
  246. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  247. package/dist/simple-tree/api/treeNodeApi.js +21 -19
  248. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  249. package/dist/simple-tree/api/verboseTree.js +2 -2
  250. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  251. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  252. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  253. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  254. package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
  255. package/dist/simple-tree/arrayNode.d.ts +2 -2
  256. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  257. package/dist/simple-tree/arrayNode.js +30 -21
  258. package/dist/simple-tree/arrayNode.js.map +1 -1
  259. package/dist/simple-tree/core/index.d.ts +3 -3
  260. package/dist/simple-tree/core/index.d.ts.map +1 -1
  261. package/dist/simple-tree/core/index.js +4 -1
  262. package/dist/simple-tree/core/index.js.map +1 -1
  263. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  264. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  265. package/dist/simple-tree/core/schemaCaching.js +10 -1
  266. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  267. package/dist/simple-tree/core/treeNodeKernel.d.ts +61 -3
  268. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  269. package/dist/simple-tree/core/treeNodeKernel.js +166 -13
  270. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  271. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  272. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  273. package/dist/simple-tree/core/types.d.ts +17 -20
  274. package/dist/simple-tree/core/types.d.ts.map +1 -1
  275. package/dist/simple-tree/core/types.js.map +1 -1
  276. package/dist/simple-tree/core/withType.d.ts +3 -2
  277. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  278. package/dist/simple-tree/core/withType.js.map +1 -1
  279. package/dist/simple-tree/index.d.ts +7 -9
  280. package/dist/simple-tree/index.d.ts.map +1 -1
  281. package/dist/simple-tree/index.js +15 -6
  282. package/dist/simple-tree/index.js.map +1 -1
  283. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  284. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  285. package/dist/simple-tree/leafNodeSchema.js +13 -11
  286. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  287. package/dist/simple-tree/mapNode.d.ts +1 -1
  288. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  289. package/dist/simple-tree/mapNode.js +38 -29
  290. package/dist/simple-tree/mapNode.js.map +1 -1
  291. package/dist/simple-tree/objectNode.d.ts +9 -7
  292. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  293. package/dist/simple-tree/objectNode.js +37 -31
  294. package/dist/simple-tree/objectNode.js.map +1 -1
  295. package/dist/simple-tree/proxies.d.ts +1 -14
  296. package/dist/simple-tree/proxies.d.ts.map +1 -1
  297. package/dist/simple-tree/proxies.js +12 -15
  298. package/dist/simple-tree/proxies.js.map +1 -1
  299. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  300. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  301. package/dist/simple-tree/proxyBinding.js +8 -181
  302. package/dist/simple-tree/proxyBinding.js.map +1 -1
  303. package/dist/simple-tree/schemaTypes.d.ts +7 -7
  304. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  305. package/dist/simple-tree/schemaTypes.js +4 -4
  306. package/dist/simple-tree/schemaTypes.js.map +1 -1
  307. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  308. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  309. package/dist/simple-tree/toFlexSchema.js +54 -31
  310. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  311. package/dist/simple-tree/toMapTree.d.ts +25 -37
  312. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  313. package/dist/simple-tree/toMapTree.js +53 -16
  314. package/dist/simple-tree/toMapTree.js.map +1 -1
  315. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  316. package/dist/simple-tree/treeNodeValid.js +7 -10
  317. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  318. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  319. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  320. package/dist/simple-tree/walkSchema.d.ts +26 -0
  321. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  322. package/dist/simple-tree/walkSchema.js +49 -0
  323. package/dist/simple-tree/walkSchema.js.map +1 -0
  324. package/dist/treeFactory.d.ts +2 -1
  325. package/dist/treeFactory.d.ts.map +1 -1
  326. package/dist/treeFactory.js +2 -1
  327. package/dist/treeFactory.js.map +1 -1
  328. package/dist/util/typeUtils.d.ts +2 -2
  329. package/dist/util/typeUtils.js.map +1 -1
  330. package/legacy.d.ts +11 -0
  331. package/lib/alpha.d.ts +102 -0
  332. package/lib/beta.d.ts +6 -2
  333. package/lib/core/index.d.ts +1 -1
  334. package/lib/core/index.d.ts.map +1 -1
  335. package/lib/core/index.js +1 -1
  336. package/lib/core/index.js.map +1 -1
  337. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  338. package/lib/core/revertible.d.ts.map +1 -0
  339. package/lib/core/revertible.js.map +1 -0
  340. package/lib/core/schema-stored/format.d.ts +3 -3
  341. package/lib/core/schema-stored/format.js +1 -1
  342. package/lib/core/schema-stored/format.js.map +1 -1
  343. package/lib/core/schema-stored/schema.d.ts +2 -7
  344. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  345. package/lib/core/schema-stored/schema.js +4 -6
  346. package/lib/core/schema-stored/schema.js.map +1 -1
  347. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  348. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  349. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  350. package/lib/core/tree/anchorSet.js +6 -2
  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} +48 -29
  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 -33
  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 -104
  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 -190
  404. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  405. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -2
  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 +1 -1
  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 -28
  416. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  417. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  418. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  419. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  420. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  421. package/lib/feature-libraries/flex-tree/lazyNode.js +23 -72
  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 +4 -4
  473. package/lib/index.d.ts.map +1 -1
  474. package/lib/index.js +3 -5
  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.d.ts.map +1 -1
  479. package/lib/packageVersion.js +1 -1
  480. package/lib/packageVersion.js.map +1 -1
  481. package/lib/public.d.ts +0 -1
  482. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  483. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  484. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  485. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  486. package/lib/shared-tree/index.d.ts +3 -3
  487. package/lib/shared-tree/index.d.ts.map +1 -1
  488. package/lib/shared-tree/index.js +1 -1
  489. package/lib/shared-tree/index.js.map +1 -1
  490. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  491. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  492. package/lib/shared-tree/schematizeTree.js +8 -9
  493. package/lib/shared-tree/schematizeTree.js.map +1 -1
  494. package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
  495. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  496. package/lib/shared-tree/schematizingTreeView.js +26 -13
  497. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  498. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  499. package/lib/shared-tree/sharedTree.js +2 -2
  500. package/lib/shared-tree/sharedTree.js.map +1 -1
  501. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  502. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  503. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  504. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  505. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  506. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  507. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  508. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  509. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  510. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  511. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  512. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  513. package/lib/shared-tree/treeApi.d.ts +1 -3
  514. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  515. package/lib/shared-tree/treeApi.js +7 -5
  516. package/lib/shared-tree/treeApi.js.map +1 -1
  517. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  518. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  519. package/lib/shared-tree/treeCheckout.js +18 -2
  520. package/lib/shared-tree/treeCheckout.js.map +1 -1
  521. package/lib/shared-tree-core/branch.js +1 -1
  522. package/lib/shared-tree-core/branch.js.map +1 -1
  523. package/lib/simple-tree/api/create.d.ts.map +1 -1
  524. package/lib/simple-tree/api/create.js +2 -2
  525. package/lib/simple-tree/api/create.js.map +1 -1
  526. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  527. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  528. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  529. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  530. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  531. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  532. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  533. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  534. package/lib/simple-tree/api/index.d.ts +5 -0
  535. package/lib/simple-tree/api/index.d.ts.map +1 -1
  536. package/lib/simple-tree/api/index.js +3 -0
  537. package/lib/simple-tree/api/index.js.map +1 -1
  538. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
  539. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  540. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  541. package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
  542. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  543. package/lib/simple-tree/api/schemaFactory.js +43 -12
  544. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  545. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  546. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  547. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  548. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  549. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  550. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  551. package/lib/simple-tree/api/tree.d.ts +1 -21
  552. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  553. package/lib/simple-tree/api/tree.js +2 -34
  554. package/lib/simple-tree/api/tree.js.map +1 -1
  555. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  556. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  557. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  558. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  559. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -1
  560. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  561. package/lib/simple-tree/api/treeNodeApi.js +23 -21
  562. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  563. package/lib/simple-tree/api/verboseTree.js +1 -1
  564. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  565. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  566. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  567. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  568. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  569. package/lib/simple-tree/arrayNode.d.ts +2 -2
  570. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  571. package/lib/simple-tree/arrayNode.js +33 -24
  572. package/lib/simple-tree/arrayNode.js.map +1 -1
  573. package/lib/simple-tree/core/index.d.ts +3 -3
  574. package/lib/simple-tree/core/index.d.ts.map +1 -1
  575. package/lib/simple-tree/core/index.js +2 -2
  576. package/lib/simple-tree/core/index.js.map +1 -1
  577. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  578. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  579. package/lib/simple-tree/core/schemaCaching.js +8 -0
  580. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  581. package/lib/simple-tree/core/treeNodeKernel.d.ts +61 -3
  582. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  583. package/lib/simple-tree/core/treeNodeKernel.js +156 -5
  584. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  585. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  586. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  587. package/lib/simple-tree/core/types.d.ts +17 -20
  588. package/lib/simple-tree/core/types.d.ts.map +1 -1
  589. package/lib/simple-tree/core/types.js.map +1 -1
  590. package/lib/simple-tree/core/withType.d.ts +3 -2
  591. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  592. package/lib/simple-tree/core/withType.js.map +1 -1
  593. package/lib/simple-tree/index.d.ts +7 -9
  594. package/lib/simple-tree/index.d.ts.map +1 -1
  595. package/lib/simple-tree/index.js +5 -5
  596. package/lib/simple-tree/index.js.map +1 -1
  597. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  598. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  599. package/lib/simple-tree/leafNodeSchema.js +14 -12
  600. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  601. package/lib/simple-tree/mapNode.d.ts +1 -1
  602. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  603. package/lib/simple-tree/mapNode.js +38 -29
  604. package/lib/simple-tree/mapNode.js.map +1 -1
  605. package/lib/simple-tree/objectNode.d.ts +9 -7
  606. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  607. package/lib/simple-tree/objectNode.js +40 -34
  608. package/lib/simple-tree/objectNode.js.map +1 -1
  609. package/lib/simple-tree/proxies.d.ts +1 -14
  610. package/lib/simple-tree/proxies.d.ts.map +1 -1
  611. package/lib/simple-tree/proxies.js +11 -14
  612. package/lib/simple-tree/proxies.js.map +1 -1
  613. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  614. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  615. package/lib/simple-tree/proxyBinding.js +6 -174
  616. package/lib/simple-tree/proxyBinding.js.map +1 -1
  617. package/lib/simple-tree/schemaTypes.d.ts +7 -7
  618. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  619. package/lib/simple-tree/schemaTypes.js +4 -4
  620. package/lib/simple-tree/schemaTypes.js.map +1 -1
  621. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  622. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  623. package/lib/simple-tree/toFlexSchema.js +29 -8
  624. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  625. package/lib/simple-tree/toMapTree.d.ts +25 -37
  626. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  627. package/lib/simple-tree/toMapTree.js +54 -17
  628. package/lib/simple-tree/toMapTree.js.map +1 -1
  629. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  630. package/lib/simple-tree/treeNodeValid.js +8 -11
  631. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  632. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  633. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  634. package/lib/simple-tree/walkSchema.d.ts +26 -0
  635. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  636. package/lib/simple-tree/walkSchema.js +43 -0
  637. package/lib/simple-tree/walkSchema.js.map +1 -0
  638. package/lib/treeFactory.d.ts +2 -1
  639. package/lib/treeFactory.d.ts.map +1 -1
  640. package/lib/treeFactory.js +2 -1
  641. package/lib/treeFactory.js.map +1 -1
  642. package/lib/tsdoc-metadata.json +1 -1
  643. package/lib/util/typeUtils.d.ts +2 -2
  644. package/lib/util/typeUtils.js.map +1 -1
  645. package/package.json +57 -25
  646. package/src/core/index.ts +1 -1
  647. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  648. package/src/core/schema-stored/format.ts +1 -1
  649. package/src/core/schema-stored/schema.ts +6 -13
  650. package/src/core/tree/anchorSet.ts +18 -3
  651. package/src/core/tree/detachedFieldIndex.ts +6 -5
  652. package/src/core/tree/visitDelta.ts +7 -2
  653. package/src/events/{events.ts → emitter.ts} +52 -139
  654. package/src/events/index.ts +7 -7
  655. package/src/events/interop.ts +49 -0
  656. package/src/events/listeners.ts +68 -0
  657. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  658. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  659. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  660. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  661. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  662. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -210
  663. package/src/feature-libraries/flex-tree/README.md +4 -75
  664. package/src/feature-libraries/flex-tree/context.ts +37 -16
  665. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -291
  666. package/src/feature-libraries/flex-tree/index.ts +7 -13
  667. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  668. package/src/feature-libraries/flex-tree/lazyField.ts +49 -73
  669. package/src/feature-libraries/flex-tree/lazyNode.ts +25 -154
  670. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  671. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  672. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  673. package/src/feature-libraries/index.ts +2 -27
  674. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  675. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  676. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  677. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
  678. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  679. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  680. package/src/feature-libraries/typed-schema/index.ts +1 -3
  681. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  682. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  683. package/src/feature-libraries/typed-schema/view.ts +4 -13
  684. package/src/index.ts +4 -8
  685. package/src/packageVersion.ts +1 -1
  686. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  687. package/src/shared-tree/index.ts +2 -7
  688. package/src/shared-tree/schematizeTree.ts +23 -12
  689. package/src/shared-tree/schematizingTreeView.ts +34 -24
  690. package/src/shared-tree/sharedTree.ts +6 -1
  691. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  692. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  693. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  694. package/src/shared-tree/treeApi.ts +10 -10
  695. package/src/shared-tree/treeCheckout.ts +26 -15
  696. package/src/shared-tree-core/branch.ts +1 -1
  697. package/src/simple-tree/ProxyBinding.md +23 -23
  698. package/src/simple-tree/api/create.ts +8 -3
  699. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  700. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  701. package/src/simple-tree/api/index.ts +20 -0
  702. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
  703. package/src/simple-tree/api/schemaFactory.ts +44 -13
  704. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
  705. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
  706. package/src/simple-tree/api/tree.ts +2 -71
  707. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  708. package/src/simple-tree/api/treeNodeApi.ts +32 -23
  709. package/src/simple-tree/api/verboseTree.ts +1 -1
  710. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
  711. package/src/simple-tree/arrayNode.ts +37 -31
  712. package/src/simple-tree/core/index.ts +4 -1
  713. package/src/simple-tree/core/schemaCaching.ts +10 -0
  714. package/src/simple-tree/core/treeNodeKernel.ts +198 -5
  715. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  716. package/src/simple-tree/core/types.ts +16 -27
  717. package/src/simple-tree/core/withType.ts +3 -1
  718. package/src/simple-tree/index.ts +29 -21
  719. package/src/simple-tree/leafNodeSchema.ts +24 -28
  720. package/src/simple-tree/mapNode.ts +47 -29
  721. package/src/simple-tree/objectNode.ts +51 -46
  722. package/src/simple-tree/proxies.ts +22 -51
  723. package/src/simple-tree/proxyBinding.ts +3 -254
  724. package/src/simple-tree/schemaTypes.ts +8 -8
  725. package/src/simple-tree/toFlexSchema.ts +40 -7
  726. package/src/simple-tree/toMapTree.ts +113 -79
  727. package/src/simple-tree/treeNodeValid.ts +10 -13
  728. package/src/simple-tree/typesUnsafe.ts +13 -13
  729. package/src/simple-tree/walkSchema.ts +81 -0
  730. package/src/treeFactory.ts +2 -1
  731. package/src/util/typeUtils.ts +2 -2
  732. package/dist/core/revertible/index.d.ts.map +0 -1
  733. package/dist/core/revertible/index.js +0 -10
  734. package/dist/core/revertible/index.js.map +0 -1
  735. package/dist/core/revertible/revertible.d.ts.map +0 -1
  736. package/dist/core/revertible/revertible.js.map +0 -1
  737. package/dist/domains/index.d.ts +0 -8
  738. package/dist/domains/index.d.ts.map +0 -1
  739. package/dist/domains/index.js +0 -20
  740. package/dist/domains/index.js.map +0 -1
  741. package/dist/domains/json/index.d.ts +0 -7
  742. package/dist/domains/json/index.d.ts.map +0 -1
  743. package/dist/domains/json/index.js +0 -17
  744. package/dist/domains/json/index.js.map +0 -1
  745. package/dist/domains/json/jsonCursor.d.ts +0 -52
  746. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  747. package/dist/domains/json/jsonCursor.js +0 -197
  748. package/dist/domains/json/jsonCursor.js.map +0 -1
  749. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  750. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  751. package/dist/domains/json/jsonDomainSchema.js +0 -32
  752. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  753. package/dist/domains/leafDomain.d.ts +0 -72
  754. package/dist/domains/leafDomain.d.ts.map +0 -1
  755. package/dist/domains/leafDomain.js +0 -88
  756. package/dist/domains/leafDomain.js.map +0 -1
  757. package/dist/domains/schemaBuilder.d.ts +0 -103
  758. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  759. package/dist/domains/schemaBuilder.js +0 -121
  760. package/dist/domains/schemaBuilder.js.map +0 -1
  761. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  762. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  763. package/dist/domains/testRecursiveDomain.js +0 -35
  764. package/dist/domains/testRecursiveDomain.js.map +0 -1
  765. package/dist/events/events.d.ts +0 -207
  766. package/dist/events/events.d.ts.map +0 -1
  767. package/dist/events/events.js.map +0 -1
  768. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  769. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  770. package/dist/feature-libraries/schemaBuilder.js +0 -40
  771. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  772. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  773. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  774. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  775. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  776. package/dist/shared-tree/treeView.d.ts +0 -73
  777. package/dist/shared-tree/treeView.d.ts.map +0 -1
  778. package/dist/shared-tree/treeView.js.map +0 -1
  779. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  780. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  781. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  782. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  783. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  784. package/dist/simple-tree/jsonSchema.js.map +0 -1
  785. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  786. package/dist/simple-tree/simpleSchema.js.map +0 -1
  787. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  788. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  789. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  790. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  791. package/lib/core/revertible/index.d.ts.map +0 -1
  792. package/lib/core/revertible/index.js.map +0 -1
  793. package/lib/core/revertible/revertible.d.ts.map +0 -1
  794. package/lib/core/revertible/revertible.js.map +0 -1
  795. package/lib/domains/index.d.ts +0 -8
  796. package/lib/domains/index.d.ts.map +0 -1
  797. package/lib/domains/index.js +0 -8
  798. package/lib/domains/index.js.map +0 -1
  799. package/lib/domains/json/index.d.ts +0 -7
  800. package/lib/domains/json/index.d.ts.map +0 -1
  801. package/lib/domains/json/index.js +0 -7
  802. package/lib/domains/json/index.js.map +0 -1
  803. package/lib/domains/json/jsonCursor.d.ts +0 -52
  804. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  805. package/lib/domains/json/jsonCursor.js +0 -192
  806. package/lib/domains/json/jsonCursor.js.map +0 -1
  807. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  808. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  809. package/lib/domains/json/jsonDomainSchema.js +0 -29
  810. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  811. package/lib/domains/leafDomain.d.ts +0 -72
  812. package/lib/domains/leafDomain.d.ts.map +0 -1
  813. package/lib/domains/leafDomain.js +0 -85
  814. package/lib/domains/leafDomain.js.map +0 -1
  815. package/lib/domains/schemaBuilder.d.ts +0 -103
  816. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  817. package/lib/domains/schemaBuilder.js +0 -117
  818. package/lib/domains/schemaBuilder.js.map +0 -1
  819. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  820. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  821. package/lib/domains/testRecursiveDomain.js +0 -32
  822. package/lib/domains/testRecursiveDomain.js.map +0 -1
  823. package/lib/events/events.d.ts +0 -207
  824. package/lib/events/events.d.ts.map +0 -1
  825. package/lib/events/events.js.map +0 -1
  826. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  827. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  828. package/lib/feature-libraries/schemaBuilder.js +0 -36
  829. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  830. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  831. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  832. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  833. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  834. package/lib/shared-tree/treeView.d.ts +0 -73
  835. package/lib/shared-tree/treeView.d.ts.map +0 -1
  836. package/lib/shared-tree/treeView.js.map +0 -1
  837. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  838. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  839. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  840. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  841. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  842. package/lib/simple-tree/jsonSchema.js.map +0 -1
  843. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  844. package/lib/simple-tree/simpleSchema.js.map +0 -1
  845. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  846. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  847. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  848. package/src/domains/README.md +0 -6
  849. package/src/domains/fence.json +0 -5
  850. package/src/domains/index.ts +0 -19
  851. package/src/domains/json/fence.json +0 -5
  852. package/src/domains/json/index.ts +0 -13
  853. package/src/domains/json/jsonCursor.ts +0 -247
  854. package/src/domains/json/jsonDomainSchema.ts +0 -47
  855. package/src/domains/leafDomain.ts +0 -97
  856. package/src/domains/schemaBuilder.ts +0 -153
  857. package/src/domains/testRecursiveDomain.ts +0 -38
  858. package/src/events/fence.json +0 -5
  859. package/src/feature-libraries/schemaBuilder.ts +0 -45
  860. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  861. package/src/shared-tree/treeView.ts +0 -113
  862. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  863. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  864. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  865. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  866. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  867. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  868. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  869. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SchemaBuilderInternal = void 0;
8
- const index_js_1 = require("./default-schema/index.js");
9
- const schemaBuilderBase_js_1 = require("./schemaBuilderBase.js");
10
- const index_js_2 = require("./typed-schema/index.js");
11
- /**
12
- * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.
13
- * Defaults to "required" fields.
14
- * @privateRemarks Should not be package exported.
15
- */
16
- class SchemaBuilderInternal extends schemaBuilderBase_js_1.SchemaBuilderBase {
17
- constructor(options) {
18
- super(index_js_1.FieldKinds.required, options);
19
- }
20
- /**
21
- * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.
22
- * Such nodes will be implicitly unwrapped to the value in some APIs.
23
- *
24
- * The name must be unique among all TreeNodeSchema in the the document schema.
25
- *
26
- * In addition to the normal properties of all nodes (having a schema for example),
27
- * Leaf nodes only contain a value.
28
- * Leaf nodes cannot have fields.
29
- *
30
- * TODO: Maybe ban undefined from allowed values here.
31
- * TODO: Decide and document how unwrapping works for non-primitive terminals.
32
- */
33
- leaf(name, t) {
34
- const schema = index_js_2.LeafNodeSchema.create(this, this.scoped(name), t);
35
- this.addNodeSchema(schema);
36
- return schema;
37
- }
38
- }
39
- exports.SchemaBuilderInternal = SchemaBuilderInternal;
40
- //# sourceMappingURL=schemaBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilder.js","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,wDAAuD;AACvD,iEAAsF;AACtF,sDAAyD;AAEzD;;;;GAIG;AACH,MAAa,qBAEX,SAAQ,wCAAqD;IAC9D,YAAmB,OAAqC;QACvD,KAAK,CAAC,qBAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,IAAI,CACV,IAAU,EACV,CAAI;QAEJ,MAAM,MAAM,GAAG,yBAAc,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AA5BD,sDA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../core/index.js\";\n\nimport { FieldKinds } from \"./default-schema/index.js\";\nimport { SchemaBuilderBase, type SchemaBuilderOptions } from \"./schemaBuilderBase.js\";\nimport { LeafNodeSchema } from \"./typed-schema/index.js\";\n\n/**\n * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.\n * Defaults to \"required\" fields.\n * @privateRemarks Should not be package exported.\n */\nexport class SchemaBuilderInternal<\n\tTScope extends `com.fluidframework.${string}`,\n> extends SchemaBuilderBase<TScope, typeof FieldKinds.required> {\n\tpublic constructor(options: SchemaBuilderOptions<TScope>) {\n\t\tsuper(FieldKinds.required, options);\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.\n\t * Such nodes will be implicitly unwrapped to the value in some APIs.\n\t *\n\t * The name must be unique among all TreeNodeSchema in the the document schema.\n\t *\n\t * In addition to the normal properties of all nodes (having a schema for example),\n\t * Leaf nodes only contain a value.\n\t * Leaf nodes cannot have fields.\n\t *\n\t * TODO: Maybe ban undefined from allowed values here.\n\t * TODO: Decide and document how unwrapping works for non-primitive terminals.\n\t */\n\tpublic leaf<Name extends string, const T extends ValueSchema>(\n\t\tname: Name,\n\t\tt: T,\n\t): LeafNodeSchema<`${TScope}.${Name}`, T> {\n\t\tconst schema = LeafNodeSchema.create(this, this.scoped(name), t);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n}\n"]}
@@ -1,191 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { TreeNodeSchemaIdentifier } from "../core/index.js";
6
- import { type Assume, type RestrictiveReadonlyRecord } from "../util/index.js";
7
- import type { FlexFieldKind } from "./modular-schema/index.js";
8
- import { Any, type FlexAllowedTypes, FlexFieldSchema, type FlexList, type FlexMapFieldSchema, FlexMapNodeSchema, FlexObjectNodeSchema, type FlexTreeNodeSchema, type FlexTreeSchema, type SchemaCollection, type SchemaLibraryData, type SchemaLintConfiguration, type Unenforced } from "./typed-schema/index.js";
9
- /**
10
- * Configuration for a SchemaBuilder.
11
- */
12
- export interface SchemaBuilderOptions<TScope extends string = string> {
13
- /**
14
- * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.
15
- * Use of [Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) or a UUIDv4 is recommended to avoid collisions.
16
- */
17
- scope: TScope;
18
- /**
19
- * Name used to refer to this builder in error messages.
20
- * Has no impact on the actual generated schema.
21
- * Defaults to scope.
22
- */
23
- name?: string;
24
- /**
25
- * Optional configuration for "linting".
26
- * See {@link SchemaLintConfiguration}. Currently defaults to enabling all lints.
27
- */
28
- lint?: Partial<SchemaLintConfiguration>;
29
- /**
30
- * Libraries to include in this one.
31
- *
32
- * @remarks
33
- * Unlike adding of individual schema, adding of libraries is idempotent.
34
- * If a single library is added multiple times (even indirectly via libraries it was added into),
35
- * only a single copy will be included, so they will not conflict.
36
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
37
- * Contents within the added libraries can still conflict however.
38
- * Such errors will be reported when finalizing this builder into a library or document schema.
39
- */
40
- libraries?: SchemaLibrary[];
41
- }
42
- /**
43
- * Builds schema libraries, and the schema within them.
44
- * *
45
- * @privateRemarks
46
- * This class does not directly depend on any specific field kinds,
47
- * or bake in any defaults that might have compatibility implications.
48
- * All use of such implicit defaults is done by subclasses, which thus get versioning implications.
49
- */
50
- export declare class SchemaBuilderBase<TScope extends string, TDefaultKind extends FlexFieldKind, TName extends number | string = string> {
51
- private readonly defaultKind;
52
- private readonly lintConfiguration;
53
- private readonly libraries;
54
- private finalized;
55
- private readonly treeNodeSchema;
56
- private readonly adapters;
57
- /**
58
- * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.
59
- */
60
- readonly scope: TScope;
61
- /**
62
- * Used in error messages to identify content produced by this builder.
63
- */
64
- readonly name: string;
65
- /**
66
- * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.
67
- */
68
- constructor(defaultKind: TDefaultKind, options: SchemaBuilderOptions<TScope>);
69
- protected scoped<Name extends TName>(name: Name): TreeNodeSchemaIdentifier<`${TScope}.${Name}`>;
70
- /**
71
- * Adds more libraries to this one.
72
- *
73
- * Unlike adding of individual schema, adding of libraries is idempotent.
74
- * If a single library is added multiple times (even indirectly via libraries it was added into),
75
- * only a single copy will be included, so they will not conflict.
76
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
77
- * Contents within the added libraries can still conflict however.
78
- * Such errors will be reported when finalizing this builder into a library of document schema.
79
- */
80
- private addLibraries;
81
- protected addNodeSchema<T extends FlexTreeNodeSchema>(schema: T): void;
82
- private finalizeCommon;
83
- /**
84
- * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.
85
- * May only be called once after adding content to builder is complete.
86
- */
87
- intoLibrary(): SchemaLibrary;
88
- /**
89
- * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.
90
- * Can be used with schematize to provide schema aware access to document content.
91
- *
92
- * @remarks
93
- * May only be called once after adding content to builder is complete.
94
- */
95
- intoSchema<const TSchema extends FlexImplicitFieldSchema>(root: TSchema): FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>>;
96
- /**
97
- * Define (and add to this library) a {@link FlexObjectNodeSchema}.
98
- *
99
- * The name must be unique among all TreeNodeSchema in the the document schema.
100
- */
101
- object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, {
102
- [key in keyof T]: NormalizeField<T[key], TDefaultKind>;
103
- }>;
104
- /**
105
- * Same as `object` but with less type safety and works for recursive objects.
106
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
107
- *
108
- * See {@link Unenforced} for details.
109
- *
110
- * TODO: Make this work with ImplicitFieldSchema.
111
- */
112
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, T>;
113
- /**
114
- * Define (and add to this library) a {@link FlexMapNodeSchema}.
115
- */
116
- map<Name extends TName, const T extends FlexMapFieldSchema>(name: Name, fieldSchema: T): FlexMapNodeSchema<`${TScope}.${Name}`, T>;
117
- /**
118
- * Same as `map` but with less type safety and works for recursive objects.
119
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
120
- *
121
- * See {@link Unenforced} for details.
122
- *
123
- * TODO: Make this work with ImplicitFieldSchema.
124
- */
125
- mapRecursive<Name extends TName, const T extends Unenforced<FlexMapFieldSchema>>(name: Name, t: T): FlexMapNodeSchema<`${TScope}.${Name}`, T>;
126
- /**
127
- * Define a {@link FlexFieldSchema}.
128
- *
129
- * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) of this field.
130
- * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.
131
- * @param allowedTypes - What types of children are allowed in this field.
132
- * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),
133
- * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).
134
- *
135
- * @privateRemarks
136
- * TODO:
137
- * If a solution to TreeFieldSchema not being able to have extends clauses gets found,
138
- * consider just having users do `new TreeFieldSchema` instead?
139
- */
140
- static field<Kind extends FlexFieldKind, T extends FlexImplicitAllowedTypes>(kind: Kind, allowedTypes: T): FlexFieldSchema<Kind, NormalizeAllowedTypes<T>>;
141
- /**
142
- * Define a schema for a field.
143
- * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.
144
- * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).
145
- *
146
- * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an "extends" clauses cause recursive types to error with:
147
- * "'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."
148
- *
149
- * TODO: Try and find a way to provide a more specific type without triggering the above error.
150
- */
151
- static fieldRecursive<Kind extends FlexFieldKind, T extends FlexList<Unenforced<FlexTreeNodeSchema>>>(kind: Kind, ...allowedTypes: T): FlexFieldSchema<Kind, T>;
152
- /**
153
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.
154
- */
155
- protected normalizeField<TSchema extends FlexImplicitFieldSchema>(schema: TSchema): NormalizeField<TSchema, TDefaultKind>;
156
- }
157
- /**
158
- * Schema information collected by a SchemaBuilder, including referenced libraries.
159
- * Can be aggregated into other libraries by adding to their builders.
160
- */
161
- export interface SchemaLibrary extends SchemaCollection {
162
- /**
163
- * Schema data aggregated from a collection of libraries by a SchemaBuilder.
164
- */
165
- readonly libraries: ReadonlySet<SchemaLibraryData>;
166
- }
167
- /**
168
- * Generalized version of AllowedTypes allowing for more concise expressions in some cases.
169
- */
170
- export type FlexImplicitAllowedTypes = FlexAllowedTypes | FlexTreeNodeSchema | Any;
171
- /**
172
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
173
- */
174
- export type NormalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes> = TSchema extends FlexTreeNodeSchema ? readonly [TSchema] : TSchema extends Any ? readonly [Any] : TSchema;
175
- /**
176
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
177
- */
178
- export declare function normalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes>(schema: TSchema): NormalizeAllowedTypes<TSchema>;
179
- /**
180
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
181
- */
182
- export type NormalizeField<TSchema extends FlexImplicitFieldSchema, TDefault extends FlexFieldKind> = TSchema extends FlexFieldSchema ? TSchema : FlexFieldSchema<TDefault, NormalizeAllowedTypes<Assume<TSchema, FlexImplicitAllowedTypes>>>;
183
- /**
184
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
185
- */
186
- export declare function normalizeField<TSchema extends FlexImplicitFieldSchema, TDefault extends FlexFieldKind>(schema: TSchema, defaultKind: TDefault): NormalizeField<TSchema, TDefault>;
187
- /**
188
- * Type that when combined with a default {@link FlexFieldKind} can be normalized into a {@link FlexFieldSchema}.
189
- */
190
- export type FlexImplicitFieldSchema = FlexFieldSchema | FlexImplicitAllowedTypes;
191
- //# sourceMappingURL=schemaBuilderBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilderBase.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilderBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAY,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACN,KAAK,MAAM,EACX,KAAK,yBAAyB,EAE9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACN,GAAG,EACH,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAE5B,KAAK,UAAU,EAGf,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IACnE;;;OAGG;IACH,K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AS,aAAa,EAC7B,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAS3E;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG,wBAAwB,CAAC"}
@@ -1,201 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.normalizeField = exports.normalizeAllowedTypes = exports.SchemaBuilderBase = void 0;
8
- const internal_1 = require("@fluidframework/core-utils/internal");
9
- const index_js_1 = require("../util/index.js");
10
- const index_js_2 = require("./default-schema/index.js");
11
- const index_js_3 = require("./typed-schema/index.js");
12
- /**
13
- * Builds schema libraries, and the schema within them.
14
- * *
15
- * @privateRemarks
16
- * This class does not directly depend on any specific field kinds,
17
- * or bake in any defaults that might have compatibility implications.
18
- * All use of such implicit defaults is done by subclasses, which thus get versioning implications.
19
- */
20
- class SchemaBuilderBase {
21
- /**
22
- * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.
23
- */
24
- constructor(defaultKind, options) {
25
- this.defaultKind = defaultKind;
26
- this.finalized = false;
27
- this.treeNodeSchema = new Map();
28
- this.adapters = {};
29
- this.name = options.name ?? options.scope;
30
- this.lintConfiguration = { ...index_js_3.schemaLintDefault, ...options.lint };
31
- this.libraries = new Set();
32
- this.addLibraries(...(options.libraries ?? []));
33
- this.scope = options.scope;
34
- }
35
- scoped(name) {
36
- return `${this.scope}.${name}`;
37
- }
38
- /**
39
- * Adds more libraries to this one.
40
- *
41
- * Unlike adding of individual schema, adding of libraries is idempotent.
42
- * If a single library is added multiple times (even indirectly via libraries it was added into),
43
- * only a single copy will be included, so they will not conflict.
44
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
45
- * Contents within the added libraries can still conflict however.
46
- * Such errors will be reported when finalizing this builder into a library of document schema.
47
- */
48
- addLibraries(...libraries) {
49
- for (const libs of libraries) {
50
- for (const lib of libs.libraries) {
51
- this.libraries.add(lib);
52
- }
53
- }
54
- }
55
- addNodeSchema(schema) {
56
- (0, internal_1.assert)(!this.treeNodeSchema.has(schema.name), 0x799 /* Conflicting TreeNodeSchema names */);
57
- this.treeNodeSchema.set(schema.name, schema);
58
- }
59
- finalizeCommon(field) {
60
- (0, internal_1.assert)(!this.finalized, 0x79a /* SchemaBuilder can only be finalized once. */);
61
- this.finalized = true;
62
- this.libraries.add({
63
- name: this.name,
64
- nodeSchema: this.treeNodeSchema,
65
- adapters: this.adapters,
66
- });
67
- // Check for errors and aggregate data
68
- return (0, index_js_3.aggregateSchemaLibraries)(this.name, this.lintConfiguration, this.libraries, field);
69
- }
70
- /**
71
- * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.
72
- * May only be called once after adding content to builder is complete.
73
- */
74
- intoLibrary() {
75
- const aggregated = this.finalizeCommon();
76
- // Full library set (instead of just aggregated) is kept since it is required to handle deduplication of libraries included through different paths.
77
- return { nodeSchema: aggregated.nodeSchema, libraries: this.libraries };
78
- }
79
- /**
80
- * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.
81
- * Can be used with schematize to provide schema aware access to document content.
82
- *
83
- * @remarks
84
- * May only be called once after adding content to builder is complete.
85
- */
86
- intoSchema(root) {
87
- // return this.toDocumentSchemaInternal(normalizeField(root, DefaultFieldKind));
88
- const field = this.normalizeField(root);
89
- const library = this.finalizeCommon(field);
90
- const typed = {
91
- nodeSchema: library.nodeSchema,
92
- adapters: library.adapters,
93
- rootFieldSchema: field,
94
- policy: index_js_2.defaultSchemaPolicy,
95
- };
96
- return typed;
97
- }
98
- /**
99
- * Define (and add to this library) a {@link FlexObjectNodeSchema}.
100
- *
101
- * The name must be unique among all TreeNodeSchema in the the document schema.
102
- */
103
- object(name, t) {
104
- const schema = index_js_3.FlexObjectNodeSchema.create(this, this.scoped(name), (0, index_js_1.transformObjectMap)(t, (field) => this.normalizeField(field)));
105
- this.addNodeSchema(schema);
106
- return schema;
107
- }
108
- /**
109
- * Same as `object` but with less type safety and works for recursive objects.
110
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
111
- *
112
- * See {@link Unenforced} for details.
113
- *
114
- * TODO: Make this work with ImplicitFieldSchema.
115
- */
116
- objectRecursive(name, t) {
117
- return this.object(name, t);
118
- }
119
- /**
120
- * Define (and add to this library) a {@link FlexMapNodeSchema}.
121
- */
122
- map(name, fieldSchema) {
123
- const schema = index_js_3.FlexMapNodeSchema.create(this, this.scoped(name), fieldSchema);
124
- this.addNodeSchema(schema);
125
- return schema;
126
- }
127
- /**
128
- * Same as `map` but with less type safety and works for recursive objects.
129
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
130
- *
131
- * See {@link Unenforced} for details.
132
- *
133
- * TODO: Make this work with ImplicitFieldSchema.
134
- */
135
- mapRecursive(name, t) {
136
- return this.map(name, t);
137
- }
138
- /**
139
- * Define a {@link FlexFieldSchema}.
140
- *
141
- * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) of this field.
142
- * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.
143
- * @param allowedTypes - What types of children are allowed in this field.
144
- * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),
145
- * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).
146
- *
147
- * @privateRemarks
148
- * TODO:
149
- * If a solution to TreeFieldSchema not being able to have extends clauses gets found,
150
- * consider just having users do `new TreeFieldSchema` instead?
151
- */
152
- static field(kind, allowedTypes) {
153
- return index_js_3.FlexFieldSchema.create(kind, normalizeAllowedTypes(allowedTypes));
154
- }
155
- /**
156
- * Define a schema for a field.
157
- * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.
158
- * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).
159
- *
160
- * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an "extends" clauses cause recursive types to error with:
161
- * "'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."
162
- *
163
- * TODO: Try and find a way to provide a more specific type without triggering the above error.
164
- */
165
- static fieldRecursive(kind, ...allowedTypes) {
166
- return index_js_3.FlexFieldSchema.createUnsafe(kind, allowedTypes);
167
- }
168
- /**
169
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.
170
- */
171
- normalizeField(schema) {
172
- return normalizeField(schema, this.defaultKind);
173
- }
174
- }
175
- exports.SchemaBuilderBase = SchemaBuilderBase;
176
- /**
177
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
178
- */
179
- function normalizeAllowedTypes(schema) {
180
- if (schema === index_js_3.Any) {
181
- return [index_js_3.Any];
182
- }
183
- if (schema instanceof index_js_3.TreeNodeSchemaBase) {
184
- return [schema];
185
- }
186
- (0, internal_1.assert)(Array.isArray(schema), 0x7c6 /* invalid ImplicitAllowedTypes */);
187
- return schema;
188
- }
189
- exports.normalizeAllowedTypes = normalizeAllowedTypes;
190
- /**
191
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
192
- */
193
- function normalizeField(schema, defaultKind) {
194
- if (schema instanceof index_js_3.FlexFieldSchema) {
195
- return schema;
196
- }
197
- const allowedTypes = normalizeAllowedTypes(schema);
198
- return index_js_3.FlexFieldSchema.create(defaultKind, allowedTypes);
199
- }
200
- exports.normalizeField = normalizeField;
201
- //# sourceMappingURL=schemaBuilderBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilderBase.js","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilderBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAG7D,+CAI0B;AA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C,MAAe;IAEf,IAAI,MAAM,KAAK,cAAG,EAAE,CAAC;QACpB,OAAO,CAAC,cAAG,CAA8C,CAAC;IAC3D,CAAC;IACD,IAAI,MAAM,YAAY,6BAAkB,EAAE,CAAC;QAC1C,OAAO,CAAC,MAAM,CAA8C,CAAC;IAC9D,CAAC;IACD,IAAA,iBAAM,EAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxE,OAAO,MAAmD,CAAC;AAC5D,CAAC;AAXD,sDAWC;AAeD;;GAEG;AACH,SAAgB,cAAc,CAG5B,MAAe,EAAE,WAAqB;IACvC,IAAI,MAAM,YAAY,0BAAe,EAAE,CAAC;QACvC,OAAO,MAA2C,CAAC;IACpD,CAAC;IACD,MAAM,YAAY,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,0BAAe,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAGtD,CAAC;AACH,CAAC;AAZD,wCAYC","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 type { Adapters, TreeNodeSchemaIdentifier } from \"../core/index.js\";\nimport {\n\ttype Assume,\n\ttype RestrictiveReadonlyRecord,\n\ttransformObjectMap,\n} from \"../util/index.js\";\n\nimport { defaultSchemaPolicy } from \"./default-schema/index.js\";\nimport type { FlexFieldKind } from \"./modular-schema/index.js\";\nimport {\n\tAny,\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexList,\n\ttype FlexMapFieldSchema,\n\tFlexMapNodeSchema,\n\tFlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\ttype SchemaCollection,\n\ttype SchemaLibraryData,\n\ttype SchemaLintConfiguration,\n\tTreeNodeSchemaBase,\n\ttype Unenforced,\n\taggregateSchemaLibraries,\n\tschemaLintDefault,\n} from \"./typed-schema/index.js\";\n\n/**\n * Configuration for a SchemaBuilder.\n */\nexport interface SchemaBuilderOptions<TScope extends string = string> {\n\t/**\n\t * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.\n\t * Use of [Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) or a UUIDv4 is recommended to avoid collisions.\n\t */\n\tscope: TScope;\n\n\t/**\n\t * Name used to refer to this builder in error messages.\n\t * Has no impact on the actual generated schema.\n\t * Defaults to scope.\n\t */\n\tname?: string;\n\n\t/**\n\t * Optional configuration for \"linting\".\n\t * See {@link SchemaLintConfiguration}. Currently defaults to enabling all lints.\n\t */\n\tlint?: Partial<SchemaLintConfiguration>;\n\n\t/**\n\t * Libraries to include in this one.\n\t *\n\t * @remarks\n\t * Unlike adding of individual schema, adding of libraries is idempotent.\n\t * If a single library is added multiple times (even indirectly via libraries it was added into),\n\t * only a single copy will be included, so they will not conflict.\n\t * This allows adding any library this one depends on without risk of conflicts for users of this library.\n\t * Contents within the added libraries can still conflict however.\n\t * Such errors will be reported when finalizing this builder into a library or document schema.\n\t */\n\tlibraries?: SchemaLibrary[];\n}\n\n/**\n * Builds schema libraries, and the schema within them.\n * *\n * @privateRemarks\n * This class does not directly depend on any specific field kinds,\n * or bake in any defaults that might have compatibility implications.\n * All use of such implicit defaults is done by subclasses, which thus get versioning implications.\n */\nexport class SchemaBuilderBase<\n\tTScope extends string,\n\tTDefaultKind extends FlexFieldKind,\n\tTName extends number | string = string,\n> {\n\tprivate readonly lintConfiguration: SchemaLintConfiguration;\n\tprivate readonly libraries: Set<SchemaLibraryData>;\n\tprivate finalized: boolean = false;\n\tprivate readonly treeNodeSchema: Map<TreeNodeSchemaIdentifier, FlexTreeNodeSchema> =\n\t\tnew Map();\n\tprivate readonly adapters: Adapters = {};\n\t/**\n\t * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.\n\t */\n\tpublic readonly scope: TScope;\n\n\t/**\n\t * Used in error messages to identify content produced by this builder.\n\t */\n\tpublic readonly name: string;\n\n\t/**\n\t * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.\n\t */\n\tpublic constructor(\n\t\tprivate readonly defaultKind: TDefaultKind,\n\t\toptions: SchemaBuilderOptions<TScope>,\n\t) {\n\t\tthis.name = options.name ?? options.scope;\n\t\tthis.lintConfiguration = { ...schemaLintDefault, ...options.lint };\n\t\tthis.libraries = new Set();\n\t\tthis.addLibraries(...(options.libraries ?? []));\n\t\tthis.scope = options.scope;\n\t}\n\n\tprotected scoped<Name extends TName>(\n\t\tname: Name,\n\t): TreeNodeSchemaIdentifier<`${TScope}.${Name}`> {\n\t\treturn `${this.scope}.${name}` as TreeNodeSchemaIdentifier<`${TScope}.${Name}`>;\n\t}\n\n\t/**\n\t * Adds more libraries to this one.\n\t *\n\t * Unlike adding of individual schema, adding of libraries is idempotent.\n\t * If a single library is added multiple times (even indirectly via libraries it was added into),\n\t * only a single copy will be included, so they will not conflict.\n\t * This allows adding any library this one depends on without risk of conflicts for users of this library.\n\t * Contents within the added libraries can still conflict however.\n\t * Such errors will be reported when finalizing this builder into a library of document schema.\n\t */\n\tprivate addLibraries(...libraries: SchemaLibrary[]): void {\n\t\tfor (const libs of libraries) {\n\t\t\tfor (const lib of libs.libraries) {\n\t\t\t\tthis.libraries.add(lib);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addNodeSchema<T extends FlexTreeNodeSchema>(schema: T): void {\n\t\tassert(\n\t\t\t!this.treeNodeSchema.has(schema.name),\n\t\t\t0x799 /* Conflicting TreeNodeSchema names */,\n\t\t);\n\t\tthis.treeNodeSchema.set(schema.name, schema);\n\t}\n\n\tprivate finalizeCommon(field?: FlexFieldSchema): SchemaLibraryData {\n\t\tassert(!this.finalized, 0x79a /* SchemaBuilder can only be finalized once. */);\n\t\tthis.finalized = true;\n\t\tthis.libraries.add({\n\t\t\tname: this.name,\n\t\t\tnodeSchema: this.treeNodeSchema,\n\t\t\tadapters: this.adapters,\n\t\t});\n\n\t\t// Check for errors and aggregate data\n\t\treturn aggregateSchemaLibraries(this.name, this.lintConfiguration, this.libraries, field);\n\t}\n\n\t/**\n\t * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.\n\t * May only be called once after adding content to builder is complete.\n\t */\n\tpublic intoLibrary(): SchemaLibrary {\n\t\tconst aggregated = this.finalizeCommon();\n\n\t\t// Full library set (instead of just aggregated) is kept since it is required to handle deduplication of libraries included through different paths.\n\t\treturn { nodeSchema: aggregated.nodeSchema, libraries: this.libraries };\n\t}\n\n\t/**\n\t * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.\n\t * Can be used with schematize to provide schema aware access to document content.\n\t *\n\t * @remarks\n\t * May only be called once after adding content to builder is complete.\n\t */\n\tpublic intoSchema<const TSchema extends FlexImplicitFieldSchema>(\n\t\troot: TSchema,\n\t): FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>> {\n\t\t// return this.toDocumentSchemaInternal(normalizeField(root, DefaultFieldKind));\n\t\tconst field: NormalizeField<TSchema, TDefaultKind> = this.normalizeField(root);\n\t\tconst library = this.finalizeCommon(field);\n\n\t\tconst typed: FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>> = {\n\t\t\tnodeSchema: library.nodeSchema,\n\t\t\tadapters: library.adapters,\n\t\t\trootFieldSchema: field,\n\t\t\tpolicy: defaultSchemaPolicy,\n\t\t};\n\t\treturn typed;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link FlexObjectNodeSchema}.\n\t *\n\t * The name must be unique among all TreeNodeSchema in the the document schema.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t): FlexObjectNodeSchema<\n\t\t`${TScope}.${Name}`,\n\t\t{ [key in keyof T]: NormalizeField<T[key], TDefaultKind> }\n\t> {\n\t\tconst schema = FlexObjectNodeSchema.create(\n\t\t\tthis,\n\t\t\tthis.scoped(name),\n\t\t\ttransformObjectMap(t, (field): FlexFieldSchema => this.normalizeField(field)) as {\n\t\t\t\t[key in keyof T]: NormalizeField<T[key], TDefaultKind>;\n\t\t\t},\n\t\t);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Same as `object` but with less type safety and works for recursive objects.\n\t * Reduced type safety is a side effect of a workaround for a TypeScript limitation.\n\t *\n\t * See {@link Unenforced} for details.\n\t *\n\t * TODO: Make this work with ImplicitFieldSchema.\n\t */\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>,\n\t>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, T> {\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as unknown as RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>,\n\t\t) as unknown as FlexObjectNodeSchema<`${TScope}.${Name}`, T>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link FlexMapNodeSchema}.\n\t */\n\tpublic map<Name extends TName, const T extends FlexMapFieldSchema>(\n\t\tname: Name,\n\t\tfieldSchema: T,\n\t): FlexMapNodeSchema<`${TScope}.${Name}`, T> {\n\t\tconst schema = FlexMapNodeSchema.create(this, this.scoped(name), fieldSchema);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Same as `map` but with less type safety and works for recursive objects.\n\t * Reduced type safety is a side effect of a workaround for a TypeScript limitation.\n\t *\n\t * See {@link Unenforced} for details.\n\t *\n\t * TODO: Make this work with ImplicitFieldSchema.\n\t */\n\tpublic mapRecursive<Name extends TName, const T extends Unenforced<FlexMapFieldSchema>>(\n\t\tname: Name,\n\t\tt: T,\n\t): FlexMapNodeSchema<`${TScope}.${Name}`, T> {\n\t\treturn this.map(name, t as FlexMapFieldSchema) as FlexMapNodeSchema<\n\t\t\t`${TScope}.${Name}`,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * Define a {@link FlexFieldSchema}.\n\t *\n\t * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) of this field.\n\t * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.\n\t * @param allowedTypes - What types of children are allowed in this field.\n\t * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),\n\t * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).\n\t *\n\t * @privateRemarks\n\t * TODO:\n\t * If a solution to TreeFieldSchema not being able to have extends clauses gets found,\n\t * consider just having users do `new TreeFieldSchema` instead?\n\t */\n\tpublic static field<Kind extends FlexFieldKind, T extends FlexImplicitAllowedTypes>(\n\t\tkind: Kind,\n\t\tallowedTypes: T,\n\t): FlexFieldSchema<Kind, NormalizeAllowedTypes<T>> {\n\t\treturn FlexFieldSchema.create(kind, normalizeAllowedTypes(allowedTypes));\n\t}\n\n\t/**\n\t * Define a schema for a field.\n\t * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.\n\t * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).\n\t *\n\t * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an \"extends\" clauses cause recursive types to error with:\n\t * \"'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.\"\n\t *\n\t * TODO: Try and find a way to provide a more specific type without triggering the above error.\n\t */\n\tpublic static fieldRecursive<\n\t\tKind extends FlexFieldKind,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n\t\tT extends FlexList<Unenforced<FlexTreeNodeSchema>>,\n\t>(kind: Kind, ...allowedTypes: T): FlexFieldSchema<Kind, T> {\n\t\treturn FlexFieldSchema.createUnsafe(kind, allowedTypes);\n\t}\n\n\t/**\n\t * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.\n\t */\n\tprotected normalizeField<TSchema extends FlexImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): NormalizeField<TSchema, TDefaultKind> {\n\t\treturn normalizeField(schema, this.defaultKind);\n\t}\n}\n\n/**\n * Schema information collected by a SchemaBuilder, including referenced libraries.\n * Can be aggregated into other libraries by adding to their builders.\n */\nexport interface SchemaLibrary extends SchemaCollection {\n\t/**\n\t * Schema data aggregated from a collection of libraries by a SchemaBuilder.\n\t */\n\treadonly libraries: ReadonlySet<SchemaLibraryData>;\n}\n\n/**\n * Generalized version of AllowedTypes allowing for more concise expressions in some cases.\n */\nexport type FlexImplicitAllowedTypes = FlexAllowedTypes | FlexTreeNodeSchema | Any;\n\n/**\n * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.\n */\nexport type NormalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes> =\n\tTSchema extends FlexTreeNodeSchema\n\t\t? readonly [TSchema]\n\t\t: TSchema extends Any\n\t\t\t? readonly [Any]\n\t\t\t: TSchema;\n\n/**\n * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.\n */\nexport function normalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes>(\n\tschema: TSchema,\n): NormalizeAllowedTypes<TSchema> {\n\tif (schema === Any) {\n\t\treturn [Any] as unknown as NormalizeAllowedTypes<TSchema>;\n\t}\n\tif (schema instanceof TreeNodeSchemaBase) {\n\t\treturn [schema] as unknown as NormalizeAllowedTypes<TSchema>;\n\t}\n\tassert(Array.isArray(schema), 0x7c6 /* invalid ImplicitAllowedTypes */);\n\treturn schema as unknown as NormalizeAllowedTypes<TSchema>;\n}\n\n/**\n * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.\n */\nexport type NormalizeField<\n\tTSchema extends FlexImplicitFieldSchema,\n\tTDefault extends FlexFieldKind,\n> = TSchema extends FlexFieldSchema\n\t? TSchema\n\t: FlexFieldSchema<\n\t\t\tTDefault,\n\t\t\tNormalizeAllowedTypes<Assume<TSchema, FlexImplicitAllowedTypes>>\n\t\t>;\n\n/**\n * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.\n */\nexport function normalizeField<\n\tTSchema extends FlexImplicitFieldSchema,\n\tTDefault extends FlexFieldKind,\n>(schema: TSchema, defaultKind: TDefault): NormalizeField<TSchema, TDefault> {\n\tif (schema instanceof FlexFieldSchema) {\n\t\treturn schema as NormalizeField<TSchema, TDefault>;\n\t}\n\tconst allowedTypes = normalizeAllowedTypes(schema);\n\treturn FlexFieldSchema.create(defaultKind, allowedTypes) as unknown as NormalizeField<\n\t\tTSchema,\n\t\tTDefault\n\t>;\n}\n\n/**\n * Type that when combined with a default {@link FlexFieldKind} can be normalized into a {@link FlexFieldSchema}.\n */\nexport type FlexImplicitFieldSchema = FlexFieldSchema | FlexImplicitAllowedTypes;\n"]}
@@ -1,73 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type Context, type FlexFieldSchema, type FlexTreeContext, type FlexTreeSchema, type FlexTreeTypedField, type NodeKeyManager } from "../feature-libraries/index.js";
6
- import { type IDisposable, disposeSymbol } from "../util/index.js";
7
- import type { ITreeCheckout, ITreeCheckoutFork } from "./treeCheckout.js";
8
- /**
9
- * The portion of {@link FlexTreeView} that does not depend on the schema's type.
10
- * @privateRemarks
11
- * Since {@link FlexTreeView}'s schema is invariant, `FlexTreeView<FlexFieldSchema>` does not cover this use case.
12
- */
13
- export interface FlexTreeViewGeneric extends IDisposable {
14
- /**
15
- * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.
16
- *
17
- * @remarks
18
- * This is an owning reference: disposing of this view disposes its context.
19
- */
20
- readonly context: FlexTreeContext;
21
- /**
22
- * Access non-view schema specific aspects of of this branch.
23
- *
24
- * @remarks
25
- * This is a non-owning reference: disposing of this view does not impact the branch.
26
- */
27
- readonly checkout: ITreeCheckout;
28
- }
29
- /**
30
- * An editable view of a (version control style) branch of a shared tree.
31
- * @privateRemarks
32
- * TODO:
33
- * If schema aware APIs are removed from flex tree, this can be combined with {@link FlexTreeViewGeneric}.
34
- */
35
- export interface FlexTreeView<in out TRoot extends FlexFieldSchema> extends FlexTreeViewGeneric {
36
- /**
37
- * Get a typed view of the tree content using the flex-tree API.
38
- */
39
- readonly flexTree: FlexTreeTypedField<TRoot>;
40
- /**
41
- * Spawn a new view which is based off of the current state of this view.
42
- * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.
43
- */
44
- fork(): ITreeViewFork<TRoot>;
45
- }
46
- /**
47
- * Branch (like in a version control system) of SharedTree.
48
- *
49
- * {@link FlexTreeView} that has forked off of the main trunk/branch.
50
- */
51
- export interface ITreeViewFork<in out TRoot extends FlexFieldSchema> extends FlexTreeView<TRoot> {
52
- readonly checkout: ITreeCheckoutFork;
53
- }
54
- /**
55
- * Implementation of FlexTreeView wrapping a ITreeCheckout.
56
- */
57
- export declare class CheckoutFlexTreeView<in out TRoot extends FlexFieldSchema, out TCheckout extends ITreeCheckout = ITreeCheckout> implements FlexTreeView<TRoot> {
58
- readonly checkout: TCheckout;
59
- readonly schema: FlexTreeSchema<TRoot>;
60
- readonly nodeKeyManager: NodeKeyManager;
61
- private readonly onDispose?;
62
- readonly context: Context;
63
- readonly flexTree: FlexTreeTypedField<TRoot>;
64
- constructor(checkout: TCheckout, schema: FlexTreeSchema<TRoot>, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
65
- [disposeSymbol](): void;
66
- fork(): CheckoutFlexTreeView<TRoot, ITreeCheckout & ITreeCheckoutFork>;
67
- }
68
- /**
69
- * Maps the context of every {@link CheckoutFlexTreeView} to the view.
70
- * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.
71
- */
72
- export declare const contextToTreeView: WeakMap<Context, FlexTreeViewGeneric>;
73
- //# sourceMappingURL=treeView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,eAAe,CACjE,SAAQ,mBAAmB;IAC3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE7C;;;OAGG;IACH,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,eAAe,CAClE,SAAQ,YAAY,CAAC,KAAK,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,oBAAoB,CAChC,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,eAAe,EACpC,GAAG,CAAC,SAAS,SAAS,aAAa,GAAG,aAAa,CAClD,YAAW,YAAY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AAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvD,IAAA,6BAAkB,EAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,wBAAa,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACpB,CAAC;IAEM,IAAI;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;CACD;AA/BD,oDA+BC;AAED;;;GAGG;AACU,QAAA,iBAAiB,GAAG,IAAI,OAAO,EAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype Context,\n\ttype FlexFieldSchema,\n\ttype FlexTreeContext,\n\ttype FlexTreeSchema,\n\ttype FlexTreeTypedField,\n\ttype NodeKeyManager,\n\tgetTreeContext,\n} from \"../feature-libraries/index.js\";\nimport { tryDisposeTreeNode } from \"../simple-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../util/index.js\";\n\nimport type { ITreeCheckout, ITreeCheckoutFork } from \"./treeCheckout.js\";\n\n/**\n * The portion of {@link FlexTreeView} that does not depend on the schema's type.\n * @privateRemarks\n * Since {@link FlexTreeView}'s schema is invariant, `FlexTreeView<FlexFieldSchema>` does not cover this use case.\n */\nexport interface FlexTreeViewGeneric extends IDisposable {\n\t/**\n\t * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.\n\t *\n\t * @remarks\n\t * This is an owning reference: disposing of this view disposes its context.\n\t */\n\treadonly context: FlexTreeContext;\n\n\t/**\n\t * Access non-view schema specific aspects of of this branch.\n\t *\n\t * @remarks\n\t * This is a non-owning reference: disposing of this view does not impact the branch.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * An editable view of a (version control style) branch of a shared tree.\n * @privateRemarks\n * TODO:\n * If schema aware APIs are removed from flex tree, this can be combined with {@link FlexTreeViewGeneric}.\n */\nexport interface FlexTreeView<in out TRoot extends FlexFieldSchema>\n\textends FlexTreeViewGeneric {\n\t/**\n\t * Get a typed view of the tree content using the flex-tree API.\n\t */\n\treadonly flexTree: FlexTreeTypedField<TRoot>;\n\n\t/**\n\t * Spawn a new view which is based off of the current state of this view.\n\t * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.\n\t */\n\tfork(): ITreeViewFork<TRoot>;\n}\n\n/**\n * Branch (like in a version control system) of SharedTree.\n *\n * {@link FlexTreeView} that has forked off of the main trunk/branch.\n */\nexport interface ITreeViewFork<in out TRoot extends FlexFieldSchema>\n\textends FlexTreeView<TRoot> {\n\treadonly checkout: ITreeCheckoutFork;\n}\n\n/**\n * Implementation of FlexTreeView wrapping a ITreeCheckout.\n */\nexport class CheckoutFlexTreeView<\n\tin out TRoot extends FlexFieldSchema,\n\tout TCheckout extends ITreeCheckout = ITreeCheckout,\n> implements FlexTreeView<TRoot>\n{\n\tpublic readonly context: Context;\n\tpublic readonly flexTree: FlexTreeTypedField<TRoot>;\n\tpublic constructor(\n\t\tpublic readonly checkout: TCheckout,\n\t\tpublic readonly schema: FlexTreeSchema<TRoot>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.context = getTreeContext(schema, this.checkout, nodeKeyManager);\n\t\tcontextToTreeView.set(this.context, this);\n\t\tthis.flexTree = this.context.root as FlexTreeTypedField<TRoot>;\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tfor (const anchorNode of this.checkout.forest.anchors) {\n\t\t\ttryDisposeTreeNode(anchorNode);\n\t\t}\n\n\t\tthis.context[disposeSymbol]();\n\t\tthis.onDispose?.();\n\t}\n\n\tpublic fork(): CheckoutFlexTreeView<TRoot, ITreeCheckout & ITreeCheckoutFork> {\n\t\tconst branch = this.checkout.fork();\n\t\treturn new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager);\n\t}\n}\n\n/**\n * Maps the context of every {@link CheckoutFlexTreeView} to the view.\n * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.\n */\nexport const contextToTreeView = new WeakMap<Context, FlexTreeViewGeneric>();\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getJsonSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAW7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAK1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../src/simple-tree/getJsonSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+EAA6D;AAC7D,6DAAuD;AACvD,+CAA+C;AAG/C;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,OAAO,EAAkC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,SAAgB,aAAa,CAAC,MAA4B;IACzD,OAAO,IAAA,sBAAW,EAAC,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE;QAChD,MAAM,YAAY,GAAG,IAAA,oCAAe,EAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,IAAA,0CAAY,EAAC,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACJ,CAAC;AALD,sCAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { JsonTreeSchema } from \"./jsonSchema.js\";\nimport type { ImplicitAllowedTypes } from \"./schemaTypes.js\";\nimport { toJsonSchema } from \"./simpleSchemaToJsonSchema.js\";\nimport { getSimpleSchema } from \"./getSimpleSchema.js\";\nimport { getOrCreate } from \"../util/index.js\";\nimport type { TreeNodeSchema } from \"./core/index.js\";\n\n/**\n * Cache in which the results of {@link getJsonSchema} are saved.\n */\nconst jsonSchemaCache = new WeakMap<TreeNodeSchema, JsonTreeSchema>();\n\n/**\n * Creates a {@link https://json-schema.org/ | JSON Schema} representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks\n * Useful when communicating the schema to external libraries or services.\n * Caches the result for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```json\n * {\n * \t\"$defs\": {\n * \t\t\"com.fluidframework.leaf.string\": {\n * \t\t\t\"type\": \"string\",\n * \t\t},\n * \t\t\"com.fluidframework.leaf.number\": {\n * \t\t\t\"type\": \"number\",\n * \t\t},\n * \t\t\"com.myapp.MyObject\": {\n * \t\t\t\"type\": \"object\",\n * \t\t\t\"properties\": {\n * \t\t\t\t\"foo\": { \"$ref\": \"com.fluidframework.leaf.number\" },\n * \t\t\t\t\"bar\": { \"$ref\": \"com.fluidframework.leaf.string\" },\n * \t\t\t},\n * \t\t\t\"required\": [\"foo\"],\n * \t\t},\n * \t},\n * \t\"anyOf\": [ { \"$ref\": \"#/$defs/com.myapp.MyObject\" } ],\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * @alpha\n */\nexport function getJsonSchema(schema: ImplicitAllowedTypes): JsonTreeSchema {\n\treturn getOrCreate(jsonSchemaCache, schema, () => {\n\t\tconst simpleSchema = getSimpleSchema(schema);\n\t\treturn toJsonSchema(simpleSchema);\n\t});\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getSimpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB,CAE9E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/getSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA+C;AAI/C,+EAAmE;AAEnE;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,SAAgB,eAAe,CAAC,MAA4B;IAC3D,OAAO,IAAA,sBAAW,EAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAA,gDAAkB,EAAC,MAAM,CAAC,CAAC,CAAC;AACjF,CAAC;AAFD,0CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { getOrCreate } from \"../util/index.js\";\nimport type { TreeNodeSchema } from \"./core/index.js\";\nimport type { ImplicitAllowedTypes } from \"./schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"./simpleSchema.js\";\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Cache in which the results of {@link getSimpleSchema} saved.\n */\nconst simpleSchemaCache = new WeakMap<TreeNodeSchema, SimpleTreeSchema>();\n\n/**\n * Creates a simplified representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```typescript\n * {\n * \tdefinitions: [\n * \t\t[\"com.fluidframework.leaf.number\", {\n * \t\t\tkind: \"leaf\",\n * \t\t\ttype: \"number\",\n * \t\t}],\n * \t\t[\"com.fluidframework.leaf.string\", {\n * \t\t\tkind: \"leaf\",\n * \t\t\ttype: \"string\",\n * \t\t}],\n * \t\t[\"com.myapp.MyObject\", {\n * \t\t\tkind: \"object\",\n * \t\t\tfields: {\n * \t\t\t\tfoo: {\n * \t\t\t\t\tkind: \"required\",\n * \t\t\t\t\tallowedTypes: [\"com.fluidframework.leaf.number\"]\n * \t\t\t\t},\n * \t\t\t\tbar: {\n * \t\t\t\t\tkind: \"optional\",\n * \t\t\t\t\tallowedTypes: [\"com.fluidframework.leaf.string\"]\n * \t\t\t\t},\n * \t\t\t},\n * \t\t}],\n * \t],\n * \tallowedTypes: [\"com.myapp.MyObject\"],\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n */\nexport function getSimpleSchema(schema: ImplicitAllowedTypes): SimpleTreeSchema {\n\treturn getOrCreate(simpleSchemaCache, schema, () => toSimpleTreeSchema(schema));\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/jsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;G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