@fluidframework/tree 2.50.0 → 2.51.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 (636) hide show
  1. package/.eslintrc.cjs +3 -2
  2. package/.vscode/Tree.code-workspace +14 -1
  3. package/.vscode/settings.json +16 -0
  4. package/CHANGELOG.md +51 -2
  5. package/api-report/tree.alpha.api.md +7 -7
  6. package/dist/core/schema-stored/schema.d.ts +14 -1
  7. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  8. package/dist/core/schema-stored/schema.js.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  10. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  11. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  12. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  13. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  14. package/dist/feature-libraries/flex-tree/context.js +4 -4
  15. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  17. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/index.js +3 -1
  19. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  21. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  22. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  25. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  26. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  29. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  30. package/dist/feature-libraries/index.d.ts +2 -2
  31. package/dist/feature-libraries/index.d.ts.map +1 -1
  32. package/dist/feature-libraries/index.js +3 -8
  33. package/dist/feature-libraries/index.js.map +1 -1
  34. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  35. package/dist/feature-libraries/modular-schema/comparison.js +0 -3
  36. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  37. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  38. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  39. package/dist/feature-libraries/modular-schema/index.js +1 -8
  40. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/shared-tree/index.d.ts +0 -1
  45. package/dist/shared-tree/index.d.ts.map +1 -1
  46. package/dist/shared-tree/index.js +1 -3
  47. package/dist/shared-tree/index.js.map +1 -1
  48. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  49. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  50. package/dist/shared-tree/schematizeTree.js +7 -10
  51. package/dist/shared-tree/schematizeTree.js.map +1 -1
  52. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  53. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  54. package/dist/shared-tree/schematizingTreeView.js +60 -83
  55. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  56. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  57. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  58. package/dist/shared-tree/tree.d.ts.map +1 -1
  59. package/dist/shared-tree/tree.js +4 -3
  60. package/dist/shared-tree/tree.js.map +1 -1
  61. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  62. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  63. package/dist/shared-tree/treeAlpha.js.map +1 -1
  64. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  65. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  66. package/dist/shared-tree/treeCheckout.js +4 -1
  67. package/dist/shared-tree/treeCheckout.js.map +1 -1
  68. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  69. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  70. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  71. package/dist/simple-tree/api/configuration.d.ts +1 -1
  72. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  73. package/dist/simple-tree/api/configuration.js +5 -5
  74. package/dist/simple-tree/api/configuration.js.map +1 -1
  75. package/dist/simple-tree/api/create.d.ts +3 -1
  76. package/dist/simple-tree/api/create.d.ts.map +1 -1
  77. package/dist/simple-tree/api/create.js +2 -0
  78. package/dist/simple-tree/api/create.js.map +1 -1
  79. package/dist/simple-tree/api/customTree.d.ts +1 -2
  80. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  81. package/dist/simple-tree/api/customTree.js.map +1 -1
  82. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  83. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  84. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  85. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  86. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  87. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  88. package/dist/simple-tree/api/identifierIndex.js +2 -2
  89. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  90. package/dist/simple-tree/api/index.d.ts +1 -1
  91. package/dist/simple-tree/api/index.d.ts.map +1 -1
  92. package/dist/simple-tree/api/index.js.map +1 -1
  93. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  94. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  95. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -82
  96. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  97. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  98. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  99. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  100. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  101. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  102. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFactory.js +18 -18
  104. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  106. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  109. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  111. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  112. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  113. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  114. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  115. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  116. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  118. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  119. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  120. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  122. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  123. package/dist/simple-tree/api/storedSchema.js +2 -2
  124. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  125. package/dist/simple-tree/api/tree.d.ts +2 -1
  126. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  127. package/dist/simple-tree/api/tree.js.map +1 -1
  128. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  129. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  130. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  131. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  132. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  133. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  134. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  135. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  136. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  137. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  138. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  139. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  140. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  141. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  142. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  143. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  144. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  145. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  146. package/dist/simple-tree/core/allowedTypes.js +173 -0
  147. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  148. package/dist/simple-tree/core/context.d.ts +3 -9
  149. package/dist/simple-tree/core/context.d.ts.map +1 -1
  150. package/dist/simple-tree/core/context.js +3 -11
  151. package/dist/simple-tree/core/context.js.map +1 -1
  152. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  153. package/dist/simple-tree/core/flexList.js.map +1 -0
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  156. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  157. package/dist/simple-tree/core/index.d.ts +9 -3
  158. package/dist/simple-tree/core/index.d.ts.map +1 -1
  159. package/dist/simple-tree/core/index.js +19 -3
  160. package/dist/simple-tree/core/index.js.map +1 -1
  161. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  162. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  163. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  164. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  166. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  168. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  169. package/{lib/simple-tree → dist/simple-tree/core}/treeNodeValid.d.ts +18 -4
  170. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  171. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  172. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  173. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  174. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  175. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  176. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  177. package/dist/simple-tree/core/walkSchema.js +6 -2
  178. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  179. package/dist/simple-tree/createContext.d.ts +6 -2
  180. package/dist/simple-tree/createContext.d.ts.map +1 -1
  181. package/dist/simple-tree/createContext.js +15 -3
  182. package/dist/simple-tree/createContext.js.map +1 -1
  183. package/dist/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  184. package/dist/simple-tree/discrepancies.d.ts.map +1 -0
  185. package/dist/simple-tree/discrepancies.js +382 -0
  186. package/dist/simple-tree/discrepancies.js.map +1 -0
  187. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  188. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  189. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  190. package/dist/simple-tree/fieldSchema.js.map +1 -0
  191. package/dist/simple-tree/index.d.ts +7 -6
  192. package/dist/simple-tree/index.d.ts.map +1 -1
  193. package/dist/simple-tree/index.js +17 -11
  194. package/dist/simple-tree/index.js.map +1 -1
  195. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  196. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.js +117 -2
  198. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  199. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  200. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  201. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  202. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  203. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  204. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  205. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  206. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  207. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  208. package/dist/simple-tree/node-kinds/common.js +42 -0
  209. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  210. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  211. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  213. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  214. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  215. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  216. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  218. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  221. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  222. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  224. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  225. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  226. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  227. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  228. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  229. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  230. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  231. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  232. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  233. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  234. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  235. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  236. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  237. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  238. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  239. package/dist/simple-tree/prepareForInsertion.js +3 -3
  240. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  245. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  246. package/dist/simple-tree/toStoredSchema.js +6 -7
  247. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  248. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  249. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  250. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  251. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  252. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  253. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  254. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  255. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  256. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  257. package/dist/simple-tree/walkFieldSchema.js +2 -2
  258. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  259. package/dist/tableSchema.d.ts +12 -12
  260. package/dist/treeFactory.d.ts +0 -1
  261. package/dist/treeFactory.d.ts.map +1 -1
  262. package/dist/treeFactory.js +0 -1
  263. package/dist/treeFactory.js.map +1 -1
  264. package/lib/core/schema-stored/schema.d.ts +14 -1
  265. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  266. package/lib/core/schema-stored/schema.js.map +1 -1
  267. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  268. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  269. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  270. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  271. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  272. package/lib/feature-libraries/flex-tree/context.js +4 -4
  273. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  274. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  275. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  276. package/lib/feature-libraries/flex-tree/index.js +1 -0
  277. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  278. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  279. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  280. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  281. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  282. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  283. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  284. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  285. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  286. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  287. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  288. package/lib/feature-libraries/index.d.ts +2 -2
  289. package/lib/feature-libraries/index.d.ts.map +1 -1
  290. package/lib/feature-libraries/index.js +2 -2
  291. package/lib/feature-libraries/index.js.map +1 -1
  292. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  293. package/lib/feature-libraries/modular-schema/comparison.js +0 -3
  294. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  295. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  296. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  297. package/lib/feature-libraries/modular-schema/index.js +0 -1
  298. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  299. package/lib/packageVersion.d.ts +1 -1
  300. package/lib/packageVersion.js +1 -1
  301. package/lib/packageVersion.js.map +1 -1
  302. package/lib/shared-tree/index.d.ts +0 -1
  303. package/lib/shared-tree/index.d.ts.map +1 -1
  304. package/lib/shared-tree/index.js +0 -1
  305. package/lib/shared-tree/index.js.map +1 -1
  306. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  307. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  308. package/lib/shared-tree/schematizeTree.js +5 -8
  309. package/lib/shared-tree/schematizeTree.js.map +1 -1
  310. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  311. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  312. package/lib/shared-tree/schematizingTreeView.js +61 -83
  313. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  314. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  315. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  316. package/lib/shared-tree/tree.d.ts.map +1 -1
  317. package/lib/shared-tree/tree.js +4 -3
  318. package/lib/shared-tree/tree.js.map +1 -1
  319. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  320. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  321. package/lib/shared-tree/treeAlpha.js.map +1 -1
  322. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  323. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  324. package/lib/shared-tree/treeCheckout.js +5 -2
  325. package/lib/shared-tree/treeCheckout.js.map +1 -1
  326. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  327. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  328. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  329. package/lib/simple-tree/api/configuration.d.ts +1 -1
  330. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  331. package/lib/simple-tree/api/configuration.js +2 -2
  332. package/lib/simple-tree/api/configuration.js.map +1 -1
  333. package/lib/simple-tree/api/create.d.ts +3 -1
  334. package/lib/simple-tree/api/create.d.ts.map +1 -1
  335. package/lib/simple-tree/api/create.js +2 -0
  336. package/lib/simple-tree/api/create.js.map +1 -1
  337. package/lib/simple-tree/api/customTree.d.ts +1 -2
  338. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  339. package/lib/simple-tree/api/customTree.js.map +1 -1
  340. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  341. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  342. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  343. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  344. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  345. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  346. package/lib/simple-tree/api/identifierIndex.js +1 -1
  347. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  348. package/lib/simple-tree/api/index.d.ts +1 -1
  349. package/lib/simple-tree/api/index.d.ts.map +1 -1
  350. package/lib/simple-tree/api/index.js.map +1 -1
  351. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  352. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  353. package/lib/simple-tree/api/schemaCompatibilityTester.js +25 -76
  354. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  355. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  356. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  357. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  358. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  359. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  360. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  361. package/lib/simple-tree/api/schemaFactory.js +2 -2
  362. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  363. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  364. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  365. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  367. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  368. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  369. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  370. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  371. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  372. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  373. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  374. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  375. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  376. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  377. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  378. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  379. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  380. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  381. package/lib/simple-tree/api/storedSchema.js +2 -2
  382. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  383. package/lib/simple-tree/api/tree.d.ts +2 -1
  384. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  385. package/lib/simple-tree/api/tree.js.map +1 -1
  386. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  387. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  388. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  389. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  390. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  391. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  392. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  393. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  394. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  395. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  396. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  397. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  398. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  399. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  400. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  401. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  402. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  403. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  404. package/lib/simple-tree/core/allowedTypes.js +162 -0
  405. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  406. package/lib/simple-tree/core/context.d.ts +3 -9
  407. package/lib/simple-tree/core/context.d.ts.map +1 -1
  408. package/lib/simple-tree/core/context.js +0 -8
  409. package/lib/simple-tree/core/context.js.map +1 -1
  410. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  411. package/lib/simple-tree/core/flexList.js.map +1 -0
  412. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  413. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  414. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  415. package/lib/simple-tree/core/index.d.ts +9 -3
  416. package/lib/simple-tree/core/index.d.ts.map +1 -1
  417. package/lib/simple-tree/core/index.js +6 -3
  418. package/lib/simple-tree/core/index.js.map +1 -1
  419. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  420. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  421. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  422. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  423. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  424. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  425. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  426. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  427. package/{dist/simple-tree → lib/simple-tree/core}/treeNodeValid.d.ts +18 -4
  428. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  429. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  430. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  431. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  432. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  433. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  434. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  435. package/lib/simple-tree/core/walkSchema.js +7 -3
  436. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  437. package/lib/simple-tree/createContext.d.ts +6 -2
  438. package/lib/simple-tree/createContext.d.ts.map +1 -1
  439. package/lib/simple-tree/createContext.js +13 -2
  440. package/lib/simple-tree/createContext.js.map +1 -1
  441. package/lib/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  442. package/lib/simple-tree/discrepancies.d.ts.map +1 -0
  443. package/lib/simple-tree/discrepancies.js +376 -0
  444. package/lib/simple-tree/discrepancies.js.map +1 -0
  445. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  446. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  447. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  448. package/lib/simple-tree/fieldSchema.js.map +1 -0
  449. package/lib/simple-tree/index.d.ts +7 -6
  450. package/lib/simple-tree/index.d.ts.map +1 -1
  451. package/lib/simple-tree/index.js +4 -3
  452. package/lib/simple-tree/index.js.map +1 -1
  453. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  454. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  455. package/lib/simple-tree/leafNodeSchema.js +117 -3
  456. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  458. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  460. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  462. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  464. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  466. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  467. package/lib/simple-tree/node-kinds/common.js +38 -0
  468. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  469. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  470. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  471. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  472. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  473. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  474. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  475. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  476. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  477. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  478. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  479. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  480. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  481. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  482. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  483. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  484. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  485. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  486. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  487. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  488. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  489. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  490. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  491. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  492. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  493. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  494. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  496. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  497. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  498. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  499. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  500. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  501. package/lib/simple-tree/prepareForInsertion.js +2 -2
  502. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  507. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  508. package/lib/simple-tree/toStoredSchema.js +2 -3
  509. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  510. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  511. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  512. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  513. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  514. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  515. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  516. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  517. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  518. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  519. package/lib/simple-tree/walkFieldSchema.js +1 -1
  520. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  521. package/lib/tableSchema.d.ts +12 -12
  522. package/lib/treeFactory.d.ts +0 -1
  523. package/lib/treeFactory.d.ts.map +1 -1
  524. package/lib/treeFactory.js +0 -1
  525. package/lib/treeFactory.js.map +1 -1
  526. package/package.json +22 -23
  527. package/src/core/schema-stored/schema.ts +14 -1
  528. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  529. package/src/feature-libraries/flex-tree/context.ts +10 -5
  530. package/src/feature-libraries/flex-tree/index.ts +2 -0
  531. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  532. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  533. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  534. package/src/feature-libraries/index.ts +1 -15
  535. package/src/feature-libraries/modular-schema/comparison.ts +0 -4
  536. package/src/feature-libraries/modular-schema/index.ts +0 -17
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -2
  539. package/src/shared-tree/schematizeTree.ts +5 -9
  540. package/src/shared-tree/schematizingTreeView.ts +75 -113
  541. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  542. package/src/shared-tree/tree.ts +4 -3
  543. package/src/shared-tree/treeAlpha.ts +7 -1
  544. package/src/shared-tree/treeCheckout.ts +15 -2
  545. package/src/simple-tree/api/conciseTree.ts +1 -2
  546. package/src/simple-tree/api/configuration.ts +7 -4
  547. package/src/simple-tree/api/create.ts +3 -1
  548. package/src/simple-tree/api/customTree.ts +1 -2
  549. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  550. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  551. package/src/simple-tree/api/identifierIndex.ts +1 -1
  552. package/src/simple-tree/api/index.ts +2 -0
  553. package/src/simple-tree/api/schemaCompatibilityTester.ts +38 -128
  554. package/src/simple-tree/api/schemaCreationUtilities.ts +50 -5
  555. package/src/simple-tree/api/schemaFactory.ts +45 -10
  556. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  557. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  558. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  559. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  560. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  561. package/src/simple-tree/api/storedSchema.ts +1 -2
  562. package/src/simple-tree/api/tree.ts +2 -2
  563. package/src/simple-tree/api/treeBeta.ts +4 -1
  564. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  565. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  566. package/src/simple-tree/api/verboseTree.ts +3 -6
  567. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  568. package/src/simple-tree/core/README.md +1 -1
  569. package/src/simple-tree/core/allowedTypes.ts +496 -0
  570. package/src/simple-tree/core/context.ts +3 -10
  571. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  572. package/src/simple-tree/core/index.ts +62 -9
  573. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  574. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  575. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  576. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  577. package/src/simple-tree/core/walkSchema.ts +9 -5
  578. package/src/simple-tree/createContext.ts +26 -2
  579. package/src/simple-tree/discrepancies.ts +648 -0
  580. package/src/simple-tree/fieldSchema.ts +734 -0
  581. package/src/simple-tree/index.ts +41 -31
  582. package/src/simple-tree/leafNodeSchema.ts +137 -5
  583. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  584. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  585. package/src/simple-tree/node-kinds/common.ts +60 -0
  586. package/src/simple-tree/node-kinds/index.ts +2 -0
  587. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  588. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  589. package/src/simple-tree/node-kinds/object/index.ts +2 -0
  590. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  591. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  592. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  593. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  594. package/src/simple-tree/prepareForInsertion.ts +7 -6
  595. package/src/simple-tree/simpleSchema.ts +2 -2
  596. package/src/simple-tree/toStoredSchema.ts +2 -3
  597. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  598. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  599. package/src/simple-tree/walkFieldSchema.ts +1 -1
  600. package/src/treeFactory.ts +0 -1
  601. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  602. package/dist/feature-libraries/modular-schema/discrepancies.js +0 -361
  603. package/dist/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  604. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  605. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  606. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  607. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  608. package/dist/simple-tree/flexList.d.ts.map +0 -1
  609. package/dist/simple-tree/flexList.js.map +0 -1
  610. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  611. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  612. package/dist/simple-tree/schemaTypes.js.map +0 -1
  613. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  614. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  615. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  616. package/lib/feature-libraries/modular-schema/discrepancies.js +0 -354
  617. package/lib/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  618. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  619. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  620. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  621. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  622. package/lib/simple-tree/flexList.d.ts.map +0 -1
  623. package/lib/simple-tree/flexList.js.map +0 -1
  624. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  625. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  626. package/lib/simple-tree/schemaTypes.js.map +0 -1
  627. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  628. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  629. package/src/feature-libraries/modular-schema/discrepancies.ts +0 -567
  630. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  631. package/src/simple-tree/schemaTypes.ts +0 -1420
  632. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  633. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  634. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  635. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  636. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -3,10 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type ArrayNodeCustomizableSchema, type MapNodeCustomizableSchema, type ObjectNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type TreeRecordNode } from "../node-kinds/index.js";
