@metaobjectsdev/metadata 0.9.0 → 0.11.0-rc.1

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 (392) hide show
  1. package/dist/attr-schema-validate.d.ts +1 -1
  2. package/dist/attr-schema-validate.d.ts.map +1 -1
  3. package/dist/attr-schema-validate.js +96 -11
  4. package/dist/attr-schema-validate.js.map +1 -1
  5. package/dist/constraint-merge.d.ts +18 -0
  6. package/dist/constraint-merge.d.ts.map +1 -0
  7. package/dist/constraint-merge.js +0 -0
  8. package/dist/constraint-merge.js.map +1 -0
  9. package/dist/constraint-validate.d.ts +6 -0
  10. package/dist/constraint-validate.d.ts.map +1 -0
  11. package/dist/constraint-validate.js +274 -0
  12. package/dist/constraint-validate.js.map +1 -0
  13. package/dist/core/attr/attr-constants.d.ts +13 -3
  14. package/dist/core/attr/attr-constants.d.ts.map +1 -1
  15. package/dist/core/attr/attr-constants.js +11 -2
  16. package/dist/core/attr/attr-constants.js.map +1 -1
  17. package/dist/core/attr/attr-definition.embedded.d.ts +3 -0
  18. package/dist/core/attr/attr-definition.embedded.d.ts.map +1 -0
  19. package/dist/core/attr/attr-definition.embedded.js +60 -0
  20. package/dist/core/attr/attr-definition.embedded.js.map +1 -0
  21. package/dist/core/documentation/doc-constants.d.ts +3 -2
  22. package/dist/core/documentation/doc-constants.d.ts.map +1 -1
  23. package/dist/core/documentation/doc-constants.js +3 -1
  24. package/dist/core/documentation/doc-constants.js.map +1 -1
  25. package/dist/core/documentation/doc-provider.d.ts.map +1 -1
  26. package/dist/core/documentation/doc-provider.js +6 -2
  27. package/dist/core/documentation/doc-provider.js.map +1 -1
  28. package/dist/core/documentation/documentation-definition.embedded.d.ts +3 -0
  29. package/dist/core/documentation/documentation-definition.embedded.d.ts.map +1 -0
  30. package/dist/core/documentation/documentation-definition.embedded.js +79 -0
  31. package/dist/core/documentation/documentation-definition.embedded.js.map +1 -0
  32. package/dist/core/field/field-constants.d.ts +7 -4
  33. package/dist/core/field/field-constants.d.ts.map +1 -1
  34. package/dist/core/field/field-constants.js +7 -7
  35. package/dist/core/field/field-constants.js.map +1 -1
  36. package/dist/core/field/field-definition.embedded.d.ts +3 -0
  37. package/dist/core/field/field-definition.embedded.d.ts.map +1 -0
  38. package/dist/core/field/field-definition.embedded.js +236 -0
  39. package/dist/core/field/field-definition.embedded.js.map +1 -0
  40. package/dist/core/field/meta-field.d.ts.map +1 -1
  41. package/dist/core/field/meta-field.js +7 -5
  42. package/dist/core/field/meta-field.js.map +1 -1
  43. package/dist/core/identity/identity-constants.d.ts.map +1 -1
  44. package/dist/core/identity/identity-constants.js +3 -0
  45. package/dist/core/identity/identity-constants.js.map +1 -1
  46. package/dist/core/identity/identity-definition.embedded.d.ts +3 -0
  47. package/dist/core/identity/identity-definition.embedded.d.ts.map +1 -0
  48. package/dist/core/identity/identity-definition.embedded.js +93 -0
  49. package/dist/core/identity/identity-definition.embedded.js.map +1 -0
  50. package/dist/core/identity/meta-identity.d.ts.map +1 -1
  51. package/dist/core/identity/meta-identity.js +8 -1
  52. package/dist/core/identity/meta-identity.js.map +1 -1
  53. package/dist/core/identity/validate-identity-passthrough.d.ts +42 -0
  54. package/dist/core/identity/validate-identity-passthrough.d.ts.map +1 -0
  55. package/dist/core/identity/validate-identity-passthrough.js +158 -0
  56. package/dist/core/identity/validate-identity-passthrough.js.map +1 -0
  57. package/dist/core/object/object-constants.d.ts +2 -1
  58. package/dist/core/object/object-constants.d.ts.map +1 -1
  59. package/dist/core/object/object-constants.js +3 -0
  60. package/dist/core/object/object-constants.js.map +1 -1
  61. package/dist/core/object/object-definition.embedded.d.ts +3 -0
  62. package/dist/core/object/object-definition.embedded.d.ts.map +1 -0
  63. package/dist/core/object/object-definition.embedded.js +110 -0
  64. package/dist/core/object/object-definition.embedded.js.map +1 -0
  65. package/dist/core/object/validate-discriminator.d.ts.map +1 -1
  66. package/dist/core/object/validate-discriminator.js +1 -3
  67. package/dist/core/object/validate-discriminator.js.map +1 -1
  68. package/dist/core/query/query-constants.d.ts.map +1 -1
  69. package/dist/core/query/query-constants.js +5 -3
  70. package/dist/core/query/query-constants.js.map +1 -1
  71. package/dist/core/relationship/derive-m2m-fields.d.ts +26 -0
  72. package/dist/core/relationship/derive-m2m-fields.d.ts.map +1 -0
  73. package/dist/core/relationship/derive-m2m-fields.js +102 -0
  74. package/dist/core/relationship/derive-m2m-fields.js.map +1 -0
  75. package/dist/core/relationship/meta-relationship.d.ts +6 -4
  76. package/dist/core/relationship/meta-relationship.d.ts.map +1 -1
  77. package/dist/core/relationship/meta-relationship.js +12 -8
  78. package/dist/core/relationship/meta-relationship.js.map +1 -1
  79. package/dist/core/relationship/relationship-constants.d.ts +6 -2
  80. package/dist/core/relationship/relationship-constants.d.ts.map +1 -1
  81. package/dist/core/relationship/relationship-constants.js +6 -2
  82. package/dist/core/relationship/relationship-constants.js.map +1 -1
  83. package/dist/core/relationship/relationship-definition.embedded.d.ts +3 -0
  84. package/dist/core/relationship/relationship-definition.embedded.d.ts.map +1 -0
  85. package/dist/core/relationship/relationship-definition.embedded.js +310 -0
  86. package/dist/core/relationship/relationship-definition.embedded.js.map +1 -0
  87. package/dist/core/validator/validator-constants.d.ts +14 -1
  88. package/dist/core/validator/validator-constants.d.ts.map +1 -1
  89. package/dist/core/validator/validator-constants.js +20 -1
  90. package/dist/core/validator/validator-constants.js.map +1 -1
  91. package/dist/core/validator/validator-definition.embedded.d.ts +3 -0
  92. package/dist/core/validator/validator-definition.embedded.d.ts.map +1 -0
  93. package/dist/core/validator/validator-definition.embedded.js +255 -0
  94. package/dist/core/validator/validator-definition.embedded.js.map +1 -0
  95. package/dist/core/yaml-desugar.d.ts.map +1 -1
  96. package/dist/core/yaml-desugar.js +88 -10
  97. package/dist/core/yaml-desugar.js.map +1 -1
  98. package/dist/core-types.d.ts +5 -2
  99. package/dist/core-types.d.ts.map +1 -1
  100. package/dist/core-types.js +285 -116
  101. package/dist/core-types.js.map +1 -1
  102. package/dist/errors.d.ts +3 -3
  103. package/dist/errors.d.ts.map +1 -1
  104. package/dist/errors.js +87 -0
  105. package/dist/errors.js.map +1 -1
  106. package/dist/index.d.ts +17 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +26 -1
  109. package/dist/index.js.map +1 -1
  110. package/dist/library/embedded-library.generated.d.ts +2 -0
  111. package/dist/library/embedded-library.generated.d.ts.map +1 -0
  112. package/dist/library/embedded-library.generated.js +11 -0
  113. package/dist/library/embedded-library.generated.js.map +1 -0
  114. package/dist/library/library-sources.d.ts +12 -0
  115. package/dist/library/library-sources.d.ts.map +1 -0
  116. package/dist/library/library-sources.js +88 -0
  117. package/dist/library/library-sources.js.map +1 -0
  118. package/dist/loader/meta-data-loader.d.ts +10 -2
  119. package/dist/loader/meta-data-loader.d.ts.map +1 -1
  120. package/dist/loader/meta-data-loader.js +57 -6
  121. package/dist/loader/meta-data-loader.js.map +1 -1
  122. package/dist/loader/shortcuts.d.ts +2 -5
  123. package/dist/loader/shortcuts.d.ts.map +1 -1
  124. package/dist/loader/shortcuts.js.map +1 -1
  125. package/dist/loader/validation-passes.d.ts +3 -0
  126. package/dist/loader/validation-passes.d.ts.map +1 -1
  127. package/dist/loader/validation-passes.js +519 -34
  128. package/dist/loader/validation-passes.js.map +1 -1
  129. package/dist/loader/validation-registry.d.ts +10 -0
  130. package/dist/loader/validation-registry.d.ts.map +1 -0
  131. package/dist/loader/validation-registry.js +84 -0
  132. package/dist/loader/validation-registry.js.map +1 -0
  133. package/dist/metamodel-docs/index.d.ts +19 -0
  134. package/dist/metamodel-docs/index.d.ts.map +1 -0
  135. package/dist/metamodel-docs/index.js +37 -0
  136. package/dist/metamodel-docs/index.js.map +1 -0
  137. package/dist/metamodel-docs/provenance.d.ts +42 -0
  138. package/dist/metamodel-docs/provenance.d.ts.map +1 -0
  139. package/dist/metamodel-docs/provenance.js +148 -0
  140. package/dist/metamodel-docs/provenance.js.map +1 -0
  141. package/dist/metamodel-docs/provider-definitions.d.ts +8 -0
  142. package/dist/metamodel-docs/provider-definitions.d.ts.map +1 -0
  143. package/dist/metamodel-docs/provider-definitions.js +48 -0
  144. package/dist/metamodel-docs/provider-definitions.js.map +1 -0
  145. package/dist/metamodel-docs/render.d.ts +12 -0
  146. package/dist/metamodel-docs/render.d.ts.map +1 -0
  147. package/dist/metamodel-docs/render.js +252 -0
  148. package/dist/metamodel-docs/render.js.map +1 -0
  149. package/dist/naming-refs.d.ts +41 -0
  150. package/dist/naming-refs.d.ts.map +1 -0
  151. package/dist/naming-refs.js +144 -0
  152. package/dist/naming-refs.js.map +1 -0
  153. package/dist/naming.d.ts.map +1 -1
  154. package/dist/naming.js +10 -2
  155. package/dist/naming.js.map +1 -1
  156. package/dist/parser-core.d.ts.map +1 -1
  157. package/dist/parser-core.js +84 -9
  158. package/dist/parser-core.js.map +1 -1
  159. package/dist/persistence/db/db-constants.d.ts +10 -0
  160. package/dist/persistence/db/db-constants.d.ts.map +1 -1
  161. package/dist/persistence/db/db-constants.js +14 -0
  162. package/dist/persistence/db/db-constants.js.map +1 -1
  163. package/dist/persistence/db/db-definition.embedded.d.ts +3 -0
  164. package/dist/persistence/db/db-definition.embedded.d.ts.map +1 -0
  165. package/dist/persistence/db/db-definition.embedded.js +227 -0
  166. package/dist/persistence/db/db-definition.embedded.js.map +1 -0
  167. package/dist/persistence/db/db-provider.d.ts.map +1 -1
  168. package/dist/persistence/db/db-provider.js +13 -18
  169. package/dist/persistence/db/db-provider.js.map +1 -1
  170. package/dist/persistence/origin/origin-definition.embedded.d.ts +3 -0
  171. package/dist/persistence/origin/origin-definition.embedded.d.ts.map +1 -0
  172. package/dist/persistence/origin/origin-definition.embedded.js +88 -0
  173. package/dist/persistence/origin/origin-definition.embedded.js.map +1 -0
  174. package/dist/persistence/source/source-definition.embedded.d.ts +3 -0
  175. package/dist/persistence/source/source-definition.embedded.d.ts.map +1 -0
  176. package/dist/persistence/source/source-definition.embedded.js +17 -0
  177. package/dist/persistence/source/source-definition.embedded.js.map +1 -0
  178. package/dist/persistence/source/validate-source-parameter-ref.d.ts.map +1 -1
  179. package/dist/persistence/source/validate-source-parameter-ref.js +7 -1
  180. package/dist/persistence/source/validate-source-parameter-ref.js.map +1 -1
  181. package/dist/persistence/source/validate-source-roles.d.ts.map +1 -1
  182. package/dist/persistence/source/validate-source-roles.js +16 -1
  183. package/dist/persistence/source/validate-source-roles.js.map +1 -1
  184. package/dist/presentation/layout/layout-definition.embedded.d.ts +3 -0
  185. package/dist/presentation/layout/layout-definition.embedded.d.ts.map +1 -0
  186. package/dist/presentation/layout/layout-definition.embedded.js +16 -0
  187. package/dist/presentation/layout/layout-definition.embedded.js.map +1 -0
  188. package/dist/presentation/ui/ui-definition.embedded.d.ts +3 -0
  189. package/dist/presentation/ui/ui-definition.embedded.d.ts.map +1 -0
  190. package/dist/presentation/ui/ui-definition.embedded.js +114 -0
  191. package/dist/presentation/ui/ui-definition.embedded.js.map +1 -0
  192. package/dist/presentation/ui/ui-provider.d.ts +3 -0
  193. package/dist/presentation/ui/ui-provider.d.ts.map +1 -0
  194. package/dist/presentation/ui/ui-provider.js +21 -0
  195. package/dist/presentation/ui/ui-provider.js.map +1 -0
  196. package/dist/presentation/view/view-definition.embedded.d.ts +3 -0
  197. package/dist/presentation/view/view-definition.embedded.d.ts.map +1 -0
  198. package/dist/presentation/view/view-definition.embedded.js +76 -0
  199. package/dist/presentation/view/view-definition.embedded.js.map +1 -0
  200. package/dist/provider-data.d.ts +184 -0
  201. package/dist/provider-data.d.ts.map +1 -0
  202. package/dist/provider-data.js +271 -0
  203. package/dist/provider-data.js.map +1 -0
  204. package/dist/provider.d.ts +3 -1
  205. package/dist/provider.d.ts.map +1 -1
  206. package/dist/provider.js +15 -1
  207. package/dist/provider.js.map +1 -1
  208. package/dist/registry-coverage.d.ts +99 -0
  209. package/dist/registry-coverage.d.ts.map +1 -0
  210. package/dist/registry-coverage.js +294 -0
  211. package/dist/registry-coverage.js.map +1 -0
  212. package/dist/registry-manifest-exclusions.d.ts +62 -0
  213. package/dist/registry-manifest-exclusions.d.ts.map +1 -0
  214. package/dist/registry-manifest-exclusions.js +163 -0
  215. package/dist/registry-manifest-exclusions.js.map +1 -0
  216. package/dist/registry-manifest.d.ts +117 -0
  217. package/dist/registry-manifest.d.ts.map +1 -0
  218. package/dist/registry-manifest.js +242 -0
  219. package/dist/registry-manifest.js.map +1 -0
  220. package/dist/registry.d.ts +76 -2
  221. package/dist/registry.d.ts.map +1 -1
  222. package/dist/registry.js +37 -1
  223. package/dist/registry.js.map +1 -1
  224. package/dist/shared/structural.d.ts +7 -0
  225. package/dist/shared/structural.d.ts.map +1 -1
  226. package/dist/shared/structural.js +7 -0
  227. package/dist/shared/structural.js.map +1 -1
  228. package/dist/subtype-rules.d.ts.map +1 -1
  229. package/dist/subtype-rules.js +97 -13
  230. package/dist/subtype-rules.js.map +1 -1
  231. package/dist/super-resolve.d.ts +49 -2
  232. package/dist/super-resolve.d.ts.map +1 -1
  233. package/dist/super-resolve.js +128 -43
  234. package/dist/super-resolve.js.map +1 -1
  235. package/dist/template/meta-template.d.ts +3 -2
  236. package/dist/template/meta-template.d.ts.map +1 -1
  237. package/dist/template/meta-template.js +3 -2
  238. package/dist/template/meta-template.js.map +1 -1
  239. package/dist/template/prompt-definition.embedded.d.ts +3 -0
  240. package/dist/template/prompt-definition.embedded.d.ts.map +1 -0
  241. package/dist/template/prompt-definition.embedded.js +368 -0
  242. package/dist/template/prompt-definition.embedded.js.map +1 -0
  243. package/dist/template/prompt-provider.d.ts +3 -0
  244. package/dist/template/prompt-provider.d.ts.map +1 -0
  245. package/dist/template/prompt-provider.js +25 -0
  246. package/dist/template/prompt-provider.js.map +1 -0
  247. package/dist/template/template-constants.d.ts +2 -0
  248. package/dist/template/template-constants.d.ts.map +1 -1
  249. package/dist/template/template-constants.js +7 -0
  250. package/dist/template/template-constants.js.map +1 -1
  251. package/dist/template/template-definition.embedded.d.ts +3 -0
  252. package/dist/template/template-definition.embedded.d.ts.map +1 -0
  253. package/dist/template/template-definition.embedded.js +30 -0
  254. package/dist/template/template-definition.embedded.js.map +1 -0
  255. package/dist/validate-max-occurs.d.ts +5 -0
  256. package/dist/validate-max-occurs.d.ts.map +1 -0
  257. package/dist/validate-max-occurs.js +28 -0
  258. package/dist/validate-max-occurs.js.map +1 -0
  259. package/dist/validation-types.d.ts +36 -0
  260. package/dist/validation-types.d.ts.map +1 -0
  261. package/dist/validation-types.js +7 -0
  262. package/dist/validation-types.js.map +1 -0
  263. package/package.json +33 -22
  264. package/src/attr-schema-validate.ts +108 -8
  265. package/src/constraint-merge.ts +0 -0
  266. package/src/constraint-validate.ts +363 -0
  267. package/src/core/attr/attr-constants.ts +15 -3
  268. package/src/core/attr/attr-definition.embedded.ts +67 -0
  269. package/src/core/documentation/doc-constants.ts +3 -1
  270. package/src/core/documentation/doc-provider.ts +6 -2
  271. package/src/core/documentation/documentation-definition.embedded.ts +86 -0
  272. package/src/core/field/field-constants.ts +8 -7
  273. package/src/core/field/field-definition.embedded.ts +243 -0
  274. package/src/core/field/meta-field.ts +6 -7
  275. package/src/core/identity/identity-constants.ts +4 -0
  276. package/src/core/identity/identity-definition.embedded.ts +100 -0
  277. package/src/core/identity/meta-identity.ts +8 -1
  278. package/src/core/identity/validate-identity-passthrough.ts +194 -0
  279. package/src/core/object/object-constants.ts +3 -0
  280. package/src/core/object/object-definition.embedded.ts +117 -0
  281. package/src/core/object/validate-discriminator.ts +0 -4
  282. package/src/core/query/query-constants.ts +5 -3
  283. package/src/core/relationship/derive-m2m-fields.ts +145 -0
  284. package/src/core/relationship/meta-relationship.ts +15 -9
  285. package/src/core/relationship/relationship-constants.ts +6 -2
  286. package/src/core/relationship/relationship-definition.embedded.ts +317 -0
  287. package/src/core/validator/validator-constants.ts +22 -1
  288. package/src/core/validator/validator-definition.embedded.ts +262 -0
  289. package/src/core/yaml-desugar.ts +96 -7
  290. package/src/core-types.ts +314 -150
  291. package/src/errors.ts +89 -2
  292. package/src/index.ts +47 -2
  293. package/src/library/embedded-library.generated.ts +10 -0
  294. package/src/library/library-sources.ts +97 -0
  295. package/src/loader/meta-data-loader.ts +78 -7
  296. package/src/loader/shortcuts.ts +2 -2
  297. package/src/loader/validation-passes.ts +690 -34
  298. package/src/loader/validation-registry.ts +93 -0
  299. package/src/metamodel-docs/index.ts +41 -0
  300. package/src/metamodel-docs/provenance.ts +187 -0
  301. package/src/metamodel-docs/provider-definitions.ts +50 -0
  302. package/src/metamodel-docs/render.ts +309 -0
  303. package/src/naming-refs.ts +162 -0
  304. package/src/naming.ts +10 -2
  305. package/src/parser-core.ts +96 -9
  306. package/src/persistence/db/db-constants.ts +16 -0
  307. package/src/persistence/db/db-definition.embedded.ts +234 -0
  308. package/src/persistence/db/db-provider.ts +13 -18
  309. package/src/persistence/origin/origin-definition.embedded.ts +95 -0
  310. package/src/persistence/source/source-definition.embedded.ts +24 -0
  311. package/src/persistence/source/validate-source-parameter-ref.ts +7 -1
  312. package/src/persistence/source/validate-source-roles.ts +22 -1
  313. package/src/presentation/layout/layout-definition.embedded.ts +23 -0
  314. package/src/presentation/ui/ui-definition.embedded.ts +121 -0
  315. package/src/presentation/ui/ui-provider.ts +25 -0
  316. package/src/presentation/view/view-definition.embedded.ts +83 -0
  317. package/src/provider-data.ts +463 -0
  318. package/src/provider.ts +18 -0
  319. package/src/registry-coverage.ts +430 -0
  320. package/src/registry-manifest-exclusions.ts +176 -0
  321. package/src/registry-manifest.ts +334 -0
  322. package/src/registry.ts +106 -3
  323. package/src/shared/structural.ts +8 -0
  324. package/src/subtype-rules.ts +135 -18
  325. package/src/super-resolve.ts +153 -43
  326. package/src/template/meta-template.ts +3 -2
  327. package/src/template/prompt-definition.embedded.ts +375 -0
  328. package/src/template/prompt-provider.ts +29 -0
  329. package/src/template/template-constants.ts +8 -0
  330. package/src/template/template-definition.embedded.ts +37 -0
  331. package/src/validate-max-occurs.ts +39 -0
  332. package/src/validation-types.ts +57 -0
  333. package/dist/core/documentation/doc-schema.d.ts +0 -8
  334. package/dist/core/documentation/doc-schema.d.ts.map +0 -1
  335. package/dist/core/documentation/doc-schema.js +0 -53
  336. package/dist/core/documentation/doc-schema.js.map +0 -1
  337. package/dist/core/field/field-schema.d.ts +0 -22
  338. package/dist/core/field/field-schema.d.ts.map +0 -1
  339. package/dist/core/field/field-schema.js +0 -171
  340. package/dist/core/field/field-schema.js.map +0 -1
  341. package/dist/core/identity/identity-schema.d.ts +0 -6
  342. package/dist/core/identity/identity-schema.d.ts.map +0 -1
  343. package/dist/core/identity/identity-schema.js +0 -55
  344. package/dist/core/identity/identity-schema.js.map +0 -1
  345. package/dist/core/object/object-schema.d.ts +0 -4
  346. package/dist/core/object/object-schema.d.ts.map +0 -1
  347. package/dist/core/object/object-schema.js +0 -28
  348. package/dist/core/object/object-schema.js.map +0 -1
  349. package/dist/core/relationship/relationship-schema.d.ts +0 -4
  350. package/dist/core/relationship/relationship-schema.d.ts.map +0 -1
  351. package/dist/core/relationship/relationship-schema.js +0 -51
  352. package/dist/core/relationship/relationship-schema.js.map +0 -1
  353. package/dist/core/validator/validator-schema.d.ts +0 -4
  354. package/dist/core/validator/validator-schema.d.ts.map +0 -1
  355. package/dist/core/validator/validator-schema.js +0 -38
  356. package/dist/core/validator/validator-schema.js.map +0 -1
  357. package/dist/persistence/db/db-schema.d.ts +0 -14
  358. package/dist/persistence/db/db-schema.d.ts.map +0 -1
  359. package/dist/persistence/db/db-schema.js +0 -35
  360. package/dist/persistence/db/db-schema.js.map +0 -1
  361. package/dist/persistence/origin/origin-schema.d.ts +0 -4
  362. package/dist/persistence/origin/origin-schema.d.ts.map +0 -1
  363. package/dist/persistence/origin/origin-schema.js +0 -59
  364. package/dist/persistence/origin/origin-schema.js.map +0 -1
  365. package/dist/persistence/source/source-schema.d.ts +0 -4
  366. package/dist/persistence/source/source-schema.d.ts.map +0 -1
  367. package/dist/persistence/source/source-schema.js +0 -98
  368. package/dist/persistence/source/source-schema.js.map +0 -1
  369. package/dist/presentation/layout/layout-schema.d.ts +0 -4
  370. package/dist/presentation/layout/layout-schema.d.ts.map +0 -1
  371. package/dist/presentation/layout/layout-schema.js +0 -46
  372. package/dist/presentation/layout/layout-schema.js.map +0 -1
  373. package/dist/presentation/view/view-schema.d.ts +0 -4
  374. package/dist/presentation/view/view-schema.d.ts.map +0 -1
  375. package/dist/presentation/view/view-schema.js +0 -15
  376. package/dist/presentation/view/view-schema.js.map +0 -1
  377. package/dist/template/template-schema.d.ts +0 -3
  378. package/dist/template/template-schema.d.ts.map +0 -1
  379. package/dist/template/template-schema.js +0 -173
  380. package/dist/template/template-schema.js.map +0 -1
  381. package/src/core/documentation/doc-schema.ts +0 -64
  382. package/src/core/field/field-schema.ts +0 -228
  383. package/src/core/identity/identity-schema.ts +0 -80
  384. package/src/core/object/object-schema.ts +0 -35
  385. package/src/core/relationship/relationship-schema.ts +0 -67
  386. package/src/core/validator/validator-schema.ts +0 -50
  387. package/src/persistence/db/db-schema.ts +0 -50
  388. package/src/persistence/origin/origin-schema.ts +0 -80
  389. package/src/persistence/source/source-schema.ts +0 -129
  390. package/src/presentation/layout/layout-schema.ts +0 -62
  391. package/src/presentation/view/view-schema.ts +0 -21
  392. package/src/template/template-schema.ts +0 -211
