@metaobjectsdev/metadata 0.9.0 → 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.
- package/dist/attr-schema-validate.d.ts +1 -1
- package/dist/attr-schema-validate.d.ts.map +1 -1
- package/dist/attr-schema-validate.js +84 -7
- package/dist/attr-schema-validate.js.map +1 -1
- package/dist/constants.d.ts +208 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +419 -0
- package/dist/constants.js.map +1 -0
- package/dist/constraint-merge.d.ts +18 -0
- package/dist/constraint-merge.d.ts.map +1 -0
- package/dist/constraint-merge.js +0 -0
- package/dist/constraint-merge.js.map +1 -0
- package/dist/constraint-validate.d.ts +6 -0
- package/dist/constraint-validate.d.ts.map +1 -0
- package/dist/constraint-validate.js +274 -0
- package/dist/constraint-validate.js.map +1 -0
- package/dist/core/attr/attr-constants.d.ts +13 -3
- package/dist/core/attr/attr-constants.d.ts.map +1 -1
- package/dist/core/attr/attr-constants.js +11 -2
- package/dist/core/attr/attr-constants.js.map +1 -1
- package/dist/core/attr/attr-definition.embedded.d.ts +3 -0
- package/dist/core/attr/attr-definition.embedded.d.ts.map +1 -0
- package/dist/core/attr/attr-definition.embedded.js +60 -0
- package/dist/core/attr/attr-definition.embedded.js.map +1 -0
- package/dist/core/documentation/doc-constants.d.ts +3 -2
- package/dist/core/documentation/doc-constants.d.ts.map +1 -1
- package/dist/core/documentation/doc-constants.js +3 -1
- package/dist/core/documentation/doc-constants.js.map +1 -1
- package/dist/core/documentation/doc-provider.d.ts.map +1 -1
- package/dist/core/documentation/doc-provider.js +6 -2
- package/dist/core/documentation/doc-provider.js.map +1 -1
- package/dist/core/documentation/doc-schema.d.ts +1 -1
- package/dist/core/documentation/doc-schema.d.ts.map +1 -1
- package/dist/core/documentation/doc-schema.js +13 -5
- package/dist/core/documentation/doc-schema.js.map +1 -1
- package/dist/core/documentation/documentation-definition.embedded.d.ts +3 -0
- package/dist/core/documentation/documentation-definition.embedded.d.ts.map +1 -0
- package/dist/core/documentation/documentation-definition.embedded.js +79 -0
- package/dist/core/documentation/documentation-definition.embedded.js.map +1 -0
- package/dist/core/field/field-constants.d.ts +7 -4
- package/dist/core/field/field-constants.d.ts.map +1 -1
- package/dist/core/field/field-constants.js +7 -7
- package/dist/core/field/field-constants.js.map +1 -1
- package/dist/core/field/field-definition.embedded.d.ts +3 -0
- package/dist/core/field/field-definition.embedded.d.ts.map +1 -0
- package/dist/core/field/field-definition.embedded.js +236 -0
- package/dist/core/field/field-definition.embedded.js.map +1 -0
- package/dist/core/field/field-schema.d.ts +0 -16
- package/dist/core/field/field-schema.d.ts.map +1 -1
- package/dist/core/field/field-schema.js +10 -158
- package/dist/core/field/field-schema.js.map +1 -1
- package/dist/core/field/meta-field.d.ts.map +1 -1
- package/dist/core/field/meta-field.js +7 -5
- package/dist/core/field/meta-field.js.map +1 -1
- package/dist/core/file-meta-data-loader.d.ts +18 -0
- package/dist/core/file-meta-data-loader.d.ts.map +1 -0
- package/dist/core/file-meta-data-loader.js +81 -0
- package/dist/core/file-meta-data-loader.js.map +1 -0
- package/dist/core/file-source.d.ts +12 -0
- package/dist/core/file-source.d.ts.map +1 -0
- package/dist/core/file-source.js +46 -0
- package/dist/core/file-source.js.map +1 -0
- package/dist/core/identity/identity-definition.embedded.d.ts +3 -0
- package/dist/core/identity/identity-definition.embedded.d.ts.map +1 -0
- package/dist/core/identity/identity-definition.embedded.js +91 -0
- package/dist/core/identity/identity-definition.embedded.js.map +1 -0
- package/dist/core/identity/identity-schema.d.ts.map +1 -1
- package/dist/core/identity/identity-schema.js +3 -2
- package/dist/core/identity/identity-schema.js.map +1 -1
- package/dist/core/identity/validate-identity-passthrough.d.ts +42 -0
- package/dist/core/identity/validate-identity-passthrough.d.ts.map +1 -0
- package/dist/core/identity/validate-identity-passthrough.js +158 -0
- package/dist/core/identity/validate-identity-passthrough.js.map +1 -0
- package/dist/core/object/object-constants.d.ts +2 -1
- package/dist/core/object/object-constants.d.ts.map +1 -1
- package/dist/core/object/object-constants.js +3 -0
- package/dist/core/object/object-constants.js.map +1 -1
- package/dist/core/object/object-definition.embedded.d.ts +3 -0
- package/dist/core/object/object-definition.embedded.d.ts.map +1 -0
- package/dist/core/object/object-definition.embedded.js +110 -0
- package/dist/core/object/object-definition.embedded.js.map +1 -0
- package/dist/core/object/validate-discriminator.d.ts.map +1 -1
- package/dist/core/object/validate-discriminator.js +1 -3
- package/dist/core/object/validate-discriminator.js.map +1 -1
- package/dist/core/query/query-constants.d.ts.map +1 -1
- package/dist/core/query/query-constants.js +5 -3
- package/dist/core/query/query-constants.js.map +1 -1
- package/dist/core/relationship/derive-m2m-fields.d.ts +26 -0
- package/dist/core/relationship/derive-m2m-fields.d.ts.map +1 -0
- package/dist/core/relationship/derive-m2m-fields.js +102 -0
- package/dist/core/relationship/derive-m2m-fields.js.map +1 -0
- package/dist/core/relationship/meta-relationship.d.ts +6 -4
- package/dist/core/relationship/meta-relationship.d.ts.map +1 -1
- package/dist/core/relationship/meta-relationship.js +12 -8
- package/dist/core/relationship/meta-relationship.js.map +1 -1
- package/dist/core/relationship/relationship-constants.d.ts +6 -2
- package/dist/core/relationship/relationship-constants.d.ts.map +1 -1
- package/dist/core/relationship/relationship-constants.js +6 -2
- package/dist/core/relationship/relationship-constants.js.map +1 -1
- package/dist/core/relationship/relationship-definition.embedded.d.ts +3 -0
- package/dist/core/relationship/relationship-definition.embedded.d.ts.map +1 -0
- package/dist/core/relationship/relationship-definition.embedded.js +310 -0
- package/dist/core/relationship/relationship-definition.embedded.js.map +1 -0
- package/dist/core/relationship/relationship-schema.d.ts.map +1 -1
- package/dist/core/relationship/relationship-schema.js +13 -7
- package/dist/core/relationship/relationship-schema.js.map +1 -1
- package/dist/core/validator/validator-definition.embedded.d.ts +3 -0
- package/dist/core/validator/validator-definition.embedded.d.ts.map +1 -0
- package/dist/core/validator/validator-definition.embedded.js +134 -0
- package/dist/core/validator/validator-definition.embedded.js.map +1 -0
- package/dist/core/yaml-desugar.d.ts.map +1 -1
- package/dist/core/yaml-desugar.js +88 -10
- package/dist/core/yaml-desugar.js.map +1 -1
- package/dist/core-attr-schemas.d.ts +22 -0
- package/dist/core-attr-schemas.d.ts.map +1 -0
- package/dist/core-attr-schemas.js +324 -0
- package/dist/core-attr-schemas.js.map +1 -0
- package/dist/core-types.d.ts +5 -2
- package/dist/core-types.d.ts.map +1 -1
- package/dist/core-types.js +261 -115
- package/dist/core-types.js.map +1 -1
- package/dist/db/db-attr-schemas.d.ts +8 -0
- package/dist/db/db-attr-schemas.d.ts.map +1 -0
- package/dist/db/db-attr-schemas.js +26 -0
- package/dist/db/db-attr-schemas.js.map +1 -0
- package/dist/db/db-provider.d.ts +3 -0
- package/dist/db/db-provider.d.ts.map +1 -0
- package/dist/db/db-provider.js +28 -0
- package/dist/db/db-provider.js.map +1 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +78 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/library/embedded-library.generated.d.ts +2 -0
- package/dist/library/embedded-library.generated.d.ts.map +1 -0
- package/dist/library/embedded-library.generated.js +11 -0
- package/dist/library/embedded-library.generated.js.map +1 -0
- package/dist/library/library-sources.d.ts +12 -0
- package/dist/library/library-sources.d.ts.map +1 -0
- package/dist/library/library-sources.js +88 -0
- package/dist/library/library-sources.js.map +1 -0
- package/dist/loader/meta-data-loader.d.ts +10 -2
- package/dist/loader/meta-data-loader.d.ts.map +1 -1
- package/dist/loader/meta-data-loader.js +47 -6
- package/dist/loader/meta-data-loader.js.map +1 -1
- package/dist/loader/shortcuts.d.ts +2 -5
- package/dist/loader/shortcuts.d.ts.map +1 -1
- package/dist/loader/shortcuts.js.map +1 -1
- package/dist/loader/validation-passes.d.ts +3 -0
- package/dist/loader/validation-passes.d.ts.map +1 -1
- package/dist/loader/validation-passes.js +513 -33
- package/dist/loader/validation-passes.js.map +1 -1
- package/dist/meta/find-reference.d.ts +22 -0
- package/dist/meta/find-reference.d.ts.map +1 -0
- package/dist/meta/find-reference.js +29 -0
- package/dist/meta/find-reference.js.map +1 -0
- package/dist/meta/meta-attr.d.ts +8 -0
- package/dist/meta/meta-attr.d.ts.map +1 -0
- package/dist/meta/meta-attr.js +17 -0
- package/dist/meta/meta-attr.js.map +1 -0
- package/dist/meta/meta-data.d.ts +107 -0
- package/dist/meta/meta-data.d.ts.map +1 -0
- package/dist/meta/meta-data.js +302 -0
- package/dist/meta/meta-data.js.map +1 -0
- package/dist/meta/meta-field.d.ts +48 -0
- package/dist/meta/meta-field.d.ts.map +1 -0
- package/dist/meta/meta-field.js +94 -0
- package/dist/meta/meta-field.js.map +1 -0
- package/dist/meta/meta-identity.d.ts +71 -0
- package/dist/meta/meta-identity.d.ts.map +1 -0
- package/dist/meta/meta-identity.js +129 -0
- package/dist/meta/meta-identity.js.map +1 -0
- package/dist/meta/meta-layout.d.ts +23 -0
- package/dist/meta/meta-layout.d.ts.map +1 -0
- package/dist/meta/meta-layout.js +45 -0
- package/dist/meta/meta-layout.js.map +1 -0
- package/dist/meta/meta-object.d.ts +40 -0
- package/dist/meta/meta-object.d.ts.map +1 -0
- package/dist/meta/meta-object.js +81 -0
- package/dist/meta/meta-object.js.map +1 -0
- package/dist/meta/meta-origin.d.ts +32 -0
- package/dist/meta/meta-origin.d.ts.map +1 -0
- package/dist/meta/meta-origin.js +55 -0
- package/dist/meta/meta-origin.js.map +1 -0
- package/dist/meta/meta-relationship.d.ts +11 -0
- package/dist/meta/meta-relationship.d.ts.map +1 -0
- package/dist/meta/meta-relationship.js +27 -0
- package/dist/meta/meta-relationship.js.map +1 -0
- package/dist/meta/meta-root.d.ts +12 -0
- package/dist/meta/meta-root.d.ts.map +1 -0
- package/dist/meta/meta-root.js +24 -0
- package/dist/meta/meta-root.js.map +1 -0
- package/dist/meta/meta-source.d.ts +18 -0
- package/dist/meta/meta-source.d.ts.map +1 -0
- package/dist/meta/meta-source.js +31 -0
- package/dist/meta/meta-source.js.map +1 -0
- package/dist/meta/meta-validator.d.ts +29 -0
- package/dist/meta/meta-validator.d.ts.map +1 -0
- package/dist/meta/meta-validator.js +49 -0
- package/dist/meta/meta-validator.js.map +1 -0
- package/dist/meta/meta-view.d.ts +4 -0
- package/dist/meta/meta-view.d.ts.map +1 -0
- package/dist/meta/meta-view.js +8 -0
- package/dist/meta/meta-view.js.map +1 -0
- package/dist/metamodel-docs/index.d.ts +19 -0
- package/dist/metamodel-docs/index.d.ts.map +1 -0
- package/dist/metamodel-docs/index.js +37 -0
- package/dist/metamodel-docs/index.js.map +1 -0
- package/dist/metamodel-docs/provenance.d.ts +42 -0
- package/dist/metamodel-docs/provenance.d.ts.map +1 -0
- package/dist/metamodel-docs/provenance.js +148 -0
- package/dist/metamodel-docs/provenance.js.map +1 -0
- package/dist/metamodel-docs/provider-definitions.d.ts +8 -0
- package/dist/metamodel-docs/provider-definitions.d.ts.map +1 -0
- package/dist/metamodel-docs/provider-definitions.js +48 -0
- package/dist/metamodel-docs/provider-definitions.js.map +1 -0
- package/dist/metamodel-docs/render.d.ts +12 -0
- package/dist/metamodel-docs/render.d.ts.map +1 -0
- package/dist/metamodel-docs/render.js +252 -0
- package/dist/metamodel-docs/render.js.map +1 -0
- package/dist/naming-refs.d.ts +41 -0
- package/dist/naming-refs.d.ts.map +1 -0
- package/dist/naming-refs.js +144 -0
- package/dist/naming-refs.js.map +1 -0
- package/dist/naming.d.ts.map +1 -1
- package/dist/naming.js +10 -2
- package/dist/naming.js.map +1 -1
- package/dist/parser-core.d.ts.map +1 -1
- package/dist/parser-core.js +74 -8
- package/dist/parser-core.js.map +1 -1
- package/dist/persistence/db/db-attr-schemas.d.ts +8 -0
- package/dist/persistence/db/db-attr-schemas.d.ts.map +1 -0
- package/dist/persistence/db/db-attr-schemas.js +28 -0
- package/dist/persistence/db/db-attr-schemas.js.map +1 -0
- package/dist/persistence/db/db-definition.embedded.d.ts +3 -0
- package/dist/persistence/db/db-definition.embedded.d.ts.map +1 -0
- package/dist/persistence/db/db-definition.embedded.js +170 -0
- package/dist/persistence/db/db-definition.embedded.js.map +1 -0
- package/dist/persistence/db/db-provider.d.ts.map +1 -1
- package/dist/persistence/db/db-provider.js +13 -18
- package/dist/persistence/db/db-provider.js.map +1 -1
- package/dist/persistence/db/db-schema.d.ts +14 -0
- package/dist/persistence/db/db-schema.d.ts.map +1 -1
- package/dist/persistence/db/db-schema.js +27 -0
- package/dist/persistence/db/db-schema.js.map +1 -1
- package/dist/persistence/origin/origin-definition.embedded.d.ts +3 -0
- package/dist/persistence/origin/origin-definition.embedded.d.ts.map +1 -0
- package/dist/persistence/origin/origin-definition.embedded.js +88 -0
- package/dist/persistence/origin/origin-definition.embedded.js.map +1 -0
- package/dist/persistence/origin/origin-schema.d.ts.map +1 -1
- package/dist/persistence/origin/origin-schema.js +7 -3
- package/dist/persistence/origin/origin-schema.js.map +1 -1
- package/dist/persistence/source/source-definition.embedded.d.ts +3 -0
- package/dist/persistence/source/source-definition.embedded.d.ts.map +1 -0
- package/dist/persistence/source/source-definition.embedded.js +17 -0
- package/dist/persistence/source/source-definition.embedded.js.map +1 -0
- package/dist/persistence/source/validate-source-parameter-ref.d.ts.map +1 -1
- package/dist/persistence/source/validate-source-parameter-ref.js +7 -1
- package/dist/persistence/source/validate-source-parameter-ref.js.map +1 -1
- package/dist/persistence/source/validate-source-roles.d.ts.map +1 -1
- package/dist/persistence/source/validate-source-roles.js +16 -1
- package/dist/persistence/source/validate-source-roles.js.map +1 -1
- package/dist/presentation/layout/layout-definition.embedded.d.ts +3 -0
- package/dist/presentation/layout/layout-definition.embedded.d.ts.map +1 -0
- package/dist/presentation/layout/layout-definition.embedded.js +16 -0
- package/dist/presentation/layout/layout-definition.embedded.js.map +1 -0
- package/dist/presentation/layout/layout-schema.d.ts.map +1 -1
- package/dist/presentation/layout/layout-schema.js +3 -2
- package/dist/presentation/layout/layout-schema.js.map +1 -1
- package/dist/presentation/ui/ui-definition.embedded.d.ts +3 -0
- package/dist/presentation/ui/ui-definition.embedded.d.ts.map +1 -0
- package/dist/presentation/ui/ui-definition.embedded.js +114 -0
- package/dist/presentation/ui/ui-definition.embedded.js.map +1 -0
- package/dist/presentation/ui/ui-provider.d.ts +3 -0
- package/dist/presentation/ui/ui-provider.d.ts.map +1 -0
- package/dist/presentation/ui/ui-provider.js +21 -0
- package/dist/presentation/ui/ui-provider.js.map +1 -0
- package/dist/presentation/ui/ui-schema.d.ts +10 -0
- package/dist/presentation/ui/ui-schema.d.ts.map +1 -0
- package/dist/presentation/ui/ui-schema.js +41 -0
- package/dist/presentation/ui/ui-schema.js.map +1 -0
- package/dist/presentation/view/view-definition.embedded.d.ts +3 -0
- package/dist/presentation/view/view-definition.embedded.d.ts.map +1 -0
- package/dist/presentation/view/view-definition.embedded.js +76 -0
- package/dist/presentation/view/view-definition.embedded.js.map +1 -0
- package/dist/provider-data.d.ts +169 -0
- package/dist/provider-data.d.ts.map +1 -0
- package/dist/provider-data.js +269 -0
- package/dist/provider-data.js.map +1 -0
- package/dist/provider.d.ts +3 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +15 -1
- package/dist/provider.js.map +1 -1
- package/dist/registry-coverage.d.ts +99 -0
- package/dist/registry-coverage.d.ts.map +1 -0
- package/dist/registry-coverage.js +294 -0
- package/dist/registry-coverage.js.map +1 -0
- package/dist/registry-manifest-exclusions.d.ts +62 -0
- package/dist/registry-manifest-exclusions.d.ts.map +1 -0
- package/dist/registry-manifest-exclusions.js +163 -0
- package/dist/registry-manifest-exclusions.js.map +1 -0
- package/dist/registry-manifest.d.ts +117 -0
- package/dist/registry-manifest.d.ts.map +1 -0
- package/dist/registry-manifest.js +242 -0
- package/dist/registry-manifest.js.map +1 -0
- package/dist/registry.d.ts +60 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +37 -1
- package/dist/registry.js.map +1 -1
- package/dist/shared/structural.d.ts +7 -0
- package/dist/shared/structural.d.ts.map +1 -1
- package/dist/shared/structural.js +7 -0
- package/dist/shared/structural.js.map +1 -1
- package/dist/subtype-rules.d.ts.map +1 -1
- package/dist/subtype-rules.js +97 -13
- package/dist/subtype-rules.js.map +1 -1
- package/dist/super-resolve.d.ts +49 -2
- package/dist/super-resolve.d.ts.map +1 -1
- package/dist/super-resolve.js +128 -43
- package/dist/super-resolve.js.map +1 -1
- package/dist/template/meta-template.d.ts +3 -2
- package/dist/template/meta-template.d.ts.map +1 -1
- package/dist/template/meta-template.js +3 -2
- package/dist/template/meta-template.js.map +1 -1
- package/dist/template/prompt-definition.embedded.d.ts +3 -0
- package/dist/template/prompt-definition.embedded.d.ts.map +1 -0
- package/dist/template/prompt-definition.embedded.js +368 -0
- package/dist/template/prompt-definition.embedded.js.map +1 -0
- package/dist/template/prompt-provider.d.ts +3 -0
- package/dist/template/prompt-provider.d.ts.map +1 -0
- package/dist/template/prompt-provider.js +25 -0
- package/dist/template/prompt-provider.js.map +1 -0
- package/dist/template/prompt-schema.d.ts +20 -0
- package/dist/template/prompt-schema.d.ts.map +1 -0
- package/dist/template/prompt-schema.js +70 -0
- package/dist/template/prompt-schema.js.map +1 -0
- package/dist/template/template-constants.d.ts +2 -0
- package/dist/template/template-constants.d.ts.map +1 -1
- package/dist/template/template-constants.js +7 -0
- package/dist/template/template-constants.js.map +1 -1
- package/dist/template/template-definition.embedded.d.ts +3 -0
- package/dist/template/template-definition.embedded.d.ts.map +1 -0
- package/dist/template/template-definition.embedded.js +30 -0
- package/dist/template/template-definition.embedded.js.map +1 -0
- package/dist/template/template-schema.d.ts.map +1 -1
- package/dist/template/template-schema.js +12 -4
- package/dist/template/template-schema.js.map +1 -1
- package/package.json +33 -22
- package/src/attr-schema-validate.ts +96 -4
- package/src/constraint-merge.ts +0 -0
- package/src/constraint-validate.ts +363 -0
- package/src/core/attr/attr-constants.ts +15 -3
- package/src/core/attr/attr-definition.embedded.ts +67 -0
- package/src/core/documentation/doc-constants.ts +3 -1
- package/src/core/documentation/doc-provider.ts +6 -2
- package/src/core/documentation/documentation-definition.embedded.ts +86 -0
- package/src/core/field/field-constants.ts +8 -7
- package/src/core/field/field-definition.embedded.ts +243 -0
- package/src/core/field/meta-field.ts +6 -7
- package/src/core/identity/identity-definition.embedded.ts +98 -0
- package/src/core/identity/validate-identity-passthrough.ts +194 -0
- package/src/core/object/object-constants.ts +3 -0
- package/src/core/object/object-definition.embedded.ts +117 -0
- package/src/core/object/validate-discriminator.ts +0 -4
- package/src/core/query/query-constants.ts +5 -3
- package/src/core/relationship/derive-m2m-fields.ts +145 -0
- package/src/core/relationship/meta-relationship.ts +15 -9
- package/src/core/relationship/relationship-constants.ts +6 -2
- package/src/core/relationship/relationship-definition.embedded.ts +317 -0
- package/src/core/validator/validator-definition.embedded.ts +141 -0
- package/src/core/yaml-desugar.ts +96 -7
- package/src/core-types.ts +289 -150
- package/src/errors.ts +78 -0
- package/src/index.ts +47 -2
- package/src/library/embedded-library.generated.ts +10 -0
- package/src/library/library-sources.ts +97 -0
- package/src/loader/meta-data-loader.ts +66 -7
- package/src/loader/shortcuts.ts +2 -2
- package/src/loader/validation-passes.ts +679 -33
- package/src/metamodel-docs/index.ts +41 -0
- package/src/metamodel-docs/provenance.ts +187 -0
- package/src/metamodel-docs/provider-definitions.ts +50 -0
- package/src/metamodel-docs/render.ts +309 -0
- package/src/naming-refs.ts +162 -0
- package/src/naming.ts +10 -2
- package/src/parser-core.ts +86 -8
- package/src/persistence/db/db-definition.embedded.ts +177 -0
- package/src/persistence/db/db-provider.ts +13 -18
- package/src/persistence/origin/origin-definition.embedded.ts +95 -0
- package/src/persistence/source/source-definition.embedded.ts +24 -0
- package/src/persistence/source/validate-source-parameter-ref.ts +7 -1
- package/src/persistence/source/validate-source-roles.ts +22 -1
- package/src/presentation/layout/layout-definition.embedded.ts +23 -0
- package/src/presentation/ui/ui-definition.embedded.ts +121 -0
- package/src/presentation/ui/ui-provider.ts +25 -0
- package/src/presentation/view/view-definition.embedded.ts +83 -0
- package/src/provider-data.ts +446 -0
- package/src/provider.ts +18 -0
- package/src/registry-coverage.ts +430 -0
- package/src/registry-manifest-exclusions.ts +176 -0
- package/src/registry-manifest.ts +334 -0
- package/src/registry.ts +90 -3
- package/src/shared/structural.ts +8 -0
- package/src/subtype-rules.ts +135 -18
- package/src/super-resolve.ts +153 -43
- package/src/template/meta-template.ts +3 -2
- package/src/template/prompt-definition.embedded.ts +375 -0
- package/src/template/prompt-provider.ts +29 -0
- package/src/template/template-constants.ts +8 -0
- package/src/template/template-definition.embedded.ts +37 -0
- package/src/core/documentation/doc-schema.ts +0 -64
- package/src/core/field/field-schema.ts +0 -228
- package/src/core/identity/identity-schema.ts +0 -80
- package/src/core/object/object-schema.ts +0 -35
- package/src/core/relationship/relationship-schema.ts +0 -67
- package/src/core/validator/validator-schema.ts +0 -50
- package/src/persistence/db/db-schema.ts +0 -50
- package/src/persistence/origin/origin-schema.ts +0 -80
- package/src/persistence/source/source-schema.ts +0 -129
- package/src/presentation/layout/layout-schema.ts +0 -62
- package/src/presentation/view/view-schema.ts +0 -21
- package/src/template/template-schema.ts +0 -211
package/src/errors.ts
CHANGED
|
@@ -23,7 +23,32 @@ export const ERROR_CODES = [
|
|
|
23
23
|
"ERR_MISSING_SUBTYPE",
|
|
24
24
|
"ERR_DUPLICATE_NAME",
|
|
25
25
|
"ERR_UNRESOLVED_SUPER",
|
|
26
|
+
// FR-024 (ADR-0029) — a dotted `Entity.child` extends ref resolved to a node
|
|
27
|
+
// whose type or subtype does not match the extending node's. Dotted-only.
|
|
28
|
+
"ERR_EXTENDS_TARGET_MISMATCH",
|
|
29
|
+
// FR-024 — an identity.* node has no name. Identities are named,
|
|
30
|
+
// author-chosen (e.g. "id"), so the dotted by-name extends form can
|
|
31
|
+
// address them.
|
|
32
|
+
"ERR_IDENTITY_NAME_REQUIRED",
|
|
33
|
+
// FR-024 — an identity.* on an object.projection lacks `extends`; a
|
|
34
|
+
// projection identity is a pass-through of an entity identity.
|
|
35
|
+
"ERR_PROJECTION_IDENTITY_NOT_EXTENDED",
|
|
36
|
+
// FR-024 — identity key correspondence broken: an extended-identity field
|
|
37
|
+
// has no local pass-through field extending it, or an explicit @fields
|
|
38
|
+
// disagrees with the computed pass-through key.
|
|
39
|
+
"ERR_IDENTITY_KEY_MISMATCH",
|
|
40
|
+
// FR-024 (ADR-0028) — a source.* on an object.projection has a writable
|
|
41
|
+
// @kind (table, or @kind omitted which defaults to table). Projections are
|
|
42
|
+
// derived read-only representations; their sources must be read-only kinds.
|
|
43
|
+
"ERR_PROJECTION_SOURCE_WRITABLE",
|
|
26
44
|
"ERR_INVALID_SUBTYPE_CHILD",
|
|
45
|
+
// FR-033 — a STRUCTURAL child (field/identity/source/validator/… — not an
|
|
46
|
+
// attr) is placed under a parent whose registered childRules do not admit it
|
|
47
|
+
// (the structural analogue of ERR_UNKNOWN_ATTR). Enforced in validate()
|
|
48
|
+
// against the merged wildcard-match semantics; a NO-OP under today's wildcard
|
|
49
|
+
// childRules (the rail strict per-subtype rules will use in S1). Strict-load
|
|
50
|
+
// only. Detail names the parent, the child, and which placement was rejected.
|
|
51
|
+
"ERR_CHILD_NOT_ALLOWED",
|
|
27
52
|
"ERR_UNKNOWN_ATTR",
|
|
28
53
|
"ERR_BAD_ATTR_VALUE",
|
|
29
54
|
"ERR_BAD_DEFAULT_SORT_FIELD",
|
|
@@ -37,7 +62,39 @@ export const ERROR_CODES = [
|
|
|
37
62
|
"ERR_OVERLAY_NO_TARGET",
|
|
38
63
|
"ERR_MALFORMED_YAML",
|
|
39
64
|
"ERR_INVALID_ORIGIN",
|
|
65
|
+
// FR-024 (ADR-0029 decision 5) — an implicit (omitted-@via) origin path is
|
|
66
|
+
// ambiguous: more than one single-hop relationship leads from the base
|
|
67
|
+
// entity to the @from/@of entity (the error names the candidates), or a
|
|
68
|
+
// projection's base entity cannot be derived because its fields extend
|
|
69
|
+
// multiple entities and no extended identity anchors the base.
|
|
70
|
+
"ERR_AMBIGUOUS_PATH",
|
|
71
|
+
// FR-024 (ADR-0029 decision 6) — origin cardinality contract broken: a
|
|
72
|
+
// passthrough @via path crosses a to-many hop (row-multiplying — you meant
|
|
73
|
+
// aggregate), or an aggregate @via path is to-one at every hop (you meant
|
|
74
|
+
// passthrough). Checked on explicit AND inferred paths.
|
|
75
|
+
"ERR_ORIGIN_CARDINALITY",
|
|
76
|
+
// FR-024 (ADR-0029 decision 7) — a field declares BOTH an entity-nested
|
|
77
|
+
// `extends` (shape lineage) and an `origin.passthrough` @from (data lineage)
|
|
78
|
+
// and they disagree: the resolved @from target is not the field's resolved
|
|
79
|
+
// extends target (nor anywhere on its extends chain). Host-agnostic
|
|
80
|
+
// (projections, entities, values). Aggregates are never judged (they
|
|
81
|
+
// compute something new); a top-level abstract extends target is never
|
|
82
|
+
// judged (shape-only reuse makes no lineage claim).
|
|
83
|
+
"ERR_EXTENDS_ORIGIN_MISMATCH",
|
|
84
|
+
// FR-024 (spec §7) — an object.entity field carrying an origin.* child is
|
|
85
|
+
// derived (read-only), so the entity must declare at least one source with
|
|
86
|
+
// a read-only @kind (view/materializedView/storedProc/tableFunction) to
|
|
87
|
+
// provide it. Table-only (or source-less) entities with derived fields
|
|
88
|
+
// error. Projections and object.value hosts are exempt. Until the Phase-E
|
|
89
|
+
// B4b cutover removes view-PRIMARY entities, a read-only-kind PRIMARY
|
|
90
|
+
// source also counts as providable (legacy spelling).
|
|
91
|
+
"ERR_DERIVED_FIELD_NO_READ_SOURCE",
|
|
92
|
+
"ERR_ENTITY_PRIMARY_SOURCE_READONLY",
|
|
40
93
|
"ERR_INVALID_TEMPLATE",
|
|
94
|
+
// FR-017 — M:N relationship validation (slim vocabulary): @through must name a
|
|
95
|
+
// junction declaring two identity.reference children; @sourceRefField must match
|
|
96
|
+
// one of them; M:N attrs are invalid on a 1:N (@cardinality:one / no @through).
|
|
97
|
+
"ERR_INVALID_RELATIONSHIP",
|
|
41
98
|
"ERR_VAR_NOT_ON_PAYLOAD",
|
|
42
99
|
"ERR_PARTIAL_UNRESOLVED",
|
|
43
100
|
"ERR_REQUIRED_SLOT_UNUSED",
|
|
@@ -45,6 +102,9 @@ export const ERROR_CODES = [
|
|
|
45
102
|
"ERR_BAD_ATTR_FILTER",
|
|
46
103
|
"ERR_STORAGE_FLATTENED_ARRAY",
|
|
47
104
|
"ERR_STORAGE_WITHOUT_OBJECT_REF",
|
|
105
|
+
// ADR-0013 — a field.object REQUIRES @objectRef (open/untyped JSON uses
|
|
106
|
+
// the physical @dbColumnType: jsonb escape hatch on field.string instead).
|
|
107
|
+
"ERR_OBJECT_FIELD_WITHOUT_OBJECT_REF",
|
|
48
108
|
// Source v2 (ADR-0007) error codes — enforcement added during the source-v2 rollout.
|
|
49
109
|
"ERR_RESERVED_ATTR",
|
|
50
110
|
"ERR_SOURCE_NO_PRIMARY",
|
|
@@ -71,6 +131,24 @@ export const ERROR_CODES = [
|
|
|
71
131
|
// FR5c — multi-file overlay merge produced a conflicting attribute value:
|
|
72
132
|
// two contributors set the same @attr to different non-empty values.
|
|
73
133
|
"ERR_MERGE_CONFLICT",
|
|
134
|
+
// SP-H Unit9 — @filterable: true on a field subtype with no filter-operator
|
|
135
|
+
// band (e.g. field.object). Would silently generate an empty-ops filter.
|
|
136
|
+
"ERR_FILTERABLE_UNSUPPORTED_SUBTYPE",
|
|
137
|
+
// ADR-0023 — a registration was attempted against a registry sealed after its
|
|
138
|
+
// agreed metamodel-provider bootstrap. Codegen cannot invent metamodel attrs.
|
|
139
|
+
"ERR_REGISTRY_SEALED",
|
|
140
|
+
// FR-032 (ADR-0032) — a ref-bearing attr (extends/@objectRef/@references/
|
|
141
|
+
// origin @from/@of/@via/@parameterRef/@payloadRef/@responseRef) in CANONICAL
|
|
142
|
+
// JSON used a relative authoring form (leading `::` or `..::`). Canonical JSON
|
|
143
|
+
// is the self-contained interchange form: every ref MUST be fully-qualified.
|
|
144
|
+
// Relative navigation is YAML-only (the desugar expands it via expandRef).
|
|
145
|
+
"ERR_RELATIVE_REF_IN_CANONICAL",
|
|
146
|
+
// FR-033 — a provider set's merged metamodel constraint graph is contradictory.
|
|
147
|
+
// Surfaced by validateConstraints (constraint-validate.ts) at registry compose:
|
|
148
|
+
// dangling ref / unsatisfiable required child / bad cardinality / closed-set
|
|
149
|
+
// clash / required-child cycle / conflicting attr redefinition. The detail names
|
|
150
|
+
// which of the six checks fired and the offending type(s).
|
|
151
|
+
"ERR_INVALID_METAMODEL_CONSTRAINT",
|
|
74
152
|
"ERR_UNKNOWN",
|
|
75
153
|
] as const;
|
|
76
154
|
|
package/src/index.ts
CHANGED
|
@@ -68,11 +68,23 @@ export {
|
|
|
68
68
|
MetaReferenceIdentity,
|
|
69
69
|
} from "./core/identity/meta-identity.js";
|
|
70
70
|
export type { IdentityGeneration } from "./core/identity/meta-identity.js";
|
|
71
|
+
// FR-024 — projection identity pass-through derivation (computed local key;
|
|
72
|
+
// pure tree read, codegen-facing).
|
|
73
|
+
export {
|
|
74
|
+
computedIdentityFields,
|
|
75
|
+
identityOwnFields,
|
|
76
|
+
identityEffectiveFields,
|
|
77
|
+
resolveIdentityPassthrough,
|
|
78
|
+
} from "./core/identity/validate-identity-passthrough.js";
|
|
79
|
+
export type { IdentityPassthroughResolution } from "./core/identity/validate-identity-passthrough.js";
|
|
71
80
|
// Relationship
|
|
72
81
|
export { MetaRelationship } from "./core/relationship/meta-relationship.js";
|
|
73
82
|
// Cross-entity reference lookup
|
|
74
83
|
export { findReferenceBetween } from "./core/relationship/find-reference.js";
|
|
75
84
|
export type { ReferenceLookup } from "./core/relationship/find-reference.js";
|
|
85
|
+
// FR-017 — M:N junction FK derivation (hetero / directed-self-join / symmetric)
|
|
86
|
+
export { deriveM2MFields, M2MDerivationError } from "./core/relationship/derive-m2m-fields.js";
|
|
87
|
+
export type { M2MFields } from "./core/relationship/derive-m2m-fields.js";
|
|
76
88
|
// Validator: base + subtype-specific
|
|
77
89
|
export {
|
|
78
90
|
MetaValidator,
|
|
@@ -122,9 +134,39 @@ export type AnyMeta =
|
|
|
122
134
|
export { TypeId, TypeRegistry, childRuleMatches } from "./registry.js";
|
|
123
135
|
export type { AttrSchema, ChildRule, TypeDefinition } from "./registry.js";
|
|
124
136
|
export { registerCoreTypes, coreTypesProvider, coreProviders } from "./core-types.js";
|
|
137
|
+
|
|
138
|
+
// FR-033 — the constraint engine: additive merge + the contradiction validator.
|
|
139
|
+
export { mergeConstraints } from "./constraint-merge.js";
|
|
140
|
+
export type { EffectiveConstraints } from "./constraint-merge.js";
|
|
141
|
+
export { validateConstraints } from "./constraint-validate.js";
|
|
142
|
+
|
|
143
|
+
// Registry conformance manifest (SP-G) — the canonical logical-vocabulary serializer.
|
|
144
|
+
export { buildRegistryManifest, emitRegistryManifest, classifyPerTypeAttr } from "./registry-manifest.js";
|
|
145
|
+
export type { AttrClassification } from "./registry-manifest.js";
|
|
146
|
+
export { ExclusionReason } from "./registry-manifest-exclusions.js";
|
|
147
|
+
|
|
148
|
+
// FR-033 S3 — metamodel doc-gen: tiered, LLM-readable docs FOR THE METAMODEL
|
|
149
|
+
// (the type/subtype/attr vocabulary), generated from the strict registry.
|
|
150
|
+
// Distinct from `meta docs --model` (which documents a user's entities).
|
|
151
|
+
export {
|
|
152
|
+
renderMetamodelDocs,
|
|
153
|
+
buildMetamodelProvenance,
|
|
154
|
+
coreProviderDescriptions,
|
|
155
|
+
renderCoreMetamodelDocs,
|
|
156
|
+
} from "./metamodel-docs/index.js";
|
|
157
|
+
export type { MetamodelProvenance } from "./metamodel-docs/index.js";
|
|
158
|
+
|
|
159
|
+
// Registry coverage (SP-G Unit 5) — untested-vocabulary report (manifest vs
|
|
160
|
+
// fixture corpora). NODE-ONLY: registry-coverage.ts statically imports node:fs
|
|
161
|
+
// to scan the fixture corpora, so it must NOT be re-exported from this
|
|
162
|
+
// browser-facing barrel (it would drag node:fs into the root entry, breaking
|
|
163
|
+
// browser-safety.test.ts). It is a build-time tooling module — consumers (and
|
|
164
|
+
// its test) import it directly by path: `@metaobjectsdev/metadata/src/registry-coverage`.
|
|
125
165
|
export { dbProvider } from "./persistence/db/db-provider.js";
|
|
126
|
-
export { commonDocAttrs } from "./core/documentation/doc-schema.js";
|
|
127
166
|
export { docProvider } from "./core/documentation/doc-provider.js";
|
|
167
|
+
export { promptProvider } from "./template/prompt-provider.js";
|
|
168
|
+
export { uiProvider } from "./presentation/ui/ui-provider.js";
|
|
169
|
+
export { FIELD_ATTR_XML_TEXT } from "./template/template-constants.js";
|
|
128
170
|
|
|
129
171
|
// Type provider model
|
|
130
172
|
export { composeRegistry } from "./provider.js";
|
|
@@ -157,9 +199,12 @@ export type { SerializeOptions } from "./serializer-json.js";
|
|
|
157
199
|
// Super resolution helper (most resolution moved into parser; this is the lookup utility)
|
|
158
200
|
export { resolveSuperRef } from "./super-resolve.js";
|
|
159
201
|
|
|
202
|
+
// FR-032 (ADR-0032) — canonical reference expansion + FQN object matching.
|
|
203
|
+
export { expandRef, isRelativeRef, refMatchesObject, REF_BEARING_ATTR_NAMES } from "./naming-refs.js";
|
|
204
|
+
|
|
160
205
|
// Loader hierarchy
|
|
161
206
|
export { MetaDataLoader } from "./loader/meta-data-loader.js";
|
|
162
|
-
export type { LoadOptions, LoadResult, LoadingState } from "./loader/meta-data-loader.js";
|
|
207
|
+
export type { LoadOptions, LoadResult, LoadingState, DirectoryFactoryOptions } from "./loader/meta-data-loader.js";
|
|
163
208
|
export { InMemoryStringSource } from "./loader/meta-data-source.js";
|
|
164
209
|
export type { MetaDataSource, MetaDataFormat } from "./loader/meta-data-source.js";
|
|
165
210
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-embedded-library.ts — DO NOT EDIT.
|
|
2
|
+
// Canonical source: repo-root library/**/*.yaml
|
|
3
|
+
// Regenerate: bun run scripts/generate-embedded-library.ts
|
|
4
|
+
//
|
|
5
|
+
// Embeds the canonical library files as string literals so they resolve
|
|
6
|
+
// wherever the on-disk library/ directory is unavailable.
|
|
7
|
+
// Keys are refs: path under library/ minus the .yaml extension.
|
|
8
|
+
export const EMBEDDED_LIBRARY: Record<string, string> = {
|
|
9
|
+
"ai/llm-call": "# library/ai/llm-call.yaml\n# MetaObjects-shipped standard metadata. Adopters opt in via the loader's\n# `libraries: [\"ai\"]` option, then `extends: \"metaobjects::ai::LlmCallBase\"`.\nmetadata:\n package: metaobjects::ai\n children:\n - object.entity:\n name: LlmCallBase\n abstract: true\n children:\n - field.uuid: { name: traceId }\n - field.uuid: { name: spanId }\n - field.uuid: { name: parentSpanId }\n - field.string: { name: sessionId }\n - field.string: { name: callType }\n - field.string: { name: system }\n - field.string: { name: requestModel }\n - field.string: { name: responseModel }\n - field.int: { name: inputTokens }\n - field.int: { name: outputTokens }\n - field.currency: { name: costMinor, currency: USD }\n - field.int: { name: latencyMs }\n - field.string: { name: finishReason }\n - field.string: { name: status }\n - field.string: { name: errorDetail }\n - field.timestamp: { name: startedAt }\n - field.string: { name: llmRequest, dbColumnType: jsonb } # generic jsonb (no objectRef)\n - field.string: { name: llmResponse, dbColumnType: jsonb }\n - object.entity:\n name: LlmCall\n extends: metaobjects::ai::LlmCallBase\n children:\n - source.rdb: { table: llm_call, role: primary }\n - identity.primary: { name: id, fields: [\"spanId\"] }\n",
|
|
10
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// library-sources.ts — resolves MetaDataSource instances for shipped library packages.
|
|
2
|
+
//
|
|
3
|
+
// On-disk-first: if the repo-root library/ tree is reachable (dev / installed-from-source
|
|
4
|
+
// layout), a FileSource is returned so edits to the on-disk YAML are picked up immediately.
|
|
5
|
+
// Embedded fallback: when the binary is compiled (bun --compile) or the library/ directory
|
|
6
|
+
// is absent, the content embedded in embedded-library.generated.ts is used.
|
|
7
|
+
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { join, dirname } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { FileSource } from "../loader/sources/file-source.js";
|
|
12
|
+
import { InMemoryStringSource } from "../loader/meta-data-source.js";
|
|
13
|
+
import type { MetaDataSource } from "../loader/meta-data-source.js";
|
|
14
|
+
import { EMBEDDED_LIBRARY } from "./embedded-library.generated.js";
|
|
15
|
+
|
|
16
|
+
// Package → ordered refs, derived from the generated embedded module so adding a
|
|
17
|
+
// library file (which regenerates EMBEDDED_LIBRARY) needs no edit here.
|
|
18
|
+
const REFS_BY_PACKAGE: Readonly<Record<string, readonly string[]>> = (() => {
|
|
19
|
+
const map: Record<string, string[]> = {};
|
|
20
|
+
for (const ref of Object.keys(EMBEDDED_LIBRARY).sort()) {
|
|
21
|
+
const pkg = ref.split("/")[0];
|
|
22
|
+
if (pkg === undefined || pkg === "") continue;
|
|
23
|
+
(map[pkg] ??= []).push(ref);
|
|
24
|
+
}
|
|
25
|
+
return map;
|
|
26
|
+
})();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Locate the repo-root `library/` directory by walking up from this module's
|
|
30
|
+
* location until a directory contains BOTH `library/` and `server/` (the two
|
|
31
|
+
* structural anchors that identify the repo root). Returns the path to the
|
|
32
|
+
* `library/` subdirectory if found, or `undefined` when absent (compiled binary).
|
|
33
|
+
*/
|
|
34
|
+
function libraryDirOnDisk(): string | undefined {
|
|
35
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
36
|
+
for (let i = 0; i < 12; i++) {
|
|
37
|
+
if (existsSync(join(dir, "library")) && existsSync(join(dir, "server"))) {
|
|
38
|
+
return join(dir, "library");
|
|
39
|
+
}
|
|
40
|
+
const parent = dirname(dir);
|
|
41
|
+
if (parent === dir) break; // reached filesystem root
|
|
42
|
+
dir = parent;
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Cache the on-disk location: resolved once per process.
|
|
48
|
+
let _cache: { dir: string | undefined } | undefined;
|
|
49
|
+
|
|
50
|
+
function getLibraryDir(): string | undefined {
|
|
51
|
+
return (_cache ??= { dir: libraryDirOnDisk() }).dir;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns a list of `MetaDataSource` instances for the requested library packages.
|
|
56
|
+
*
|
|
57
|
+
* - Recognized packages: `"ai"` (others contribute no sources).
|
|
58
|
+
* - Per ref: if the on-disk `library/<ref>.yaml` exists, returns a `FileSource`;
|
|
59
|
+
* otherwise falls back to an `InMemoryStringSource` built from the embedded content.
|
|
60
|
+
*
|
|
61
|
+
* @param packages - Package names to include (e.g. `["ai"]`).
|
|
62
|
+
*/
|
|
63
|
+
export function librarySources(packages: string[]): MetaDataSource[] {
|
|
64
|
+
const dir = getLibraryDir();
|
|
65
|
+
const out: MetaDataSource[] = [];
|
|
66
|
+
|
|
67
|
+
for (const pkg of packages) {
|
|
68
|
+
const refs = REFS_BY_PACKAGE[pkg];
|
|
69
|
+
if (refs === undefined) continue; // unknown package — no sources
|
|
70
|
+
|
|
71
|
+
for (const ref of refs) {
|
|
72
|
+
if (dir !== undefined) {
|
|
73
|
+
const path = join(dir, `${ref}.yaml`);
|
|
74
|
+
if (existsSync(path)) {
|
|
75
|
+
out.push(new FileSource(path));
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const embedded = EMBEDDED_LIBRARY[ref];
|
|
80
|
+
if (embedded !== undefined) {
|
|
81
|
+
out.push(
|
|
82
|
+
new InMemoryStringSource(embedded, {
|
|
83
|
+
id: `library:${ref}.yaml`,
|
|
84
|
+
format: "yaml",
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`library ref "${ref}" (package "${pkg}") has no on-disk file and no embedded entry — ` +
|
|
90
|
+
`the embedded library module is stale; run scripts/generate-embedded-library.ts`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
@@ -17,7 +17,7 @@ import { ParseError } from "../errors.js";
|
|
|
17
17
|
import type { LoaderWarning } from "../source.js";
|
|
18
18
|
import { codeSource, resolvedSource } from "../source.js";
|
|
19
19
|
import { parseJson } from "../parser-json.js";
|
|
20
|
-
import { validateDataGridSortFields, validateFilterableHasIndex, validateOriginPaths, validateDataGridFilterValues, validateFieldObjectStorage, validateTemplatePayloadRefs, validateFieldDefaults } from "./validation-passes.js";
|
|
20
|
+
import { validateDataGridSortFields, validateFilterableHasIndex, validateFilterableHasSupportedOps, validateOriginPaths, validateDerivedFieldProvidability, validateDataGridFilterValues, validateFieldObjectStorage, validateTemplatePayloadRefs, validateFieldDefaults, validateRelationships } from "./validation-passes.js";
|
|
21
21
|
import { validateSourceRoles } from "../persistence/source/validate-source-roles.js";
|
|
22
22
|
import { validateSourcePhysicalNames } from "../persistence/source/validate-source-physical-names.js";
|
|
23
23
|
import { validateSourceParameterRef } from "../persistence/source/validate-source-parameter-ref.js";
|
|
@@ -25,6 +25,7 @@ import { validateFieldReadOnly } from "../core/field/validate-field-readonly.js"
|
|
|
25
25
|
import { validateDiscriminator } from "../core/object/validate-discriminator.js";
|
|
26
26
|
import { resolveDeferredSupers } from "../super-resolve.js";
|
|
27
27
|
import { validateSubtypeRules } from "../subtype-rules.js";
|
|
28
|
+
import { validateIdentityPassthrough } from "../core/identity/validate-identity-passthrough.js";
|
|
28
29
|
import { validateAttrSchema } from "../attr-schema-validate.js";
|
|
29
30
|
import type { MetaDataFormat, MetaDataSource } from "./meta-data-source.js";
|
|
30
31
|
import { InMemoryStringSource } from "./meta-data-source.js";
|
|
@@ -35,9 +36,18 @@ import type { ParseOptions, ParseResult } from "../parser-core.js";
|
|
|
35
36
|
// browser-safety crawler — which walks every `import|export from` it sees,
|
|
36
37
|
// type-only or not — never follows a path into a node:fs-using file.
|
|
37
38
|
// Keep field-for-field in sync with `DirectoryOptions` in `./sources/directory-source.ts`.
|
|
38
|
-
type DirectoryFactoryOptions = {
|
|
39
|
+
export type DirectoryFactoryOptions = {
|
|
39
40
|
exclude?: string[];
|
|
40
41
|
recurse?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Opt-in library packages to prepend before the directory's own sources.
|
|
44
|
+
* Library sources are prepended so `extends` references to library-shipped
|
|
45
|
+
* abstract bases are resolvable from app metadata files.
|
|
46
|
+
*
|
|
47
|
+
* Example: `{ libraries: ["ai"] }` prepends the `metaobjects::ai` library
|
|
48
|
+
* (LlmCallBase etc.) so app entities may use `extends: "metaobjects::ai::LlmCallBase"`.
|
|
49
|
+
*/
|
|
50
|
+
libraries?: string[];
|
|
41
51
|
};
|
|
42
52
|
|
|
43
53
|
// YAML parser and node:fs-backed Source impls are loaded lazily (dynamic
|
|
@@ -101,7 +111,9 @@ export class MetaDataLoader {
|
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
private static _defaultRegistry(): TypeRegistry {
|
|
104
|
-
|
|
114
|
+
// FR-033 — validate the library's own metamodel at bootstrap: a contradictory
|
|
115
|
+
// core provider set fails fast here (the real metamodel must be contradiction-free).
|
|
116
|
+
return composeRegistry(coreProviders, { validate: true });
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
// ---------------------------------------------------------------------------
|
|
@@ -124,7 +136,7 @@ export class MetaDataLoader {
|
|
|
124
136
|
dir: string,
|
|
125
137
|
opts?: DirectoryFactoryOptions & LoadOptions,
|
|
126
138
|
): Promise<LoadResult> {
|
|
127
|
-
const { exclude, recurse, ...loaderOpts } = opts ?? {};
|
|
139
|
+
const { exclude, recurse, libraries, ...loaderOpts } = opts ?? {};
|
|
128
140
|
// Conditional spreads honor exactOptionalPropertyTypes — only forward keys
|
|
129
141
|
// when the caller supplied a value, so DirectorySource's own defaults apply.
|
|
130
142
|
const dirOpts: DirectoryFactoryOptions = {
|
|
@@ -134,8 +146,19 @@ export class MetaDataLoader {
|
|
|
134
146
|
const { DirectorySource } = await import("./sources/directory-source.js");
|
|
135
147
|
const loader = new MetaDataLoader(loaderOpts);
|
|
136
148
|
try {
|
|
137
|
-
const
|
|
138
|
-
|
|
149
|
+
const dirSources = await new DirectorySource(dir, dirOpts).expand();
|
|
150
|
+
// Library sources are loaded lazily and conditionally to keep the import
|
|
151
|
+
// path away from the browser-safe entry (library-sources.ts uses node:fs)
|
|
152
|
+
// and to avoid the import cost when no libraries are requested.
|
|
153
|
+
let libSources: MetaDataSource[] = [];
|
|
154
|
+
if (libraries?.length) {
|
|
155
|
+
const { librarySources } = await import("../library/library-sources.js");
|
|
156
|
+
libSources = librarySources(libraries);
|
|
157
|
+
}
|
|
158
|
+
// Prepend library sources so `extends` refs to library-shipped abstract
|
|
159
|
+
// bases are resolvable when the merged root is built. Super resolution is
|
|
160
|
+
// deferred (order-independent), but prepending is the deterministic choice.
|
|
161
|
+
return loader.load([...libSources, ...dirSources]);
|
|
139
162
|
} catch (err) {
|
|
140
163
|
// Match the pre-unification contract: a missing/unreadable directory is
|
|
141
164
|
// surfaced as a collected error on the LoadResult, not a throw. The
|
|
@@ -396,6 +419,22 @@ export class MetaDataLoader {
|
|
|
396
419
|
// parse-time source supplies files + jsonPath (the location of the
|
|
397
420
|
// broken `extends:` on disk); referrer = the declaring node's FQN;
|
|
398
421
|
// target = the unresolved supertype ref.
|
|
422
|
+
if (failure.kind === "target-mismatch") {
|
|
423
|
+
// FR-024 — a dotted child-targeting ref resolved, but the target's
|
|
424
|
+
// type/subtype differs from the extending node's. Dotted-only check.
|
|
425
|
+
const r = failure.referrer;
|
|
426
|
+
const t = failure.target;
|
|
427
|
+
errors.push(
|
|
428
|
+
new ParseError(
|
|
429
|
+
`the extends target '${failure.ref}' is ${t?.type}.${t?.subType} but the extending node '${failure.nodeFqn}' is ${r?.type}.${r?.subType} — a dotted extends must target a node of the same type and subtype`,
|
|
430
|
+
{
|
|
431
|
+
code: "ERR_EXTENDS_TARGET_MISMATCH",
|
|
432
|
+
source: resolvedSource(failure.source, failure.nodeFqn, failure.ref),
|
|
433
|
+
},
|
|
434
|
+
),
|
|
435
|
+
);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
399
438
|
errors.push(
|
|
400
439
|
new ParseError(
|
|
401
440
|
`the SuperClass '${failure.ref}' does not exist (referenced by ${failure.nodeFqn})`,
|
|
@@ -413,19 +452,39 @@ export class MetaDataLoader {
|
|
|
413
452
|
errors.push(...ruleResult.errors);
|
|
414
453
|
warnings.push(...ruleResult.warnings);
|
|
415
454
|
|
|
455
|
+
// FR-024 B3 — projection identity pass-through + key correspondence
|
|
456
|
+
// (ERR_PROJECTION_IDENTITY_NOT_EXTENDED / ERR_IDENTITY_KEY_MISMATCH).
|
|
457
|
+
errors.push(...validateIdentityPassthrough(root));
|
|
458
|
+
|
|
416
459
|
// Fourth pass: data-grid @defaultSortField cross-reference validation.
|
|
417
460
|
errors.push(...validateDataGridSortFields(root));
|
|
418
461
|
|
|
419
462
|
// Fifth pass: @filterable without index drift warning.
|
|
420
463
|
warnings.push(...validateFilterableHasIndex(root));
|
|
421
464
|
|
|
465
|
+
// SP-H Unit9 — @filterable on a subtype with no operator band → error
|
|
466
|
+
// (would silently generate a filter that rejects every request).
|
|
467
|
+
errors.push(...validateFilterableHasSupportedOps(root));
|
|
468
|
+
|
|
422
469
|
// Sixth pass: origin path validation — validates passthrough.@from,
|
|
423
470
|
// aggregate.@of, and .@via relationship chains.
|
|
424
471
|
errors.push(...validateOriginPaths(root));
|
|
425
472
|
|
|
473
|
+
// FR-024 B6 — derived-field providability: an entity field carrying an
|
|
474
|
+
// origin.* is derived (read-only) and must be providable by at least one
|
|
475
|
+
// read-only-kind source on the entity (spec §7 multi-source pattern);
|
|
476
|
+
// projections and object.value hosts are exempt.
|
|
477
|
+
errors.push(...validateDerivedFieldProvidability(root));
|
|
478
|
+
|
|
426
479
|
// Seventh pass: @filter value validation — fields filterable + ops allowed per subtype.
|
|
427
480
|
errors.push(...validateDataGridFilterValues(root));
|
|
428
481
|
|
|
482
|
+
// FR-017 — M:N relationship validation (deferred-resolution): @through names a
|
|
483
|
+
// junction declaring two identity.reference children; @sourceRefField matches one;
|
|
484
|
+
// @symmetric is self-join-only + mutually exclusive with @sourceRefField; M:N attrs
|
|
485
|
+
// are invalid on a 1:N relationship.
|
|
486
|
+
errors.push(...validateRelationships(root));
|
|
487
|
+
|
|
429
488
|
// template.* validation — @payloadRef resolves to a known object;
|
|
430
489
|
// @requiredSlots are real fields on it (FR-004 Plan #3, T2).
|
|
431
490
|
errors.push(...validateTemplatePayloadRefs(root));
|
|
@@ -433,7 +492,7 @@ export class MetaDataLoader {
|
|
|
433
492
|
// Eighth pass: attribute-schema validation (Phase A3) — checks each
|
|
434
493
|
// node's @-attributes against its (type, subType) AttrSchema: required
|
|
435
494
|
// attrs present, declared attrs well-typed, allowedValues honored.
|
|
436
|
-
const attrSchemaResult = validateAttrSchema(root, this._registry);
|
|
495
|
+
const attrSchemaResult = validateAttrSchema(root, this._registry, this._strict);
|
|
437
496
|
errors.push(...attrSchemaResult.errors);
|
|
438
497
|
warnings.push(...attrSchemaResult.warnings);
|
|
439
498
|
|
package/src/loader/shortcuts.ts
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
// preserving the package root's browser-safety contract.
|
|
9
9
|
|
|
10
10
|
import { MetaDataLoader } from "./meta-data-loader.js";
|
|
11
|
-
import type { LoadOptions, LoadResult } from "./meta-data-loader.js";
|
|
11
|
+
import type { LoadOptions, LoadResult, DirectoryFactoryOptions } from "./meta-data-loader.js";
|
|
12
12
|
import type { MetaDataFormat } from "./meta-data-source.js";
|
|
13
13
|
|
|
14
14
|
export function loadDirectory(
|
|
15
15
|
dir: string,
|
|
16
|
-
opts?:
|
|
16
|
+
opts?: DirectoryFactoryOptions & LoadOptions,
|
|
17
17
|
): Promise<LoadResult> {
|
|
18
18
|
return MetaDataLoader.fromDirectory(dir, opts);
|
|
19
19
|
}
|