@fluidframework/tree 2.52.0 → 2.53.0-350190

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 (337) hide show
  1. package/api-report/tree.alpha.api.md +38 -29
  2. package/dist/alpha.d.ts +2 -1
  3. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  4. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  5. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  6. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +7 -0
  7. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  8. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +1 -0
  9. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  10. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  11. package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -0
  12. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  13. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  14. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  15. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +49 -20
  16. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  17. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  18. package/dist/feature-libraries/optional-field/optionalField.js +3 -0
  19. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  20. package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +1 -0
  21. package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
  22. package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +4 -0
  23. package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/jsonDomainSchema.d.ts +5 -3
  28. package/dist/jsonDomainSchema.d.ts.map +1 -1
  29. package/dist/jsonDomainSchema.js.map +1 -1
  30. package/dist/packageVersion.d.ts +1 -1
  31. package/dist/packageVersion.d.ts.map +1 -1
  32. package/dist/packageVersion.js +1 -1
  33. package/dist/packageVersion.js.map +1 -1
  34. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  35. package/dist/shared-tree/schematizeTree.js +1 -1
  36. package/dist/shared-tree/schematizeTree.js.map +1 -1
  37. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  38. package/dist/shared-tree/schematizingTreeView.js +3 -3
  39. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  40. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  41. package/dist/shared-tree/treeAlpha.js +9 -3
  42. package/dist/shared-tree/treeAlpha.js.map +1 -1
  43. package/dist/simple-tree/api/configuration.d.ts +3 -0
  44. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  45. package/dist/simple-tree/api/configuration.js +5 -1
  46. package/dist/simple-tree/api/configuration.js.map +1 -1
  47. package/dist/simple-tree/api/create.d.ts +4 -4
  48. package/dist/simple-tree/api/create.d.ts.map +1 -1
  49. package/dist/simple-tree/api/create.js +3 -6
  50. package/dist/simple-tree/api/create.js.map +1 -1
  51. package/dist/simple-tree/api/discrepancies.d.ts +5 -9
  52. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  53. package/dist/simple-tree/api/discrepancies.js +11 -10
  54. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  55. package/dist/simple-tree/api/index.d.ts +3 -2
  56. package/dist/simple-tree/api/index.d.ts.map +1 -1
  57. package/dist/simple-tree/api/index.js +3 -2
  58. package/dist/simple-tree/api/index.js.map +1 -1
  59. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  60. package/dist/simple-tree/api/schemaCompatibilityTester.js +3 -4
  61. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  62. package/dist/simple-tree/api/schemaFactory.d.ts +9 -155
  63. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  64. package/dist/simple-tree/api/schemaFactory.js +4 -47
  65. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  66. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +157 -16
  67. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  68. package/dist/simple-tree/api/schemaFactoryAlpha.js +33 -11
  69. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  70. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -3
  71. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  72. package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -7
  73. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  74. package/dist/simple-tree/api/schemaStatics.d.ts +158 -0
  75. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -0
  76. package/dist/simple-tree/api/schemaStatics.js +59 -0
  77. package/dist/simple-tree/api/schemaStatics.js.map +1 -0
  78. package/dist/simple-tree/api/storedSchema.d.ts +5 -3
  79. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  80. package/dist/simple-tree/api/storedSchema.js +4 -2
  81. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  82. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  83. package/dist/simple-tree/api/treeBeta.js +12 -6
  84. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  85. package/dist/simple-tree/core/allowedTypes.d.ts +33 -17
  86. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  87. package/dist/simple-tree/core/allowedTypes.js +20 -12
  88. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  89. package/dist/simple-tree/core/index.d.ts +5 -3
  90. package/dist/simple-tree/core/index.d.ts.map +1 -1
  91. package/dist/simple-tree/core/index.js +6 -1
  92. package/dist/simple-tree/core/index.js.map +1 -1
  93. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts +25 -0
  94. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -0
  95. package/dist/simple-tree/core/simpleNodeSchemaBase.js +7 -0
  96. package/dist/simple-tree/core/simpleNodeSchemaBase.js.map +1 -0
  97. package/dist/simple-tree/core/toStored.d.ts +32 -0
  98. package/dist/simple-tree/core/toStored.d.ts.map +1 -0
  99. package/dist/simple-tree/core/toStored.js +37 -0
  100. package/dist/simple-tree/core/toStored.js.map +1 -0
  101. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -2
  102. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  103. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  104. package/dist/simple-tree/core/treeNodeValid.d.ts +6 -1
  105. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  106. package/dist/simple-tree/core/treeNodeValid.js +11 -3
  107. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  108. package/dist/simple-tree/core/walkSchema.d.ts +19 -5
  109. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  110. package/dist/simple-tree/core/walkSchema.js +4 -2
  111. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  112. package/dist/simple-tree/createContext.d.ts.map +1 -1
  113. package/dist/simple-tree/createContext.js +1 -1
  114. package/dist/simple-tree/createContext.js.map +1 -1
  115. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  116. package/dist/simple-tree/fieldSchema.js +1 -1
  117. package/dist/simple-tree/fieldSchema.js.map +1 -1
  118. package/dist/simple-tree/index.d.ts +4 -4
  119. package/dist/simple-tree/index.d.ts.map +1 -1
  120. package/dist/simple-tree/index.js +7 -1
  121. package/dist/simple-tree/index.js.map +1 -1
  122. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  123. package/dist/simple-tree/leafNodeSchema.js +1 -0
  124. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  125. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  126. package/dist/simple-tree/node-kinds/array/arrayNode.js +17 -3
  127. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  128. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  129. package/dist/simple-tree/node-kinds/map/mapNode.js +9 -2
  130. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  131. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
  132. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  133. package/dist/simple-tree/node-kinds/object/objectNode.js +37 -26
  134. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  135. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  136. package/dist/simple-tree/node-kinds/record/recordNode.js +9 -2
  137. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  138. package/dist/simple-tree/prepareForInsertion.d.ts +5 -5
  139. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  140. package/dist/simple-tree/prepareForInsertion.js +10 -10
  141. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  142. package/dist/simple-tree/simpleSchema.d.ts +6 -21
  143. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  144. package/dist/simple-tree/simpleSchema.js.map +1 -1
  145. package/dist/simple-tree/toStoredSchema.d.ts +35 -11
  146. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  147. package/dist/simple-tree/toStoredSchema.js +68 -33
  148. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  149. package/lib/alpha.d.ts +2 -1
  150. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  151. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
  152. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  153. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +7 -0
  154. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  155. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +1 -0
  156. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  157. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  158. package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -0
  159. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  160. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  161. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  162. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +50 -21
  163. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  164. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  165. package/lib/feature-libraries/optional-field/optionalField.js +3 -0
  166. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  167. package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +1 -0
  168. package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
  169. package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +4 -0
  170. package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
  171. package/lib/index.d.ts +1 -1
  172. package/lib/index.d.ts.map +1 -1
  173. package/lib/index.js.map +1 -1
  174. package/lib/jsonDomainSchema.d.ts +5 -3
  175. package/lib/jsonDomainSchema.d.ts.map +1 -1
  176. package/lib/jsonDomainSchema.js.map +1 -1
  177. package/lib/packageVersion.d.ts +1 -1
  178. package/lib/packageVersion.d.ts.map +1 -1
  179. package/lib/packageVersion.js +1 -1
  180. package/lib/packageVersion.js.map +1 -1
  181. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  182. package/lib/shared-tree/schematizeTree.js +2 -2
  183. package/lib/shared-tree/schematizeTree.js.map +1 -1
  184. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  185. package/lib/shared-tree/schematizingTreeView.js +4 -4
  186. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  187. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  188. package/lib/shared-tree/treeAlpha.js +10 -4
  189. package/lib/shared-tree/treeAlpha.js.map +1 -1
  190. package/lib/simple-tree/api/configuration.d.ts +3 -0
  191. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  192. package/lib/simple-tree/api/configuration.js +6 -2
  193. package/lib/simple-tree/api/configuration.js.map +1 -1
  194. package/lib/simple-tree/api/create.d.ts +4 -4
  195. package/lib/simple-tree/api/create.d.ts.map +1 -1
  196. package/lib/simple-tree/api/create.js +3 -6
  197. package/lib/simple-tree/api/create.js.map +1 -1
  198. package/lib/simple-tree/api/discrepancies.d.ts +5 -9
  199. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  200. package/lib/simple-tree/api/discrepancies.js +11 -10
  201. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  202. package/lib/simple-tree/api/index.d.ts +3 -2
  203. package/lib/simple-tree/api/index.d.ts.map +1 -1
  204. package/lib/simple-tree/api/index.js +2 -1
  205. package/lib/simple-tree/api/index.js.map +1 -1
  206. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  207. package/lib/simple-tree/api/schemaCompatibilityTester.js +4 -5
  208. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  209. package/lib/simple-tree/api/schemaFactory.d.ts +9 -155
  210. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  211. package/lib/simple-tree/api/schemaFactory.js +2 -45
  212. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  213. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +157 -16
  214. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  215. package/lib/simple-tree/api/schemaFactoryAlpha.js +23 -1
  216. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  217. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -3
  218. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  219. package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -5
  220. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  221. package/lib/simple-tree/api/schemaStatics.d.ts +158 -0
  222. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -0
  223. package/lib/simple-tree/api/schemaStatics.js +56 -0
  224. package/lib/simple-tree/api/schemaStatics.js.map +1 -0
  225. package/lib/simple-tree/api/storedSchema.d.ts +5 -3
  226. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  227. package/lib/simple-tree/api/storedSchema.js +6 -4
  228. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  229. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  230. package/lib/simple-tree/api/treeBeta.js +8 -2
  231. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  232. package/lib/simple-tree/core/allowedTypes.d.ts +33 -17
  233. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  234. package/lib/simple-tree/core/allowedTypes.js +23 -12
  235. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  236. package/lib/simple-tree/core/index.d.ts +5 -3
  237. package/lib/simple-tree/core/index.d.ts.map +1 -1
  238. package/lib/simple-tree/core/index.js +3 -2
  239. package/lib/simple-tree/core/index.js.map +1 -1
  240. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts +25 -0
  241. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -0
  242. package/lib/simple-tree/core/simpleNodeSchemaBase.js +6 -0
  243. package/lib/simple-tree/core/simpleNodeSchemaBase.js.map +1 -0
  244. package/lib/simple-tree/core/toStored.d.ts +32 -0
  245. package/lib/simple-tree/core/toStored.d.ts.map +1 -0
  246. package/lib/simple-tree/core/toStored.js +32 -0
  247. package/lib/simple-tree/core/toStored.js.map +1 -0
  248. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -2
  249. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  250. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  251. package/lib/simple-tree/core/treeNodeValid.d.ts +6 -1
  252. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  253. package/lib/simple-tree/core/treeNodeValid.js +9 -2
  254. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  255. package/lib/simple-tree/core/walkSchema.d.ts +19 -5
  256. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  257. package/lib/simple-tree/core/walkSchema.js +4 -2
  258. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  259. package/lib/simple-tree/createContext.d.ts.map +1 -1
  260. package/lib/simple-tree/createContext.js +2 -2
  261. package/lib/simple-tree/createContext.js.map +1 -1
  262. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  263. package/lib/simple-tree/fieldSchema.js +1 -1
  264. package/lib/simple-tree/fieldSchema.js.map +1 -1
  265. package/lib/simple-tree/index.d.ts +4 -4
  266. package/lib/simple-tree/index.d.ts.map +1 -1
  267. package/lib/simple-tree/index.js +1 -1
  268. package/lib/simple-tree/index.js.map +1 -1
  269. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  270. package/lib/simple-tree/leafNodeSchema.js +2 -1
  271. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  272. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  273. package/lib/simple-tree/node-kinds/array/arrayNode.js +20 -6
  274. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  275. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  276. package/lib/simple-tree/node-kinds/map/mapNode.js +12 -5
  277. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  278. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
  279. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  280. package/lib/simple-tree/node-kinds/object/objectNode.js +16 -5
  281. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  282. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  283. package/lib/simple-tree/node-kinds/record/recordNode.js +12 -5
  284. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  285. package/lib/simple-tree/prepareForInsertion.d.ts +5 -5
  286. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  287. package/lib/simple-tree/prepareForInsertion.js +10 -10
  288. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  289. package/lib/simple-tree/simpleSchema.d.ts +6 -21
  290. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  291. package/lib/simple-tree/simpleSchema.js.map +1 -1
  292. package/lib/simple-tree/toStoredSchema.d.ts +35 -11
  293. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  294. package/lib/simple-tree/toStoredSchema.js +67 -34
  295. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  296. package/package.json +21 -21
  297. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  298. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +9 -0
  299. package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -0
  300. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +61 -19
  301. package/src/feature-libraries/optional-field/optionalField.ts +4 -0
  302. package/src/feature-libraries/sequence-field/sequenceFieldChangeRebaser.ts +4 -0
  303. package/src/index.ts +2 -1
  304. package/src/jsonDomainSchema.ts +4 -0
  305. package/src/packageVersion.ts +1 -1
  306. package/src/shared-tree/schematizeTree.ts +2 -2
  307. package/src/shared-tree/schematizingTreeView.ts +9 -3
  308. package/src/shared-tree/treeAlpha.ts +18 -4
  309. package/src/simple-tree/api/configuration.ts +10 -2
  310. package/src/simple-tree/api/create.ts +5 -10
  311. package/src/simple-tree/api/discrepancies.ts +18 -17
  312. package/src/simple-tree/api/index.ts +2 -3
  313. package/src/simple-tree/api/schemaCompatibilityTester.ts +5 -9
  314. package/src/simple-tree/api/schemaFactory.ts +6 -250
  315. package/src/simple-tree/api/schemaFactoryAlpha.ts +174 -1
  316. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -25
  317. package/src/simple-tree/api/schemaStatics.ts +291 -0
  318. package/src/simple-tree/api/storedSchema.ts +12 -5
  319. package/src/simple-tree/api/treeBeta.ts +9 -2
  320. package/src/simple-tree/core/allowedTypes.ts +46 -26
  321. package/src/simple-tree/core/index.ts +9 -1
  322. package/src/simple-tree/core/simpleNodeSchemaBase.ts +30 -0
  323. package/src/simple-tree/core/toStored.ts +58 -0
  324. package/src/simple-tree/core/treeNodeSchema.ts +8 -2
  325. package/src/simple-tree/core/treeNodeValid.ts +14 -2
  326. package/src/simple-tree/core/walkSchema.ts +23 -6
  327. package/src/simple-tree/createContext.ts +5 -2
  328. package/src/simple-tree/fieldSchema.ts +2 -1
  329. package/src/simple-tree/index.ts +14 -3
  330. package/src/simple-tree/leafNodeSchema.ts +2 -1
  331. package/src/simple-tree/node-kinds/array/arrayNode.ts +32 -4
  332. package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
  333. package/src/simple-tree/node-kinds/object/objectNode.ts +34 -4
  334. package/src/simple-tree/node-kinds/record/recordNode.ts +20 -2
  335. package/src/simple-tree/prepareForInsertion.ts +12 -7
  336. package/src/simple-tree/simpleSchema.ts +6 -26
  337. package/src/simple-tree/toStoredSchema.ts +107 -44
