@metaobjectsdev/metadata 0.9.0-rc.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) 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 +84 -7
  4. package/dist/attr-schema-validate.js.map +1 -1
  5. package/dist/constants.d.ts +208 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +419 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/constraint-merge.d.ts +18 -0
  10. package/dist/constraint-merge.d.ts.map +1 -0
  11. package/dist/constraint-merge.js +0 -0
  12. package/dist/constraint-merge.js.map +1 -0
  13. package/dist/constraint-validate.d.ts +6 -0
  14. package/dist/constraint-validate.d.ts.map +1 -0
  15. package/dist/constraint-validate.js +274 -0
  16. package/dist/constraint-validate.js.map +1 -0
  17. package/dist/core/attr/attr-constants.d.ts +13 -3
  18. package/dist/core/attr/attr-constants.d.ts.map +1 -1
  19. package/dist/core/attr/attr-constants.js +11 -2
  20. package/dist/core/attr/attr-constants.js.map +1 -1
  21. package/dist/core/attr/attr-definition.embedded.d.ts +3 -0
  22. package/dist/core/attr/attr-definition.embedded.d.ts.map +1 -0
  23. package/dist/core/attr/attr-definition.embedded.js +60 -0
  24. package/dist/core/attr/attr-definition.embedded.js.map +1 -0
  25. package/dist/core/documentation/doc-constants.d.ts +3 -2
  26. package/dist/core/documentation/doc-constants.d.ts.map +1 -1
  27. package/dist/core/documentation/doc-constants.js +3 -1
  28. package/dist/core/documentation/doc-constants.js.map +1 -1
  29. package/dist/core/documentation/doc-provider.d.ts.map +1 -1
  30. package/dist/core/documentation/doc-provider.js +6 -2
  31. package/dist/core/documentation/doc-provider.js.map +1 -1
  32. package/dist/core/documentation/doc-schema.d.ts +1 -1
  33. package/dist/core/documentation/doc-schema.d.ts.map +1 -1
  34. package/dist/core/documentation/doc-schema.js +13 -5
  35. package/dist/core/documentation/doc-schema.js.map +1 -1
  36. package/dist/core/documentation/documentation-definition.embedded.d.ts +3 -0
  37. package/dist/core/documentation/documentation-definition.embedded.d.ts.map +1 -0
  38. package/dist/core/documentation/documentation-definition.embedded.js +79 -0
  39. package/dist/core/documentation/documentation-definition.embedded.js.map +1 -0
  40. package/dist/core/field/field-constants.d.ts +7 -4
  41. package/dist/core/field/field-constants.d.ts.map +1 -1
  42. package/dist/core/field/field-constants.js +7 -7
  43. package/dist/core/field/field-constants.js.map +1 -1
  44. package/dist/core/field/field-definition.embedded.d.ts +3 -0
  45. package/dist/core/field/field-definition.embedded.d.ts.map +1 -0
  46. package/dist/core/field/field-definition.embedded.js +236 -0
  47. package/dist/core/field/field-definition.embedded.js.map +1 -0
  48. package/dist/core/field/field-schema.d.ts +0 -16
  49. package/dist/core/field/field-schema.d.ts.map +1 -1
  50. package/dist/core/field/field-schema.js +10 -158
  51. package/dist/core/field/field-schema.js.map +1 -1
  52. package/dist/core/field/meta-field.d.ts.map +1 -1
  53. package/dist/core/field/meta-field.js +7 -5
  54. package/dist/core/field/meta-field.js.map +1 -1
  55. package/dist/core/file-meta-data-loader.d.ts +18 -0
  56. package/dist/core/file-meta-data-loader.d.ts.map +1 -0
  57. package/dist/core/file-meta-data-loader.js +81 -0
  58. package/dist/core/file-meta-data-loader.js.map +1 -0
  59. package/dist/core/file-source.d.ts +12 -0
  60. package/dist/core/file-source.d.ts.map +1 -0
  61. package/dist/core/file-source.js +46 -0
  62. package/dist/core/file-source.js.map +1 -0
  63. package/dist/core/identity/identity-definition.embedded.d.ts +3 -0
  64. package/dist/core/identity/identity-definition.embedded.d.ts.map +1 -0
  65. package/dist/core/identity/identity-definition.embedded.js +91 -0
  66. package/dist/core/identity/identity-definition.embedded.js.map +1 -0
  67. package/dist/core/identity/identity-schema.d.ts.map +1 -1
  68. package/dist/core/identity/identity-schema.js +3 -2
  69. package/dist/core/identity/identity-schema.js.map +1 -1
  70. package/dist/core/identity/validate-identity-passthrough.d.ts +42 -0
  71. package/dist/core/identity/validate-identity-passthrough.d.ts.map +1 -0
  72. package/dist/core/identity/validate-identity-passthrough.js +158 -0
  73. package/dist/core/identity/validate-identity-passthrough.js.map +1 -0
  74. package/dist/core/object/object-constants.d.ts +2 -1
  75. package/dist/core/object/object-constants.d.ts.map +1 -1
  76. package/dist/core/object/object-constants.js +3 -0
  77. package/dist/core/object/object-constants.js.map +1 -1
  78. package/dist/core/object/object-definition.embedded.d.ts +3 -0
  79. package/dist/core/object/object-definition.embedded.d.ts.map +1 -0
  80. package/dist/core/object/object-definition.embedded.js +110 -0
  81. package/dist/core/object/object-definition.embedded.js.map +1 -0
  82. package/dist/core/object/validate-discriminator.d.ts.map +1 -1
  83. package/dist/core/object/validate-discriminator.js +1 -3
  84. package/dist/core/object/validate-discriminator.js.map +1 -1
  85. package/dist/core/query/query-constants.d.ts.map +1 -1
  86. package/dist/core/query/query-constants.js +5 -3
  87. package/dist/core/query/query-constants.js.map +1 -1
  88. package/dist/core/relationship/derive-m2m-fields.d.ts +26 -0
  89. package/dist/core/relationship/derive-m2m-fields.d.ts.map +1 -0
  90. package/dist/core/relationship/derive-m2m-fields.js +102 -0
  91. package/dist/core/relationship/derive-m2m-fields.js.map +1 -0
  92. package/dist/core/relationship/meta-relationship.d.ts +6 -4
  93. package/dist/core/relationship/meta-relationship.d.ts.map +1 -1
  94. package/dist/core/relationship/meta-relationship.js +12 -8
  95. package/dist/core/relationship/meta-relationship.js.map +1 -1
  96. package/dist/core/relationship/relationship-constants.d.ts +6 -2
  97. package/dist/core/relationship/relationship-constants.d.ts.map +1 -1
  98. package/dist/core/relationship/relationship-constants.js +6 -2
  99. package/dist/core/relationship/relationship-constants.js.map +1 -1
  100. package/dist/core/relationship/relationship-definition.embedded.d.ts +3 -0
  101. package/dist/core/relationship/relationship-definition.embedded.d.ts.map +1 -0
  102. package/dist/core/relationship/relationship-definition.embedded.js +310 -0
  103. package/dist/core/relationship/relationship-definition.embedded.js.map +1 -0
  104. package/dist/core/relationship/relationship-schema.d.ts.map +1 -1
  105. package/dist/core/relationship/relationship-schema.js +13 -7
  106. package/dist/core/relationship/relationship-schema.js.map +1 -1
  107. package/dist/core/validator/validator-definition.embedded.d.ts +3 -0
  108. package/dist/core/validator/validator-definition.embedded.d.ts.map +1 -0
  109. package/dist/core/validator/validator-definition.embedded.js +134 -0
  110. package/dist/core/validator/validator-definition.embedded.js.map +1 -0
  111. package/dist/core/yaml-desugar.d.ts.map +1 -1
  112. package/dist/core/yaml-desugar.js +88 -10
  113. package/dist/core/yaml-desugar.js.map +1 -1
  114. package/dist/core-attr-schemas.d.ts +22 -0
  115. package/dist/core-attr-schemas.d.ts.map +1 -0
  116. package/dist/core-attr-schemas.js +324 -0
  117. package/dist/core-attr-schemas.js.map +1 -0
  118. package/dist/core-types.d.ts +5 -2
  119. package/dist/core-types.d.ts.map +1 -1
  120. package/dist/core-types.js +261 -115
  121. package/dist/core-types.js.map +1 -1
  122. package/dist/db/db-attr-schemas.d.ts +8 -0
  123. package/dist/db/db-attr-schemas.d.ts.map +1 -0
  124. package/dist/db/db-attr-schemas.js +26 -0
  125. package/dist/db/db-attr-schemas.js.map +1 -0
  126. package/dist/db/db-provider.d.ts +3 -0
  127. package/dist/db/db-provider.d.ts.map +1 -0
  128. package/dist/db/db-provider.js +28 -0
  129. package/dist/db/db-provider.js.map +1 -0
  130. package/dist/errors.d.ts +1 -1
  131. package/dist/errors.d.ts.map +1 -1
  132. package/dist/errors.js +78 -0
  133. package/dist/errors.js.map +1 -1
  134. package/dist/index.d.ts +17 -2
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +26 -1
  137. package/dist/index.js.map +1 -1
  138. package/dist/library/embedded-library.generated.d.ts +2 -0
  139. package/dist/library/embedded-library.generated.d.ts.map +1 -0
  140. package/dist/library/embedded-library.generated.js +11 -0
  141. package/dist/library/embedded-library.generated.js.map +1 -0
  142. package/dist/library/library-sources.d.ts +12 -0
  143. package/dist/library/library-sources.d.ts.map +1 -0
  144. package/dist/library/library-sources.js +88 -0
  145. package/dist/library/library-sources.js.map +1 -0
  146. package/dist/loader/meta-data-loader.d.ts +10 -2
  147. package/dist/loader/meta-data-loader.d.ts.map +1 -1
  148. package/dist/loader/meta-data-loader.js +47 -6
  149. package/dist/loader/meta-data-loader.js.map +1 -1
  150. package/dist/loader/shortcuts.d.ts +2 -5
  151. package/dist/loader/shortcuts.d.ts.map +1 -1
  152. package/dist/loader/shortcuts.js.map +1 -1
  153. package/dist/loader/validation-passes.d.ts +3 -0
  154. package/dist/loader/validation-passes.d.ts.map +1 -1
  155. package/dist/loader/validation-passes.js +513 -33
  156. package/dist/loader/validation-passes.js.map +1 -1
  157. package/dist/meta/find-reference.d.ts +22 -0
  158. package/dist/meta/find-reference.d.ts.map +1 -0
  159. package/dist/meta/find-reference.js +29 -0
  160. package/dist/meta/find-reference.js.map +1 -0
  161. package/dist/meta/meta-attr.d.ts +8 -0
  162. package/dist/meta/meta-attr.d.ts.map +1 -0
  163. package/dist/meta/meta-attr.js +17 -0
  164. package/dist/meta/meta-attr.js.map +1 -0
  165. package/dist/meta/meta-data.d.ts +107 -0
  166. package/dist/meta/meta-data.d.ts.map +1 -0
  167. package/dist/meta/meta-data.js +302 -0
  168. package/dist/meta/meta-data.js.map +1 -0
  169. package/dist/meta/meta-field.d.ts +48 -0
  170. package/dist/meta/meta-field.d.ts.map +1 -0
  171. package/dist/meta/meta-field.js +94 -0
  172. package/dist/meta/meta-field.js.map +1 -0
  173. package/dist/meta/meta-identity.d.ts +71 -0
  174. package/dist/meta/meta-identity.d.ts.map +1 -0
  175. package/dist/meta/meta-identity.js +129 -0
  176. package/dist/meta/meta-identity.js.map +1 -0
  177. package/dist/meta/meta-layout.d.ts +23 -0
  178. package/dist/meta/meta-layout.d.ts.map +1 -0
  179. package/dist/meta/meta-layout.js +45 -0
  180. package/dist/meta/meta-layout.js.map +1 -0
  181. package/dist/meta/meta-object.d.ts +40 -0
  182. package/dist/meta/meta-object.d.ts.map +1 -0
  183. package/dist/meta/meta-object.js +81 -0
  184. package/dist/meta/meta-object.js.map +1 -0
  185. package/dist/meta/meta-origin.d.ts +32 -0
  186. package/dist/meta/meta-origin.d.ts.map +1 -0
  187. package/dist/meta/meta-origin.js +55 -0
  188. package/dist/meta/meta-origin.js.map +1 -0
  189. package/dist/meta/meta-relationship.d.ts +11 -0
  190. package/dist/meta/meta-relationship.d.ts.map +1 -0
  191. package/dist/meta/meta-relationship.js +27 -0
  192. package/dist/meta/meta-relationship.js.map +1 -0
  193. package/dist/meta/meta-root.d.ts +12 -0
  194. package/dist/meta/meta-root.d.ts.map +1 -0
  195. package/dist/meta/meta-root.js +24 -0
  196. package/dist/meta/meta-root.js.map +1 -0
  197. package/dist/meta/meta-source.d.ts +18 -0
  198. package/dist/meta/meta-source.d.ts.map +1 -0
  199. package/dist/meta/meta-source.js +31 -0
  200. package/dist/meta/meta-source.js.map +1 -0
  201. package/dist/meta/meta-validator.d.ts +29 -0
  202. package/dist/meta/meta-validator.d.ts.map +1 -0
  203. package/dist/meta/meta-validator.js +49 -0
  204. package/dist/meta/meta-validator.js.map +1 -0
  205. package/dist/meta/meta-view.d.ts +4 -0
  206. package/dist/meta/meta-view.d.ts.map +1 -0
  207. package/dist/meta/meta-view.js +8 -0
  208. package/dist/meta/meta-view.js.map +1 -0
  209. package/dist/metamodel-docs/index.d.ts +19 -0
  210. package/dist/metamodel-docs/index.d.ts.map +1 -0
  211. package/dist/metamodel-docs/index.js +37 -0
  212. package/dist/metamodel-docs/index.js.map +1 -0
  213. package/dist/metamodel-docs/provenance.d.ts +42 -0
  214. package/dist/metamodel-docs/provenance.d.ts.map +1 -0
  215. package/dist/metamodel-docs/provenance.js +148 -0
  216. package/dist/metamodel-docs/provenance.js.map +1 -0
  217. package/dist/metamodel-docs/provider-definitions.d.ts +8 -0
  218. package/dist/metamodel-docs/provider-definitions.d.ts.map +1 -0
  219. package/dist/metamodel-docs/provider-definitions.js +48 -0
  220. package/dist/metamodel-docs/provider-definitions.js.map +1 -0
  221. package/dist/metamodel-docs/render.d.ts +12 -0
  222. package/dist/metamodel-docs/render.d.ts.map +1 -0
  223. package/dist/metamodel-docs/render.js +252 -0
  224. package/dist/metamodel-docs/render.js.map +1 -0
  225. package/dist/naming-refs.d.ts +41 -0
  226. package/dist/naming-refs.d.ts.map +1 -0
  227. package/dist/naming-refs.js +144 -0
  228. package/dist/naming-refs.js.map +1 -0
  229. package/dist/naming.d.ts.map +1 -1
  230. package/dist/naming.js +10 -2
  231. package/dist/naming.js.map +1 -1
  232. package/dist/parser-core.d.ts.map +1 -1
  233. package/dist/parser-core.js +74 -8
  234. package/dist/parser-core.js.map +1 -1
  235. package/dist/persistence/db/db-attr-schemas.d.ts +8 -0
  236. package/dist/persistence/db/db-attr-schemas.d.ts.map +1 -0
  237. package/dist/persistence/db/db-attr-schemas.js +28 -0
  238. package/dist/persistence/db/db-attr-schemas.js.map +1 -0
  239. package/dist/persistence/db/db-definition.embedded.d.ts +3 -0
  240. package/dist/persistence/db/db-definition.embedded.d.ts.map +1 -0
  241. package/dist/persistence/db/db-definition.embedded.js +170 -0
  242. package/dist/persistence/db/db-definition.embedded.js.map +1 -0
  243. package/dist/persistence/db/db-provider.d.ts.map +1 -1
  244. package/dist/persistence/db/db-provider.js +13 -18
  245. package/dist/persistence/db/db-provider.js.map +1 -1
  246. package/dist/persistence/db/db-schema.d.ts +14 -0
  247. package/dist/persistence/db/db-schema.d.ts.map +1 -1
  248. package/dist/persistence/db/db-schema.js +27 -0
  249. package/dist/persistence/db/db-schema.js.map +1 -1
  250. package/dist/persistence/origin/origin-definition.embedded.d.ts +3 -0
  251. package/dist/persistence/origin/origin-definition.embedded.d.ts.map +1 -0
  252. package/dist/persistence/origin/origin-definition.embedded.js +88 -0
  253. package/dist/persistence/origin/origin-definition.embedded.js.map +1 -0
  254. package/dist/persistence/origin/origin-schema.d.ts.map +1 -1
  255. package/dist/persistence/origin/origin-schema.js +7 -3
  256. package/dist/persistence/origin/origin-schema.js.map +1 -1
  257. package/dist/persistence/source/source-definition.embedded.d.ts +3 -0
  258. package/dist/persistence/source/source-definition.embedded.d.ts.map +1 -0
  259. package/dist/persistence/source/source-definition.embedded.js +17 -0
  260. package/dist/persistence/source/source-definition.embedded.js.map +1 -0
  261. package/dist/persistence/source/validate-source-parameter-ref.d.ts.map +1 -1
  262. package/dist/persistence/source/validate-source-parameter-ref.js +7 -1
  263. package/dist/persistence/source/validate-source-parameter-ref.js.map +1 -1
  264. package/dist/persistence/source/validate-source-roles.d.ts.map +1 -1
  265. package/dist/persistence/source/validate-source-roles.js +16 -1
  266. package/dist/persistence/source/validate-source-roles.js.map +1 -1
  267. package/dist/presentation/layout/layout-definition.embedded.d.ts +3 -0
  268. package/dist/presentation/layout/layout-definition.embedded.d.ts.map +1 -0
  269. package/dist/presentation/layout/layout-definition.embedded.js +16 -0
  270. package/dist/presentation/layout/layout-definition.embedded.js.map +1 -0
  271. package/dist/presentation/layout/layout-schema.d.ts.map +1 -1
  272. package/dist/presentation/layout/layout-schema.js +3 -2
  273. package/dist/presentation/layout/layout-schema.js.map +1 -1
  274. package/dist/presentation/ui/ui-definition.embedded.d.ts +3 -0
  275. package/dist/presentation/ui/ui-definition.embedded.d.ts.map +1 -0
  276. package/dist/presentation/ui/ui-definition.embedded.js +114 -0
  277. package/dist/presentation/ui/ui-definition.embedded.js.map +1 -0
  278. package/dist/presentation/ui/ui-provider.d.ts +3 -0
  279. package/dist/presentation/ui/ui-provider.d.ts.map +1 -0
  280. package/dist/presentation/ui/ui-provider.js +21 -0
  281. package/dist/presentation/ui/ui-provider.js.map +1 -0
  282. package/dist/presentation/ui/ui-schema.d.ts +10 -0
  283. package/dist/presentation/ui/ui-schema.d.ts.map +1 -0
  284. package/dist/presentation/ui/ui-schema.js +41 -0
  285. package/dist/presentation/ui/ui-schema.js.map +1 -0
  286. package/dist/presentation/view/view-definition.embedded.d.ts +3 -0
  287. package/dist/presentation/view/view-definition.embedded.d.ts.map +1 -0
  288. package/dist/presentation/view/view-definition.embedded.js +76 -0
  289. package/dist/presentation/view/view-definition.embedded.js.map +1 -0
  290. package/dist/provider-data.d.ts +169 -0
  291. package/dist/provider-data.d.ts.map +1 -0
  292. package/dist/provider-data.js +269 -0
  293. package/dist/provider-data.js.map +1 -0
  294. package/dist/provider.d.ts +3 -1
  295. package/dist/provider.d.ts.map +1 -1
  296. package/dist/provider.js +15 -1
  297. package/dist/provider.js.map +1 -1
  298. package/dist/registry-coverage.d.ts +99 -0
  299. package/dist/registry-coverage.d.ts.map +1 -0
  300. package/dist/registry-coverage.js +294 -0
  301. package/dist/registry-coverage.js.map +1 -0
  302. package/dist/registry-manifest-exclusions.d.ts +62 -0
  303. package/dist/registry-manifest-exclusions.d.ts.map +1 -0
  304. package/dist/registry-manifest-exclusions.js +163 -0
  305. package/dist/registry-manifest-exclusions.js.map +1 -0
  306. package/dist/registry-manifest.d.ts +117 -0
  307. package/dist/registry-manifest.d.ts.map +1 -0
  308. package/dist/registry-manifest.js +242 -0
  309. package/dist/registry-manifest.js.map +1 -0
  310. package/dist/registry.d.ts +60 -2
  311. package/dist/registry.d.ts.map +1 -1
  312. package/dist/registry.js +37 -1
  313. package/dist/registry.js.map +1 -1
  314. package/dist/shared/structural.d.ts +7 -0
  315. package/dist/shared/structural.d.ts.map +1 -1
  316. package/dist/shared/structural.js +7 -0
  317. package/dist/shared/structural.js.map +1 -1
  318. package/dist/subtype-rules.d.ts.map +1 -1
  319. package/dist/subtype-rules.js +97 -13
  320. package/dist/subtype-rules.js.map +1 -1
  321. package/dist/super-resolve.d.ts +49 -2
  322. package/dist/super-resolve.d.ts.map +1 -1
  323. package/dist/super-resolve.js +128 -43
  324. package/dist/super-resolve.js.map +1 -1
  325. package/dist/template/meta-template.d.ts +3 -2
  326. package/dist/template/meta-template.d.ts.map +1 -1
  327. package/dist/template/meta-template.js +3 -2
  328. package/dist/template/meta-template.js.map +1 -1
  329. package/dist/template/prompt-definition.embedded.d.ts +3 -0
  330. package/dist/template/prompt-definition.embedded.d.ts.map +1 -0
  331. package/dist/template/prompt-definition.embedded.js +368 -0
  332. package/dist/template/prompt-definition.embedded.js.map +1 -0
  333. package/dist/template/prompt-provider.d.ts +3 -0
  334. package/dist/template/prompt-provider.d.ts.map +1 -0
  335. package/dist/template/prompt-provider.js +25 -0
  336. package/dist/template/prompt-provider.js.map +1 -0
  337. package/dist/template/prompt-schema.d.ts +20 -0
  338. package/dist/template/prompt-schema.d.ts.map +1 -0
  339. package/dist/template/prompt-schema.js +70 -0
  340. package/dist/template/prompt-schema.js.map +1 -0
  341. package/dist/template/template-constants.d.ts +2 -0
  342. package/dist/template/template-constants.d.ts.map +1 -1
  343. package/dist/template/template-constants.js +7 -0
  344. package/dist/template/template-constants.js.map +1 -1
  345. package/dist/template/template-definition.embedded.d.ts +3 -0
  346. package/dist/template/template-definition.embedded.d.ts.map +1 -0
  347. package/dist/template/template-definition.embedded.js +30 -0
  348. package/dist/template/template-definition.embedded.js.map +1 -0
  349. package/dist/template/template-schema.d.ts.map +1 -1
  350. package/dist/template/template-schema.js +12 -4
  351. package/dist/template/template-schema.js.map +1 -1
  352. package/package.json +33 -22
  353. package/src/attr-schema-validate.ts +96 -4
  354. package/src/constraint-merge.ts +0 -0
  355. package/src/constraint-validate.ts +363 -0
  356. package/src/core/attr/attr-constants.ts +15 -3
  357. package/src/core/attr/attr-definition.embedded.ts +67 -0
  358. package/src/core/documentation/doc-constants.ts +3 -1
  359. package/src/core/documentation/doc-provider.ts +6 -2
  360. package/src/core/documentation/documentation-definition.embedded.ts +86 -0
  361. package/src/core/field/field-constants.ts +8 -7
  362. package/src/core/field/field-definition.embedded.ts +243 -0
  363. package/src/core/field/meta-field.ts +6 -7
  364. package/src/core/identity/identity-definition.embedded.ts +98 -0
  365. package/src/core/identity/validate-identity-passthrough.ts +194 -0
  366. package/src/core/object/object-constants.ts +3 -0
  367. package/src/core/object/object-definition.embedded.ts +117 -0
  368. package/src/core/object/validate-discriminator.ts +0 -4
  369. package/src/core/query/query-constants.ts +5 -3
  370. package/src/core/relationship/derive-m2m-fields.ts +145 -0
  371. package/src/core/relationship/meta-relationship.ts +15 -9
  372. package/src/core/relationship/relationship-constants.ts +6 -2
  373. package/src/core/relationship/relationship-definition.embedded.ts +317 -0
  374. package/src/core/validator/validator-definition.embedded.ts +141 -0
  375. package/src/core/yaml-desugar.ts +96 -7
  376. package/src/core-types.ts +289 -150
  377. package/src/errors.ts +78 -0
  378. package/src/index.ts +47 -2
  379. package/src/library/embedded-library.generated.ts +10 -0
  380. package/src/library/library-sources.ts +97 -0
  381. package/src/loader/meta-data-loader.ts +66 -7
  382. package/src/loader/shortcuts.ts +2 -2
  383. package/src/loader/validation-passes.ts +679 -33
  384. package/src/metamodel-docs/index.ts +41 -0
  385. package/src/metamodel-docs/provenance.ts +187 -0
  386. package/src/metamodel-docs/provider-definitions.ts +50 -0
  387. package/src/metamodel-docs/render.ts +309 -0
  388. package/src/naming-refs.ts +162 -0
  389. package/src/naming.ts +10 -2
  390. package/src/parser-core.ts +86 -8
  391. package/src/persistence/db/db-definition.embedded.ts +177 -0
  392. package/src/persistence/db/db-provider.ts +13 -18
  393. package/src/persistence/origin/origin-definition.embedded.ts +95 -0
  394. package/src/persistence/source/source-definition.embedded.ts +24 -0
  395. package/src/persistence/source/validate-source-parameter-ref.ts +7 -1
  396. package/src/persistence/source/validate-source-roles.ts +22 -1
  397. package/src/presentation/layout/layout-definition.embedded.ts +23 -0
  398. package/src/presentation/ui/ui-definition.embedded.ts +121 -0
  399. package/src/presentation/ui/ui-provider.ts +25 -0
  400. package/src/presentation/view/view-definition.embedded.ts +83 -0
  401. package/src/provider-data.ts +446 -0
  402. package/src/provider.ts +18 -0
  403. package/src/registry-coverage.ts +430 -0
  404. package/src/registry-manifest-exclusions.ts +176 -0
  405. package/src/registry-manifest.ts +334 -0
  406. package/src/registry.ts +90 -3
  407. package/src/shared/structural.ts +8 -0
  408. package/src/subtype-rules.ts +135 -18
  409. package/src/super-resolve.ts +153 -43
  410. package/src/template/meta-template.ts +3 -2
  411. package/src/template/prompt-definition.embedded.ts +375 -0
  412. package/src/template/prompt-provider.ts +29 -0
  413. package/src/template/template-constants.ts +8 -0
  414. package/src/template/template-definition.embedded.ts +37 -0
  415. package/src/core/documentation/doc-schema.ts +0 -64
  416. package/src/core/field/field-schema.ts +0 -228
  417. package/src/core/identity/identity-schema.ts +0 -80
  418. package/src/core/object/object-schema.ts +0 -35
  419. package/src/core/relationship/relationship-schema.ts +0 -67
  420. package/src/core/validator/validator-schema.ts +0 -50
  421. package/src/persistence/db/db-schema.ts +0 -50
  422. package/src/persistence/origin/origin-schema.ts +0 -80
  423. package/src/persistence/source/source-schema.ts +0 -129
  424. package/src/presentation/layout/layout-schema.ts +0 -62
  425. package/src/presentation/view/view-schema.ts +0 -21
  426. package/src/template/template-schema.ts +0 -211