6
- import { SchemaFactory, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
- import type { ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, ImplicitAnnotatedFieldSchema, NodeSchemaOptionsAlpha } from "../schemaTypes.js";
6
+ import { SchemaFactory, type NodeSchemaOptionsAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
+ import type { ImplicitAnnotatedFieldSchema } from "../fieldSchema.js";
8
8
  import type { RestrictiveStringRecord } from "../../util/index.js";
9
- import type { NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, WithType } from "../core/index.js";
9
+ import type { NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, WithType, ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes } from "../core/index.js";
10
10
  import type { ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe, TreeRecordNodeUnsafe } from "./typesUnsafe.js";
11
11
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
12
12
  /**
@@ -52,28 +52,28 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
52
52
  * {@inheritDoc SchemaStatics.optional}
53
53
  */
54
54
  static readonly optional: {
55
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
56
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
55
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Optional, T, TCustomMetadata>;
56
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Optional, import("../core/allowedTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
57
57
  };
58
58
  /**
59
59
  * {@inheritDoc SchemaStatics.required}
60
60
  */
61
61
  static readonly required: {
62
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
63
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
62
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Required, T, TCustomMetadata>;
63
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Required, import("../core/allowedTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
64
64
  };
65
65
  /**
66
66
  * {@inheritDoc SchemaStatics.optionalRecursive}
67
67
  */
68
- static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
68
+ static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../fieldSchema.js").FieldKind.Optional, T, TCustomMetadata>;
69
69
  /**
70
70
  * {@inheritDoc SchemaStatics.requiredRecursive}
71
71
  */
72
- static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
72
+ static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../fieldSchema.js").FieldKind.Required, T, TCustomMetadata>;
73
73
  /**
74
74
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
75
75
  */
76
- static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata>;
76
+ static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<import("../fieldSchema.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata>;
77
77
  /**
78
78
  * {@inheritDoc SchemaStatics.leaves}
79
79
  */
@@ -82,24 +82,24 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
82
82
  * {@inheritDoc SchemaStatics.optional}
83
83
  */
84
84
  readonly optional: {
85
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
86
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
85
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Optional, T, TCustomMetadata>;
86
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Optional, import("../core/allowedTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
87
87
  };
88
88
  /**
89
89
  * {@inheritDoc SchemaStatics.required}
90
90
  */
91
91
  readonly required: {
92
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
93
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
92
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Required, T, TCustomMetadata>;
93
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../fieldSchema.js").FieldSchemaAlpha<import("../fieldSchema.js").FieldKind.Required, import("../core/allowedTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
94
94
  };
95
95
  /**
96
96
  * {@inheritDoc SchemaStatics.optionalRecursive}
97
97
  */
98
- readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
98
+ readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../fieldSchema.js").FieldKind.Optional, T, TCustomMetadata>;
99
99
  /**
100
100
  * {@inheritDoc SchemaStatics.requiredRecursive}
101
101
  */
102
- readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
102
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../fieldSchema.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../fieldSchema.js").FieldKind.Required, T, TCustomMetadata>;
103
103
  /**
104
104
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
105
105
  *
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,2BAA2B,EAEhC,KAAK,yBAAyB,EAE9B,KAAK,gBAAgB,EAErB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAE7B,KAAK,cAAc,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,aAAa,EAGb,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACX,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAE5B,sBAAsB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EAEd,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,iCAAiC,EACjC,+BAA+B,EAC/B,aAAa,EACb,oBAAoB,EACpB,MAAM,kB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,IAAI,CAAC,WAAW,CACpC,IAAI,EACJ,YAAwC;QACxC,kBAAkB,CAAC,IAAI;QACvB,iFAAiF;QACjF,8GAA8G;QAC9G,6BAA6B,CAAC,KAAK,CACnC,CAAC;QAEF,OAAO,YAeN,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,aAAa,CACnB,IAAO;QAEP,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;;AAvaD;;GAEG;AAC6B,yBAAM,GAAG,aAAa,CAAC,MAAM,AAAvB,CAAwB;AAE9D;;GAEG;AAC6B,2BAAQ,GAAG,aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,aAAa,CAAC,UAAU,AAA3B,CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\trecordSchema,\n\ttype TreeRecordNode,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tschemaStatics,\n\tstructuralName,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type {\n\tImplicitAllowedTypes,\n\tImplicitAnnotatedAllowedTypes,\n\tImplicitAnnotatedFieldSchema,\n\tImplicitFieldSchema,\n\tNodeSchemaOptionsAlpha,\n} from \"../schemaTypes.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tTreeNodeSchemaBoth,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n} from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\nimport type { SimpleObjectNodeSchema } from \"../simpleSchema.js\";\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n *\n * Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.\n * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\tprivate scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\toptions?.allowUnknownOptionalFields ??\n\t\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * The identifier for this record is defined as a function of the provided types.\n\t * It is still scoped to this `SchemaFactory`, but multiple calls with the same arguments will return the same\n\t * schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named records, other types in this schema builder should avoid names of the form `Record<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyRecord = factory.record(factory.number);\n\t * type MyRecord = NodeFromSchema<typeof Record>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", { myRecord: factory.record(factory.number) });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * The name produced at the type-level here is not as specific as it could be; however, doing type-level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal, since TypeScript's structural types will allow assignment between runtime incompatible types at compile time.\n\t * For example, attempts to narrow unions of structural records by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls to this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\t/* Name */ ScopedSchemaName<TScope, `Record<${string}>`>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * Like TypeScript `Record`s, record nodes have some potential pitfalls.\n\t * For example: TypeScript makes assumptions about built-in keys being present (e.g. `toString`, `hasOwnProperty`, etc.).\n\t * Since these are otherwise valid keys in a record, this can lead to unexpected behavior.\n\t * To prevent inconsistent behavior, these built-ins are hidden by record nodes.\n\t * This means that if you try to call these built-ins (e.g. `toString()`) on a record node, you will get an error.\n\t *\n\t * In most cases, it is probably preferable to use {@link SchemaFactory.(map:2)} instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.record(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic record<const Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\t/**\n\t * {@link SchemaFactory.array} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic record<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tmaybeAllowedTypes?: T,\n\t): TreeNodeSchema<\n\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T\n\t> {\n\t\tif (maybeAllowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Record\", types);\n\t\t\treturn this.getStructuralType(fullName, types, () =>\n\t\t\t\tthis.namedRecord(\n\t\t\t\t\tfullName,\n\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t/* customizable */ false,\n\t\t\t\t\t/* implicitlyConstructable */ true,\n\t\t\t\t),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t\t/* Info */ T,\n\t\t\t\t/* TConstructorExtra */ undefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t> = this.namedRecord(\n\t\t\tnameOrAllowedTypes as TName,\n\t\t\tmaybeAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t/* implicitlyConstructable */ true,\n\t\t);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedRecord<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t> {\n\t\tconst record = recordSchema({\n\t\t\tidentifier: this.scoped2(name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable,\n\t\t\timplicitlyConstructable,\n\t\t});\n\n\t\treturn record as TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.recordAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic recordAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn recordSchema({\n\t\t\tidentifier: this.scoped2(name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable: true,\n\t\t\timplicitlyConstructable: true,\n\t\t\tmetadata: options?.metadata,\n\t\t\tpersistedMetadata: options?.persistedMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryAlpha.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t>(name: Name, allowedTypes: T) {\n\t\tconst RecordSchema = this.namedRecord(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\t/* implicitlyConstructable */ false,\n\t\t);\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t>;\n\t}\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(this.scoped2(name));\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,YAAY,EAGZ,YAAY,GAEZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,aAAa,EACb,aAAa,EACb,cAAc,GAId,MAAM,oBAAoB,CAAC;AAqB5B;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAGX,SAAQ,aAA4B;IAHtC;;QAuIC;;WAEG;QACsB,WAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QAEvD;;WAEG;QACsB,aAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAE3D;;WAEG;QACsB,aAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAE3D;;WAEG;QAC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WG;IACI,WAAW,CAKjB,IAAU,EACV,YAAe,EACf,OAAiD;QAEjD,OAAO,YAAY,CAAC;YACnB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAC9B,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,IAAI;YAClB,uBAAuB,EAAE,IAAI;YAC7B,QAAQ,EAAE,OAAO,EAAE,QAAQ;YAC3B,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;SAC7C,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,4EAA4E;IACrE,eAAe,CAGpB,IAAU,EAAE,YAAe;QAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CACpC,IAAI,EACJ,YAAwC;QACxC,kBAAkB,CAAC,IAAI;QACvB,iFAAiF;QACjF,8GAA8G;QAC9G,6BAA6B,CAAC,KAAK,CACnC,CAAC;QAEF,OAAO,YAeN,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,aAAa,CACnB,IAAO;QAEP,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;;AAvaD;;GAEG;AAC6B,yBAAM,GAAG,aAAa,CAAC,MAAM,AAAvB,CAAwB;AAE9D;;GAEG;AAC6B,2BAAQ,GAAG,aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,aAAa,CAAC,UAAU,AAA3B,CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\trecordSchema,\n\ttype TreeRecordNode,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tschemaStatics,\n\tstructuralName,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type { ImplicitAnnotatedFieldSchema, ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tTreeNodeSchemaBoth,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tImplicitAllowedTypes,\n\tImplicitAnnotatedAllowedTypes,\n} from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\nimport type { SimpleObjectNodeSchema } from \"../simpleSchema.js\";\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n *\n * Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.\n * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\tprivate scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\toptions?.allowUnknownOptionalFields ??\n\t\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * The identifier for this record is defined as a function of the provided types.\n\t * It is still scoped to this `SchemaFactory`, but multiple calls with the same arguments will return the same\n\t * schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named records, other types in this schema builder should avoid names of the form `Record<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyRecord = factory.record(factory.number);\n\t * type MyRecord = NodeFromSchema<typeof Record>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", { myRecord: factory.record(factory.number) });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * The name produced at the type-level here is not as specific as it could be; however, doing type-level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal, since TypeScript's structural types will allow assignment between runtime incompatible types at compile time.\n\t * For example, attempts to narrow unions of structural records by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls to this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\t/* Name */ ScopedSchemaName<TScope, `Record<${string}>`>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * Like TypeScript `Record`s, record nodes have some potential pitfalls.\n\t * For example: TypeScript makes assumptions about built-in keys being present (e.g. `toString`, `hasOwnProperty`, etc.).\n\t * Since these are otherwise valid keys in a record, this can lead to unexpected behavior.\n\t * To prevent inconsistent behavior, these built-ins are hidden by record nodes.\n\t * This means that if you try to call these built-ins (e.g. `toString()`) on a record node, you will get an error.\n\t *\n\t * In most cases, it is probably preferable to use {@link SchemaFactory.(map:2)} instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.record(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic record<const Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\t/**\n\t * {@link SchemaFactory.array} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic record<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tmaybeAllowedTypes?: T,\n\t): TreeNodeSchema<\n\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T\n\t> {\n\t\tif (maybeAllowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Record\", types);\n\t\t\treturn this.getStructuralType(fullName, types, () =>\n\t\t\t\tthis.namedRecord(\n\t\t\t\t\tfullName,\n\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t/* customizable */ false,\n\t\t\t\t\t/* implicitlyConstructable */ true,\n\t\t\t\t),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t\t/* Info */ T,\n\t\t\t\t/* TConstructorExtra */ undefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t> = this.namedRecord(\n\t\t\tnameOrAllowedTypes as TName,\n\t\t\tmaybeAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t/* implicitlyConstructable */ true,\n\t\t);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedRecord<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t> {\n\t\tconst record = recordSchema({\n\t\t\tidentifier: this.scoped2(name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable,\n\t\t\timplicitlyConstructable,\n\t\t});\n\n\t\treturn record as TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.recordAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic recordAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn recordSchema({\n\t\t\tidentifier: this.scoped2(name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable: true,\n\t\t\timplicitlyConstructable: true,\n\t\t\tmetadata: options?.metadata,\n\t\t\tpersistedMetadata: options?.persistedMetadata,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryAlpha.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t>(name: Name, allowedTypes: T) {\n\t\tconst RecordSchema = this.namedRecord(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\t/* implicitlyConstructable */ false,\n\t\t);\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t>;\n\t}\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(this.scoped2(name));\n\t}\n}\n"]}
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { RestrictiveStringRecord } from "../../util/index.js";
6
- import type { NodeKind, TreeNodeSchema, WithType, TreeNode } from "../core/index.js";
6
+ import type { NodeKind, TreeNodeSchema, WithType, TreeNode, ImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes } from "../core/index.js";
7
7
  import type { InsertableObjectFromSchemaRecord } from "../node-kinds/index.js";
8
- import { type FieldKind, type FieldProps, type ImplicitAllowedTypes, type ImplicitFieldSchema, type InsertableTreeNodeFromImplicitAllowedTypes } from "../schemaTypes.js";
8
+ import { type FieldKind, type FieldProps, type ImplicitFieldSchema } from "../fieldSchema.js";
9
9
  import type { FieldSchemaAlphaUnsafe, System_Unsafe } from "./typesUnsafe.js";
10
10
  export declare function createFieldSchemaUnsafe<Kind extends FieldKind, Types extends System_Unsafe.ImplicitAllowedTypesUnsafe, TCustomMetadata = unknown>(kind: Kind, allowedTypes: Types, props?: FieldProps<TCustomMetadata>): FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata>;
11
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryRecursive.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryRecursive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0CAA0C,EAC/C,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9E,wBAAgB,uBAAuB,CACtC,IAAI,SAAS,SAAS,EACtB,KAAK,SAAS,aAAa,CAAC,0BAA0B,EACtD,eAAe,GAAG,OAAO,EAEzB,IAAI,EAAE,IAAI,EACV,Y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ACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAG;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { createFieldSchema, } from "../schemaTypes.js";
5
+ import { createFieldSchema, } from "../fieldSchema.js";
6
6
  export function createFieldSchemaUnsafe(kind, allowedTypes, props) {
7
7
  // At runtime, we still want this to be a FieldSchema instance, but we can't satisfy its extends clause, so just return it as an FieldSchemaUnsafe
8
8
  return createFieldSchema(kind, allowedTypes, props);
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryRecursive.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryRecursive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAGN,iBAAiB,GAIjB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,UAAU,uBAAuB,CAKtC,IAAU,EACV,YAAmB,EACnB,KAAmC;IAEnC,kJAAkJ;IAClJ,OAAO,iBAAiB,CACvB,IAAI,EACJ,YAA4C,EAC5C,KAAK,CACmD,CAAC;AAC3D,CAAC;AAkOD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAI,CAAK,IAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type { NodeKind, TreeNodeSchema, WithType, TreeNode } from \"../core/index.js\";\nimport type { InsertableObjectFromSchemaRecord } from \"../node-kinds/index.js\";\nimport {\n\ttype FieldKind,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\n\nimport type { FieldSchemaAlphaUnsafe, System_Unsafe } from \"./typesUnsafe.js\";\n\nexport function createFieldSchemaUnsafe<\n\tKind extends FieldKind,\n\tTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\tTCustomMetadata = unknown,\n>(\n\tkind: Kind,\n\tallowedTypes: Types,\n\tprops?: FieldProps<TCustomMetadata>,\n): FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata> {\n\t// At runtime, we still want this to be a FieldSchema instance, but we can't satisfy its extends clause, so just return it as an FieldSchemaUnsafe\n\treturn createFieldSchema(\n\t\tkind,\n\t\tallowedTypes as ImplicitAllowedTypes & Types,\n\t\tprops,\n\t) as FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata>;\n}\n\n/**\n * Compile time check for validity of a recursive schema.\n * This type also serves as a central location for documenting the requirements and issues related to recursive schema.\n *\n * @example\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => Test]) {}\n * {\n * type _check = ValidateRecursiveSchema<typeof Test>;\n * }\n * ```\n * @remarks\n * In this context recursive schema are defined as all {@link FieldSchema} and {@link TreeNodeSchema} schema which are part of a cycle such that walking down through each {@link TreeNodeSchemaCore.childTypes} the given starting schema can be reached again.\n * Schema referencing the recursive schema and schema they reference that are not part of a cycle are not considered recursive.\n *\n * TypeScript puts a lot of limitations on the typing of recursive schema.\n * To help avoid running into these limitations and thus getting schema that do not type check (or only type checks sometimes!),\n * {@link SchemaFactory} provides APIs (postfixed with `Recursive`) for writing recursive schema.\n * These APIs when combined with the patterns documented below should ensure that the schema provide robust type checking.\n * These special patterns (other than {@link LazyItem} forward references which are not recursion specific)\n * are not required for correct runtime behavior: they exist entirely to mitigate TypeScript type checking limitations and bugs.\n * Ideally TypeScript's type checker would be able to handle all of these cases and more, removing the need for recursive type specific guidance, rules and APIs.\n * Currently however there are open issues preventing this:\n * {@link https://github.com/microsoft/TypeScript/issues/59550 | 1},\n * {@link https://github.com/microsoft/TypeScript/issues/55832 | 2},\n * {@link https://github.com/microsoft/TypeScript/issues/55758 | 3}.\n * Note that the proposed resolution to some of these issues is for the compiler to error rather than allow the case,\n * so even if these are all resolved the recursive type workarounds may still be needed.\n *\n * # Patterns\n *\n * Below are patterns for how to use recursive schema.\n *\n * ## General Patterns\n *\n * When defining a recursive {@link TreeNodeSchema}, use the `*Recursive` {@link SchemaFactory} methods.\n * The returned class should be used as the base class for the recursive schema, which should then be passed to {@link ValidateRecursiveSchema}.\n *\n * Using {@link ValidateRecursiveSchema} will provide compile error for some of the cases of malformed schema.\n * This can be used to help mitigate the issue that recursive schema definitions are {@link Unenforced}.\n * If an issue is encountered where a mistake in a recursive schema is made which produces an invalid schema but is not rejected by this checker,\n * it should be considered a bug and this should be updated to handle that case (or have a disclaimer added to these docs that it misses that case).\n *\n * The non-recursive versions of the schema building methods will run into several issues when used recursively.\n * Consider the following example:\n *\n * ```typescript\n * const Test = sf.array(Test); // Bad\n * ```\n *\n * This has several issues:\n *\n * 1. It is a structurally named schema.\n * Structurally named schema derive their name from the names of their child types, which is not possible when the type is recursive since its name would include itself.\n * Instead a name must be explicitly provided.\n *\n * 2. The schema accesses itself before it's defined.\n * This would be a runtime error if the TypeScript compiler allowed it.\n * This can be fixed by wrapping the type in a function, which also requires explicitly listing the allowed types in an array (`[() => Test]`).\n *\n * 3. TypeScript fails to infer the recursive type and falls back to `any` with this warning or error (depending on the compiler configuration):\n * `'Test' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)`.\n * This issue is what the specialized recursive schema building methods fix.\n * This fix comes at a cost: to make the recursive cases work, the `extends` clauses had to be removed.\n * This means that mistakes declaring recursive schema often don't give compile errors in the schema.\n * Additionally support for implicit construction had to be disabled.\n * This means that new nested {@link Unhydrated} nodes can not be created like `new Test([[]])`.\n * Instead the nested nodes must be created explicitly using the construction like`new Test([new Test([])])`.\n *\n * 4. It is using \"POJO\" mode since it's not explicitly declaring a new class.\n * This means that the generated d.ts files for the schema replace recursive references with `any`, breaking use of recursive schema across compilation boundaries.\n * This is fixed by explicitly creating a class which extends the returned schema.\n *\n * All together, the fixed version looks like:\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => Test]) {} // Good\n * ```\n *\n * Be very careful when declaring recursive schema.\n * Due to the removed extends clauses, subtle mistakes will compile just fine but cause strange errors when the schema is used.\n *\n * For example if a reference to a schema is malformed (in this case boxed inside an object):\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * ```\n * This schema will still compile, and some (but not all) usages of it may look like they work correctly while other usages will produce generally unintelligible compile errors.\n * This issue can be partially mitigated using {@link ValidateRecursiveSchema}:\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * {\n * type _check = ValidateRecursiveSchema<typeof Test>; // Reports compile error due to invalid schema above.\n * }\n * ```\n *\n * If your TypeScript configuration objects to this patten due to the unused local, you can use {@link allowUnused} to suppress the error:\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * allowUnused<ValidateRecursiveSchema<typeof Test>>(); // Reports compile error due to invalid schema above.\n * ```\n *\n * ## Object Schema\n *\n * When defining fields, if the fields is part of the recursive cycle, use the `*Recursive` {@link SchemaFactory} methods for defining the {@link FieldSchema}.\n *\n * ## Array Schema\n *\n * See {@link FixRecursiveArraySchema} for array specific details.\n *\n * @privateRemarks\n * There are probably mistakes this misses: it's hard to guess all the wrong things people will accidentally do and defend against them.\n * Hopefully over time this can grow toward being robust, at least for common mistakes.\n *\n * This check duplicates logic that ideally would be entirely decided by the actual schema building methods.\n * Therefore changes to those methods may require updating `ValidateRecursiveSchema`.\n *\n * TODO: this currently does not reject `any`, but ideally should.\n * @public\n */\nexport type ValidateRecursiveSchema<\n\t// Recursive types should always be using TreeNodeSchemaClass (not TreeNodeSchemaNonClass) as thats part of the requirements for the type to work across compilation boundaries correctly.\n\tT extends ValidateRecursiveSchemaTemplate<T>,\n> = true;\n\n/**\n * Validation logic used by {@link ValidateRecursiveSchema}.\n * @system @public\n */\nexport type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<\n\t// Name: This validator places no restrictions on the name other than that it's a string (as required by TreeNodeSchemaClass).\n\tstring,\n\t// NodeKind: These are the NodeKinds which currently can be used recursively.\n\tNodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record,\n\t// TNode: The produced node API. This is pretty minimal validation: more could be added if similar to how TInsertable works below if needed.\n\tTreeNode & WithType<T[\"identifier\"], T[\"kind\"]>,\n\t// TInsertable: What can be passed to the constructor. This should be enough to catch most issues with incorrect schema.\n\t// These match whats defined in the recursive methods on `SchemaFactory` except they do not use `Unenforced`.\n\t{\n\t\t[NodeKind.Object]: T[\"info\"] extends RestrictiveStringRecord<ImplicitFieldSchema>\n\t\t\t? InsertableObjectFromSchemaRecord<T[\"info\"]>\n\t\t\t: unknown;\n\t\t[NodeKind.Array]: T[\"info\"] extends ImplicitAllowedTypes\n\t\t\t? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T[\"info\"]>>\n\t\t\t: unknown;\n\t\t[NodeKind.Map]: T[\"info\"] extends ImplicitAllowedTypes\n\t\t\t? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T[\"info\"]>]>\n\t\t\t: unknown;\n\t\t[NodeKind.Record]: {\n\t\t\treadonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;\n\t\t};\n\t\t[NodeKind.Leaf]: unknown;\n\t}[T[\"kind\"]],\n\t// ImplicitlyConstructable: recursive types are currently not implicitly constructable.\n\tfalse,\n\t// Info: What's passed to the method to create the schema. Constraining these here should be about as effective as if the actual constraints existed on the actual method itself.\n\t{\n\t\t[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;\n\t\t[NodeKind.Array]: ImplicitAllowedTypes;\n\t\t[NodeKind.Map]: ImplicitAllowedTypes;\n\t\t[NodeKind.Record]: ImplicitAllowedTypes;\n\t\t[NodeKind.Leaf]: unknown;\n\t}[T[\"kind\"]]\n>;\n\n/**\n * Workaround for \"Type instantiation is excessively deep and possibly infinite.ts\" errors.\n * @remarks\n *\n * Generally this workaround should be avoided if possible,\n * especially for exported types, as it is likely to result in issues when exporting or importing schema where the user will be forced to use the workaround as well.\n * This is particularly problematic since in some cases it may not be possible for the user to replicate the pattern.\n * Additionally, which cases hit these limits may vary based on TypeScript version and implementation details of this library.\n *\n * This workaround is provided and documented as a last resort to be able to keep an app compiling.\n * Future version of SharedTree should provide schema type erasure functionality as a better alternative for most cases.\n *\n * When TypeScript gives the error \"Error (TS2589) Type instantiation is excessively deep and possibly infinite.\" on the invocation of `ValidateRecursiveSchema`\n * for a large schema, it can sometimes be worked around by repeating the usage of the type multiple times.\n * This works because the TypeScript compiler caches some of the intermediate results from the first usage, and thus can get further on the second.\n *\n * This utility can be referenced when applying this pattern.\n * For recursive types this can be used directly:\n *\n * ```typescript\n * {\n * // @ts-expect-error Recursion limit\n * type _check1 = FixRecursiveRecursionLimit<typeof LargeType>;\n * type _check2 = FixRecursiveRecursionLimit<typeof LargeType>;\n * type _check3 = ValidateRecursiveSchemaTemplate<typeof LargeType>;\n * }\n * ```\n *\n * For non-recursive types, they can be ported to the more flexible recursive APIs and use the pattern above.\n *\n * Non-recursive types can also use this workaround by making a duplicate copy of the problematic schema written using the recursive APIs.\n * Then this pattern can be applied to the duplicate copy.\n *\n * ```typescript\n * // Workaround TypeScript recursion limit\n * \t{\n * \t\tclass LargeUnionObjectNode_Fix extends schema.objectRecursive(\"ObjectNode\", {\n * \t\t\tx: largeUnion,\n * \t\t}) {}\n *\n * \t\t// @ts-expect-error Recursion limit\n * \t\tallowUnused<FixRecursiveRecursionLimit<typeof LargeUnionObjectNode_Fix>>();\n * \t\tallowUnused<FixRecursiveRecursionLimit<typeof LargeUnionObjectNode_Fix>>();\n * \t\tallowUnused<ValidateRecursiveSchema<typeof LargeUnionObjectNode_Fix>>();\n * \t\t}\n *\n * \t// Fails to compile without the above workaround.\n * \tclass LargeUnionObjectNode extends schema.object(\"ObjectNode\", { x: largeUnion }) {}\n * ```\n * @privateRemarks\n * Using this is real sketchy, and leads to a lot of issues (errors which depend on how the schema is compiled, making different build setups produce different results and complicating exports).\n * This is being kept as internal for now: if a customer really needs it, we have this as a documented workaround, but it would be much better to find an alternative solution before using this one.\n * This uses ValidateRecursiveSchemaTemplate since it was found to evaluate enough of the type to work.\n * @internal\n */\nexport type FixRecursiveRecursionLimit<T extends TreeNodeSchema> =\n\tT extends ValidateRecursiveSchemaTemplate<T> ? undefined : undefined;\n\n/**\n * Does nothing with the provided value, but appears to use it to make unused locals warnings and errors go away.\n *\n * @remarks\n * When TypeScript is configured with \"noUnusedLocals\", it will produce an error if a local variable is declared but never used.\n * When you want to have this check enabled, but not follow it for a specific variable, you can pass the type or value to this function.\n *\n * Instead of using this, consider disabling \"noUnusedLocals\" in your tsconfig.json file, and enabling a similar check via a linter.\n * This will allow you to still have the check, but have more control over it, for example being able to suppress it, or enable patterns like allowing unused locals with an \"_\" prefix.\n * @alpha\n */\nexport function allowUnused<T>(t?: T): void {}\n\n/**\n * Workaround for fixing errors resulting from an issue with recursive ArrayNode schema exports.\n * @remarks\n * Importing a recursive ArrayNode schema via a d.ts file can produce an error like\n * `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.`\n * if using a tsconfig with `\"skipLibCheck\": false`.\n *\n * This error occurs due to the TypeScript compiler splitting the class definition into two separate declarations in the d.ts file (one for the base, and one for the actual class).\n * For unknown reasons, splitting the class declaration in this way breaks the recursive type handling, leading to the mentioned error.\n *\n * This type always evaluates to `undefined` to ensure the dummy export (which doesn't exist at runtime) is typed correctly.\n *\n * {@link https://github.com/microsoft/TypeScript/issues/59550|TypeScript Issue 59550} tracks a suggestion which would make this workaround unnecessary.\n *\n * @example Usage\n * Since recursive type handling in TypeScript is order dependent, putting just the right kind of usages of the type before the declarations can cause it to not hit this error.\n * For the case of ArrayNodes, this can be done via usage that looks like this:\n *\n * This example should use a doc comment to ensure the workaround comment shows up in the intellisense for the dummy export,\n * however doing so is impossible due to how this example is included in a doc comment.\n * ```typescript\n * // Workaround to avoid\n * // `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.\n * export declare type _RecursiveArrayWorkaround = FixRecursiveArraySchema<typeof RecursiveArray>;\n * export class RecursiveArray extends schema.arrayRecursive(\"RA\", [() => RecursiveArray]) {}\n * {\n * \ttype _check = ValidateRecursiveSchema<typeof RecursiveArray>;\n * }\n * ```\n *\n * @alpha\n */\nexport type FixRecursiveArraySchema<T> = T extends TreeNodeSchema ? undefined : undefined;\n"]}
1
+ {"version":3,"file":"schemaFactoryRecursive.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryRecursive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAGN,iBAAiB,GAEjB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,UAAU,uBAAuB,CAKtC,IAAU,EACV,YAAmB,EACnB,KAAmC;IAEnC,kJAAkJ;IAClJ,OAAO,iBAAiB,CACvB,IAAI,EACJ,YAA4C,EAC5C,KAAK,CACmD,CAAC;AAC3D,CAAC;AAkOD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAI,CAAK,IAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tWithType,\n\tTreeNode,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../core/index.js\";\nimport type { InsertableObjectFromSchemaRecord } from \"../node-kinds/index.js\";\nimport {\n\ttype FieldKind,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype ImplicitFieldSchema,\n} from \"../fieldSchema.js\";\n\nimport type { FieldSchemaAlphaUnsafe, System_Unsafe } from \"./typesUnsafe.js\";\n\nexport function createFieldSchemaUnsafe<\n\tKind extends FieldKind,\n\tTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\tTCustomMetadata = unknown,\n>(\n\tkind: Kind,\n\tallowedTypes: Types,\n\tprops?: FieldProps<TCustomMetadata>,\n): FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata> {\n\t// At runtime, we still want this to be a FieldSchema instance, but we can't satisfy its extends clause, so just return it as an FieldSchemaUnsafe\n\treturn createFieldSchema(\n\t\tkind,\n\t\tallowedTypes as ImplicitAllowedTypes & Types,\n\t\tprops,\n\t) as FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata>;\n}\n\n/**\n * Compile time check for validity of a recursive schema.\n * This type also serves as a central location for documenting the requirements and issues related to recursive schema.\n *\n * @example\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => Test]) {}\n * {\n * type _check = ValidateRecursiveSchema<typeof Test>;\n * }\n * ```\n * @remarks\n * In this context recursive schema are defined as all {@link FieldSchema} and {@link TreeNodeSchema} schema which are part of a cycle such that walking down through each {@link TreeNodeSchemaCore.childTypes} the given starting schema can be reached again.\n * Schema referencing the recursive schema and schema they reference that are not part of a cycle are not considered recursive.\n *\n * TypeScript puts a lot of limitations on the typing of recursive schema.\n * To help avoid running into these limitations and thus getting schema that do not type check (or only type checks sometimes!),\n * {@link SchemaFactory} provides APIs (postfixed with `Recursive`) for writing recursive schema.\n * These APIs when combined with the patterns documented below should ensure that the schema provide robust type checking.\n * These special patterns (other than {@link LazyItem} forward references which are not recursion specific)\n * are not required for correct runtime behavior: they exist entirely to mitigate TypeScript type checking limitations and bugs.\n * Ideally TypeScript's type checker would be able to handle all of these cases and more, removing the need for recursive type specific guidance, rules and APIs.\n * Currently however there are open issues preventing this:\n * {@link https://github.com/microsoft/TypeScript/issues/59550 | 1},\n * {@link https://github.com/microsoft/TypeScript/issues/55832 | 2},\n * {@link https://github.com/microsoft/TypeScript/issues/55758 | 3}.\n * Note that the proposed resolution to some of these issues is for the compiler to error rather than allow the case,\n * so even if these are all resolved the recursive type workarounds may still be needed.\n *\n * # Patterns\n *\n * Below are patterns for how to use recursive schema.\n *\n * ## General Patterns\n *\n * When defining a recursive {@link TreeNodeSchema}, use the `*Recursive` {@link SchemaFactory} methods.\n * The returned class should be used as the base class for the recursive schema, which should then be passed to {@link ValidateRecursiveSchema}.\n *\n * Using {@link ValidateRecursiveSchema} will provide compile error for some of the cases of malformed schema.\n * This can be used to help mitigate the issue that recursive schema definitions are {@link Unenforced}.\n * If an issue is encountered where a mistake in a recursive schema is made which produces an invalid schema but is not rejected by this checker,\n * it should be considered a bug and this should be updated to handle that case (or have a disclaimer added to these docs that it misses that case).\n *\n * The non-recursive versions of the schema building methods will run into several issues when used recursively.\n * Consider the following example:\n *\n * ```typescript\n * const Test = sf.array(Test); // Bad\n * ```\n *\n * This has several issues:\n *\n * 1. It is a structurally named schema.\n * Structurally named schema derive their name from the names of their child types, which is not possible when the type is recursive since its name would include itself.\n * Instead a name must be explicitly provided.\n *\n * 2. The schema accesses itself before it's defined.\n * This would be a runtime error if the TypeScript compiler allowed it.\n * This can be fixed by wrapping the type in a function, which also requires explicitly listing the allowed types in an array (`[() => Test]`).\n *\n * 3. TypeScript fails to infer the recursive type and falls back to `any` with this warning or error (depending on the compiler configuration):\n * `'Test' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)`.\n * This issue is what the specialized recursive schema building methods fix.\n * This fix comes at a cost: to make the recursive cases work, the `extends` clauses had to be removed.\n * This means that mistakes declaring recursive schema often don't give compile errors in the schema.\n * Additionally support for implicit construction had to be disabled.\n * This means that new nested {@link Unhydrated} nodes can not be created like `new Test([[]])`.\n * Instead the nested nodes must be created explicitly using the construction like`new Test([new Test([])])`.\n *\n * 4. It is using \"POJO\" mode since it's not explicitly declaring a new class.\n * This means that the generated d.ts files for the schema replace recursive references with `any`, breaking use of recursive schema across compilation boundaries.\n * This is fixed by explicitly creating a class which extends the returned schema.\n *\n * All together, the fixed version looks like:\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => Test]) {} // Good\n * ```\n *\n * Be very careful when declaring recursive schema.\n * Due to the removed extends clauses, subtle mistakes will compile just fine but cause strange errors when the schema is used.\n *\n * For example if a reference to a schema is malformed (in this case boxed inside an object):\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * ```\n * This schema will still compile, and some (but not all) usages of it may look like they work correctly while other usages will produce generally unintelligible compile errors.\n * This issue can be partially mitigated using {@link ValidateRecursiveSchema}:\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * {\n * type _check = ValidateRecursiveSchema<typeof Test>; // Reports compile error due to invalid schema above.\n * }\n * ```\n *\n * If your TypeScript configuration objects to this patten due to the unused local, you can use {@link allowUnused} to suppress the error:\n *\n * ```typescript\n * class Test extends sf.arrayRecursive(\"Test\", [() => ({ Test })]) {} // Bad\n * allowUnused<ValidateRecursiveSchema<typeof Test>>(); // Reports compile error due to invalid schema above.\n * ```\n *\n * ## Object Schema\n *\n * When defining fields, if the fields is part of the recursive cycle, use the `*Recursive` {@link SchemaFactory} methods for defining the {@link FieldSchema}.\n *\n * ## Array Schema\n *\n * See {@link FixRecursiveArraySchema} for array specific details.\n *\n * @privateRemarks\n * There are probably mistakes this misses: it's hard to guess all the wrong things people will accidentally do and defend against them.\n * Hopefully over time this can grow toward being robust, at least for common mistakes.\n *\n * This check duplicates logic that ideally would be entirely decided by the actual schema building methods.\n * Therefore changes to those methods may require updating `ValidateRecursiveSchema`.\n *\n * TODO: this currently does not reject `any`, but ideally should.\n * @public\n */\nexport type ValidateRecursiveSchema<\n\t// Recursive types should always be using TreeNodeSchemaClass (not TreeNodeSchemaNonClass) as thats part of the requirements for the type to work across compilation boundaries correctly.\n\tT extends ValidateRecursiveSchemaTemplate<T>,\n> = true;\n\n/**\n * Validation logic used by {@link ValidateRecursiveSchema}.\n * @system @public\n */\nexport type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<\n\t// Name: This validator places no restrictions on the name other than that it's a string (as required by TreeNodeSchemaClass).\n\tstring,\n\t// NodeKind: These are the NodeKinds which currently can be used recursively.\n\tNodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record,\n\t// TNode: The produced node API. This is pretty minimal validation: more could be added if similar to how TInsertable works below if needed.\n\tTreeNode & WithType<T[\"identifier\"], T[\"kind\"]>,\n\t// TInsertable: What can be passed to the constructor. This should be enough to catch most issues with incorrect schema.\n\t// These match whats defined in the recursive methods on `SchemaFactory` except they do not use `Unenforced`.\n\t{\n\t\t[NodeKind.Object]: T[\"info\"] extends RestrictiveStringRecord<ImplicitFieldSchema>\n\t\t\t? InsertableObjectFromSchemaRecord<T[\"info\"]>\n\t\t\t: unknown;\n\t\t[NodeKind.Array]: T[\"info\"] extends ImplicitAllowedTypes\n\t\t\t? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T[\"info\"]>>\n\t\t\t: unknown;\n\t\t[NodeKind.Map]: T[\"info\"] extends ImplicitAllowedTypes\n\t\t\t? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T[\"info\"]>]>\n\t\t\t: unknown;\n\t\t[NodeKind.Record]: {\n\t\t\treadonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;\n\t\t};\n\t\t[NodeKind.Leaf]: unknown;\n\t}[T[\"kind\"]],\n\t// ImplicitlyConstructable: recursive types are currently not implicitly constructable.\n\tfalse,\n\t// Info: What's passed to the method to create the schema. Constraining these here should be about as effective as if the actual constraints existed on the actual method itself.\n\t{\n\t\t[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;\n\t\t[NodeKind.Array]: ImplicitAllowedTypes;\n\t\t[NodeKind.Map]: ImplicitAllowedTypes;\n\t\t[NodeKind.Record]: ImplicitAllowedTypes;\n\t\t[NodeKind.Leaf]: unknown;\n\t}[T[\"kind\"]]\n>;\n\n/**\n * Workaround for \"Type instantiation is excessively deep and possibly infinite.ts\" errors.\n * @remarks\n *\n * Generally this workaround should be avoided if possible,\n * especially for exported types, as it is likely to result in issues when exporting or importing schema where the user will be forced to use the workaround as well.\n * This is particularly problematic since in some cases it may not be possible for the user to replicate the pattern.\n * Additionally, which cases hit these limits may vary based on TypeScript version and implementation details of this library.\n *\n * This workaround is provided and documented as a last resort to be able to keep an app compiling.\n * Future version of SharedTree should provide schema type erasure functionality as a better alternative for most cases.\n *\n * When TypeScript gives the error \"Error (TS2589) Type instantiation is excessively deep and possibly infinite.\" on the invocation of `ValidateRecursiveSchema`\n * for a large schema, it can sometimes be worked around by repeating the usage of the type multiple times.\n * This works because the TypeScript compiler caches some of the intermediate results from the first usage, and thus can get further on the second.\n *\n * This utility can be referenced when applying this pattern.\n * For recursive types this can be used directly:\n *\n * ```typescript\n * {\n * // @ts-expect-error Recursion limit\n * type _check1 = FixRecursiveRecursionLimit<typeof LargeType>;\n * type _check2 = FixRecursiveRecursionLimit<typeof LargeType>;\n * type _check3 = ValidateRecursiveSchemaTemplate<typeof LargeType>;\n * }\n * ```\n *\n * For non-recursive types, they can be ported to the more flexible recursive APIs and use the pattern above.\n *\n * Non-recursive types can also use this workaround by making a duplicate copy of the problematic schema written using the recursive APIs.\n * Then this pattern can be applied to the duplicate copy.\n *\n * ```typescript\n * // Workaround TypeScript recursion limit\n * \t{\n * \t\tclass LargeUnionObjectNode_Fix extends schema.objectRecursive(\"ObjectNode\", {\n * \t\t\tx: largeUnion,\n * \t\t}) {}\n *\n * \t\t// @ts-expect-error Recursion limit\n * \t\tallowUnused<FixRecursiveRecursionLimit<typeof LargeUnionObjectNode_Fix>>();\n * \t\tallowUnused<FixRecursiveRecursionLimit<typeof LargeUnionObjectNode_Fix>>();\n * \t\tallowUnused<ValidateRecursiveSchema<typeof LargeUnionObjectNode_Fix>>();\n * \t\t}\n *\n * \t// Fails to compile without the above workaround.\n * \tclass LargeUnionObjectNode extends schema.object(\"ObjectNode\", { x: largeUnion }) {}\n * ```\n * @privateRemarks\n * Using this is real sketchy, and leads to a lot of issues (errors which depend on how the schema is compiled, making different build setups produce different results and complicating exports).\n * This is being kept as internal for now: if a customer really needs it, we have this as a documented workaround, but it would be much better to find an alternative solution before using this one.\n * This uses ValidateRecursiveSchemaTemplate since it was found to evaluate enough of the type to work.\n * @internal\n */\nexport type FixRecursiveRecursionLimit<T extends TreeNodeSchema> =\n\tT extends ValidateRecursiveSchemaTemplate<T> ? undefined : undefined;\n\n/**\n * Does nothing with the provided value, but appears to use it to make unused locals warnings and errors go away.\n *\n * @remarks\n * When TypeScript is configured with \"noUnusedLocals\", it will produce an error if a local variable is declared but never used.\n * When you want to have this check enabled, but not follow it for a specific variable, you can pass the type or value to this function.\n *\n * Instead of using this, consider disabling \"noUnusedLocals\" in your tsconfig.json file, and enabling a similar check via a linter.\n * This will allow you to still have the check, but have more control over it, for example being able to suppress it, or enable patterns like allowing unused locals with an \"_\" prefix.\n * @alpha\n */\nexport function allowUnused<T>(t?: T): void {}\n\n/**\n * Workaround for fixing errors resulting from an issue with recursive ArrayNode schema exports.\n * @remarks\n * Importing a recursive ArrayNode schema via a d.ts file can produce an error like\n * `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.`\n * if using a tsconfig with `\"skipLibCheck\": false`.\n *\n * This error occurs due to the TypeScript compiler splitting the class definition into two separate declarations in the d.ts file (one for the base, and one for the actual class).\n * For unknown reasons, splitting the class declaration in this way breaks the recursive type handling, leading to the mentioned error.\n *\n * This type always evaluates to `undefined` to ensure the dummy export (which doesn't exist at runtime) is typed correctly.\n *\n * {@link https://github.com/microsoft/TypeScript/issues/59550|TypeScript Issue 59550} tracks a suggestion which would make this workaround unnecessary.\n *\n * @example Usage\n * Since recursive type handling in TypeScript is order dependent, putting just the right kind of usages of the type before the declarations can cause it to not hit this error.\n * For the case of ArrayNodes, this can be done via usage that looks like this:\n *\n * This example should use a doc comment to ensure the workaround comment shows up in the intellisense for the dummy export,\n * however doing so is impossible due to how this example is included in a doc comment.\n * ```typescript\n * // Workaround to avoid\n * // `error TS2310: Type 'RecursiveArray' recursively references itself as a base type.` in the d.ts file.\n * export declare type _RecursiveArrayWorkaround = FixRecursiveArraySchema<typeof RecursiveArray>;\n * export class RecursiveArray extends schema.arrayRecursive(\"RA\", [() => RecursiveArray]) {}\n * {\n * \ttype _check = ValidateRecursiveSchema<typeof RecursiveArray>;\n * }\n * ```\n *\n * @alpha\n */\nexport type FixRecursiveArraySchema<T> = T extends TreeNodeSchema ? undefined : undefined;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFromSimple.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFromSimple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,KAAK,EAGX,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAmBnF"}
1
+ {"version":3,"file":"schemaFromSimple.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFromSimple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,EAGX,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAmBnF"}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
6
6
  import { NodeKind } from "../core/index.js";
7
- import { FieldKind, } from "../schemaTypes.js";
7
+ import { FieldKind, } from "../fieldSchema.js";
8
8
  import { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
9
9
  const factory = new SchemaFactoryAlpha(undefined);
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFromSimple.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFromSimple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAuB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAIN,SAAS,GAET,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB;IACtE,MAAM,OAAO,GAAY,IAAI,GAAG,CAC/B,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAqD,EAAE,CAAC;QACpE,EAAE;QACF,8EAA8E;QAC9E,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC;KACvC,CACD,CACD,CAAC;IACF,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA6C,CAAC;IACzE,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;QAClC,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO;QACN,IAAI;QACJ,WAAW;KACX,CAAC;AACH,CAAC;AAID,SAAS,mBAAmB,CAC3B,MAAyB,EAC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C,SAAS,CAAC,CAAC;YACpE,CAAC;YACD,gGAAgG;YAChG,kGAAkG;YAClG,OAAO,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,KAAK,QAAQ,CAAC,KAAK;YAClB,OAAO,OAAO,CAAC,UAAU,CACxB,EAAE,EACF,oBAAoB,CAAC,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAC7D,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAC7B,CAAC;QACH,KAAK,QAAQ,CAAC,GAAG;YAChB,OAAO,OAAO,CAAC,QAAQ,CACtB,EAAE,EACF,oBAAoB,CAAC,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAC7D,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAC7B,CAAC;QACH,KAAK,QAAQ,CAAC,MAAM;YACnB,OAAO,OAAO,CAAC,WAAW,CACzB,EAAE,EACF,oBAAoB,CAAC,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAC7D,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAC7B,CAAC;QACH,KAAK,QAAQ,CAAC,IAAI;YACjB,OAAO,CACN,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;gBAChE,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAChC,CAAC;QACH;YACC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype AllowedTypes,\n\ttype FieldSchemaAlpha,\n\tFieldKind,\n\ttype FieldProps,\n} from \"../schemaTypes.js\";\nimport type {\n\tSimpleFieldSchema,\n\tSimpleNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\n\nimport type { TreeSchema } from \"./configuration.js\";\nimport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\n\nconst factory = new SchemaFactoryAlpha(undefined);\n\n/**\n * Create {@link FieldSchema} from a SimpleTreeSchema.\n * @remarks\n * Only use this API if hand written schema (produced using {@link SchemaFactory} cannot be provided.\n *\n * Using generated schema with schema aware APIs (designed to work with strongly typed schema) like {@link TreeViewConfiguration}\n * will produce a poor TypeScript typing experience which is subject to change.\n *\n * Editing through a view produced using this schema can easily violate invariants other users of the document might expect and must be done with great care.\n *\n * This API bakes in some arbitrary policy choices for how to handle data that is not included in the SimpleTreeSchema API, for example the value of `allowUnknownOptionalFields`.\n * If any particular choice is required for such cases, this API should not be used.\n * @alpha\n */\nexport function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): TreeSchema {\n\tconst context: Context = new Map(\n\t\t[...simple.definitions].map(\n\t\t\t([id, schema]): [string, () => TreeNodeSchema & SimpleNodeSchema] => [\n\t\t\t\tid,\n\t\t\t\t// This relies on the caching in evaluateLazySchema so that it only runs once.\n\t\t\t\t() => generateNode(id, schema, context),\n\t\t\t],\n\t\t),\n\t);\n\tconst root = generateFieldSchema(simple.root, context, undefined);\n\tconst definitions = new Map<string, TreeNodeSchema & SimpleNodeSchema>();\n\tfor (const [id, lazy] of context) {\n\t\tdefinitions.set(id, lazy());\n\t}\n\treturn {\n\t\troot,\n\t\tdefinitions,\n\t};\n}\n\ntype Context = ReadonlyMap<string, () => TreeNodeSchema & SimpleNodeSchema>;\n\nfunction generateFieldSchema(\n\tsimple: SimpleFieldSchema,\n\tcontext: Context,\n\tstoredKey: string | undefined,\n): FieldSchemaAlpha {\n\tconst allowed = generateAllowedTypes(simple.allowedTypesIdentifiers, context);\n\tconst props: Omit<FieldProps, \"defaultProvider\"> = {\n\t\tmetadata: simple.metadata,\n\t\tkey: storedKey,\n\t};\n\n\t// Using createFieldSchema could work, but would require setting up the default providers.\n\tswitch (simple.kind) {\n\t\tcase FieldKind.Identifier:\n\t\t\treturn SchemaFactoryAlpha.identifier(props);\n\t\tcase FieldKind.Optional:\n\t\t\treturn SchemaFactoryAlpha.optional(allowed, props);\n\t\tcase FieldKind.Required:\n\t\t\treturn SchemaFactoryAlpha.required(allowed, props);\n\t\tdefault:\n\t\t\treturn unreachableCase(simple.kind);\n\t}\n}\n\nfunction generateAllowedTypes(allowed: ReadonlySet<string>, context: Context): AllowedTypes {\n\treturn [...allowed].map((id) => context.get(id) ?? fail(0xb5a /* Missing schema */));\n}\n\nfunction generateNode(\n\tid: string,\n\tschema: SimpleNodeSchema,\n\tcontext: Context,\n): TreeNodeSchema & SimpleNodeSchema {\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Object: {\n\t\t\tconst fields: Record<string, FieldSchema> = {};\n\t\t\tfor (const [key, field] of schema.fields) {\n\t\t\t\tfields[key] = generateFieldSchema(field, context, field.storedKey);\n\t\t\t}\n\t\t\t// Here allowUnknownOptionalFields is implicitly defaulting. This is a subjective policy choice:\n\t\t\t// users of this code are expected to handle what ever choice this code makes for cases like this.\n\t\t\treturn factory.objectAlpha(id, fields, { metadata: schema.metadata });\n\t\t}\n\t\tcase NodeKind.Array:\n\t\t\treturn factory.arrayAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Map:\n\t\t\treturn factory.mapAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Record:\n\t\t\treturn factory.recordAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Leaf:\n\t\t\treturn (\n\t\t\t\tSchemaFactoryAlpha.leaves.find((leaf) => leaf.identifier === id) ??\n\t\t\t\tfail(0xb5b /* Missing schema */)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn unreachableCase(schema);\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaFromSimple.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFromSimple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAA0C,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAGN,SAAS,GAET,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB;IACtE,MAAM,OAAO,GAAY,IAAI,GAAG,CAC/B,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAC1B,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAqD,EAAE,CAAC;QACpE,EAAE;QACF,8EAA8E;QAC9E,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC;KACvC,CACD,CACD,CAAC;IACF,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA6C,CAAC;IACzE,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;QAClC,WAAW,CAAC,GAA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ft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport { NodeKind, type TreeNodeSchema, type AllowedTypes } from \"../core/index.js\";\nimport {\n\ttype FieldSchema,\n\ttype FieldSchemaAlpha,\n\tFieldKind,\n\ttype FieldProps,\n} from \"../fieldSchema.js\";\nimport type {\n\tSimpleFieldSchema,\n\tSimpleNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\n\nimport type { TreeSchema } from \"./configuration.js\";\nimport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\n\nconst factory = new SchemaFactoryAlpha(undefined);\n\n/**\n * Create {@link FieldSchema} from a SimpleTreeSchema.\n * @remarks\n * Only use this API if hand written schema (produced using {@link SchemaFactory} cannot be provided.\n *\n * Using generated schema with schema aware APIs (designed to work with strongly typed schema) like {@link TreeViewConfiguration}\n * will produce a poor TypeScript typing experience which is subject to change.\n *\n * Editing through a view produced using this schema can easily violate invariants other users of the document might expect and must be done with great care.\n *\n * This API bakes in some arbitrary policy choices for how to handle data that is not included in the SimpleTreeSchema API, for example the value of `allowUnknownOptionalFields`.\n * If any particular choice is required for such cases, this API should not be used.\n * @alpha\n */\nexport function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): TreeSchema {\n\tconst context: Context = new Map(\n\t\t[...simple.definitions].map(\n\t\t\t([id, schema]): [string, () => TreeNodeSchema & SimpleNodeSchema] => [\n\t\t\t\tid,\n\t\t\t\t// This relies on the caching in evaluateLazySchema so that it only runs once.\n\t\t\t\t() => generateNode(id, schema, context),\n\t\t\t],\n\t\t),\n\t);\n\tconst root = generateFieldSchema(simple.root, context, undefined);\n\tconst definitions = new Map<string, TreeNodeSchema & SimpleNodeSchema>();\n\tfor (const [id, lazy] of context) {\n\t\tdefinitions.set(id, lazy());\n\t}\n\treturn {\n\t\troot,\n\t\tdefinitions,\n\t};\n}\n\ntype Context = ReadonlyMap<string, () => TreeNodeSchema & SimpleNodeSchema>;\n\nfunction generateFieldSchema(\n\tsimple: SimpleFieldSchema,\n\tcontext: Context,\n\tstoredKey: string | undefined,\n): FieldSchemaAlpha {\n\tconst allowed = generateAllowedTypes(simple.allowedTypesIdentifiers, context);\n\tconst props: Omit<FieldProps, \"defaultProvider\"> = {\n\t\tmetadata: simple.metadata,\n\t\tkey: storedKey,\n\t};\n\n\t// Using createFieldSchema could work, but would require setting up the default providers.\n\tswitch (simple.kind) {\n\t\tcase FieldKind.Identifier:\n\t\t\treturn SchemaFactoryAlpha.identifier(props);\n\t\tcase FieldKind.Optional:\n\t\t\treturn SchemaFactoryAlpha.optional(allowed, props);\n\t\tcase FieldKind.Required:\n\t\t\treturn SchemaFactoryAlpha.required(allowed, props);\n\t\tdefault:\n\t\t\treturn unreachableCase(simple.kind);\n\t}\n}\n\nfunction generateAllowedTypes(allowed: ReadonlySet<string>, context: Context): AllowedTypes {\n\treturn [...allowed].map((id) => context.get(id) ?? fail(0xb5a /* Missing schema */));\n}\n\nfunction generateNode(\n\tid: string,\n\tschema: SimpleNodeSchema,\n\tcontext: Context,\n): TreeNodeSchema & SimpleNodeSchema {\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Object: {\n\t\t\tconst fields: Record<string, FieldSchema> = {};\n\t\t\tfor (const [key, field] of schema.fields) {\n\t\t\t\tfields[key] = generateFieldSchema(field, context, field.storedKey);\n\t\t\t}\n\t\t\t// Here allowUnknownOptionalFields is implicitly defaulting. This is a subjective policy choice:\n\t\t\t// users of this code are expected to handle what ever choice this code makes for cases like this.\n\t\t\treturn factory.objectAlpha(id, fields, { metadata: schema.metadata });\n\t\t}\n\t\tcase NodeKind.Array:\n\t\t\treturn factory.arrayAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Map:\n\t\t\treturn factory.mapAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Record:\n\t\t\treturn factory.recordAlpha(\n\t\t\t\tid,\n\t\t\t\tgenerateAllowedTypes(schema.allowedTypesIdentifiers, context),\n\t\t\t\t{ metadata: schema.metadata },\n\t\t\t);\n\t\tcase NodeKind.Leaf:\n\t\t\treturn (\n\t\t\t\tSchemaFactoryAlpha.leaves.find((leaf) => leaf.identifier === id) ??\n\t\t\t\tfail(0xb5b /* Missing schema */)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn unreachableCase(schema);\n\t}\n}\n"]}
@@ -6,7 +6,7 @@ import { unreachableCase } from "@fluidframework/core-utils/internal";
6
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
7
  import { ValueSchema } from "../../core/index.js";
8
8
  import { copyProperty, hasSingle } from "../../util/index.js";
9
- import { FieldKind } from "../schemaTypes.js";
9
+ import { FieldKind } from "../fieldSchema.js";
10
10
  import { NodeKind } from "../core/index.js";
11
11
  import { ArrayNodeSchema, isMapNodeSchema, isRecordNodeSchema, ObjectNodeSchema, } from "../node-kinds/index.js";
12
12
  import { LeafNodeSchema } from "../leafNodeSchema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAc5E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAO9C,OAAO,EAAE,QAAQ,EAAuB,MAAM,kBAAkB,CAAC;AAGjE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soft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport type { TreeSchema } from \"./configuration.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n *\n * @internal\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String:\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Number:\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Boolean:\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Null:\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\tcase ValueSchema.FluidHandle:\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\tdefault:\n\t\t\tunreachableCase(schema.leafKind);\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key = options.useStoredKeys ? fieldSchema.storedKey : propertyKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (fieldSchema.kind !== FieldKind.Optional) {\n\t\t\tif (\n\t\t\t\toptions.requireFieldsWithDefaults ||\n\t\t\t\tfieldSchema.props?.defaultProvider === undefined\n\t\t\t) {\n\t\t\t\trequired.push(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
1
+ {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS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,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../fieldSchema.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport type { TreeSchema } from \"./configuration.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n *\n * @internal\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String:\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Number:\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Boolean:\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Null:\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\tcase ValueSchema.FluidHandle:\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\tdefault:\n\t\t\tunreachableCase(schema.leafKind);\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key = options.useStoredKeys ? fieldSchema.storedKey : propertyKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (fieldSchema.kind !== FieldKind.Optional) {\n\t\t\tif (\n\t\t\t\toptions.requireFieldsWithDefaults ||\n\t\t\t\tfieldSchema.props?.defaultProvider === undefined\n\t\t\t) {\n\t\t\t\trequired.push(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type TreeIndexNodes, type TreeIndex, type TreeIndexKey } from "../../feature-libraries/index.js";
6
- import type { ImplicitFieldSchema, NodeFromSchema } from "../schemaTypes.js";
7
- import { type TreeNode, type TreeNodeSchema } from "../core/index.js";
6
+ import type { ImplicitFieldSchema } from "../fieldSchema.js";
7
+ import { type TreeNode, type TreeNodeSchema, type NodeFromSchema } from "../core/index.js";
8
8
  import type { TreeView } from "./tree.js";
9
9
  /**
10
10
  * A {@link TreeIndex} that returns tree nodes given their associated keys.
@@ -1 +1 @@
1
- {"version":3,"file":"simpleTreeIndex.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAGN,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE1F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,YAAY,EAAE,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,SAAS,mBAAmB,EACxC,IAAI,SAAS,YAAY,EACzB,MAAM,EAEN,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,SAAS,EACvD,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,MAAM,EACrD,UAAU,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,GAAG,IAAI,IAAI,GAC5C,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACjC;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,SAAS,mBAAmB,E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js";
7
7
  import { brand } from "../../util/index.js";
8
- import { treeNodeFromAnchor } from "../core/index.js";
8
+ import { treeNodeFromAnchor, } from "../core/index.js";
9
9
  import { treeNodeApi } from "./treeNodeApi.js";
10
10
  import { walkFieldSchema } from "../walkFieldSchema.js";
11
11
  /**
@@ -48,7 +48,7 @@ export function createSimpleTreeIndex(view, indexer, getValue, isKeyValid, index
48
48
  }
49
49
  }
50
50
  };
51
- const index = new AnchorTreeIndex(view.getView().checkout.forest, schemaIndexer, (anchorNodes) => {
51
+ const index = new AnchorTreeIndex(view.checkout.forest, schemaIndexer, (anchorNodes) => {
52
52
  const simpleTreeNodes = [];
53
53
  for (const anchorNode of anchorNodes) {
54
54
  const simpleTree = treeNodeFromAnchor(anchorNode);