package/src/core-types.ts CHANGED
@@ -3,6 +3,8 @@ import { TypeId, type AttrSchema, type ChildRule, type TypeDefinition, TypeRegis
3
3
  import type { MetaDataTypeProvider } from "./provider.js";
4
4
  import { dbProvider } from "./persistence/db/db-provider.js";
5
5
  import { docProvider } from "./core/documentation/doc-provider.js";
6
+ import { promptProvider } from "./template/prompt-provider.js";
7
+ import { uiProvider } from "./presentation/ui/ui-provider.js";
6
8
  import { type DataType } from "./data-type.js";
7
9
  import type { MetaData } from "./shared/meta-data.js";
8
10
  import { MetaRoot } from "./shared/meta-root.js";
@@ -35,16 +37,19 @@ import { MetaRelationship } from "./core/relationship/meta-relationship.js";
35
37
  import { MetaLayout } from "./presentation/layout/meta-layout.js";
36
38
  import { MetaSource } from "./persistence/source/meta-source.js";
37
39
  import { MetaOrigin, MetaPassthroughOrigin, MetaAggregateOrigin, MetaCollectionOrigin } from "./persistence/origin/meta-origin.js";
38
- import { commonFieldAttrs, currencyFieldAttr, enumFieldAttr, enumAliasAttr, enumDocAttr, coerceDefaultAttr, normalizeAttr } from "./core/field/field-schema.js";
39
- import { objectAttrs } from "./core/object/object-schema.js";
40
- import { relationshipAttrs } from "./core/relationship/relationship-schema.js";
41
- import { identityFieldsAttr, IDENTITY_ATTRS_MAP } from "./core/identity/identity-schema.js";
42
- import { VALIDATOR_ATTRS_MAP } from "./core/validator/validator-schema.js";
43
- import { currencyViewAttrs } from "./presentation/view/view-schema.js";
44
- import { dataGridLayoutAttrs } from "./presentation/layout/layout-schema.js";
45
- import { ORIGIN_ATTRS_MAP } from "./persistence/origin/origin-schema.js";
40
+ import { defineProviderFromData, type FactoryMap } from "./provider-data.js";
41
+ import { FIELD_DEFINITION } from "./core/field/field-definition.embedded.js";
42
+ import { OBJECT_DEFINITION } from "./core/object/object-definition.embedded.js";
43
+ import { ATTR_DEFINITION } from "./core/attr/attr-definition.embedded.js";
44
+ import { VALIDATOR_DEFINITION } from "./core/validator/validator-definition.embedded.js";
45
+ import { IDENTITY_DEFINITION } from "./core/identity/identity-definition.embedded.js";
46
+ import { RELATIONSHIP_DEFINITION } from "./core/relationship/relationship-definition.embedded.js";
47
+ import { ORIGIN_DEFINITION } from "./persistence/origin/origin-definition.embedded.js";
48
+ import { SOURCE_DEFINITION } from "./persistence/source/source-definition.embedded.js";
49
+ import { VIEW_DEFINITION } from "./presentation/view/view-definition.embedded.js";
50
+ import { LAYOUT_DEFINITION } from "./presentation/layout/layout-definition.embedded.js";
46
51
  import { MetaTemplate } from "./template/meta-template.js";
47
- import { TEMPLATE_ATTRS_MAP } from "./template/template-schema.js";
52
+ import { TEMPLATE_DEFINITION } from "./template/template-definition.embedded.js";
48
53
  import { TEMPLATE_SUBTYPES } from "./template/template-constants.js";
49
54
  import {
50
55
  TYPE_METADATA,
@@ -62,8 +67,8 @@ import {
62
67
  SUBTYPE_ROOT,
63
68
  } from "./shared/base-types.js";
64
69
  import { CHILD_RULE_WILDCARD } from "./shared/structural.js";
65
- import { OBJECT_SUBTYPES, OBJECT_SUBTYPE_ENTITY, OBJECT_SUBTYPE_VALUE } from "./core/object/object-constants.js";
66
- import { FIELD_SUBTYPES, FIELD_SUBTYPE_CURRENCY, FIELD_SUBTYPE_ENUM } from "./core/field/field-constants.js";
70
+ import { OBJECT_SUBTYPES, OBJECT_SUBTYPE_ENTITY } from "./core/object/object-constants.js";
71
+ import { FIELD_SUBTYPES } from "./core/field/field-constants.js";
67
72
  import { ATTR_SUBTYPES } from "./core/attr/attr-constants.js";
68
73
  import {
69
74
  VALIDATOR_SUBTYPES,
@@ -73,18 +78,16 @@ import {
73
78
  VALIDATOR_SUBTYPE_NUMERIC,
74
79
  VALIDATOR_SUBTYPE_ARRAY,
75
80
  } from "./core/validator/validator-constants.js";
76
- import {
77
- VIEW_SUBTYPES,
78
- VIEW_SUBTYPE_CURRENCY,
79
- } from "./presentation/view/view-constants.js";
81
+ import { VIEW_SUBTYPES } from "./presentation/view/view-constants.js";
80
82
  import {
81
83
  IDENTITY_SUBTYPES,
82
84
  IDENTITY_SUBTYPE_PRIMARY,
83
85
  IDENTITY_SUBTYPE_SECONDARY,
84
86
  IDENTITY_SUBTYPE_REFERENCE,
87
+ IDENTITY_REFERENCE_ATTR_REFERENCES,
85
88
  } from "./core/identity/identity-constants.js";
86
- import { RELATIONSHIP_SUBTYPES } from "./core/relationship/relationship-constants.js";
87
- import { LAYOUT_SUBTYPES, LAYOUT_SUBTYPE_DATA_GRID } from "./presentation/layout/layout-constants.js";
89
+ import { RELATIONSHIP_SUBTYPES, RELATIONSHIP_ATTR_OBJECT_REF } from "./core/relationship/relationship-constants.js";
90
+ import { LAYOUT_SUBTYPES } from "./presentation/layout/layout-constants.js";
88
91
  import { SOURCE_SUBTYPES } from "./persistence/source/source-constants.js";
89
92
  import {
90
93
  ORIGIN_SUBTYPES,
@@ -95,7 +98,8 @@ import {
95
98
 
96
99
  // ---------------------------------------------------------------------------
97
100
  // The per-(type, subType) attribute schemas live in per-concern *-schema.ts
98
- // modules (e.g. core/field/field-schema.ts, persistence/origin/origin-schema.ts).
101
+ // modules (e.g. presentation/view/view-schema.ts) or, increasingly under
102
+ // FR-033, in the externalized spec/metamodel/*.json provider definitions.
99
103
  // This file keeps only the registration logic: the def() helper, the
100
104
  // subtype→class dispatch maps, and registerCoreTypes() itself.
101
105
  // ---------------------------------------------------------------------------
@@ -161,175 +165,326 @@ const ORIGIN_CLASS_MAP = new Map<string, NodeConstructor>([
161
165
  // re-exported from the package index for the same public surface.
162
166
 
163
167
  function registerCoreTypeDefs(registry: TypeRegistry): void {
164
- // metadata — 1 subtype (the document root: metadata.root)
168
+ // metadata — 1 subtype (the document root: metadata.root). FR-033 S1-simple:
169
+ // the any-attr wildcard child rule is DROPPED (strict/fail-closed — a document
170
+ // root holds structural nodes, never bare attrs); the genuinely-open structural
171
+ // wildcards (object/field/validator/template) are KEPT — a root legitimately
172
+ // holds arbitrary nodes of those types.
165
173
  registry.register(
166
174
  def(TYPE_METADATA, SUBTYPE_ROOT, "Root metadata document", [
167
175
  wildcard(TYPE_OBJECT),
168
176
  wildcard(TYPE_FIELD),
169
- wildcard(TYPE_ATTR),
170
177
  wildcard(TYPE_VALIDATOR),
171
178
  wildcard(TYPE_TEMPLATE),
172
179
  ], MetaRoot),
173
180
  );
174
181
 
175
- // object — 4 subtypes
176
- const objectRules = [
177
- wildcard(TYPE_FIELD),
178
- wildcard(TYPE_IDENTITY),
179
- wildcard(TYPE_RELATIONSHIP),
180
- wildcard(TYPE_VALIDATOR),
181
- wildcard(TYPE_LAYOUT),
182
- wildcard(TYPE_SOURCE),
183
- wildcard(TYPE_ATTR),
184
- ];
185
- for (const subType of OBJECT_SUBTYPES) {
186
- // FR-011: object.value additionally carries @normalize the object-level
187
- // default normalization mode for its enum fields' tolerant extract.
188
- const subTypeObjectAttrs =
189
- subType === OBJECT_SUBTYPE_VALUE
190
- ? [...objectAttrs, { ...normalizeAttr }]
191
- : [...objectAttrs];
192
- registry.register(
193
- def(TYPE_OBJECT, subType, `Object/entity (${subType})`, objectRules, MetaObject, subTypeObjectAttrs),
194
- );
182
+ // object — 4 subtypes. FR-033 S1-object: the object provider's declarative
183
+ // definition (vocabulary + per-subtype attr constraints + the structural child
184
+ // rules + real descriptions + the ADR-0028 taxonomy rule prose) is externalized
185
+ // to spec/metamodel/object.json, embedded at build into OBJECT_DEFINITION. The
186
+ // strict per-subtype model lives entirely in the JSON now: object.base carries
187
+ // the INTERSECTION of every subtype's structural children (field/identity/
188
+ // validator/layout/source); each concrete subtype sets extendsBase:true
189
+ // (composeWithBase folds the base childRules in at registration) and adds ONLY
190
+ // its subtype-specific children — value adds relationship; entity adds
191
+ // relationship + template (templates may be co-located) + the FR-014 TPH attrs
192
+ // @discriminator/@discriminatorValue (an entity-inheritance concept a value
193
+ // object / derived projection carries no discriminator); projection inherits the
194
+ // base intersection ONLY (NO relationship derivation is via @via, not a
195
+ // relationship child — and NO template). The "any attr" wildcard child rule is
196
+ // DROPPED (strict/fail-closed) and childRules are NO LONGER post-assigned in
197
+ // code. defineProviderFromData lowers it to TypeDefinitions; the factory
198
+ // (behavior) stays code via OBJECT_FACTORIES, mapping every subType → MetaObject.
199
+ const OBJECT_FACTORIES: FactoryMap = Object.fromEntries(
200
+ OBJECT_SUBTYPES.map((subType) => [
201
+ `${TYPE_OBJECT}.${subType}`,
202
+ (typeId: TypeId, name: string) => new MetaObject(typeId, name),
203
+ ]),
204
+ );
205
+ for (const objectDef of defineProviderFromData(OBJECT_DEFINITION, OBJECT_FACTORIES)) {
206
+ registry.register(objectDef);
195
207
  }
196
208
 
197
- // field — 13 subtypes
198
- const fieldRules = [
199
- wildcard(TYPE_VALIDATOR),
200
- wildcard(TYPE_VIEW),
201
- wildcard(TYPE_ATTR),
202
- wildcard(TYPE_ORIGIN),
203
- ];
204
- for (const subType of FIELD_SUBTYPES) {
205
- // field.currency additionally carries @currency; field.enum additionally
206
- // carries @values; all other field subtypes share the common attrs only.
207
- const fieldAttrs =
208
- subType === FIELD_SUBTYPE_CURRENCY
209
- ? [...commonFieldAttrs, { ...currencyFieldAttr }]
210
- : subType === FIELD_SUBTYPE_ENUM
211
- ? [
212
- ...commonFieldAttrs,
213
- { ...enumFieldAttr },
214
- { ...enumAliasAttr },
215
- { ...enumDocAttr },
216
- { ...coerceDefaultAttr },
217
- { ...normalizeAttr },
218
- ]
219
- : [...commonFieldAttrs];
220
- registry.register(
221
- def(TYPE_FIELD, subType, `Field of type ${subType}`, fieldRules, MetaField, fieldAttrs,
222
- new MetaField(new TypeId(TYPE_FIELD, subType), "").dataType),
223
- );
209
+ // field — 15 subtypes. FR-033 S1-field-B: the field provider's declarative
210
+ // definition (vocabulary + per-subtype attr constraints + the structural child
211
+ // rules + descriptions + rule prose) is externalized to spec/metamodel/field.json,
212
+ // embedded at build into FIELD_DEFINITION. The strict per-subtype model lives
213
+ // entirely in the JSON now: field.base carries the universal core attrs
214
+ // (@required/@readOnly/@default/@unique) + the open validator/view/origin child
215
+ // rules; each concrete subtype sets extendsBase:true (composeWithBase folds the
216
+ // base attrs+childRules in at registration) and adds ONLY its subtype-specific
217
+ // attrs (@maxLength→string, @precision/@scale→decimal, @currency→currency,
218
+ // @objectRef→object, @values/@provided→enum). The "any attr" wildcard child rule
219
+ // is DROPPED (strict/fail-closed) and childRules are NO LONGER post-assigned in
220
+ // code. defineProviderFromData lowers it to TypeDefinitions; the factory
221
+ // (behavior) stays code via FIELD_FACTORIES.
222
+ //
223
+ // (id, name) → MetaField for every field subtype. MetaField computes its own
224
+ // dataType from subType (FIELD_DATA_TYPE getter), so no setDataType is needed;
225
+ // FIELD_DEFINITION.dataType carries the same per-subtype value onto the def.
226
+ const FIELD_FACTORIES: FactoryMap = Object.fromEntries(
227
+ FIELD_SUBTYPES.map((subType) => [
228
+ `${TYPE_FIELD}.${subType}`,
229
+ (typeId: TypeId, name: string) => new MetaField(typeId, name),
230
+ ]),
231
+ );
232
+ for (const fieldDef of defineProviderFromData(FIELD_DEFINITION, FIELD_FACTORIES)) {
233
+ registry.register(fieldDef);
224
234
  }
225
235
 
226
- // attr — 9 subtypes, no children allowed. Each subtype's class owns its
227
- // dataType (resolved by this.subType); we read it off a probe instance so the
228
- // TypeDefinition.dataType contract (registry.find(...).dataType) still holds.
229
- for (const subType of ATTR_SUBTYPES) {
230
- const AttrClass = attrClassFor(subType);
231
- const probeDataType = new AttrClass(new TypeId(TYPE_ATTR, subType), "").dataType;
232
- registry.register(
233
- def(TYPE_ATTR, subType, `Attribute of type ${subType}`, [], AttrClass, [], probeDataType),
234
- );
236
+ // attr — 9 subtypes, no children allowed, no per-type attrs. FR-033: the attr
237
+ // provider's declarative definition (vocabulary + descriptions + per-subtype
238
+ // dataType) is externalized to spec/metamodel/attr.json, embedded at build into
239
+ // ATTR_DEFINITION. defineProviderFromData lowers it to TypeDefinitions; the
240
+ // factory (behavior) stays code via ATTR_FACTORIES. attrs are leaf value-type
241
+ // vocabulary: no childRules and no attributes, so (unlike field) NO post-assign
242
+ // is needed. Each subtype's class owns its dataType internally (resolved by
243
+ // this.subType); ATTR_DEFINITION.dataType carries the same per-subtype value.
244
+ const ATTR_FACTORIES: FactoryMap = Object.fromEntries(
245
+ ATTR_SUBTYPES.map((subType) => [
246
+ `${TYPE_ATTR}.${subType}`,
247
+ (typeId: TypeId, name: string) => new (attrClassFor(subType))(typeId, name),
248
+ ]),
249
+ );
250
+ for (const attrDef of defineProviderFromData(ATTR_DEFINITION, ATTR_FACTORIES)) {
251
+ registry.register(attrDef);
235
252
  }
236
253
 
237
254
  // validator — 6 subtypes (base + 5 named); dispatch to subtype-specific class.
238
- // Subtype→class dispatch for TYPE_VALIDATOR (formerly handled by metaOf()):
255
+ // FR-033: the validator provider's declarative definition (vocabulary +
256
+ // per-subtype attr constraints + descriptions + rule prose) is externalized to
257
+ // spec/metamodel/validator.json, embedded at build into VALIDATOR_DEFINITION.
258
+ // defineProviderFromData lowers it to TypeDefinitions; the factory (behavior)
259
+ // stays code via VALIDATOR_FACTORIES, dispatching subType→class:
239
260
  // required → MetaRequiredValidator, length → MetaLengthValidator,
240
261
  // regex → MetaRegexValidator, numeric → MetaNumericValidator,
241
262
  // array → MetaArrayValidator, default (base) → MetaValidator.
242
- // Attr schemas: MetaValidator (base) + length/numeric/array read @min/@max via
243
- // this.ownAttr(VALIDATOR_ATTR_MIN/MAX); regex also reads @pattern via this.ownAttr().
244
- // required has no extra attrs.
245
- const validatorRules = [wildcard(TYPE_ATTR)];
246
- for (const subType of VALIDATOR_SUBTYPES) {
247
- const NodeClass = VALIDATOR_CLASS_MAP.get(subType) ?? MetaValidator;
248
- const validatorAttrs = VALIDATOR_ATTRS_MAP.get(subType) ?? [];
249
- registry.register(
250
- def(TYPE_VALIDATOR, subType, `Validator (${subType})`, validatorRules, NodeClass, validatorAttrs),
251
- );
263
+ // FR-033 S1-simple: validator is an ATTR-ONLY type its only children are its
264
+ // declared named attrs (no structural children, ever). The "any attr" wildcard
265
+ // child rule is DROPPED (strict/fail-closed); defineProviderFromData leaves
266
+ // childRules EMPTY. The named attrs still enforce strictly via attr-schema-
267
+ // validate (ERR_UNKNOWN_ATTR); a misplaced STRUCTURAL child is now
268
+ // ERR_CHILD_NOT_ALLOWED. Attr schemas: base + length/numeric/array read @min/@max
269
+ // via this.ownAttr(VALIDATOR_ATTR_MIN/MAX); regex also reads @pattern; required
270
+ // has no extra attrs.
271
+ const VALIDATOR_FACTORIES: FactoryMap = Object.fromEntries(
272
+ VALIDATOR_SUBTYPES.map((subType) => [
273
+ `${TYPE_VALIDATOR}.${subType}`,
274
+ (typeId: TypeId, name: string) =>
275
+ new (VALIDATOR_CLASS_MAP.get(subType) ?? MetaValidator)(typeId, name),
276
+ ]),
277
+ );
278
+ for (const validatorDef of defineProviderFromData(VALIDATOR_DEFINITION, VALIDATOR_FACTORIES)) {
279
+ registry.register(validatorDef);
252
280
  }
253
281
 
254
- // view — N subtypes. Each view permits only attr children (Java parity:
255
- // MetaView only attaches to fields, never aggregates child views).
256
- // Only view.currency carries a documented attr (@locale); others have none.
257
- for (const subType of VIEW_SUBTYPES) {
258
- const viewAttrs = subType === VIEW_SUBTYPE_CURRENCY ? [...currencyViewAttrs] : [];
259
- registry.register(
260
- def(TYPE_VIEW, subType, `View (${subType})`, [wildcard(TYPE_ATTR)], MetaView, viewAttrs),
261
- );
282
+ // view — 13 subtypes (base + 12 field-level UI/render hints). Each view permits
283
+ // only attr children (Java parity: MetaView only attaches to fields, never
284
+ // aggregates child views).
285
+ // FR-033: the view provider's declarative definition (vocabulary + real
286
+ // per-subtype descriptions + the single @locale attr on view.currency) is
287
+ // externalized to spec/metamodel/view.json, embedded at build into
288
+ // VIEW_DEFINITION. defineProviderFromData lowers it to TypeDefinitions; the
289
+ // factory (behavior) stays code via VIEW_FACTORIES — every subtype maps to the
290
+ // single MetaView class (views carry no per-subtype behavior). Only
291
+ // view.currency carries a documented attr (@locale, default "en-US"); the
292
+ // other 12 subtypes have none. FR-033 S1-simple: view is an ATTR-ONLY type —
293
+ // the "any attr" wildcard child rule is DROPPED (strict/fail-closed) and
294
+ // childRules are left EMPTY; the declared named attrs still enforce strictly,
295
+ // a misplaced STRUCTURAL child is now ERR_CHILD_NOT_ALLOWED.
296
+ const VIEW_FACTORIES: FactoryMap = Object.fromEntries(
297
+ VIEW_SUBTYPES.map((subType) => [
298
+ `${TYPE_VIEW}.${subType}`,
299
+ (typeId: TypeId, name: string) => new MetaView(typeId, name),
300
+ ]),
301
+ );
302
+ for (const viewDef of defineProviderFromData(VIEW_DEFINITION, VIEW_FACTORIES)) {
303
+ registry.register(viewDef);
262
304
  }
263
305
 
264
306
  // layout — object-level UI surfaces (data grids, forms, tabs, cards).
265
- // Each subtype permits only attr children like views, layouts are config carriers.
266
- for (const subType of LAYOUT_SUBTYPES) {
267
- const layoutAttrs = subType === LAYOUT_SUBTYPE_DATA_GRID ? [...dataGridLayoutAttrs] : [];
268
- registry.register(
269
- def(TYPE_LAYOUT, subType, `Layout (${subType})`, [wildcard(TYPE_ATTR)], MetaLayout, layoutAttrs),
270
- );
307
+ // FR-033: the layout provider's declarative definition (2 subtypes base +
308
+ // dataGrid vocabulary + the 6 dataGrid attr constraints + descriptions) is
309
+ // externalized to spec/metamodel/layout.json, embedded at build into
310
+ // LAYOUT_DEFINITION. defineProviderFromData lowers it to TypeDefinitions; the
311
+ // factory (behavior) stays code via LAYOUT_FACTORIES — every subtype maps to
312
+ // the single MetaLayout class (layouts are config carriers, no per-subtype
313
+ // behavior). FR-033 S1-simple: layout is an ATTR-ONLY type — like views,
314
+ // layouts are config carriers — the "any attr" wildcard child rule is DROPPED
315
+ // (strict/fail-closed) and childRules are left EMPTY; the declared named attrs
316
+ // still enforce strictly, a misplaced STRUCTURAL child is now
317
+ // ERR_CHILD_NOT_ALLOWED.
318
+ const LAYOUT_FACTORIES: FactoryMap = Object.fromEntries(
319
+ LAYOUT_SUBTYPES.map((subType) => [
320
+ `${TYPE_LAYOUT}.${subType}`,
321
+ (typeId: TypeId, name: string) => new MetaLayout(typeId, name),
322
+ ]),
323
+ );
324
+ for (const layoutDef of defineProviderFromData(LAYOUT_DEFINITION, LAYOUT_FACTORIES)) {
325
+ registry.register(layoutDef);
271
326
  }
272
327
 
273
- // source — declares where an object's data lives (rdb, ... per ADR-0007).
274
- // Only attr children; sources carry only configuration, never nested structure.
275
- // Per-subtype attrs (@table/@kind/@role/@schema for rdb) are added by
276
- // dbProvider via TypeRegistry.extend.
277
- for (const subType of SOURCE_SUBTYPES) {
278
- registry.register(
279
- def(TYPE_SOURCE, subType, `Source (${subType})`, [wildcard(TYPE_ATTR)], MetaSource, []),
280
- );
328
+ // source — declares where an object's data lives (2 subtypes: base/rdb, per
329
+ // ADR-0007). Only attr children; sources carry only configuration, never
330
+ // nested structure.
331
+ // FR-033: the CORE source registration (the bare source shells + real
332
+ // descriptions + ADR-0007 rules prose) is externalized to
333
+ // spec/metamodel/source.json, embedded at build into SOURCE_DEFINITION.
334
+ // defineProviderFromData lowers it to TypeDefinitions; the factory (behavior)
335
+ // stays code via SOURCE_FACTORIES — a single MetaSource class backs all
336
+ // subtypes. The CORE registration carries NO own attrs (children == []); the
337
+ // per-subtype @table/@kind/@role/@schema/@parameterRef attrs on source.rdb are
338
+ // contributed by a SEPARATE provider (dbProvider, persistence/db) via
339
+ // registry.extend(TYPE_SOURCE, "rdb", ...) — untouched by this conversion.
340
+ // FR-033 S1-simple: source is an ATTR-ONLY type (configuration carrier, never
341
+ // nested structure) — the "any attr" wildcard child rule is DROPPED (strict/
342
+ // fail-closed) and childRules are left EMPTY; the per-subtype @table/@kind/
343
+ // @role/@schema attrs (from dbProvider) still enforce strictly, a misplaced
344
+ // STRUCTURAL child is now ERR_CHILD_NOT_ALLOWED.
345
+ const SOURCE_FACTORIES: FactoryMap = Object.fromEntries(
346
+ SOURCE_SUBTYPES.map((subType) => [
347
+ `${TYPE_SOURCE}.${subType}`,
348
+ (typeId: TypeId, name: string) => new MetaSource(typeId, name),
349
+ ]),
350
+ );
351
+ for (const sourceDef of defineProviderFromData(SOURCE_DEFINITION, SOURCE_FACTORIES)) {
352
+ registry.register(sourceDef);
281
353
  }
282
354
 
283
- // origin — field-level provenance. Only attr children.
284
- // Subtype→class dispatch (mirrors validator / identity patterns):
355
+ // origin — field-level provenance (4 subtypes: base/passthrough/aggregate/
356
+ // collection; only attr children).
357
+ // FR-033: the origin provider's declarative definition (vocabulary +
358
+ // per-subtype attr constraints + real descriptions) is externalized to
359
+ // spec/metamodel/origin.json, embedded at build into ORIGIN_DEFINITION.
360
+ // defineProviderFromData lowers it to TypeDefinitions; the factory (behavior)
361
+ // stays code via ORIGIN_FACTORIES, dispatching subType→class:
285
362
  // passthrough → MetaPassthroughOrigin, aggregate → MetaAggregateOrigin,
286
- // base (and any unmapped subtype) → MetaOrigin.
287
- for (const subType of ORIGIN_SUBTYPES) {
288
- const NodeClass = ORIGIN_CLASS_MAP.get(subType) ?? MetaOrigin;
289
- const originAttrs = ORIGIN_ATTRS_MAP.get(subType) ?? [];
290
- registry.register(
291
- def(TYPE_ORIGIN, subType, `Origin (${subType})`, [wildcard(TYPE_ATTR)], NodeClass, originAttrs),
292
- );
363
+ // collection → MetaCollectionOrigin, base (and any unmapped subtype) →
364
+ // MetaOrigin (fallback).
365
+ // FR-033 S1-simple: origin is an ATTR-ONLY type — the "any attr" wildcard child
366
+ // rule is DROPPED (strict/fail-closed) and childRules are left EMPTY; the named
367
+ // attrs still enforce strictly, a misplaced STRUCTURAL child is now
368
+ // ERR_CHILD_NOT_ALLOWED. Attr schemas: base has none; passthrough adds @from
369
+ // (required) + @via; aggregate adds @agg (required) + @of (required) + @via;
370
+ // collection adds @via (required).
371
+ const ORIGIN_FACTORIES: FactoryMap = Object.fromEntries(
372
+ ORIGIN_SUBTYPES.map((subType) => [
373
+ `${TYPE_ORIGIN}.${subType}`,
374
+ (typeId: TypeId, name: string) =>
375
+ new (ORIGIN_CLASS_MAP.get(subType) ?? MetaOrigin)(typeId, name),
376
+ ]),
377
+ );
378
+ for (const originDef of defineProviderFromData(ORIGIN_DEFINITION, ORIGIN_FACTORIES)) {
379
+ registry.register(originDef);
293
380
  }
294
381
 
295
382
  // template — renderable text artifacts (FR-004) + tool-call envelopes
296
- // (ADR-0011). Three subtypes: prompt + output + toolcall; attr-only children.
297
- // A single MetaTemplate class backs all three subtypes (mirrors source);
383
+ // (ADR-0011). Four subtypes: base + prompt + output + toolcall; attr-only
384
+ // children. A single MetaTemplate class backs every subtype (mirrors source);
298
385
  // per-subtype attr schemas drive validation (prompt + output require
299
386
  // @payloadRef + @textRef + @format closed enum; prompt adds the LLM overlay;
300
- // toolcall has its own set — @toolName + @payloadRef + @description, no
301
- // @textRef requirement since toolcalls have no renderable body).
302
- for (const subType of TEMPLATE_SUBTYPES) {
303
- const templateAttrs = TEMPLATE_ATTRS_MAP.get(subType) ?? [];
304
- registry.register(
305
- def(TYPE_TEMPLATE, subType, `Template (${subType})`, [wildcard(TYPE_ATTR)], MetaTemplate, templateAttrs),
306
- );
387
+ // output adds @promptStyle + @kind/email part-refs; toolcall has its own set —
388
+ // @toolName + @payloadRef, no @textRef requirement since toolcalls have no
389
+ // renderable body).
390
+ // FR-033: the template provider's declarative definition (the 4-subtype
391
+ // vocabulary + the full per-subtype attr constraints — incl. @format/@promptStyle/
392
+ // @kind closed-enum allowedValues + defaults + required @payloadRef/@toolName —
393
+ // + real descriptions + the FR-004/ADR-0011 rules prose) is externalized to
394
+ // spec/metamodel/template.json, embedded at build into TEMPLATE_DEFINITION.
395
+ // defineProviderFromData lowers it to TypeDefinitions; the factory (behavior)
396
+ // stays code via TEMPLATE_FACTORIES, mapping every subType → MetaTemplate.
397
+ // FR-033 S2: template's CORE registration carries NO own attrs (children == []);
398
+ // the per-subtype type attrs (@payloadRef/@textRef/@format/@kind/…) on prompt/
399
+ // output/toolcall are contributed by a SEPARATE provider (promptProvider,
400
+ // template/prompt-provider) via registry.extend(TYPE_TEMPLATE, sub, ...). With
401
+ // those attrs re-homed, template is now an ATTR-ONLY type and the "any attr"
402
+ // wildcard child rule is DROPPED (strict completion — like view/layout/source);
403
+ // childRules are left EMPTY, so a misplaced STRUCTURAL child is now
404
+ // ERR_CHILD_NOT_ALLOWED and a non-declared attr is ERR_UNKNOWN_ATTR. Vendor
405
+ // toolcall attrs stay extensible via consumer registry.extend (ADR-0011).
406
+ const TEMPLATE_FACTORIES: FactoryMap = Object.fromEntries(
407
+ TEMPLATE_SUBTYPES.map((subType) => [
408
+ `${TYPE_TEMPLATE}.${subType}`,
409
+ (typeId: TypeId, name: string) => new MetaTemplate(typeId, name),
410
+ ]),
411
+ );
412
+ for (const templateDef of defineProviderFromData(TEMPLATE_DEFINITION, TEMPLATE_FACTORIES)) {
413
+ registry.register(templateDef);
307
414
  }
308
415
 
309
- // identity — 2 subtypes (no base; Java doesn't register one).
310
- // Subtype→class dispatch for TYPE_IDENTITY (formerly handled by metaOf()):
416
+ // identity — 3 subtypes (primary/secondary/reference; no base Java doesn't
417
+ // register one).
418
+ // FR-033: the identity provider's declarative definition (vocabulary +
419
+ // per-subtype attr constraints + descriptions) is externalized to
420
+ // spec/metamodel/identity.json, embedded at build into IDENTITY_DEFINITION.
421
+ // defineProviderFromData lowers it to TypeDefinitions; the factory (behavior)
422
+ // stays code via IDENTITY_FACTORIES, dispatching subType→class:
311
423
  // primary → MetaPrimaryIdentity, secondary → MetaSecondaryIdentity,
312
- // default → MetaIdentity (fallback, not currently registered).
313
- for (const subType of IDENTITY_SUBTYPES) {
314
- const NodeClass = IDENTITY_CLASS_MAP.get(subType) ?? MetaIdentity;
315
- const idAttrs = IDENTITY_ATTRS_MAP.get(subType) ?? [{ ...identityFieldsAttr }];
316
- registry.register(
317
- def(TYPE_IDENTITY, subType, `Identity (${subType})`, [wildcard(TYPE_ATTR)], NodeClass, idAttrs),
318
- );
424
+ // reference → MetaReferenceIdentity, default → MetaIdentity (fallback).
425
+ // FR-033 S1-simple: identity is an ATTR-ONLY type — the "any attr" wildcard
426
+ // child rule is DROPPED (strict/fail-closed) and childRules are left EMPTY; the
427
+ // named attrs still enforce strictly, a misplaced STRUCTURAL child is now
428
+ // ERR_CHILD_NOT_ALLOWED. Attr schemas: all three carry the required @fields;
429
+ // primary adds @generation, secondary @unique, reference @references (required)
430
+ // + @enforce.
431
+ const IDENTITY_FACTORIES: FactoryMap = Object.fromEntries(
432
+ IDENTITY_SUBTYPES.map((subType) => [
433
+ `${TYPE_IDENTITY}.${subType}`,
434
+ (typeId: TypeId, name: string) =>
435
+ new (IDENTITY_CLASS_MAP.get(subType) ?? MetaIdentity)(typeId, name),
436
+ ]),
437
+ );
438
+ for (const identityDef of defineProviderFromData(IDENTITY_DEFINITION, IDENTITY_FACTORIES)) {
439
+ registry.register(identityDef);
319
440
  }
320
441
 
321
- // relationship — 4 subtypes
442
+ // relationship — 4 subtypes (base/association/aggregation/composition), all
443
+ // backed by the single MetaRelationship node class (no subType→class dispatch).
444
+ // FR-033: the relationship provider's declarative definition (vocabulary +
445
+ // the 7 shared attr constraints + real descriptions + the complex M:N rules
446
+ // prose) is externalized to spec/metamodel/relationship.json, embedded at build
447
+ // into RELATIONSHIP_DEFINITION. defineProviderFromData lowers it to
448
+ // TypeDefinitions; the factory (behavior) stays code via RELATIONSHIP_FACTORIES,
449
+ // mapping every subType → MetaRelationship. FR-033 S1-simple: relationship is an
450
+ // ATTR-ONLY type — the "any attr" wildcard child rule is DROPPED (strict/fail-
451
+ // closed) and childRules are left EMPTY; the named attrs still enforce strictly,
452
+ // a misplaced STRUCTURAL child is now ERR_CHILD_NOT_ALLOWED.
453
+ const RELATIONSHIP_FACTORIES: FactoryMap = Object.fromEntries(
454
+ RELATIONSHIP_SUBTYPES.map((subType) => [
455
+ `${TYPE_RELATIONSHIP}.${subType}`,
456
+ (typeId: TypeId, name: string) => new MetaRelationship(typeId, name),
457
+ ]),
458
+ );
459
+ for (const relationshipDef of defineProviderFromData(
460
+ RELATIONSHIP_DEFINITION,
461
+ RELATIONSHIP_FACTORIES,
462
+ )) {
463
+ registry.register(relationshipDef);
464
+ }
465
+
466
+ // Declare the core cross-references ON their TypeDefinitions, so the loader's
467
+ // registry-derived validation resolves them generically (a dangling target fails the
468
+ // load). Set on the concrete subtypes the parser produces. (Production moves these into
469
+ // the embedded spec/metamodel JSON once every port's spec reader carries the field.)
322
470
  for (const subType of RELATIONSHIP_SUBTYPES) {
323
- registry.register(
324
- def(
325
- TYPE_RELATIONSHIP,
326
- subType,
327
- `Relationship (${subType})`,
328
- [wildcard(TYPE_ATTR)],
329
- MetaRelationship,
330
- [...relationshipAttrs],
331
- ),
332
- );
471
+ const def = registry.find(TYPE_RELATIONSHIP, subType);
472
+ if (def) {
473
+ def.references = [
474
+ { attr: RELATIONSHIP_ATTR_OBJECT_REF, targetType: TYPE_OBJECT, errorCode: "ERR_INVALID_RELATIONSHIP" },
475
+ ];
476
+ }
477
+ }
478
+ const idRefDef = registry.find(TYPE_IDENTITY, IDENTITY_SUBTYPE_REFERENCE);
479
+ if (idRefDef) {
480
+ idRefDef.references = [
481
+ {
482
+ attr: IDENTITY_REFERENCE_ATTR_REFERENCES,
483
+ targetType: TYPE_OBJECT,
484
+ dottedFieldPath: true,
485
+ errorCode: "ERR_INVALID_REFERENCE",
486
+ },
487
+ ];
333
488
  }
334
489
 
335
490
  // Default subTypes for YAML authoring sugar: a bare `metadata:` / `object:`
@@ -354,9 +509,18 @@ export const coreTypesProvider: MetaDataTypeProvider = {
354
509
  },
355
510
  };
356
511
 
357
- /** The default provider bundle — core metamodel types plus DB-domain attrs.
358
- * Spread it to add more: `[...coreProviders, mine]`. */
359
- export const coreProviders: readonly MetaDataTypeProvider[] = [coreTypesProvider, dbProvider, docProvider];
512
+ /** The default provider bundle — core metamodel types plus the four concern
513
+ * providers (DB-domain attrs, documentation common-attrs, prompt/AI + the
514
+ * UI/query-surface markers). FR-033 S1-field-A re-homed the field's
515
+ * filter/sort/teaching/extract/storage attrs out of core into db/ui/prompt;
516
+ * the composed set is unchanged. Spread it to add more: `[...coreProviders, mine]`. */
517
+ export const coreProviders: readonly MetaDataTypeProvider[] = [
518
+ coreTypesProvider,
519
+ dbProvider,
520
+ docProvider,
521
+ promptProvider,
522
+ uiProvider,
523
+ ];
360
524
 
361
525
  /**
362
526
  * Register the core metamodel into an existing registry. Thin convenience