@@ -6,9 +6,142 @@ import { type ArrayNodeCustomizableSchema, type MapNodeCustomizableSchema, type
6
6
  import { SchemaFactory, type NodeSchemaOptionsAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
7
  import type { ImplicitAnnotatedFieldSchema } from "../fieldSchema.js";
8
8
  import type { RestrictiveStringRecord } from "../../util/index.js";
9
- import type { NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, WithType, ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes } from "../core/index.js";
9
+ import type { NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, WithType, ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, AnnotatedAllowedType, LazyItem } 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
+ import type { FieldProps, FieldSchemaAlpha, FieldPropsAlpha, FieldKind } from "../fieldSchema.js";
13
+ import type { LeafSchema } from "../leafNodeSchema.js";
14
+ import type { SimpleLeafNodeSchema } from "../simpleSchema.js";
15
+ import type { UnannotateImplicitAllowedTypes } from "../core/index.js";
16
+ import type { FieldSchemaAlphaUnsafe } from "./typesUnsafe.js";
17
+ /**
18
+ * Stateless APIs exposed via {@link SchemaFactoryAlpha} as both instance properties and as statics.
19
+ * @remarks
20
+ * See {@link SchemaStatics} for why this is useful.
21
+ * @system @sealed @alpha
22
+ */
23
+ export interface SchemaStaticsAlpha {
24
+ /**
25
+ * Declares a staged type in a set of {@link AllowedTypes}.
26
+ *
27
+ * @remarks
28
+ * Staged allowed types add support for loading documents which may or may not permit an allowed type in a location in a schema.
29
+ * This allows for an incremental rollout of a schema change to add a {@link TreeNodeSchema} to an {@link AllowedTypes} without breaking cross version collaboration.
30
+ *
31
+ * Once enough clients have the type staged (and thus can read documents which allow it), documents can start being created and upgraded to allow the staged type.
32
+ * This is done by deploying a new version of the app which removes the `staged` wrapper around the allowed type in the the schema definition.
33
+ * This will also require {@link TreeView.upgradeSchema|upgrading the schema} for existing documents.
34
+ *
35
+ * Using a staged allowed type in a schema is just like using the schema as an allowed type with the following exceptions:
36
+ *
37
+ * 1. {@link TreeView.initialize} will omit the staged allowed type from the newly created stored schema.
38
+ * 2. {@link TreeView.upgradeSchema} will omit the staged allowed type from the the upgraded stored schema.
39
+ * 3. When evaluating {@link TreeView.compatibility}, it will be viewable even if the staged allowed type is not present in the stored schema's corresponding allowed types.
40
+ * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type when inserting the content into a tree who's stored schema does not permit it.
41
+ *
42
+ * Currently, `staged` is not supported in the recursive type APIs: this is a known limitation which future versions of the API will address.
43
+ *
44
+ * @example
45
+ * Suppose you have a schema which has a field that allows some type `A`, but you want to add support for type `B`.
46
+ *
47
+ * The first change is to used to mark the new type as staged, replacing `A` in the schema with `[A, SchemaStaticsAlpha.staged(B)]`.
48
+ * Once this is done, and any code which reads contents from documents is updated to handle any `B` content that may be present, this version of the code can be deployed.
49
+ *
50
+ * Once all users have the above changes, the schema can be updated again to `[A, B]`, and the app can be updated to allow creating of `B` content.
51
+ * This updated version of the app will need to call {@link TreeView.upgradeSchema} when opening documents created by earlier versions.
52
+ *
53
+ * Adding a `B` schema as an option in the root could look like this:
54
+ * ```typescript
55
+ * const factory = new SchemaFactoryAlpha("test");
56
+ * class A extends factory.objectAlpha("A", {}) {}
57
+ * class B extends factory.objectAlpha("B", {}) {}
58
+ *
59
+ * // Does not support B
60
+ * const configBefore = new TreeViewConfigurationAlpha({
61
+ * schema: A,
62
+ * });
63
+ *
64
+ * // Supports documents with or without B
65
+ * const configStaged = new TreeViewConfigurationAlpha({
66
+ * // Adds staged support for B.
67
+ * // Currently this requires wrapping the root field with `SchemaFactoryAlpha.required`:
68
+ * // this is normally implicitly included, but is currently required while the "staged" APIs are `@alpha`.
69
+ * schema: SchemaFactoryAlpha.required([A, SchemaFactoryAlpha.staged(B)]),
70
+ * });
71
+ *
72
+ * // Only supports documents with A and B: can be used to upgrade schema to add B.
73
+ * const configAfter = new TreeViewConfigurationAlpha({
74
+ * schema: [A, B],
75
+ * });
76
+ * ```
77
+ * @example
78
+ * Below is a full example of how the schema migration process works.
79
+ * This can also be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.
80
+ * ```typescript
81
+ * // Schema A: only number allowed
82
+ * const schemaA = SchemaFactoryAlpha.optional([SchemaFactoryAlpha.number]);
83
+ *
84
+ * // Schema B: number or string (string is staged)
85
+ * const schemaB = SchemaFactoryAlpha.optional([
86
+ * SchemaFactoryAlpha.number,
87
+ * SchemaFactoryAlpha.staged(SchemaFactoryAlpha.string),
88
+ * ]);
89
+ *
90
+ * // Schema C: number or string, both fully allowed
91
+ * const schemaC = SchemaFactoryAlpha.optional([
92
+ * SchemaFactoryAlpha.number,
93
+ * SchemaFactoryAlpha.string,
94
+ * ]);
95
+ *
96
+ * // Initialize with schema A.
97
+ * const configA = new TreeViewConfiguration({
98
+ * schema: schemaA,
99
+ * });
100
+ * const viewA = treeA.viewWith(configA);
101
+ * viewA.initialize(5);
102
+ *
103
+ * // Since we are running all the different versions of the app in the same process making changes synchronously,
104
+ * // an explicit flush is needed to make them available to each other.
105
+ * synchronizeTrees();
106
+ *
107
+ * assert.deepEqual(viewA.root, 5);
108
+ *
109
+ * // View the same document with a second tree using schema B.
110
+ * const configB = new TreeViewConfiguration({
111
+ * schema: schemaB,
112
+ * });
113
+ * const viewB = treeB.viewWith(configB);
114
+ * // B cannot write strings to the root.
115
+ * assert.throws(() => (viewB.root = "test"));
116
+ *
117
+ * // View the same document with a third tree using schema C.
118
+ * const configC = new TreeViewConfiguration({
119
+ * schema: schemaC,
120
+ * });
121
+ * const viewC = treeC.viewWith(configC);
122
+ * // Upgrade to schema C
123
+ * viewC.upgradeSchema();
124
+ * // Use the newly enabled schema.
125
+ * viewC.root = "test";
126
+ *
127
+ * synchronizeTrees();
128
+ *
129
+ * // View A is now incompatible with the stored schema:
130
+ * assert.equal(viewA.compatibility.canView, false);
131
+ *
132
+ * // View B can still read the document, and now sees the string root which relies on the staged schema.
133
+ * assert.deepEqual(viewB.root, "test");
134
+ * ```
135
+ * @privateRemarks
136
+ * TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very
137
+ * user friendly and should be improved, particularly in the case of staged allowed types
138
+ *
139
+ * TODO: the example above does not work tell in intellisense: its formatted to work onm the website. We should find a solution that works well for both.
140
+ *
141
+ * TODO: AB#45711: Update the docs above when recursive type support is added.
142
+ */
143
+ staged: <const T extends LazyItem<TreeNodeSchema>>(t: T | AnnotatedAllowedType<T>) => AnnotatedAllowedType<T>;
144
+ }
12
145
  /**
13
146
  * {@link SchemaFactory} with additional alpha APIs.
14
147
  *
@@ -47,59 +180,67 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
47
180
  /**
48
181
  * {@inheritDoc SchemaStatics.leaves}
49
182
  */
50
- static readonly leaves: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
183
+ static readonly leaves: readonly [LeafSchema<"string", string> & SimpleLeafNodeSchema, LeafSchema<"number", number> & SimpleLeafNodeSchema, LeafSchema<"boolean", boolean> & SimpleLeafNodeSchema, LeafSchema<"null", null> & SimpleLeafNodeSchema, LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & SimpleLeafNodeSchema];
51
184
  /**
52
185
  * {@inheritDoc SchemaStatics.optional}
53
186
  */
54
187
  static readonly optional: {
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>;
188
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata>;
189
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Optional, UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
57
190
  };
58
191
  /**
59
192
  * {@inheritDoc SchemaStatics.required}
60
193
  */
61
194
  static readonly required: {
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>;
195
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata>;
196
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Required, UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
64
197
  };
65
198
  /**
66
199
  * {@inheritDoc SchemaStatics.optionalRecursive}
67
200
  */
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>;
201
+ static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
69
202
  /**
70
203
  * {@inheritDoc SchemaStatics.requiredRecursive}
71
204
  */
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>;
205
+ static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T, TCustomMetadata>;
73
206
  /**
74
207
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
75
208
  */
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>;
209
+ static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha<FieldKind.Identifier, LeafSchema<"string", string> & SimpleLeafNodeSchema, TCustomMetadata>;
77
210
  /**
78
211
  * {@inheritDoc SchemaStatics.leaves}
79
212
  */
80
- readonly leaves: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
213
+ readonly leaves: readonly [LeafSchema<"string", string> & SimpleLeafNodeSchema, LeafSchema<"number", number> & SimpleLeafNodeSchema, LeafSchema<"boolean", boolean> & SimpleLeafNodeSchema, LeafSchema<"null", null> & SimpleLeafNodeSchema, LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & SimpleLeafNodeSchema];
81
214
  /**
82
215
  * {@inheritDoc SchemaStatics.optional}
83
216
  */
84
217
  readonly optional: {
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>;
218
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata>;
219
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Optional, UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
87
220
  };
88
221
  /**
89
222
  * {@inheritDoc SchemaStatics.required}
90
223
  */
91
224
  readonly required: {
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>;
225
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata>;
226
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha<FieldKind.Required, UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
94
227
  };
95
228
  /**
96
229
  * {@inheritDoc SchemaStatics.optionalRecursive}
97
230
  */
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>;
231
+ readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
99
232
  /**
100
233
  * {@inheritDoc SchemaStatics.requiredRecursive}
101
234
  */
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>;
235
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T, TCustomMetadata>;
236
+ /**
237
+ * {@inheritDoc SchemaStaticsAlpha.staged}
238
+ */
239
+ static staged: <const T extends LazyItem<TreeNodeSchema>>(t: T | AnnotatedAllowedType<T>) => AnnotatedAllowedType<T>;
240
+ /**
241
+ * {@inheritDoc SchemaStaticsAlpha.staged}
242
+ */
243
+ staged: <const T extends LazyItem<TreeNodeSchema>>(t: T | AnnotatedAllowedType<T>) => AnnotatedAllowedType<T>;
103
244
  /**
104
245
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
105
246
  *
@@ -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,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,4BAA4B,EAAuB,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EAEd,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,oBAAoB,EACpB,6BAA6B,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,iCAAiC,EACjC,+BAA+B,EAC/B,aAAa,EACb,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,kBAAkB,CAC9B,GAAG,CAAC,MAAM,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EAC1D,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CACrC,SAAQ,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC;IACrC,OAAO,CAAC,OAAO;IAMf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AO,CAAC,WAAW;IAsCnB;;;;;;;;;;;OAWG;IACI,WAAW,CACjB,KAAK,CAAC,IAAI,SAAS,KAAK,EACxB,KAAK,CAAC,CAAC,SAAS,6BAA6B,EAC7C,KAAK,CAAC,eAAe,GAAG,OAAO,EAE/B,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,CAAC,EACf,OAAO,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAC/C,4BAA4B,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC;IAWzF;;;;;;OAMG;IAEI,eAAe,CACrB,IAAI,SAAS,KAAK,EAClB,KAAK,CAAC,CAAC,SAAS,aAAa,CAAC,0BAA0B,EACvD,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;;;IA4B7B;;;;;OAKG;IACI,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACtF,IAAI,EAAE,CAAC,GACL,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC;CAG9D"}
@@ -7,6 +7,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.SchemaFactoryAlpha = void 0;
8
8
  const index_js_1 = require("../node-kinds/index.js");
9
9
  const schemaFactory_js_1 = require("./schemaFactory.js");
10
+ const schemaStatics_js_1 = require("./schemaStatics.js");
11
+ const index_js_2 = require("../core/index.js");
12
+ const schemaStaticsAlpha = {
13
+ staged: (t) => {
14
+ const annotatedType = (0, index_js_2.normalizeToAnnotatedAllowedType)(t);
15
+ return {
16
+ type: annotatedType.type,
17
+ metadata: {
18
+ ...annotatedType.metadata,
19
+ stagedSchemaUpgrade: (0, index_js_2.createSchemaUpgrade)(),
20
+ },
21
+ };
22
+ },
23
+ };
10
24
  /**
11
25
  * {@link SchemaFactory} with additional alpha APIs.
12
26
  *
@@ -22,23 +36,27 @@ class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
22
36
  /**
23
37
  * {@inheritDoc SchemaStatics.leaves}
24
38
  */
25
- this.leaves = schemaFactory_js_1.schemaStatics.leaves;
39
+ this.leaves = schemaStatics_js_1.schemaStatics.leaves;
26
40
  /**
27
41
  * {@inheritDoc SchemaStatics.optional}
28
42
  */
29
- this.optional = schemaFactory_js_1.schemaStatics.optional;
43
+ this.optional = schemaStatics_js_1.schemaStatics.optional;
30
44
  /**
31
45
  * {@inheritDoc SchemaStatics.required}
32
46
  */
33
- this.required = schemaFactory_js_1.schemaStatics.required;
47
+ this.required = schemaStatics_js_1.schemaStatics.required;
34
48
  /**
35
49
  * {@inheritDoc SchemaStatics.optionalRecursive}
36
50
  */
37
- this.optionalRecursive = schemaFactory_js_1.schemaStatics.optionalRecursive;
51
+ this.optionalRecursive = schemaStatics_js_1.schemaStatics.optionalRecursive;
38
52
  /**
39
53
  * {@inheritDoc SchemaStatics.requiredRecursive}
40
54
  */
41
- this.requiredRecursive = schemaFactory_js_1.schemaStatics.requiredRecursive;
55
+ this.requiredRecursive = schemaStatics_js_1.schemaStatics.requiredRecursive;
56
+ /**
57
+ * {@inheritDoc SchemaStaticsAlpha.staged}
58
+ */
59
+ this.staged = schemaStaticsAlpha.staged;
42
60
  }
43
61
  scoped2(name) {
44
62
  return (this.scope === undefined ? `${name}` : `${this.scope}.${name}`);
@@ -195,25 +213,29 @@ exports.SchemaFactoryAlpha = SchemaFactoryAlpha;
195
213
  /**
196
214
  * {@inheritDoc SchemaStatics.leaves}
197
215
  */
198
- SchemaFactoryAlpha.leaves = schemaFactory_js_1.schemaStatics.leaves;
216
+ SchemaFactoryAlpha.leaves = schemaStatics_js_1.schemaStatics.leaves;
199
217
  /**
200
218
  * {@inheritDoc SchemaStatics.optional}
201
219
  */
202
- SchemaFactoryAlpha.optional = schemaFactory_js_1.schemaStatics.optional;
220
+ SchemaFactoryAlpha.optional = schemaStatics_js_1.schemaStatics.optional;
203
221
  /**
204
222
  * {@inheritDoc SchemaStatics.required}
205
223
  */
206
- SchemaFactoryAlpha.required = schemaFactory_js_1.schemaStatics.required;
224
+ SchemaFactoryAlpha.required = schemaStatics_js_1.schemaStatics.required;
207
225
  /**
208
226
  * {@inheritDoc SchemaStatics.optionalRecursive}
209
227
  */
210
- SchemaFactoryAlpha.optionalRecursive = schemaFactory_js_1.schemaStatics.optionalRecursive;
228
+ SchemaFactoryAlpha.optionalRecursive = schemaStatics_js_1.schemaStatics.optionalRecursive;
211
229
  /**
212
230
  * {@inheritDoc SchemaStatics.requiredRecursive}
213
231
  */
214
- SchemaFactoryAlpha.requiredRecursive = schemaFactory_js_1.schemaStatics.requiredRecursive;
232
+ SchemaFactoryAlpha.requiredRecursive = schemaStatics_js_1.schemaStatics.requiredRecursive;
215
233
  /**
216
234
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
217
235
  */
218
- SchemaFactoryAlpha.identifier = schemaFactory_js_1.schemaStatics.identifier;
236
+ SchemaFactoryAlpha.identifier = schemaStatics_js_1.schemaStatics.identifier;
237
+ /**
238
+ * {@inheritDoc SchemaStaticsAlpha.staged}
239
+ */
240
+ SchemaFactoryAlpha.staged = schemaStaticsAlpha.staged;
219
241
  //# sourceMappingURL=schemaFactoryAlpha.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAWgC;AAChC,yDAQ4B;AAqB5B;;;;;;;;GAQG;AACH,MAAa,kBAGX,SAAQ,gCAA4B;IAHtC;;QAuIC;;WAEG;QACsB,WAAM,GAAG,gCAAa,CAAC,MAAM,CAAC;QAEvD;;WAEG;QACsB,aAAQ,GAAG,gCAAa,CAAC,QAAQ,CAAC;QAE3D;;WAEG;QACsB,aAAQ,GAAG,gCAAa,CAAC,QAAQ,CAAC;QAE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yright (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"]}
1
+ {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-t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ACJ,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;;AA1hBF,gDA2hBC;AAlbA;;GAEG;AAC6B,yBAAM,GAAG,gCAAa,CAAC,MAAM,AAAvB,CAAwB;AAE9D;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,gCAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AAC6B,oCAAiB,GAAG,gCAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,gCAAa,CAAC,UAAU,AAA3B,CAA4B;AA2B7D;;GAEG;AACW,yBAAM,GAAG,kBAAkB,CAAC,MAAM,AAA5B,CAA6B","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\tstructuralName,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport { schemaStatics } from \"./schemaStatics.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\tAnnotatedAllowedType,\n\tLazyItem,\n} from \"../core/index.js\";\nimport { normalizeToAnnotatedAllowedType, createSchemaUpgrade } 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// This import prevents a large number of type references in the API reports from showing up as *_2.\n/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */\nimport type {\n\tFieldProps,\n\tFieldSchemaAlpha,\n\tFieldPropsAlpha,\n\tFieldKind,\n} from \"../fieldSchema.js\";\nimport type { LeafSchema } from \"../leafNodeSchema.js\";\nimport type { SimpleLeafNodeSchema } from \"../simpleSchema.js\";\nimport type { UnannotateImplicitAllowedTypes } from \"../core/index.js\";\nimport type { FieldSchemaAlphaUnsafe } from \"./typesUnsafe.js\";\n/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */\n\n/**\n * Stateless APIs exposed via {@link SchemaFactoryAlpha} as both instance properties and as statics.\n * @remarks\n * See {@link SchemaStatics} for why this is useful.\n * @system @sealed @alpha\n */\nexport interface SchemaStaticsAlpha {\n\t/**\n\t * Declares a staged type in a set of {@link AllowedTypes}.\n\t *\n\t * @remarks\n\t * Staged allowed types add support for loading documents which may or may not permit an allowed type in a location in a schema.\n\t * This allows for an incremental rollout of a schema change to add a {@link TreeNodeSchema} to an {@link AllowedTypes} without breaking cross version collaboration.\n\t *\n\t * Once enough clients have the type staged (and thus can read documents which allow it), documents can start being created and upgraded to allow the staged type.\n\t * This is done by deploying a new version of the app which removes the `staged` wrapper around the allowed type in the the schema definition.\n\t * This will also require {@link TreeView.upgradeSchema|upgrading the schema} for existing documents.\n\t *\n\t * Using a staged allowed type in a schema is just like using the schema as an allowed type with the following exceptions:\n\t *\n\t * 1. {@link TreeView.initialize} will omit the staged allowed type from the newly created stored schema.\n\t * 2. {@link TreeView.upgradeSchema} will omit the staged allowed type from the the upgraded stored schema.\n\t * 3. When evaluating {@link TreeView.compatibility}, it will be viewable even if the staged allowed type is not present in the stored schema's corresponding allowed types.\n\t * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type when inserting the content into a tree who's stored schema does not permit it.\n\t *\n\t * Currently, `staged` is not supported in the recursive type APIs: this is a known limitation which future versions of the API will address.\n\t *\n\t * @example\n\t * Suppose you have a schema which has a field that allows some type `A`, but you want to add support for type `B`.\n\t *\n\t * The first change is to used to mark the new type as staged, replacing `A` in the schema with `[A, SchemaStaticsAlpha.staged(B)]`.\n\t * Once this is done, and any code which reads contents from documents is updated to handle any `B` content that may be present, this version of the code can be deployed.\n\t *\n\t * Once all users have the above changes, the schema can be updated again to `[A, B]`, and the app can be updated to allow creating of `B` content.\n\t * This updated version of the app will need to call {@link TreeView.upgradeSchema} when opening documents created by earlier versions.\n\t *\n\t * Adding a `B` schema as an option in the root could look like this:\n\t * ```typescript\n\t * const factory = new SchemaFactoryAlpha(\"test\");\n\t * class A extends factory.objectAlpha(\"A\", {}) {}\n\t * class B extends factory.objectAlpha(\"B\", {}) {}\n\t *\n\t * // Does not support B\n\t * const configBefore = new TreeViewConfigurationAlpha({\n\t * \tschema: A,\n\t * });\n\t *\n\t * // Supports documents with or without B\n\t * const configStaged = new TreeViewConfigurationAlpha({\n\t * \t// Adds staged support for B.\n\t * \t// Currently this requires wrapping the root field with `SchemaFactoryAlpha.required`:\n\t * \t// this is normally implicitly included, but is currently required while the \"staged\" APIs are `@alpha`.\n\t * \tschema: SchemaFactoryAlpha.required([A, SchemaFactoryAlpha.staged(B)]),\n\t * });\n\t *\n\t * // Only supports documents with A and B: can be used to upgrade schema to add B.\n\t * const configAfter = new TreeViewConfigurationAlpha({\n\t * \tschema: [A, B],\n\t * });\n\t * ```\n\t * @example\n\t * Below is a full example of how the schema migration process works.\n\t * This can also be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.\n\t * ```typescript\n\t * // Schema A: only number allowed\n\t * const schemaA = SchemaFactoryAlpha.optional([SchemaFactoryAlpha.number]);\n\t *\n\t * // Schema B: number or string (string is staged)\n\t * const schemaB = SchemaFactoryAlpha.optional([\n\t * \tSchemaFactoryAlpha.number,\n\t * \tSchemaFactoryAlpha.staged(SchemaFactoryAlpha.string),\n\t * ]);\n\t *\n\t * // Schema C: number or string, both fully allowed\n\t * const schemaC = SchemaFactoryAlpha.optional([\n\t * \tSchemaFactoryAlpha.number,\n\t * \tSchemaFactoryAlpha.string,\n\t * ]);\n\t *\n\t * // Initialize with schema A.\n\t * const configA = new TreeViewConfiguration({\n\t * \tschema: schemaA,\n\t * });\n\t * const viewA = treeA.viewWith(configA);\n\t * viewA.initialize(5);\n\t *\n\t * // Since we are running all the different versions of the app in the same process making changes synchronously,\n\t * // an explicit flush is needed to make them available to each other.\n\t * synchronizeTrees();\n\t *\n\t * assert.deepEqual(viewA.root, 5);\n\t *\n\t * // View the same document with a second tree using schema B.\n\t * const configB = new TreeViewConfiguration({\n\t * \tschema: schemaB,\n\t * });\n\t * const viewB = treeB.viewWith(configB);\n\t * // B cannot write strings to the root.\n\t * assert.throws(() => (viewB.root = \"test\"));\n\t *\n\t * // View the same document with a third tree using schema C.\n\t * const configC = new TreeViewConfiguration({\n\t * \tschema: schemaC,\n\t * });\n\t * const viewC = treeC.viewWith(configC);\n\t * // Upgrade to schema C\n\t * viewC.upgradeSchema();\n\t * // Use the newly enabled schema.\n\t * viewC.root = \"test\";\n\t *\n\t * synchronizeTrees();\n\t *\n\t * // View A is now incompatible with the stored schema:\n\t * assert.equal(viewA.compatibility.canView, false);\n\t *\n\t * // View B can still read the document, and now sees the string root which relies on the staged schema.\n\t * assert.deepEqual(viewB.root, \"test\");\n\t * ```\n\t * @privateRemarks\n\t * TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very\n\t * user friendly and should be improved, particularly in the case of staged allowed types\n\t *\n\t * TODO: the example above does not work tell in intellisense: its formatted to work onm the website. We should find a solution that works well for both.\n\t *\n\t * TODO: AB#45711: Update the docs above when recursive type support is added.\n\t */\n\tstaged: <const T extends LazyItem<TreeNodeSchema>>(\n\t\tt: T | AnnotatedAllowedType<T>,\n\t) => AnnotatedAllowedType<T>;\n}\n\nconst schemaStaticsAlpha: SchemaStaticsAlpha = {\n\tstaged: <const T extends LazyItem<TreeNodeSchema>>(\n\t\tt: T | AnnotatedAllowedType<T>,\n\t): AnnotatedAllowedType<T> => {\n\t\tconst annotatedType = normalizeToAnnotatedAllowedType(t);\n\t\treturn {\n\t\t\ttype: annotatedType.type,\n\t\t\tmetadata: {\n\t\t\t\t...annotatedType.metadata,\n\t\t\t\tstagedSchemaUpgrade: createSchemaUpgrade(),\n\t\t\t},\n\t\t};\n\t},\n};\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 * {@inheritDoc SchemaStaticsAlpha.staged}\n\t */\n\tpublic static staged = schemaStaticsAlpha.staged;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsAlpha.staged}\n\t */\n\tpublic staged = schemaStaticsAlpha.staged;\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"]}
@@ -5,9 +5,7 @@
5
5
  import type { RestrictiveStringRecord } from "../../util/index.js";
6
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 ImplicitFieldSchema } from "../fieldSchema.js";
9
- import type { FieldSchemaAlphaUnsafe, System_Unsafe } from "./typesUnsafe.js";
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>;
8
+ import type { ImplicitFieldSchema } from "../fieldSchema.js";
11
9
  /**
12
10
  * Compile time check for validity of a recursive schema.
13
11
  * This type also serves as a central location for documenting the requirements and issues related to recursive schema.
@@ -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,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,0CAA0C,EAC1C,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,mBAAmB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9E,wBAAgB,uBAA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ed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.allowUnused = exports.createFieldSchemaUnsafe = void 0;
8
- const fieldSchema_js_1 = require("../fieldSchema.js");
9
- function createFieldSchemaUnsafe(kind, allowedTypes, props) {
10
- // 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
11
- return (0, fieldSchema_js_1.createFieldSchema)(kind, allowedTypes, props);
12
- }
13
- exports.createFieldSchemaUnsafe = createFieldSchemaUnsafe;
7
+ exports.allowUnused = void 0;
14
8
  /**
15
9
  * Does nothing with the provided value, but appears to use it to make unused locals warnings and errors go away.
16
10
  *