@@ -0,0 +1,317 @@
1
+ // AUTO-GENERATED by scripts/generate-embedded-metamodel.ts — DO NOT EDIT.
2
+ // Canonical source: repo-root spec/metamodel/relationship.json
3
+ // Regenerate: bun run scripts/generate-embedded-metamodel.ts
4
+ //
5
+ // Embeds the canonical FR-033 ProviderDefinition so the provider can register
6
+ // itself wherever the on-disk spec/ tree is unavailable (bundled builds).
7
+ import type { ProviderDefinition } from "../../provider-data.js";
8
+
9
+ export const RELATIONSHIP_DEFINITION: ProviderDefinition = {
10
+ "provider": "metaobjects-core-types",
11
+ "types": [
12
+ {
13
+ "type": "relationship",
14
+ "subType": "base",
15
+ "description": "Abstract relationship base — shared shape for the concrete association/aggregation/composition subtypes; not authored directly.",
16
+ "rules": "@cardinality is an open string at the metamodel level ('one'/'many', and Java-canonical composite forms such as 'many-to-one'); @objectRef names the target entity. M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. @onDelete/@onUpdate carry referential actions (cascade/set-null/restrict/no-action).",
17
+ "children": [
18
+ {
19
+ "type": "attr",
20
+ "subType": "string",
21
+ "name": "cardinality",
22
+ "min": 0,
23
+ "max": 1,
24
+ "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')."
25
+ },
26
+ {
27
+ "type": "attr",
28
+ "subType": "string",
29
+ "name": "objectRef",
30
+ "min": 0,
31
+ "max": 1,
32
+ "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
33
+ },
34
+ {
35
+ "type": "attr",
36
+ "subType": "string",
37
+ "name": "through",
38
+ "min": 0,
39
+ "max": 1,
40
+ "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references."
41
+ },
42
+ {
43
+ "type": "attr",
44
+ "subType": "string",
45
+ "name": "sourceRefField",
46
+ "min": 0,
47
+ "max": 1,
48
+ "description": "Directed self-join disambiguator: names the source-side FK field on the junction (the other reference is the target side). Required only for directed/ambiguous self-join M:N. Mutually exclusive with @symmetric."
49
+ },
50
+ {
51
+ "type": "attr",
52
+ "subType": "boolean",
53
+ "name": "symmetric",
54
+ "min": 0,
55
+ "max": 1,
56
+ "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField."
57
+ },
58
+ {
59
+ "type": "attr",
60
+ "subType": "string",
61
+ "name": "onDelete",
62
+ "min": 0,
63
+ "max": 1,
64
+ "allowedValues": [
65
+ "cascade",
66
+ "set-null",
67
+ "restrict",
68
+ "no-action"
69
+ ],
70
+ "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)."
71
+ },
72
+ {
73
+ "type": "attr",
74
+ "subType": "string",
75
+ "name": "onUpdate",
76
+ "min": 0,
77
+ "max": 1,
78
+ "allowedValues": [
79
+ "cascade",
80
+ "set-null",
81
+ "restrict",
82
+ "no-action"
83
+ ],
84
+ "description": "Referential action on key update. Default cascade."
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "type": "relationship",
90
+ "subType": "association",
91
+ "description": "A plain reference to another entity — no ownership; the target has an independent lifecycle (default @onDelete restrict).",
92
+ "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Association is a plain reference — the target's lifecycle is independent (default @onDelete restrict).",
93
+ "children": [
94
+ {
95
+ "type": "attr",
96
+ "subType": "string",
97
+ "name": "cardinality",
98
+ "min": 0,
99
+ "max": 1,
100
+ "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')."
101
+ },
102
+ {
103
+ "type": "attr",
104
+ "subType": "string",
105
+ "name": "objectRef",
106
+ "min": 0,
107
+ "max": 1,
108
+ "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
109
+ },
110
+ {
111
+ "type": "attr",
112
+ "subType": "string",
113
+ "name": "through",
114
+ "min": 0,
115
+ "max": 1,
116
+ "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references."
117
+ },
118
+ {
119
+ "type": "attr",
120
+ "subType": "string",
121
+ "name": "sourceRefField",
122
+ "min": 0,
123
+ "max": 1,
124
+ "description": "Directed self-join disambiguator: names the source-side FK field on the junction (the other reference is the target side). Required only for directed/ambiguous self-join M:N. Mutually exclusive with @symmetric."
125
+ },
126
+ {
127
+ "type": "attr",
128
+ "subType": "boolean",
129
+ "name": "symmetric",
130
+ "min": 0,
131
+ "max": 1,
132
+ "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField."
133
+ },
134
+ {
135
+ "type": "attr",
136
+ "subType": "string",
137
+ "name": "onDelete",
138
+ "min": 0,
139
+ "max": 1,
140
+ "allowedValues": [
141
+ "cascade",
142
+ "set-null",
143
+ "restrict",
144
+ "no-action"
145
+ ],
146
+ "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)."
147
+ },
148
+ {
149
+ "type": "attr",
150
+ "subType": "string",
151
+ "name": "onUpdate",
152
+ "min": 0,
153
+ "max": 1,
154
+ "allowedValues": [
155
+ "cascade",
156
+ "set-null",
157
+ "restrict",
158
+ "no-action"
159
+ ],
160
+ "description": "Referential action on key update. Default cascade."
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "type": "relationship",
166
+ "subType": "aggregation",
167
+ "description": "A shared/independent containment — the parent groups the target but does not own its lifecycle (default @onDelete set-null).",
168
+ "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Aggregation is shared/independent — the target outlives the parent (default @onDelete set-null).",
169
+ "children": [
170
+ {
171
+ "type": "attr",
172
+ "subType": "string",
173
+ "name": "cardinality",
174
+ "min": 0,
175
+ "max": 1,
176
+ "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')."
177
+ },
178
+ {
179
+ "type": "attr",
180
+ "subType": "string",
181
+ "name": "objectRef",
182
+ "min": 0,
183
+ "max": 1,
184
+ "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
185
+ },
186
+ {
187
+ "type": "attr",
188
+ "subType": "string",
189
+ "name": "through",
190
+ "min": 0,
191
+ "max": 1,
192
+ "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references."
193
+ },
194
+ {
195
+ "type": "attr",
196
+ "subType": "string",
197
+ "name": "sourceRefField",
198
+ "min": 0,
199
+ "max": 1,
200
+ "description": "Directed self-join disambiguator: names the source-side FK field on the junction (the other reference is the target side). Required only for directed/ambiguous self-join M:N. Mutually exclusive with @symmetric."
201
+ },
202
+ {
203
+ "type": "attr",
204
+ "subType": "boolean",
205
+ "name": "symmetric",
206
+ "min": 0,
207
+ "max": 1,
208
+ "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField."
209
+ },
210
+ {
211
+ "type": "attr",
212
+ "subType": "string",
213
+ "name": "onDelete",
214
+ "min": 0,
215
+ "max": 1,
216
+ "allowedValues": [
217
+ "cascade",
218
+ "set-null",
219
+ "restrict",
220
+ "no-action"
221
+ ],
222
+ "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)."
223
+ },
224
+ {
225
+ "type": "attr",
226
+ "subType": "string",
227
+ "name": "onUpdate",
228
+ "min": 0,
229
+ "max": 1,
230
+ "allowedValues": [
231
+ "cascade",
232
+ "set-null",
233
+ "restrict",
234
+ "no-action"
235
+ ],
236
+ "description": "Referential action on key update. Default cascade."
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ "type": "relationship",
242
+ "subType": "composition",
243
+ "description": "An owned containment — the parent owns the target's lifecycle; deleting the parent deletes the children (default @onDelete cascade).",
244
+ "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Composition is owned lifecycle — the children do not outlive the parent (default @onDelete cascade).",
245
+ "children": [
246
+ {
247
+ "type": "attr",
248
+ "subType": "string",
249
+ "name": "cardinality",
250
+ "min": 0,
251
+ "max": 1,
252
+ "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')."
253
+ },
254
+ {
255
+ "type": "attr",
256
+ "subType": "string",
257
+ "name": "objectRef",
258
+ "min": 0,
259
+ "max": 1,
260
+ "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
261
+ },
262
+ {
263
+ "type": "attr",
264
+ "subType": "string",
265
+ "name": "through",
266
+ "min": 0,
267
+ "max": 1,
268
+ "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references."
269
+ },
270
+ {
271
+ "type": "attr",
272
+ "subType": "string",
273
+ "name": "sourceRefField",
274
+ "min": 0,
275
+ "max": 1,
276
+ "description": "Directed self-join disambiguator: names the source-side FK field on the junction (the other reference is the target side). Required only for directed/ambiguous self-join M:N. Mutually exclusive with @symmetric."
277
+ },
278
+ {
279
+ "type": "attr",
280
+ "subType": "boolean",
281
+ "name": "symmetric",
282
+ "min": 0,
283
+ "max": 1,
284
+ "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField."
285
+ },
286
+ {
287
+ "type": "attr",
288
+ "subType": "string",
289
+ "name": "onDelete",
290
+ "min": 0,
291
+ "max": 1,
292
+ "allowedValues": [
293
+ "cascade",
294
+ "set-null",
295
+ "restrict",
296
+ "no-action"
297
+ ],
298
+ "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)."
299
+ },
300
+ {
301
+ "type": "attr",
302
+ "subType": "string",
303
+ "name": "onUpdate",
304
+ "min": 0,
305
+ "max": 1,
306
+ "allowedValues": [
307
+ "cascade",
308
+ "set-null",
309
+ "restrict",
310
+ "no-action"
311
+ ],
312
+ "description": "Referential action on key update. Default cascade."
313
+ }
314
+ ]
315
+ }
316
+ ]
317
+ };
@@ -0,0 +1,141 @@
1
+ // AUTO-GENERATED by scripts/generate-embedded-metamodel.ts — DO NOT EDIT.
2
+ // Canonical source: repo-root spec/metamodel/validator.json
3
+ // Regenerate: bun run scripts/generate-embedded-metamodel.ts
4
+ //
5
+ // Embeds the canonical FR-033 ProviderDefinition so the provider can register
6
+ // itself wherever the on-disk spec/ tree is unavailable (bundled builds).
7
+ import type { ProviderDefinition } from "../../provider-data.js";
8
+
9
+ export const VALIDATOR_DEFINITION: ProviderDefinition = {
10
+ "provider": "metaobjects-core-types",
11
+ "types": [
12
+ {
13
+ "type": "validator",
14
+ "subType": "base",
15
+ "description": "Abstract base validator — the shared root subtype concrete validators specialize. Carries the @min/@max bounds attrs but enforces no rule of its own.",
16
+ "children": [
17
+ {
18
+ "type": "attr",
19
+ "subType": "int",
20
+ "name": "min",
21
+ "min": 0,
22
+ "max": 1,
23
+ "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)."
24
+ },
25
+ {
26
+ "type": "attr",
27
+ "subType": "int",
28
+ "name": "max",
29
+ "min": 0,
30
+ "max": 1,
31
+ "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)."
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ "type": "validator",
37
+ "subType": "required",
38
+ "description": "Fails when the value is null/empty (NOT NULL). Equivalent to @required on the owning field."
39
+ },
40
+ {
41
+ "type": "validator",
42
+ "subType": "length",
43
+ "description": "Bounds string length / collection size via @min/@max.",
44
+ "children": [
45
+ {
46
+ "type": "attr",
47
+ "subType": "int",
48
+ "name": "min",
49
+ "min": 0,
50
+ "max": 1,
51
+ "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)."
52
+ },
53
+ {
54
+ "type": "attr",
55
+ "subType": "int",
56
+ "name": "max",
57
+ "min": 0,
58
+ "max": 1,
59
+ "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)."
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "type": "validator",
65
+ "subType": "regex",
66
+ "description": "Requires the value match a regular expression (@pattern).",
67
+ "children": [
68
+ {
69
+ "type": "attr",
70
+ "subType": "int",
71
+ "name": "min",
72
+ "min": 0,
73
+ "max": 1,
74
+ "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)."
75
+ },
76
+ {
77
+ "type": "attr",
78
+ "subType": "int",
79
+ "name": "max",
80
+ "min": 0,
81
+ "max": 1,
82
+ "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)."
83
+ },
84
+ {
85
+ "type": "attr",
86
+ "subType": "string",
87
+ "name": "pattern",
88
+ "min": 0,
89
+ "max": 1,
90
+ "description": "Regular expression the value must match."
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "type": "validator",
96
+ "subType": "numeric",
97
+ "description": "Bounds a numeric value's magnitude via @min/@max.",
98
+ "children": [
99
+ {
100
+ "type": "attr",
101
+ "subType": "int",
102
+ "name": "min",
103
+ "min": 0,
104
+ "max": 1,
105
+ "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)."
106
+ },
107
+ {
108
+ "type": "attr",
109
+ "subType": "int",
110
+ "name": "max",
111
+ "min": 0,
112
+ "max": 1,
113
+ "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)."
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "type": "validator",
119
+ "subType": "array",
120
+ "description": "Bounds the element count of an array-valued field via @min/@max.",
121
+ "children": [
122
+ {
123
+ "type": "attr",
124
+ "subType": "int",
125
+ "name": "min",
126
+ "min": 0,
127
+ "max": 1,
128
+ "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)."
129
+ },
130
+ {
131
+ "type": "attr",
132
+ "subType": "int",
133
+ "name": "max",
134
+ "min": 0,
135
+ "max": 1,
136
+ "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)."
137
+ }
138
+ ]
139
+ }
140
+ ]
141
+ };
@@ -35,9 +35,13 @@ import {
35
35
  RESERVED_KEYS,
36
36
  RESERVED_KEY_CHILDREN,
37
37
  RESERVED_KEY_NAME,
38
+ RESERVED_KEY_PACKAGE,
39
+ RESERVED_KEY_EXTENDS,
38
40
  RESERVED_KEY_IS_ARRAY,
39
41
  TYPE_SUBTYPE_SEPARATOR,
42
+ PACKAGE_SEPARATOR,
40
43
  } from "../shared/structural.js";
44
+ import { expandRef, REF_BEARING_ATTR_NAMES } from "../naming-refs.js";
41
45
  import {
42
46
  getPositionMap,
43
47
  setPositionMap,
@@ -72,10 +76,34 @@ export interface DesugarResult {
72
76
  /** Desugar a parsed-YAML authoring document into a canonical-shaped object. */
73
77
  export function desugar(input: unknown, registry: TypeRegistry): DesugarResult {
74
78
  const errors: CollectedError[] = [];
75
- const node = desugarNode(input, registry, errors, "<root>");
79
+ // FR-032 (ADR-0032): the desugar threads the effective package context down
80
+ // the tree so every ref-bearing attr (extends + @objectRef/@references/@from/
81
+ // @of/@via/@parameterRef/@payloadRef/@responseRef) is expanded to its FQN via
82
+ // expandRef. The root context is empty (the metadata.root's own `package`
83
+ // body key seeds the first real context inside desugarNode).
84
+ const node = desugarNode(input, registry, errors, "<root>", "");
76
85
  return { canonical: node ?? {}, errors };
77
86
  }
78
87
 
88
+ // FR-032: compute a node's effective package from its raw `package` body key
89
+ // (inheriting the parent context when absent). Mirrors parser-core's
90
+ // expandPackageForPath so the desugar's ref-expansion context matches the JSON
91
+ // loader's package resolution. The `package` attr itself is NEVER ref-expanded
92
+ // (ADR-0032 §2.1 — it is the node's identity, taken literally/absolute).
93
+ function effectivePackageFor(rawBody: unknown, parentPkg: string): string {
94
+ if (typeof rawBody !== "object" || rawBody === null || Array.isArray(rawBody)) {
95
+ return parentPkg;
96
+ }
97
+ const rawPkg = (rawBody as Record<string, unknown>)[RESERVED_KEY_PACKAGE];
98
+ if (typeof rawPkg !== "string") return parentPkg;
99
+ // Legacy expandPackageForPath: a leading "::" on a child package prepends the
100
+ // parent; otherwise it is used as-is.
101
+ if (parentPkg !== "" && rawPkg.startsWith(PACKAGE_SEPARATOR)) {
102
+ return parentPkg + rawPkg;
103
+ }
104
+ return rawPkg;
105
+ }
106
+
79
107
  // Desugar one node — a single-key mapping { "type.subType": body }.
80
108
  // Returns the canonical node object, or undefined if `input` is not a usable
81
109
  // node (the caller substitutes a placeholder).
@@ -84,6 +112,7 @@ function desugarNode(
84
112
  registry: TypeRegistry,
85
113
  errors: CollectedError[],
86
114
  path: string,
115
+ parentPkg: string,
87
116
  ): Record<string, unknown> | undefined {
88
117
  if (typeof input !== "object" || input === null || Array.isArray(input)) {
89
118
  errors.push({ message: `Node at ${path} must be a mapping with one type key` });
@@ -120,11 +149,16 @@ function desugarNode(
120
149
  // Rule 1: a bare `type` key → the type's registry default subType.
121
150
  const canonicalKey = resolveKey(key, registry, errors, path);
122
151
 
152
+ // FR-032: this node's effective package context (its own `package` body key,
153
+ // else inherited). Used to expand its ref-bearing attrs AND threaded to its
154
+ // children so their bare/relative refs resolve against the right package.
155
+ const nodePkg = effectivePackageFor(rawBody, parentPkg);
156
+
123
157
  // Rule 2: a scalar body → { name: <scalar> }.
124
158
  // FR5b — propagate the wrapper-key's position into the synthesized body
125
159
  // when the input body was a scalar (no body-side positions to inherit).
126
160
  const wrapperKeyPos = wrapperPositions?.[rawKey];
127
- const body = desugarBody(rawBody, registry, canonicalKey, errors, path, wrapperKeyPos);
161
+ const body = desugarBody(rawBody, registry, canonicalKey, errors, path, wrapperKeyPos, nodePkg);
128
162
 
129
163
  // Rule 4 (cont.): stamp isArray onto the canonical body.
130
164
  if (isArray) body[RESERVED_KEY_IS_ARRAY] = true;
@@ -135,7 +169,7 @@ function desugarNode(
135
169
  const children: unknown[] = [];
136
170
  for (let i = 0; i < rawChildren.length; i++) {
137
171
  const childPath = `${path}.${RESERVED_KEY_CHILDREN}[${i}]`;
138
- const child = desugarNode(rawChildren[i], registry, errors, childPath);
172
+ const child = desugarNode(rawChildren[i], registry, errors, childPath, nodePkg);
139
173
  // On a bad child keep an empty-object placeholder so sibling indices
140
174
  // stay stable; the error is already collected.
141
175
  children.push(child ?? {});
@@ -196,6 +230,10 @@ function desugarBody(
196
230
  * empty bodies; for mapping bodies we use the body's own position-by-key
197
231
  * map. */
198
232
  wrapperKeyPos: { line: number; col: number } | undefined,
233
+ /** FR-032: this node's effective package context, used to expand its
234
+ * ref-bearing attrs (extends + @objectRef/@references/@from/@of/@via/
235
+ * @parameterRef/@payloadRef/@responseRef) to FQN via expandRef. */
236
+ nodePkg: string,
199
237
  ): Record<string, unknown> {
200
238
  if (
201
239
  typeof rawBody === "string" ||
@@ -241,16 +279,27 @@ function desugarBody(
241
279
  for (const key of Object.keys(src)) {
242
280
  let outKey: string;
243
281
  if (RESERVED_KEYS.has(key) || key.startsWith(ATTR_PREFIX)) {
244
- out[key] = src[key];
245
282
  outKey = key;
246
- // D2 also applies to author-written @-keys (the awkward form).
283
+ // FR-032: expand a ref-bearing value to FQN. `extends` (reserved) and the
284
+ // @-prefixed ref attrs are expanded; everything else is copied verbatim.
247
285
  const attrName = key.startsWith(ATTR_PREFIX) ? key.slice(ATTR_PREFIX.length) : "";
286
+ if (key === RESERVED_KEY_EXTENDS || (attrName !== "" && REF_BEARING_ATTR_NAMES.has(attrName))) {
287
+ out[key] = expandRefValue(src[key], nodePkg, errors, path, key);
288
+ } else {
289
+ out[key] = src[key];
290
+ }
291
+ // D2 also applies to author-written @-keys (the awkward form).
248
292
  if (attrName !== "" && !RESERVED_KEYS.has(attrName)) {
249
293
  checkCoercion(attrName, src[key], schemaIndex, errors, path);
250
294
  }
251
295
  } else {
252
296
  outKey = `${ATTR_PREFIX}${key}`;
253
- out[outKey] = src[key];
297
+ // FR-032: a bare (sigil-free) ref-bearing attr is expanded to FQN too.
298
+ if (REF_BEARING_ATTR_NAMES.has(key)) {
299
+ out[outKey] = expandRefValue(src[key], nodePkg, errors, path, outKey);
300
+ } else {
301
+ out[outKey] = src[key];
302
+ }
254
303
  checkCoercion(key, src[key], schemaIndex, errors, path);
255
304
  }
256
305
  const pos = srcPositions?.[key];
@@ -263,6 +312,41 @@ function desugarBody(
263
312
  return out;
264
313
  }
265
314
 
315
+ // ---------------------------------------------------------------------------
316
+ // FR-032 (ADR-0032) — expand a ref-bearing value to FQN.
317
+ //
318
+ // A ref value is a single string (most refs) or a string-array (@references can
319
+ // carry multiple). expandRef preserves any FR-024 dotted child suffix and the
320
+ // `package` attr is never touched here (it is not a ref). A parent-relative
321
+ // over-drop (more `..::` than the package has segments) throws inside expandRef;
322
+ // we collect it as ERR_BAD_ATTR_VALUE and pass the raw value through so the rest
323
+ // of the desugar/load proceeds and surfaces a single actionable error.
324
+ // ---------------------------------------------------------------------------
325
+
326
+ function expandRefValue(
327
+ raw: unknown,
328
+ nodePkg: string,
329
+ errors: CollectedError[],
330
+ path: string,
331
+ refLabel: string,
332
+ ): unknown {
333
+ if (typeof raw === "string") {
334
+ try {
335
+ return expandRef(raw, nodePkg);
336
+ } catch (err) {
337
+ errors.push({
338
+ message: `Cannot expand reference '${refLabel}' at ${path}: ${(err as Error).message}`,
339
+ code: "ERR_BAD_ATTR_VALUE",
340
+ });
341
+ return raw;
342
+ }
343
+ }
344
+ if (Array.isArray(raw)) {
345
+ return raw.map((el) => (typeof el === "string" ? expandRefValue(el, nodePkg, errors, path, refLabel) : el));
346
+ }
347
+ return raw;
348
+ }
349
+
266
350
  // ---------------------------------------------------------------------------
267
351
  // D2 — YAML type-coercion guard
268
352
  // ---------------------------------------------------------------------------
@@ -301,7 +385,12 @@ function checkCoercion(
301
385
  const spec = schemaIndex.get(attrName);
302
386
  if (spec === undefined || spec.valueType === undefined) return;
303
387
 
304
- switch (spec.valueType) {
388
+ // Array-valued attr (the `string` + `isArray` model that replaced the
389
+ // `stringarray` subtype): validate as a string-array regardless of the scalar
390
+ // valueType token.
391
+ const effectiveValueType = spec.isArray === true ? ATTR_SUBTYPE_STRINGARRAY : spec.valueType;
392
+
393
+ switch (effectiveValueType) {
305
394
  case ATTR_SUBTYPE_STRING:
306
395
  case ATTR_SUBTYPE_CLASS:
307
396
  if (typeof raw !== "string") emitCoercion(attrName, raw, "string", errors, path);