@astrale-os/kernel-dsl 0.1.5 → 0.2.0-beta.10
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/index.d.ts +1 -57
- package/dist/index.js +1 -31
- package/dist/upgrade/contract.d.ts +31 -0
- package/dist/upgrade/contract.js +1 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade/index.js +1 -0
- package/dist/v1/addressing/class-key.d.ts +12 -0
- package/dist/v1/addressing/class-key.js +39 -0
- package/dist/v1/addressing/definition-ref.d.ts +28 -0
- package/dist/v1/addressing/definition-ref.js +63 -0
- package/dist/v1/addressing/domain-dependency.d.ts +18 -0
- package/dist/v1/addressing/domain-dependency.js +6 -0
- package/dist/v1/addressing/index.d.ts +12 -0
- package/dist/v1/addressing/index.js +7 -0
- package/dist/v1/addressing/key.d.ts +19 -0
- package/dist/v1/addressing/key.js +39 -0
- package/dist/v1/addressing/method-address.d.ts +9 -0
- package/dist/v1/addressing/method-address.js +1 -0
- package/dist/v1/addressing/method-key.d.ts +15 -0
- package/dist/v1/addressing/method-key.js +60 -0
- package/dist/v1/addressing/ordering.d.ts +6 -0
- package/dist/v1/addressing/ordering.js +20 -0
- package/dist/v1/addressing/patterns.d.ts +27 -0
- package/dist/v1/addressing/patterns.js +29 -0
- package/dist/v1/addressing/property-key.d.ts +13 -0
- package/dist/v1/addressing/property-key.js +39 -0
- package/dist/v1/addressing/revision.d.ts +8 -0
- package/dist/v1/addressing/revision.js +8 -0
- package/dist/v1/builder/callable/authoring.d.ts +117 -0
- package/dist/v1/builder/callable/authoring.js +67 -0
- package/dist/v1/builder/class/authoring.d.ts +367 -0
- package/dist/v1/builder/class/authoring.js +134 -0
- package/dist/v1/builder/class/property.d.ts +52 -0
- package/dist/v1/builder/class/property.js +49 -0
- package/dist/v1/builder/core/authoring.d.ts +42 -0
- package/dist/v1/builder/core/authoring.js +39 -0
- package/dist/v1/builder/index.d.ts +26 -0
- package/dist/v1/builder/index.js +11 -0
- package/dist/v1/builder/lowering/callable.d.ts +24 -0
- package/dist/v1/builder/lowering/callable.js +135 -0
- package/dist/v1/builder/lowering/class.d.ts +22 -0
- package/dist/v1/builder/lowering/class.js +129 -0
- package/dist/v1/builder/lowering/core-properties.d.ts +10 -0
- package/dist/v1/builder/lowering/core-properties.js +76 -0
- package/dist/v1/builder/lowering/core.d.ts +22 -0
- package/dist/v1/builder/lowering/core.js +50 -0
- package/dist/v1/builder/lowering/policy.d.ts +16 -0
- package/dist/v1/builder/lowering/policy.js +59 -0
- package/dist/v1/builder/lowering/schema/capture.d.ts +4 -0
- package/dist/v1/builder/lowering/schema/capture.js +70 -0
- package/dist/v1/builder/lowering/schema/compile.d.ts +10 -0
- package/dist/v1/builder/lowering/schema/compile.js +80 -0
- package/dist/v1/builder/lowering/schema/context.d.ts +44 -0
- package/dist/v1/builder/lowering/schema/context.js +247 -0
- package/dist/v1/builder/lowering/schema/ownership.d.ts +8 -0
- package/dist/v1/builder/lowering/schema/ownership.js +29 -0
- package/dist/v1/builder/lowering/value/compile.d.ts +15 -0
- package/dist/v1/builder/lowering/value/compile.js +136 -0
- package/dist/v1/builder/lowering/value/path.d.ts +3 -0
- package/dist/v1/builder/lowering/value/path.js +20 -0
- package/dist/v1/builder/lowering/value/zod.d.ts +32 -0
- package/dist/v1/builder/lowering/value/zod.js +342 -0
- package/dist/v1/builder/lowering/view.d.ts +11 -0
- package/dist/v1/builder/lowering/view.js +27 -0
- package/dist/v1/builder/policy/authoring.d.ts +52 -0
- package/dist/v1/builder/policy/authoring.js +90 -0
- package/dist/v1/builder/schema/define.d.ts +11 -0
- package/dist/v1/builder/schema/define.js +5 -0
- package/dist/v1/builder/schema/diagnostic.d.ts +16 -0
- package/dist/v1/builder/schema/diagnostic.js +31 -0
- package/dist/v1/builder/schema/handle.d.ts +7 -0
- package/dist/v1/builder/schema/handle.js +14 -0
- package/dist/v1/builder/schema/input.d.ts +15 -0
- package/dist/v1/builder/schema/input.js +1 -0
- package/dist/v1/builder/schema/lazy.d.ts +2 -0
- package/dist/v1/builder/schema/lazy.js +13 -0
- package/dist/v1/builder/schema/projection.d.ts +364 -0
- package/dist/v1/builder/schema/projection.js +1 -0
- package/dist/v1/builder/value/full-match.d.ts +4 -0
- package/dist/v1/builder/value/full-match.js +11 -0
- package/dist/v1/builder/value/path-metadata.d.ts +4 -0
- package/dist/v1/builder/value/path-metadata.js +7 -0
- package/dist/v1/builder/value/path.d.ts +8 -0
- package/dist/v1/builder/value/path.js +11 -0
- package/dist/v1/builder/value/schema.d.ts +16 -0
- package/dist/v1/builder/value/schema.js +10 -0
- package/dist/v1/builder/view/authoring.d.ts +17 -0
- package/dist/v1/builder/view/authoring.js +16 -0
- package/dist/v1/bundle/codec.d.ts +5 -0
- package/dist/v1/bundle/codec.js +168 -0
- package/dist/v1/bundle/create.d.ts +3 -0
- package/dist/v1/bundle/create.js +5 -0
- package/dist/v1/bundle/diagnostic.d.ts +10 -0
- package/dist/v1/bundle/diagnostic.js +17 -0
- package/dist/v1/bundle/index.d.ts +18 -0
- package/dist/v1/bundle/index.js +20 -0
- package/dist/v1/bundle/model.d.ts +16 -0
- package/dist/v1/bundle/model.js +11 -0
- package/dist/v1/bundle/structure.d.ts +7 -0
- package/dist/v1/bundle/structure.js +71 -0
- package/dist/v1/bundle/transport.d.ts +8 -0
- package/dist/v1/bundle/transport.js +7 -0
- package/dist/v1/compiled/admission/accept.d.ts +3 -0
- package/dist/v1/compiled/admission/accept.js +881 -0
- package/dist/v1/compiled/admission/revision.d.ts +4 -0
- package/dist/v1/compiled/admission/revision.js +73 -0
- package/dist/v1/compiled/admission/semantics.d.ts +7 -0
- package/dist/v1/compiled/admission/semantics.js +1091 -0
- package/dist/v1/compiled/codec/json.d.ts +3 -0
- package/dist/v1/compiled/codec/json.js +9 -0
- package/dist/v1/compiled/compiler/compile.d.ts +4 -0
- package/dist/v1/compiled/compiler/compile.js +113 -0
- package/dist/v1/compiled/diagnostic.d.ts +11 -0
- package/dist/v1/compiled/diagnostic.js +13 -0
- package/dist/v1/compiled/index.d.ts +7 -0
- package/dist/v1/compiled/index.js +5 -0
- package/dist/v1/compiled/loader/index.d.ts +1 -0
- package/dist/v1/compiled/loader/index.js +1 -0
- package/dist/v1/compiled/loader/load.d.ts +4 -0
- package/dist/v1/compiled/loader/load.js +141 -0
- package/dist/v1/compiled/model/schema.d.ts +73 -0
- package/dist/v1/compiled/model/schema.js +1 -0
- package/dist/v1/domain/create.d.ts +8 -0
- package/dist/v1/domain/create.js +264 -0
- package/dist/v1/domain/index.d.ts +2 -0
- package/dist/v1/domain/index.js +1 -0
- package/dist/v1/domain/model/domain.d.ts +59 -0
- package/dist/v1/domain/model/domain.js +1 -0
- package/dist/v1/domain/model/input.d.ts +31 -0
- package/dist/v1/domain/model/input.js +1 -0
- package/dist/v1/domain/namespace/member-collection.d.ts +5 -0
- package/dist/v1/domain/namespace/member-collection.js +81 -0
- package/dist/v1/domain/projection/classes.d.ts +4 -0
- package/dist/v1/domain/projection/classes.js +200 -0
- package/dist/v1/domain/validation/create.d.ts +18 -0
- package/dist/v1/domain/validation/create.js +75 -0
- package/dist/v1/index.d.ts +16 -0
- package/dist/v1/index.js +8 -0
- package/dist/v1/language/callable/index.d.ts +2 -0
- package/dist/v1/language/callable/index.js +1 -0
- package/dist/v1/language/callable/model/callable.d.ts +33 -0
- package/dist/v1/language/callable/model/callable.js +1 -0
- package/dist/v1/language/callable/resolved.d.ts +68 -0
- package/dist/v1/language/callable/resolved.js +1 -0
- package/dist/v1/language/class/facets.d.ts +58 -0
- package/dist/v1/language/class/facets.js +1 -0
- package/dist/v1/language/class/index.d.ts +8 -0
- package/dist/v1/language/class/index.js +1 -0
- package/dist/v1/language/class/model/class.d.ts +36 -0
- package/dist/v1/language/class/model/class.js +1 -0
- package/dist/v1/language/class/model/data.d.ts +11 -0
- package/dist/v1/language/class/model/data.js +2 -0
- package/dist/v1/language/class/model/edge.d.ts +38 -0
- package/dist/v1/language/class/model/edge.js +1 -0
- package/dist/v1/language/class/model/property.d.ts +18 -0
- package/dist/v1/language/class/model/property.js +1 -0
- package/dist/v1/language/class/property-values.d.ts +15 -0
- package/dist/v1/language/class/property-values.js +30 -0
- package/dist/v1/language/class/resolved.d.ts +123 -0
- package/dist/v1/language/class/resolved.js +1 -0
- package/dist/v1/language/core/index.d.ts +2 -0
- package/dist/v1/language/core/index.js +1 -0
- package/dist/v1/language/core/model/core.d.ts +20 -0
- package/dist/v1/language/core/model/core.js +1 -0
- package/dist/v1/language/core/resolved.d.ts +21 -0
- package/dist/v1/language/core/resolved.js +1 -0
- package/dist/v1/language/definition/metadata.d.ts +12 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/definition.d.ts +7 -0
- package/dist/v1/language/definition.js +1 -0
- package/dist/v1/language/index.d.ts +23 -0
- package/dist/v1/language/index.js +1 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +19 -0
- package/dist/v1/language/policy/analysis/branches.js +132 -0
- package/dist/v1/language/policy/analysis/budgets.d.ts +16 -0
- package/dist/v1/language/policy/analysis/budgets.js +25 -0
- package/dist/v1/language/policy/index.d.ts +3 -0
- package/dist/v1/language/policy/index.js +1 -0
- package/dist/v1/language/policy/model/policy.d.ts +77 -0
- package/dist/v1/language/policy/model/policy.js +1 -0
- package/dist/v1/language/policy/normalization/normalize.d.ts +4 -0
- package/dist/v1/language/policy/normalization/normalize.js +226 -0
- package/dist/v1/language/policy/resolved.d.ts +9 -0
- package/dist/v1/language/policy/resolved.js +1 -0
- package/dist/v1/language/resolved.d.ts +10 -0
- package/dist/v1/language/resolved.js +1 -0
- package/dist/v1/language/validation/diagnostic.d.ts +8 -0
- package/dist/v1/language/validation/diagnostic.js +3 -0
- package/dist/v1/language/value/compile/fields.d.ts +3 -0
- package/dist/v1/language/value/compile/fields.js +60 -0
- package/dist/v1/language/value/compile/load.d.ts +4 -0
- package/dist/v1/language/value/compile/load.js +41 -0
- package/dist/v1/language/value/compile/model.d.ts +27 -0
- package/dist/v1/language/value/compile/model.js +1 -0
- package/dist/v1/language/value/evaluate/assertions.d.ts +6 -0
- package/dist/v1/language/value/evaluate/assertions.js +58 -0
- package/dist/v1/language/value/evaluate/evaluator.d.ts +4 -0
- package/dist/v1/language/value/evaluate/evaluator.js +361 -0
- package/dist/v1/language/value/evaluate/preparation.d.ts +13 -0
- package/dist/v1/language/value/evaluate/preparation.js +135 -0
- package/dist/v1/language/value/evaluate/program.d.ts +3 -0
- package/dist/v1/language/value/evaluate/program.js +16 -0
- package/dist/v1/language/value/evaluate/types.d.ts +36 -0
- package/dist/v1/language/value/evaluate/types.js +9 -0
- package/dist/v1/language/value/evaluate/validate.d.ts +12 -0
- package/dist/v1/language/value/evaluate/validate.js +43 -0
- package/dist/v1/language/value/index.d.ts +11 -0
- package/dist/v1/language/value/index.js +8 -0
- package/dist/v1/language/value/model/instant.d.ts +9 -0
- package/dist/v1/language/value/model/instant.js +37 -0
- package/dist/v1/language/value/model/object.d.ts +5 -0
- package/dist/v1/language/value/model/object.js +3 -0
- package/dist/v1/language/value/model/schema.d.ts +25 -0
- package/dist/v1/language/value/model/schema.js +11 -0
- package/dist/v1/language/value/ordering.d.ts +13 -0
- package/dist/v1/language/value/ordering.js +174 -0
- package/dist/v1/language/value/profile/canonicalize.d.ts +4 -0
- package/dist/v1/language/value/profile/canonicalize.js +130 -0
- package/dist/v1/language/value/profile/json.validate.d.ts +2 -0
- package/dist/v1/language/value/profile/json.validate.js +14 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +78 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.js +2079 -0
- package/dist/v1/language/value/profile/meta-schema.d.ts +4 -0
- package/dist/v1/language/value/profile/meta-schema.js +19 -0
- package/dist/v1/language/value/profile/rules.d.ts +3 -0
- package/dist/v1/language/value/profile/rules.js +109 -0
- package/dist/v1/language/value/profile/validate.d.ts +4 -0
- package/dist/v1/language/value/profile/validate.js +39 -0
- package/dist/v1/language/value/profile/vocabulary.d.ts +2 -0
- package/dist/v1/language/value/profile/vocabulary.js +68 -0
- package/dist/v1/language/value/reference/closure.d.ts +11 -0
- package/dist/v1/language/value/reference/closure.js +51 -0
- package/dist/v1/language/value/reference/recursion.d.ts +5 -0
- package/dist/v1/language/value/reference/recursion.js +95 -0
- package/dist/v1/language/value/reference/references.d.ts +17 -0
- package/dist/v1/language/value/reference/references.js +45 -0
- package/dist/v1/language/value/reference/registry.d.ts +24 -0
- package/dist/v1/language/value/reference/registry.index.d.ts +14 -0
- package/dist/v1/language/value/reference/registry.index.js +76 -0
- package/dist/v1/language/value/reference/registry.js +1 -0
- package/dist/v1/language/value/regexp/ast.d.ts +21 -0
- package/dist/v1/language/value/regexp/ast.js +326 -0
- package/dist/v1/language/value/regexp/compile.d.ts +3 -0
- package/dist/v1/language/value/regexp/compile.js +96 -0
- package/dist/v1/language/value/regexp/lower.d.ts +3 -0
- package/dist/v1/language/value/regexp/lower.js +26 -0
- package/dist/v1/language/value/regexp/matcher.d.ts +7 -0
- package/dist/v1/language/value/regexp/matcher.js +50 -0
- package/dist/v1/language/value/regexp/pattern.d.ts +2 -0
- package/dist/v1/language/value/regexp/pattern.js +38 -0
- package/dist/v1/language/value/regexp/syntax.d.ts +2 -0
- package/dist/v1/language/value/regexp/syntax.js +5 -0
- package/dist/v1/language/value/syntax/full-match.d.ts +6 -0
- package/dist/v1/language/value/syntax/full-match.js +20 -0
- package/dist/v1/language/value/syntax/keywords.d.ts +3 -0
- package/dist/v1/language/value/syntax/keywords.js +20 -0
- package/dist/v1/language/value/syntax/node-path/schema.d.ts +5 -0
- package/dist/v1/language/value/syntax/node-path/schema.js +18 -0
- package/dist/v1/language/value/syntax/node-path/validate.d.ts +4 -0
- package/dist/v1/language/value/syntax/node-path/validate.js +80 -0
- package/dist/v1/language/value/syntax/pointer.d.ts +4 -0
- package/dist/v1/language/value/syntax/pointer.js +49 -0
- package/dist/v1/language/value/syntax/walk.d.ts +10 -0
- package/dist/v1/language/value/syntax/walk.js +53 -0
- package/dist/v1/language/view/index.d.ts +2 -0
- package/dist/v1/language/view/index.js +1 -0
- package/dist/v1/language/view/model/view.d.ts +11 -0
- package/dist/v1/language/view/model/view.js +1 -0
- package/dist/v1/language/view/resolved.d.ts +9 -0
- package/dist/v1/language/view/resolved.js +1 -0
- package/dist/v1/schema/admission/accept.d.ts +3 -0
- package/dist/v1/schema/admission/accept.js +26 -0
- package/dist/v1/schema/analysis/class.d.ts +41 -0
- package/dist/v1/schema/analysis/class.js +181 -0
- package/dist/v1/schema/canonical/domain.d.ts +3 -0
- package/dist/v1/schema/canonical/domain.digest.d.ts +3 -0
- package/dist/v1/schema/canonical/domain.digest.js +5 -0
- package/dist/v1/schema/canonical/domain.js +5 -0
- package/dist/v1/schema/canonical/freeze.d.ts +1 -0
- package/dist/v1/schema/canonical/freeze.js +9 -0
- package/dist/v1/schema/canonical/revision.d.ts +11 -0
- package/dist/v1/schema/canonical/revision.js +17 -0
- package/dist/v1/schema/codec/header.d.ts +17 -0
- package/dist/v1/schema/codec/header.js +26 -0
- package/dist/v1/schema/codec/schema.d.ts +5 -0
- package/dist/v1/schema/codec/schema.js +21 -0
- package/dist/v1/schema/compatibility/meaning.d.ts +29 -0
- package/dist/v1/schema/compatibility/meaning.js +605 -0
- package/dist/v1/schema/dependency/lookup.d.ts +18 -0
- package/dist/v1/schema/dependency/lookup.js +31 -0
- package/dist/v1/schema/diagnostic.d.ts +12 -0
- package/dist/v1/schema/diagnostic.js +21 -0
- package/dist/v1/schema/index.d.ts +26 -0
- package/dist/v1/schema/index.js +13 -0
- package/dist/v1/schema/model/format.d.ts +2 -0
- package/dist/v1/schema/model/format.js +2 -0
- package/dist/v1/schema/model/schema.d.ts +30 -0
- package/dist/v1/schema/model/schema.js +4 -0
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +207 -0
- package/dist/v1/schema/resolution/closure.d.ts +9 -0
- package/dist/v1/schema/resolution/closure.js +49 -0
- package/dist/v1/schema/resolution/context.d.ts +17 -0
- package/dist/v1/schema/resolution/context.js +158 -0
- package/dist/v1/schema/resolution/definition.index.d.ts +21 -0
- package/dist/v1/schema/resolution/definition.index.js +17 -0
- package/dist/v1/schema/resolution/domain.d.ts +4 -0
- package/dist/v1/schema/resolution/domain.js +112 -0
- package/dist/v1/schema/resolution/origins.d.ts +14 -0
- package/dist/v1/schema/resolution/origins.js +121 -0
- package/dist/v1/schema/resolution/value.registry.d.ts +7 -0
- package/dist/v1/schema/resolution/value.registry.js +39 -0
- package/dist/v1/schema/revision.d.ts +1 -0
- package/dist/v1/schema/revision.js +1 -0
- package/dist/v1/schema/validation/class.d.ts +5 -0
- package/dist/v1/schema/validation/class.js +208 -0
- package/dist/v1/schema/validation/core.d.ts +5 -0
- package/dist/v1/schema/validation/core.js +264 -0
- package/dist/v1/schema/validation/domain.d.ts +11 -0
- package/dist/v1/schema/validation/domain.js +36 -0
- package/dist/v1/schema/validation/domain.route.d.ts +4 -0
- package/dist/v1/schema/validation/domain.route.js +32 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +4 -0
- package/dist/v1/schema/validation/domain.structure.js +427 -0
- package/dist/v1/schema/validation/policy/budgets.d.ts +4 -0
- package/dist/v1/schema/validation/policy/budgets.js +102 -0
- package/dist/v1/schema/validation/policy/context.d.ts +28 -0
- package/dist/v1/schema/validation/policy/context.js +89 -0
- package/dist/v1/schema/validation/policy/references.d.ts +2 -0
- package/dist/v1/schema/validation/policy/references.js +143 -0
- package/dist/v1/schema/validation/policy/typing.d.ts +19 -0
- package/dist/v1/schema/validation/policy/typing.js +318 -0
- package/dist/v1/schema/validation/policy/uses.d.ts +5 -0
- package/dist/v1/schema/validation/policy/uses.js +258 -0
- package/dist/v1/schema/validation/policy/validate.d.ts +11 -0
- package/dist/v1/schema/validation/policy/validate.js +23 -0
- package/dist/v1/schema/validation/value-api.d.ts +13 -0
- package/dist/v1/schema/validation/value-api.js +23 -0
- package/dist/v1/schema/validation/value.d.ts +4 -0
- package/dist/v1/schema/validation/value.js +39 -0
- package/dist/v1/schema/validation/view.d.ts +3 -0
- package/dist/v1/schema/validation/view.js +29 -0
- package/dist/v1/value/full-match.d.ts +2 -0
- package/dist/v1/value/full-match.js +2 -0
- package/dist/v1.d.ts +2 -0
- package/dist/v1.js +2 -0
- package/dist/value/accept.d.ts +8 -0
- package/dist/value/accept.js +132 -0
- package/dist/value/canonical.d.ts +4 -0
- package/dist/value/canonical.js +41 -0
- package/dist/value/decode.d.ts +4 -0
- package/dist/value/decode.js +108 -0
- package/dist/value/equal.d.ts +3 -0
- package/dist/value/equal.js +5 -0
- package/dist/value/error.d.ts +12 -0
- package/dist/value/error.js +21 -0
- package/dist/value/index.d.ts +9 -0
- package/dist/value/index.js +6 -0
- package/dist/value/json.d.ts +3 -0
- package/dist/value/json.js +3 -0
- package/dist/value/limits.d.ts +21 -0
- package/dist/value/limits.js +15 -0
- package/dist/value/types.d.ts +6 -0
- package/dist/value/types.js +1 -0
- package/dist/value/unicode.d.ts +4 -0
- package/dist/value/unicode.js +64 -0
- package/dist/version/dispatch.d.ts +24 -0
- package/dist/version/dispatch.js +47 -0
- package/dist/version/index.d.ts +2 -0
- package/dist/version/index.js +1 -0
- package/package.json +75 -15
- package/dist/builders/bitmask.d.ts +0 -5
- package/dist/builders/bitmask.d.ts.map +0 -1
- package/dist/builders/bitmask.js +0 -12
- package/dist/builders/bitmask.js.map +0 -1
- package/dist/builders/data.d.ts +0 -7
- package/dist/builders/data.d.ts.map +0 -1
- package/dist/builders/data.js +0 -18
- package/dist/builders/data.js.map +0 -1
- package/dist/builders/definition/base.d.ts +0 -13
- package/dist/builders/definition/base.d.ts.map +0 -1
- package/dist/builders/definition/base.js +0 -24
- package/dist/builders/definition/base.js.map +0 -1
- package/dist/builders/definition/edge-class.d.ts +0 -8
- package/dist/builders/definition/edge-class.d.ts.map +0 -1
- package/dist/builders/definition/edge-class.js +0 -9
- package/dist/builders/definition/edge-class.js.map +0 -1
- package/dist/builders/definition/edge-interface.d.ts +0 -8
- package/dist/builders/definition/edge-interface.d.ts.map +0 -1
- package/dist/builders/definition/edge-interface.js +0 -9
- package/dist/builders/definition/edge-interface.js.map +0 -1
- package/dist/builders/definition/node-class.d.ts +0 -7
- package/dist/builders/definition/node-class.d.ts.map +0 -1
- package/dist/builders/definition/node-class.js +0 -9
- package/dist/builders/definition/node-class.js.map +0 -1
- package/dist/builders/definition/node-interface.d.ts +0 -7
- package/dist/builders/definition/node-interface.d.ts.map +0 -1
- package/dist/builders/definition/node-interface.js +0 -9
- package/dist/builders/definition/node-interface.js.map +0 -1
- package/dist/builders/function.d.ts +0 -34
- package/dist/builders/function.d.ts.map +0 -1
- package/dist/builders/function.js +0 -8
- package/dist/builders/function.js.map +0 -1
- package/dist/builders/policy.d.ts +0 -10
- package/dist/builders/policy.d.ts.map +0 -1
- package/dist/builders/policy.js +0 -28
- package/dist/builders/policy.js.map +0 -1
- package/dist/builders/prop.d.ts +0 -7
- package/dist/builders/prop.d.ts.map +0 -1
- package/dist/builders/prop.js +0 -9
- package/dist/builders/prop.js.map +0 -1
- package/dist/builders/ref.d.ts +0 -12
- package/dist/builders/ref.d.ts.map +0 -1
- package/dist/builders/ref.js +0 -27
- package/dist/builders/ref.js.map +0 -1
- package/dist/grammar/definition/base.d.ts +0 -13
- package/dist/grammar/definition/base.d.ts.map +0 -1
- package/dist/grammar/definition/base.js +0 -2
- package/dist/grammar/definition/base.js.map +0 -1
- package/dist/grammar/definition/discriminants.d.ts +0 -31
- package/dist/grammar/definition/discriminants.d.ts.map +0 -1
- package/dist/grammar/definition/discriminants.js +0 -33
- package/dist/grammar/definition/discriminants.js.map +0 -1
- package/dist/grammar/definition/edge-class.d.ts +0 -19
- package/dist/grammar/definition/edge-class.d.ts.map +0 -1
- package/dist/grammar/definition/edge-class.js +0 -2
- package/dist/grammar/definition/edge-class.js.map +0 -1
- package/dist/grammar/definition/edge-interface.d.ts +0 -18
- package/dist/grammar/definition/edge-interface.d.ts.map +0 -1
- package/dist/grammar/definition/edge-interface.js +0 -2
- package/dist/grammar/definition/edge-interface.js.map +0 -1
- package/dist/grammar/definition/node-class.d.ts +0 -26
- package/dist/grammar/definition/node-class.d.ts.map +0 -1
- package/dist/grammar/definition/node-class.js +0 -2
- package/dist/grammar/definition/node-class.js.map +0 -1
- package/dist/grammar/definition/node-interface.d.ts +0 -14
- package/dist/grammar/definition/node-interface.d.ts.map +0 -1
- package/dist/grammar/definition/node-interface.js +0 -2
- package/dist/grammar/definition/node-interface.js.map +0 -1
- package/dist/grammar/facets/constraints.d.ts +0 -8
- package/dist/grammar/facets/constraints.d.ts.map +0 -1
- package/dist/grammar/facets/constraints.js +0 -2
- package/dist/grammar/facets/constraints.js.map +0 -1
- package/dist/grammar/facets/content.d.ts +0 -4
- package/dist/grammar/facets/content.d.ts.map +0 -1
- package/dist/grammar/facets/content.js +0 -2
- package/dist/grammar/facets/content.js.map +0 -1
- package/dist/grammar/facets/endpoints.d.ts +0 -14
- package/dist/grammar/facets/endpoints.d.ts.map +0 -1
- package/dist/grammar/facets/endpoints.js +0 -3
- package/dist/grammar/facets/endpoints.js.map +0 -1
- package/dist/grammar/facets/indexes.d.ts +0 -12
- package/dist/grammar/facets/indexes.d.ts.map +0 -1
- package/dist/grammar/facets/indexes.js +0 -9
- package/dist/grammar/facets/indexes.js.map +0 -1
- package/dist/grammar/facets/properties.d.ts +0 -26
- package/dist/grammar/facets/properties.d.ts.map +0 -1
- package/dist/grammar/facets/properties.js +0 -45
- package/dist/grammar/facets/properties.js.map +0 -1
- package/dist/grammar/function/config.d.ts +0 -16
- package/dist/grammar/function/config.d.ts.map +0 -1
- package/dist/grammar/function/config.js +0 -2
- package/dist/grammar/function/config.js.map +0 -1
- package/dist/grammar/function/def.d.ts +0 -58
- package/dist/grammar/function/def.d.ts.map +0 -1
- package/dist/grammar/function/def.js +0 -2
- package/dist/grammar/function/def.js.map +0 -1
- package/dist/grammar/function/inheritance.d.ts +0 -3
- package/dist/grammar/function/inheritance.d.ts.map +0 -1
- package/dist/grammar/function/inheritance.js +0 -2
- package/dist/grammar/function/inheritance.js.map +0 -1
- package/dist/grammar/function/output.d.ts +0 -3
- package/dist/grammar/function/output.d.ts.map +0 -1
- package/dist/grammar/function/output.js +0 -2
- package/dist/grammar/function/output.js.map +0 -1
- package/dist/grammar/policy/callable.d.ts +0 -40
- package/dist/grammar/policy/callable.d.ts.map +0 -1
- package/dist/grammar/policy/callable.js +0 -2
- package/dist/grammar/policy/callable.js.map +0 -1
- package/dist/grammar/policy/def.d.ts +0 -27
- package/dist/grammar/policy/def.d.ts.map +0 -1
- package/dist/grammar/policy/def.js +0 -2
- package/dist/grammar/policy/def.js.map +0 -1
- package/dist/grammar/policy/pattern.d.ts +0 -34
- package/dist/grammar/policy/pattern.d.ts.map +0 -1
- package/dist/grammar/policy/pattern.js +0 -2
- package/dist/grammar/policy/pattern.js.map +0 -1
- package/dist/grammar/values/bitmask.d.ts +0 -7
- package/dist/grammar/values/bitmask.d.ts.map +0 -1
- package/dist/grammar/values/bitmask.js +0 -2
- package/dist/grammar/values/bitmask.js.map +0 -1
- package/dist/grammar/values/data.d.ts +0 -30
- package/dist/grammar/values/data.d.ts.map +0 -1
- package/dist/grammar/values/data.js +0 -2
- package/dist/grammar/values/data.js.map +0 -1
- package/dist/grammar/values/ref.d.ts +0 -26
- package/dist/grammar/values/ref.d.ts.map +0 -1
- package/dist/grammar/values/ref.js +0 -2
- package/dist/grammar/values/ref.js.map +0 -1
- package/dist/grammar/values/self.d.ts +0 -12
- package/dist/grammar/values/self.d.ts.map +0 -1
- package/dist/grammar/values/self.js +0 -6
- package/dist/grammar/values/self.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inference/content.d.ts +0 -27
- package/dist/inference/content.d.ts.map +0 -1
- package/dist/inference/content.js +0 -2
- package/dist/inference/content.js.map +0 -1
- package/dist/inference/index.d.ts +0 -7
- package/dist/inference/index.d.ts.map +0 -1
- package/dist/inference/index.js +0 -2
- package/dist/inference/index.js.map +0 -1
- package/dist/inference/inheritance.d.ts +0 -48
- package/dist/inference/inheritance.d.ts.map +0 -1
- package/dist/inference/inheritance.js +0 -2
- package/dist/inference/inheritance.js.map +0 -1
- package/dist/inference/input.d.ts +0 -30
- package/dist/inference/input.d.ts.map +0 -1
- package/dist/inference/input.js +0 -2
- package/dist/inference/input.js.map +0 -1
- package/dist/inference/methods.d.ts +0 -69
- package/dist/inference/methods.d.ts.map +0 -1
- package/dist/inference/methods.js +0 -2
- package/dist/inference/methods.js.map +0 -1
- package/dist/inference/properties.d.ts +0 -37
- package/dist/inference/properties.d.ts.map +0 -1
- package/dist/inference/properties.js +0 -2
- package/dist/inference/properties.js.map +0 -1
- package/dist/inference/schema.d.ts +0 -37
- package/dist/inference/schema.d.ts.map +0 -1
- package/dist/inference/schema.js +0 -2
- package/dist/inference/schema.js.map +0 -1
- package/dist/instance/core/define.d.ts +0 -13
- package/dist/instance/core/define.d.ts.map +0 -1
- package/dist/instance/core/define.js +0 -63
- package/dist/instance/core/define.js.map +0 -1
- package/dist/instance/core/edge.d.ts +0 -9
- package/dist/instance/core/edge.d.ts.map +0 -1
- package/dist/instance/core/edge.js +0 -11
- package/dist/instance/core/edge.js.map +0 -1
- package/dist/instance/core/endpoint.d.ts +0 -11
- package/dist/instance/core/endpoint.d.ts.map +0 -1
- package/dist/instance/core/endpoint.js +0 -19
- package/dist/instance/core/endpoint.js.map +0 -1
- package/dist/instance/core/node.d.ts +0 -7
- package/dist/instance/core/node.d.ts.map +0 -1
- package/dist/instance/core/node.js +0 -9
- package/dist/instance/core/node.js.map +0 -1
- package/dist/instance/core/path.d.ts +0 -21
- package/dist/instance/core/path.d.ts.map +0 -1
- package/dist/instance/core/path.js +0 -21
- package/dist/instance/core/path.js.map +0 -1
- package/dist/instance/core/self.d.ts +0 -15
- package/dist/instance/core/self.d.ts.map +0 -1
- package/dist/instance/core/self.js +0 -8
- package/dist/instance/core/self.js.map +0 -1
- package/dist/instance/core/types.d.ts +0 -45
- package/dist/instance/core/types.d.ts.map +0 -1
- package/dist/instance/core/types.js +0 -2
- package/dist/instance/core/types.js.map +0 -1
- package/dist/instance/seed/define.d.ts +0 -12
- package/dist/instance/seed/define.d.ts.map +0 -1
- package/dist/instance/seed/define.js +0 -34
- package/dist/instance/seed/define.js.map +0 -1
- package/dist/instance/seed/types.d.ts +0 -12
- package/dist/instance/seed/types.d.ts.map +0 -1
- package/dist/instance/seed/types.js +0 -2
- package/dist/instance/seed/types.js.map +0 -1
- package/dist/ir/classes.d.ts +0 -78
- package/dist/ir/classes.d.ts.map +0 -1
- package/dist/ir/classes.js +0 -2
- package/dist/ir/classes.js.map +0 -1
- package/dist/ir/domain.d.ts +0 -13
- package/dist/ir/domain.d.ts.map +0 -1
- package/dist/ir/domain.js +0 -2
- package/dist/ir/domain.js.map +0 -1
- package/dist/ir/endpoints.d.ts +0 -27
- package/dist/ir/endpoints.d.ts.map +0 -1
- package/dist/ir/endpoints.js +0 -2
- package/dist/ir/endpoints.js.map +0 -1
- package/dist/ir/functions.d.ts +0 -34
- package/dist/ir/functions.d.ts.map +0 -1
- package/dist/ir/functions.js +0 -2
- package/dist/ir/functions.js.map +0 -1
- package/dist/ir/index.d.ts +0 -9
- package/dist/ir/index.d.ts.map +0 -1
- package/dist/ir/index.js +0 -2
- package/dist/ir/index.js.map +0 -1
- package/dist/ir/ir.d.ts +0 -75
- package/dist/ir/ir.d.ts.map +0 -1
- package/dist/ir/ir.js +0 -5
- package/dist/ir/ir.js.map +0 -1
- package/dist/ir/json-schema.d.ts +0 -20
- package/dist/ir/json-schema.d.ts.map +0 -1
- package/dist/ir/json-schema.js +0 -2
- package/dist/ir/json-schema.js.map +0 -1
- package/dist/ir/policies.d.ts +0 -74
- package/dist/ir/policies.d.ts.map +0 -1
- package/dist/ir/policies.js +0 -2
- package/dist/ir/policies.js.map +0 -1
- package/dist/schema/classify.d.ts +0 -8
- package/dist/schema/classify.d.ts.map +0 -1
- package/dist/schema/classify.js +0 -20
- package/dist/schema/classify.js.map +0 -1
- package/dist/schema/define.d.ts +0 -23
- package/dist/schema/define.d.ts.map +0 -1
- package/dist/schema/define.js +0 -58
- package/dist/schema/define.js.map +0 -1
- package/dist/schema/error.d.ts +0 -8
- package/dist/schema/error.d.ts.map +0 -1
- package/dist/schema/error.js +0 -14
- package/dist/schema/error.js.map +0 -1
- package/dist/schema/refs.d.ts +0 -77
- package/dist/schema/refs.d.ts.map +0 -1
- package/dist/schema/refs.js +0 -100
- package/dist/schema/refs.js.map +0 -1
- package/dist/schema/resolve/index.d.ts +0 -5
- package/dist/schema/resolve/index.d.ts.map +0 -1
- package/dist/schema/resolve/index.js +0 -5
- package/dist/schema/resolve/index.js.map +0 -1
- package/dist/schema/resolve/methods.d.ts +0 -8
- package/dist/schema/resolve/methods.d.ts.map +0 -1
- package/dist/schema/resolve/methods.js +0 -18
- package/dist/schema/resolve/methods.js.map +0 -1
- package/dist/schema/resolve/properties.d.ts +0 -13
- package/dist/schema/resolve/properties.d.ts.map +0 -1
- package/dist/schema/resolve/properties.js +0 -37
- package/dist/schema/resolve/properties.js.map +0 -1
- package/dist/schema/resolve/self.d.ts +0 -7
- package/dist/schema/resolve/self.d.ts.map +0 -1
- package/dist/schema/resolve/self.js +0 -33
- package/dist/schema/resolve/self.js.map +0 -1
- package/dist/schema/resolve/thunks.d.ts +0 -12
- package/dist/schema/resolve/thunks.d.ts.map +0 -1
- package/dist/schema/resolve/thunks.js +0 -37
- package/dist/schema/resolve/thunks.js.map +0 -1
- package/dist/schema/schema.d.ts +0 -25
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js +0 -2
- package/dist/schema/schema.js.map +0 -1
- package/dist/schema/validators/context.d.ts +0 -17
- package/dist/schema/validators/context.d.ts.map +0 -1
- package/dist/schema/validators/context.js +0 -2
- package/dist/schema/validators/context.js.map +0 -1
- package/dist/schema/validators/endpoints.d.ts +0 -4
- package/dist/schema/validators/endpoints.d.ts.map +0 -1
- package/dist/schema/validators/endpoints.js +0 -27
- package/dist/schema/validators/endpoints.js.map +0 -1
- package/dist/schema/validators/index.d.ts +0 -12
- package/dist/schema/validators/index.d.ts.map +0 -1
- package/dist/schema/validators/index.js +0 -25
- package/dist/schema/validators/index.js.map +0 -1
- package/dist/schema/validators/indexes.d.ts +0 -4
- package/dist/schema/validators/indexes.d.ts.map +0 -1
- package/dist/schema/validators/indexes.js +0 -19
- package/dist/schema/validators/indexes.js.map +0 -1
- package/dist/schema/validators/inheritance.d.ts +0 -4
- package/dist/schema/validators/inheritance.d.ts.map +0 -1
- package/dist/schema/validators/inheritance.js +0 -27
- package/dist/schema/validators/inheritance.js.map +0 -1
- package/dist/schema/validators/methods.d.ts +0 -9
- package/dist/schema/validators/methods.d.ts.map +0 -1
- package/dist/schema/validators/methods.js +0 -44
- package/dist/schema/validators/methods.js.map +0 -1
- package/dist/schema/validators/names.d.ts +0 -4
- package/dist/schema/validators/names.d.ts.map +0 -1
- package/dist/schema/validators/names.js +0 -19
- package/dist/schema/validators/names.js.map +0 -1
- package/dist/schema/validators/policies.d.ts +0 -4
- package/dist/schema/validators/policies.d.ts.map +0 -1
- package/dist/schema/validators/policies.js +0 -61
- package/dist/schema/validators/policies.js.map +0 -1
- package/dist/schema/validators/ref-targets.d.ts +0 -4
- package/dist/schema/validators/ref-targets.d.ts.map +0 -1
- package/dist/schema/validators/ref-targets.js +0 -54
- package/dist/schema/validators/ref-targets.js.map +0 -1
- package/dist/serializer/context.d.ts +0 -35
- package/dist/serializer/context.d.ts.map +0 -1
- package/dist/serializer/context.js +0 -359
- package/dist/serializer/context.js.map +0 -1
- package/dist/serializer/helpers.d.ts +0 -34
- package/dist/serializer/helpers.d.ts.map +0 -1
- package/dist/serializer/helpers.js +0 -116
- package/dist/serializer/helpers.js.map +0 -1
- package/dist/serializer/index.d.ts +0 -2
- package/dist/serializer/index.d.ts.map +0 -1
- package/dist/serializer/index.js +0 -2
- package/dist/serializer/index.js.map +0 -1
- package/dist/serializer/policies.d.ts +0 -34
- package/dist/serializer/policies.d.ts.map +0 -1
- package/dist/serializer/policies.js +0 -837
- package/dist/serializer/policies.js.map +0 -1
- package/dist/serializer/policy-typing.d.ts +0 -56
- package/dist/serializer/policy-typing.d.ts.map +0 -1
- package/dist/serializer/policy-typing.js +0 -490
- package/dist/serializer/policy-typing.js.map +0 -1
- package/dist/serializer/serialize.d.ts +0 -12
- package/dist/serializer/serialize.d.ts.map +0 -1
- package/dist/serializer/serialize.js +0 -6
- package/dist/serializer/serialize.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SchemaDiagnosticCode = 'DM_MEMBER_ROOT_INVALID' | 'DM_DEPENDENCY_CONTEXT_INVALID' | 'DM_DEPENDENCY_NOT_RETAINED' | 'DM_MEANING_INCONSISTENT' | 'DM_MEMBER_ORIGIN_MISMATCH' | 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CALLABLE_POLICY_AUTH' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_CONSTRAINT' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNDIRECTED' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_COMPOSITION' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'DV_VIEW_TARGET' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_ABSTRACT_POLICY' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_INVALID' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_MULTIPLE' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
|
|
2
|
+
export interface SchemaDiagnostic<out Code extends SchemaDiagnosticCode = SchemaDiagnosticCode> {
|
|
3
|
+
readonly code: Code;
|
|
4
|
+
readonly pointer: string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly ref?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function diagnostic<const Code extends SchemaDiagnosticCode>(code: Code, pointer: string, message: string, ref?: string): SchemaDiagnostic<Code>;
|
|
9
|
+
export declare class SchemaError extends Error {
|
|
10
|
+
readonly diagnostics: readonly SchemaDiagnostic[];
|
|
11
|
+
constructor(diagnostics: readonly SchemaDiagnostic[]);
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { compareUnicode } from '../addressing/ordering.js';
|
|
2
|
+
export function diagnostic(code, pointer, message, ref) {
|
|
3
|
+
return Object.freeze({ code, pointer, message, ...(ref === undefined ? {} : { ref }) });
|
|
4
|
+
}
|
|
5
|
+
export class SchemaError extends Error {
|
|
6
|
+
diagnostics;
|
|
7
|
+
constructor(diagnostics) {
|
|
8
|
+
const ordered = [...diagnostics].sort(compareDiagnostic);
|
|
9
|
+
super(ordered.map(formatDiagnostic).join('\n'));
|
|
10
|
+
this.name = 'SchemaError';
|
|
11
|
+
this.diagnostics = Object.freeze(ordered);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function compareDiagnostic(left, right) {
|
|
15
|
+
return (compareUnicode(left.pointer, right.pointer) ||
|
|
16
|
+
compareUnicode(left.code, right.code) ||
|
|
17
|
+
compareUnicode(left.message, right.message));
|
|
18
|
+
}
|
|
19
|
+
function formatDiagnostic(value) {
|
|
20
|
+
return `${value.pointer || '/'} [${value.code}] ${value.message}`;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Admit, encode, inspect, and semantically resolve canonical V1 DomainSchemas. */
|
|
2
|
+
import type { SourceDomain } from '../domain/index.js';
|
|
3
|
+
import type { DomainSchema } from './model/schema.js';
|
|
4
|
+
export type { DomainSchema, DomainSchemaIR, DomainOfSchema as DomainOf } from './model/schema.js';
|
|
5
|
+
export type ResolvedDomainOf<Schema extends DomainSchema> = SourceDomain<Schema>;
|
|
6
|
+
export interface Resolve {
|
|
7
|
+
<const Schema extends DomainSchema>(schema: Schema): ResolvedDomainOf<Schema>;
|
|
8
|
+
}
|
|
9
|
+
export declare const resolve: Resolve;
|
|
10
|
+
export type { SchemaDiagnosticCode as DiagnosticCode } from './diagnostic.js';
|
|
11
|
+
export { acceptDomainSchema as accept } from './admission/accept.js';
|
|
12
|
+
export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
|
|
13
|
+
export { revisionOfDomainSchema as revision } from './canonical/revision.js';
|
|
14
|
+
export { compareDependencyMeaning, compareMemberMeaning } from './compatibility/meaning.js';
|
|
15
|
+
export type { DependencyMeaningChange, DependencyMeaningChangeKind, DependencyMeaningComparison, MeaningFingerprint, } from './compatibility/meaning.js';
|
|
16
|
+
export { header } from './codec/header.js';
|
|
17
|
+
export { DOMAIN_FORMAT as FORMAT, DOMAIN_VERSION as VERSION } from './model/format.js';
|
|
18
|
+
export { compile, load } from '../compiled/index.js';
|
|
19
|
+
export type { CompiledSchema, DomainOfCompiled } from '../compiled/index.js';
|
|
20
|
+
export { SchemaError as Error } from './diagnostic.js';
|
|
21
|
+
export type { SchemaDiagnostic as Diagnostic } from './diagnostic.js';
|
|
22
|
+
export type { DomainSchemaLookup as Lookup } from './dependency/lookup.js';
|
|
23
|
+
export type { DomainSchemaHeader as Header } from './codec/header.js';
|
|
24
|
+
export type { DomainDependency } from '../addressing/index.js';
|
|
25
|
+
/** The versioned value-schema grammar embedded in declarations. */
|
|
26
|
+
export * as values from './validation/value-api.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Admit, encode, inspect, and semantically resolve canonical V1 DomainSchemas. */
|
|
2
|
+
import { resolve as resolveDomainSchema } from './resolution/domain.js';
|
|
3
|
+
export const resolve = resolveDomainSchema;
|
|
4
|
+
export { acceptDomainSchema as accept } from './admission/accept.js';
|
|
5
|
+
export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
|
|
6
|
+
export { revisionOfDomainSchema as revision } from './canonical/revision.js';
|
|
7
|
+
export { compareDependencyMeaning, compareMemberMeaning } from './compatibility/meaning.js';
|
|
8
|
+
export { header } from './codec/header.js';
|
|
9
|
+
export { DOMAIN_FORMAT as FORMAT, DOMAIN_VERSION as VERSION } from './model/format.js';
|
|
10
|
+
export { compile, load } from '../compiled/index.js';
|
|
11
|
+
export { SchemaError as Error } from './diagnostic.js';
|
|
12
|
+
/** The versioned value-schema grammar embedded in declarations. */
|
|
13
|
+
export * as values from './validation/value-api.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Key } from '../../addressing/index.js';
|
|
2
|
+
import type { DomainDependencyMap } from '../../addressing/index.js';
|
|
3
|
+
import type { Domain, DomainOfSource, DomainSource } from '../../domain/model/domain.js';
|
|
4
|
+
import type { FunctionDefinition } from '../../language/callable/model/callable.js';
|
|
5
|
+
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
6
|
+
import type { CoreContent } from '../../language/core/model/core.js';
|
|
7
|
+
import type { PolicyDefinition } from '../../language/policy/model/policy.js';
|
|
8
|
+
import type { ViewDefinition } from '../../language/view/model/view.js';
|
|
9
|
+
export interface DomainSchemaIR {
|
|
10
|
+
readonly format: 'astrale.dsl';
|
|
11
|
+
readonly version: 'v1';
|
|
12
|
+
readonly origin: Key.Origin;
|
|
13
|
+
readonly dependencies: DomainDependencyMap;
|
|
14
|
+
readonly classes: Readonly<Record<string, ClassDefinition>>;
|
|
15
|
+
readonly functions: Readonly<Record<string, FunctionDefinition>>;
|
|
16
|
+
readonly policies: Readonly<Record<string, PolicyDefinition>>;
|
|
17
|
+
readonly views: Readonly<Record<string, ViewDefinition>>;
|
|
18
|
+
readonly core: CoreContent;
|
|
19
|
+
}
|
|
20
|
+
declare const DOMAIN_SCHEMA_BRAND: unique symbol;
|
|
21
|
+
/**
|
|
22
|
+
* Accepted canonical schema carrying its exact resolved Domain projection.
|
|
23
|
+
*/
|
|
24
|
+
export type DomainSchema<Origin extends string = string, Resolved extends Domain = Domain> = DomainSchemaIR & DomainSource<Resolved> & {
|
|
25
|
+
readonly origin: Origin;
|
|
26
|
+
readonly [DOMAIN_SCHEMA_BRAND]: true;
|
|
27
|
+
};
|
|
28
|
+
export type DomainOfSchema<Schema extends DomainSchema> = DomainOfSource<Schema>;
|
|
29
|
+
export declare function asDomainSchema<Origin extends string = string, Resolved extends Domain = Domain>(value: DomainSchemaIR): DomainSchema<Origin, Resolved>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import { compareDefinitionRefs, compareUnicode } from '../../addressing/ordering.js';
|
|
3
|
+
import { normalizePolicyChecks, normalizePolicyExpression, } from '../../language/policy/normalization/normalize.js';
|
|
4
|
+
import { canonicalizeValueSchema } from '../../language/value/profile/canonicalize.js';
|
|
5
|
+
export function normalizeDomainSchema(schema) {
|
|
6
|
+
const classes = mapRecord(schema.classes, canonicalizeClass);
|
|
7
|
+
const orientationByClass = new Map(Object.entries(classes)
|
|
8
|
+
.filter((entry) => entry[1].kind === 'edge')
|
|
9
|
+
.map(([name, declaration]) => [name, declaration.orientation]));
|
|
10
|
+
const normalized = {
|
|
11
|
+
format: 'astrale.dsl',
|
|
12
|
+
version: 'v1',
|
|
13
|
+
origin: schema.origin,
|
|
14
|
+
dependencies: mapRecord(schema.dependencies, (dependency) => ({ ...dependency })),
|
|
15
|
+
classes,
|
|
16
|
+
functions: mapRecord(schema.functions, canonicalizeFunction),
|
|
17
|
+
policies: mapRecord(schema.policies, canonicalizePolicy),
|
|
18
|
+
views: mapRecord(schema.views, canonicalizeView),
|
|
19
|
+
core: {
|
|
20
|
+
nodes: mapRecord(schema.core.nodes, (node) => ({
|
|
21
|
+
ref: node.ref,
|
|
22
|
+
class: node.class,
|
|
23
|
+
properties: copyJsonValue(node.properties),
|
|
24
|
+
})),
|
|
25
|
+
edges: schema.core.edges
|
|
26
|
+
.map((edge) => canonicalizeCoreEdge(edge, schema.origin, orientationByClass))
|
|
27
|
+
.sort(compareCoreEdges),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return copyJsonValue(normalized);
|
|
31
|
+
}
|
|
32
|
+
function canonicalizePolicy(value) {
|
|
33
|
+
return {
|
|
34
|
+
ref: value.ref,
|
|
35
|
+
...withDescription(value),
|
|
36
|
+
expression: normalizePolicyExpression(value.expression),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function canonicalizeView(value) {
|
|
40
|
+
return {
|
|
41
|
+
ref: value.ref,
|
|
42
|
+
...withDescription(value),
|
|
43
|
+
target: value.target.kind === 'domain'
|
|
44
|
+
? { kind: 'domain' }
|
|
45
|
+
: {
|
|
46
|
+
kind: 'definition',
|
|
47
|
+
definitions: [...value.target.definitions].sort(compareDefinitionRefs),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function canonicalizeClass(value) {
|
|
52
|
+
const base = {
|
|
53
|
+
...withDescription(value),
|
|
54
|
+
ref: value.ref,
|
|
55
|
+
kind: value.kind,
|
|
56
|
+
abstract: value.abstract,
|
|
57
|
+
extends: [...value.extends].sort(compareDefinitionRefs),
|
|
58
|
+
properties: mapRecord(value.properties, canonicalizeProperty),
|
|
59
|
+
};
|
|
60
|
+
if (value.kind === 'node') {
|
|
61
|
+
return {
|
|
62
|
+
...base,
|
|
63
|
+
methods: mapRecord(value.methods, canonicalizeMethod),
|
|
64
|
+
...(value.data === undefined ? {} : { data: { mediaType: value.data.mediaType } }),
|
|
65
|
+
...(value.icon === undefined ? {} : { icon: value.icon }),
|
|
66
|
+
policies: value.policies,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return value.orientation === 'directed'
|
|
70
|
+
? {
|
|
71
|
+
...base,
|
|
72
|
+
orientation: 'directed',
|
|
73
|
+
endpoints: canonicalizeDirectedEndpoints(value.endpoints),
|
|
74
|
+
policies: value.policies,
|
|
75
|
+
constraints: value.constraints,
|
|
76
|
+
}
|
|
77
|
+
: {
|
|
78
|
+
...base,
|
|
79
|
+
orientation: 'undirected',
|
|
80
|
+
endpoints: canonicalizeIncidentEndpoints(value.endpoints),
|
|
81
|
+
policies: value.policies,
|
|
82
|
+
constraints: value.constraints,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function canonicalizeFunction(value) {
|
|
86
|
+
return {
|
|
87
|
+
ref: value.ref,
|
|
88
|
+
...canonicalizeCallable(value),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function canonicalizeCallable(value) {
|
|
92
|
+
const base = {
|
|
93
|
+
...withDescription(value),
|
|
94
|
+
input: canonicalizeValueSchema(value.input, 'callable-input'),
|
|
95
|
+
output: canonicalizeCallableOutput(value.output),
|
|
96
|
+
};
|
|
97
|
+
return value.auth === 'authorized'
|
|
98
|
+
? {
|
|
99
|
+
...base,
|
|
100
|
+
auth: value.auth,
|
|
101
|
+
...(value.policy === undefined ? {} : { policy: normalizePolicyChecks(value.policy) }),
|
|
102
|
+
}
|
|
103
|
+
: { ...base, auth: value.auth };
|
|
104
|
+
}
|
|
105
|
+
function canonicalizeMethod(value) {
|
|
106
|
+
return {
|
|
107
|
+
...canonicalizeCallable(value),
|
|
108
|
+
static: value.static,
|
|
109
|
+
inheritance: value.inheritance,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function canonicalizeCallableOutput(value) {
|
|
113
|
+
switch (value.mode) {
|
|
114
|
+
case 'value':
|
|
115
|
+
return { mode: 'value', schema: canonicalizeValueSchema(value.schema, 'callable-output') };
|
|
116
|
+
case 'stream':
|
|
117
|
+
return { mode: 'stream', item: canonicalizeValueSchema(value.item, 'callable-output') };
|
|
118
|
+
case 'binary':
|
|
119
|
+
return { mode: 'binary' };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function canonicalizeProperty(value) {
|
|
123
|
+
return {
|
|
124
|
+
schema: canonicalizeValueSchema(value.schema, 'property-facet'),
|
|
125
|
+
required: value.required,
|
|
126
|
+
visibility: value.visibility,
|
|
127
|
+
...(value.auto === undefined
|
|
128
|
+
? {}
|
|
129
|
+
: {
|
|
130
|
+
auto: {
|
|
131
|
+
on: [...new Set(value.auto.on)].sort(compareUnicode),
|
|
132
|
+
set: value.auto.set,
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
...(value.description === undefined ? {} : { description: value.description }),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function canonicalizeDirectedEndpoints(value) {
|
|
139
|
+
return {
|
|
140
|
+
...value,
|
|
141
|
+
source: { ...value.source, accepts: [...value.source.accepts].sort(compareDefinitionRefs) },
|
|
142
|
+
target: { ...value.target, accepts: [...value.target.accepts].sort(compareDefinitionRefs) },
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function canonicalizeIncidentEndpoints(value) {
|
|
146
|
+
return [
|
|
147
|
+
{ ...value[0], accepts: [...value[0].accepts].sort(compareDefinitionRefs) },
|
|
148
|
+
{ ...value[1], accepts: [...value[1].accepts].sort(compareDefinitionRefs) },
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
function canonicalizeCoreEdge(edge, origin, orientationByClass) {
|
|
152
|
+
const isLocal = edge.class.origin === origin;
|
|
153
|
+
const isUndirected = isLocal && orientationByClass.get(edge.class.name) === 'undirected';
|
|
154
|
+
const [source, target] = isUndirected && compareCoreEndpoints(edge.source, edge.target) > 0
|
|
155
|
+
? [edge.target, edge.source]
|
|
156
|
+
: [edge.source, edge.target];
|
|
157
|
+
return {
|
|
158
|
+
class: edge.class,
|
|
159
|
+
source,
|
|
160
|
+
target,
|
|
161
|
+
properties: copyJsonValue(edge.properties),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function compareCoreEdges(left, right) {
|
|
165
|
+
return (compareDefinitionRefs(left.class, right.class) ||
|
|
166
|
+
compareCoreEndpoints(left.source, right.source) ||
|
|
167
|
+
compareCoreEndpoints(left.target, right.target) ||
|
|
168
|
+
compareBytes(json.serialize(left.properties), json.serialize(right.properties)));
|
|
169
|
+
}
|
|
170
|
+
function compareCoreEndpoints(left, right) {
|
|
171
|
+
if (left.kind === 'domain')
|
|
172
|
+
return right.kind === 'domain' ? 0 : -1;
|
|
173
|
+
if (right.kind === 'domain')
|
|
174
|
+
return 1;
|
|
175
|
+
return compareDefinitionRefs(left, right);
|
|
176
|
+
}
|
|
177
|
+
function compareBytes(left, right) {
|
|
178
|
+
const encoder = new TextEncoder();
|
|
179
|
+
const a = encoder.encode(left);
|
|
180
|
+
const b = encoder.encode(right);
|
|
181
|
+
const length = Math.min(a.length, b.length);
|
|
182
|
+
for (let index = 0; index < length; index++) {
|
|
183
|
+
if (a[index] !== b[index])
|
|
184
|
+
return (a[index] ?? 0) - (b[index] ?? 0);
|
|
185
|
+
}
|
|
186
|
+
return a.length - b.length;
|
|
187
|
+
}
|
|
188
|
+
function mapRecord(value, map) {
|
|
189
|
+
return Object.fromEntries(Object.entries(value)
|
|
190
|
+
.sort(([left], [right]) => compareUnicode(left, right))
|
|
191
|
+
.map(([name, entry]) => [name, map(entry, name)]));
|
|
192
|
+
}
|
|
193
|
+
function withDescription(value) {
|
|
194
|
+
return value.description === undefined ? {} : { description: value.description };
|
|
195
|
+
}
|
|
196
|
+
function copyJsonValue(value) {
|
|
197
|
+
if (typeof value === 'number') {
|
|
198
|
+
if (Object.is(value, -0))
|
|
199
|
+
throw new TypeError('Cannot canonicalize negative zero.');
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
if (value === null || typeof value !== 'object')
|
|
203
|
+
return value;
|
|
204
|
+
if (Array.isArray(value))
|
|
205
|
+
return value.map((entry) => copyJsonValue(entry));
|
|
206
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, copyJsonValue(entry)]));
|
|
207
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DomainSchemaEntry, DomainSchemaLookup } from '../dependency/lookup.js';
|
|
2
|
+
import type { DomainSchema } from '../model/schema.js';
|
|
3
|
+
/** Retain the exact schema objects used by one successful semantic acceptance. */
|
|
4
|
+
export declare function rememberDomainClosure(schema: DomainSchema, dependencies: Iterable<DomainSchema>): void;
|
|
5
|
+
/** Undefined means the value did not pass through this process's acceptance boundary. */
|
|
6
|
+
export declare function knownDomainClosure(schema: DomainSchema): readonly DomainSchemaEntry[] | undefined;
|
|
7
|
+
export declare function requireDomainClosure(schema: DomainSchema): readonly DomainSchemaEntry[];
|
|
8
|
+
export declare function lookupForDomainClosure(schema: DomainSchema): DomainSchemaLookup;
|
|
9
|
+
export declare function lookupEntriesForDependencies(dependencies: Readonly<Record<string, DomainSchema>>): readonly DomainSchemaEntry[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { compareUnicode } from '../../addressing/ordering.js';
|
|
2
|
+
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
3
|
+
import { MemoryDomainSchemaLookup } from '../dependency/lookup.js';
|
|
4
|
+
import { SchemaError, diagnostic } from '../diagnostic.js';
|
|
5
|
+
const knownClosure = new WeakMap();
|
|
6
|
+
/** Retain the exact schema objects used by one successful semantic acceptance. */
|
|
7
|
+
export function rememberDomainClosure(schema, dependencies) {
|
|
8
|
+
const entries = new Map();
|
|
9
|
+
for (const dependency of dependencies) {
|
|
10
|
+
const revision = revisionOfDomainSchema(dependency);
|
|
11
|
+
entries.set(closureKey(dependency.origin, revision), { revision, schema: dependency });
|
|
12
|
+
}
|
|
13
|
+
knownClosure.set(schema, freezeEntries(entries.values()));
|
|
14
|
+
}
|
|
15
|
+
/** Undefined means the value did not pass through this process's acceptance boundary. */
|
|
16
|
+
export function knownDomainClosure(schema) {
|
|
17
|
+
return knownClosure.get(schema);
|
|
18
|
+
}
|
|
19
|
+
export function requireDomainClosure(schema) {
|
|
20
|
+
const closure = knownDomainClosure(schema);
|
|
21
|
+
if (closure !== undefined)
|
|
22
|
+
return closure;
|
|
23
|
+
throw new SchemaError([
|
|
24
|
+
diagnostic('DV_ACCEPTANCE_CONTEXT', '', `DomainSchema ${schema.origin} has no retained acceptance context; accept it again against its exact lookup.`),
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
export function lookupForDomainClosure(schema) {
|
|
28
|
+
return new MemoryDomainSchemaLookup(requireDomainClosure(schema));
|
|
29
|
+
}
|
|
30
|
+
export function lookupEntriesForDependencies(dependencies) {
|
|
31
|
+
const entries = new Map();
|
|
32
|
+
for (const schema of Object.values(dependencies)) {
|
|
33
|
+
const revision = revisionOfDomainSchema(schema);
|
|
34
|
+
entries.set(closureKey(schema.origin, revision), { schema, revision });
|
|
35
|
+
for (const entry of requireDomainClosure(schema)) {
|
|
36
|
+
entries.set(closureKey(entry.schema.origin, entry.revision), entry);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return freezeEntries(entries.values());
|
|
40
|
+
}
|
|
41
|
+
function freezeEntries(entries) {
|
|
42
|
+
return Object.freeze([...entries]
|
|
43
|
+
.map(({ revision, schema }) => Object.freeze({ revision, schema }))
|
|
44
|
+
.sort((left, right) => compareUnicode(left.schema.origin, right.schema.origin) ||
|
|
45
|
+
compareUnicode(left.revision, right.revision)));
|
|
46
|
+
}
|
|
47
|
+
function closureKey(origin, revision) {
|
|
48
|
+
return `${origin}\u0000${revision}`;
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DefinitionRef, PolicyRef } from '../../addressing/index.js';
|
|
2
|
+
import type { PolicyDefinition } from '../../language/policy/model/policy.js';
|
|
3
|
+
import type { DomainSchemaLookup } from '../dependency/lookup.js';
|
|
4
|
+
import type { SchemaDiagnostic } from '../diagnostic.js';
|
|
5
|
+
import type { DomainSchema, DomainSchemaIR } from '../model/schema.js';
|
|
6
|
+
import type { IndexedClassDefinition } from './definition.index.js';
|
|
7
|
+
/** Transient symbol and dependency scope for one DomainSchema analysis pass. */
|
|
8
|
+
export interface DomainResolutionContext {
|
|
9
|
+
readonly candidate: DomainSchemaIR;
|
|
10
|
+
readonly dependencies: ReadonlyMap<string, DomainSchema>;
|
|
11
|
+
readonly definitions: ReadonlyMap<string, IndexedClassDefinition>;
|
|
12
|
+
readonly diagnostics: readonly SchemaDiagnostic[];
|
|
13
|
+
resolve(ref: DefinitionRef): IndexedClassDefinition | undefined;
|
|
14
|
+
resolveAny(ref: DefinitionRef): IndexedClassDefinition | undefined;
|
|
15
|
+
resolvePolicy(ref: PolicyRef): PolicyDefinition | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildDomainResolutionContext(candidate: DomainSchemaIR, lookup: DomainSchemaLookup): DomainResolutionContext;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { dependencyLimits } from '../../addressing/domain-dependency.js';
|
|
2
|
+
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
|
+
import { DOMAIN_REVISION_PATTERN } from '../../addressing/patterns.js';
|
|
4
|
+
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
5
|
+
import { diagnostic } from '../diagnostic.js';
|
|
6
|
+
import { indexSchemaDefinitions } from './definition.index.js';
|
|
7
|
+
import { collectUsedForeignOrigins } from './origins.js';
|
|
8
|
+
export function buildDomainResolutionContext(candidate, lookup) {
|
|
9
|
+
const diagnostics = [];
|
|
10
|
+
const dependencies = new Map();
|
|
11
|
+
const definitions = new Map();
|
|
12
|
+
const directOrigins = new Set();
|
|
13
|
+
if (Object.keys(candidate.dependencies).length > dependencyLimits.direct) {
|
|
14
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A Domain may declare at most ${dependencyLimits.direct} direct dependency aliases.`));
|
|
15
|
+
}
|
|
16
|
+
for (const [alias, dependency] of Object.entries(candidate.dependencies)) {
|
|
17
|
+
const pointer = `/dependencies/${escapeToken(alias)}`;
|
|
18
|
+
if (!DOMAIN_REVISION_PATTERN.test(dependency.revision))
|
|
19
|
+
continue;
|
|
20
|
+
if (dependency.origin === candidate.origin) {
|
|
21
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_UNIQUE', `${pointer}/origin`, 'A Domain cannot depend on itself.'));
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (directOrigins.has(dependency.origin)) {
|
|
25
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_UNIQUE', `${pointer}/origin`, `Dependency origin ${dependency.origin} is declared more than once.`));
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
directOrigins.add(dependency.origin);
|
|
29
|
+
const resolved = lookup.get(dependency.origin, dependency.revision);
|
|
30
|
+
if (resolved === undefined) {
|
|
31
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Schema lookup has no exact ${dependency.origin}@${dependency.revision}.`));
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (resolved.origin !== dependency.origin) {
|
|
35
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Schema lookup value origin ${resolved.origin} disagrees with ${dependency.origin}.`));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const actualRevision = revisionOfDomainSchema(resolved);
|
|
39
|
+
if (actualRevision !== dependency.revision) {
|
|
40
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Schema lookup content revision is ${actualRevision}, not ${dependency.revision}.`));
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
dependencies.set(resolved.origin, resolved);
|
|
44
|
+
}
|
|
45
|
+
loadDependencyClosure(candidate, dependencies, lookup, diagnostics);
|
|
46
|
+
for (const [key, resolved] of indexSchemaDefinitions(candidate))
|
|
47
|
+
definitions.set(key, resolved);
|
|
48
|
+
for (const schema of dependencies.values()) {
|
|
49
|
+
for (const [key, resolved] of indexSchemaDefinitions(schema))
|
|
50
|
+
definitions.set(key, resolved);
|
|
51
|
+
}
|
|
52
|
+
validateDependencyUse(candidate, directOrigins, diagnostics);
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
candidate,
|
|
55
|
+
dependencies,
|
|
56
|
+
definitions,
|
|
57
|
+
diagnostics: Object.freeze(diagnostics),
|
|
58
|
+
resolve(ref) {
|
|
59
|
+
if (ref.origin !== candidate.origin && !directOrigins.has(ref.origin))
|
|
60
|
+
return undefined;
|
|
61
|
+
return definitions.get(definitionRefIndex(ref));
|
|
62
|
+
},
|
|
63
|
+
resolveAny(ref) {
|
|
64
|
+
return definitions.get(definitionRefIndex(ref));
|
|
65
|
+
},
|
|
66
|
+
resolvePolicy(ref) {
|
|
67
|
+
if (ref.origin !== candidate.origin)
|
|
68
|
+
return undefined;
|
|
69
|
+
return candidate.policies[ref.name];
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
74
|
+
const revisionByOrigin = new Map();
|
|
75
|
+
const visited = new Set();
|
|
76
|
+
const activeOrigins = new Set([candidate.origin]);
|
|
77
|
+
const frames = [
|
|
78
|
+
{
|
|
79
|
+
schema: candidate,
|
|
80
|
+
key: `${candidate.origin}\u0000candidate`,
|
|
81
|
+
depth: 0,
|
|
82
|
+
edges: Object.entries(candidate.dependencies),
|
|
83
|
+
index: 0,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
let closureLimitReported = false;
|
|
87
|
+
while (frames.length > 0) {
|
|
88
|
+
const frame = frames.at(-1);
|
|
89
|
+
const edge = frame.edges[frame.index++];
|
|
90
|
+
if (edge === undefined) {
|
|
91
|
+
frames.pop();
|
|
92
|
+
activeOrigins.delete(frame.schema.origin);
|
|
93
|
+
visited.add(frame.key);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const [alias, dependency] = edge;
|
|
97
|
+
const pointer = frames.length === 1 ? `/dependencies/${escapeToken(alias)}` : '/dependencies';
|
|
98
|
+
if (activeOrigins.has(dependency.origin)) {
|
|
99
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_ACYCLIC', pointer, `Dependency cycle reaches ${dependency.origin}.`));
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const previous = revisionByOrigin.get(dependency.origin);
|
|
103
|
+
if (previous !== undefined && previous !== dependency.revision) {
|
|
104
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_REVISION_COHERENCE', pointer, `Closure contains ${dependency.origin} at both ${previous} and ${dependency.revision}.`));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
revisionByOrigin.set(dependency.origin, dependency.revision);
|
|
108
|
+
}
|
|
109
|
+
const nested = dependencies.get(dependency.origin) ?? lookup.get(dependency.origin, dependency.revision);
|
|
110
|
+
if (nested === undefined) {
|
|
111
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Dependency closure is missing ${dependency.origin}@${dependency.revision}.`));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (nested.origin !== dependency.origin) {
|
|
115
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Schema lookup value origin ${nested.origin} disagrees with ${dependency.origin}.`));
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (revisionOfDomainSchema(nested) !== dependency.revision) {
|
|
119
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_EXACT', pointer, `Schema lookup content for ${dependency.origin} disagrees with ${dependency.revision}.`));
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
dependencies.set(nested.origin, nested);
|
|
123
|
+
if (dependencies.size + 1 > dependencyLimits.closure) {
|
|
124
|
+
if (!closureLimitReported) {
|
|
125
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A dependency closure may contain at most ${dependencyLimits.closure} Domains.`));
|
|
126
|
+
closureLimitReported = true;
|
|
127
|
+
}
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const depth = frame.depth + 1;
|
|
131
|
+
if (depth > dependencyLimits.depth) {
|
|
132
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', pointer, `Dependency depth ${depth} exceeds the maximum ${dependencyLimits.depth}.`));
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const key = `${dependency.origin}\u0000${dependency.revision}`;
|
|
136
|
+
if (visited.has(key))
|
|
137
|
+
continue;
|
|
138
|
+
activeOrigins.add(nested.origin);
|
|
139
|
+
frames.push({
|
|
140
|
+
schema: nested,
|
|
141
|
+
key,
|
|
142
|
+
depth,
|
|
143
|
+
edges: Object.entries(nested.dependencies),
|
|
144
|
+
index: 0,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function validateDependencyUse(candidate, directOrigins, diagnostics) {
|
|
149
|
+
const used = collectUsedForeignOrigins(candidate);
|
|
150
|
+
for (const origin of used) {
|
|
151
|
+
if (!directOrigins.has(origin)) {
|
|
152
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_DIRECT', '', `Foreign origin ${origin} is referenced without an exact direct dependency.`));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function escapeToken(value) {
|
|
157
|
+
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
158
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ClassRef, DefinitionRef } from '../../addressing/index.js';
|
|
2
|
+
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
3
|
+
import type { DomainSchemaIR } from '../model/schema.js';
|
|
4
|
+
/** One exact Class declaration resolved within the retained Domain closure. */
|
|
5
|
+
export type IndexedClassDefinition = {
|
|
6
|
+
readonly ref: ClassRef;
|
|
7
|
+
readonly kind: 'node';
|
|
8
|
+
readonly owner: DomainSchemaIR;
|
|
9
|
+
readonly declaration: Extract<ClassDefinition, {
|
|
10
|
+
readonly kind: 'node';
|
|
11
|
+
}>;
|
|
12
|
+
} | {
|
|
13
|
+
readonly ref: ClassRef;
|
|
14
|
+
readonly kind: 'edge';
|
|
15
|
+
readonly owner: DomainSchemaIR;
|
|
16
|
+
readonly declaration: Extract<ClassDefinition, {
|
|
17
|
+
readonly kind: 'edge';
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
export declare function indexSchemaDefinitions(schema: DomainSchemaIR): ReadonlyMap<string, IndexedClassDefinition>;
|
|
21
|
+
export declare function resolveIndexedReference(indexes: ReadonlyMap<string, IndexedClassDefinition>, ref: DefinitionRef): IndexedClassDefinition | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
2
|
+
export function indexSchemaDefinitions(schema) {
|
|
3
|
+
const result = new Map();
|
|
4
|
+
for (const [name, declaration] of Object.entries(schema.classes)) {
|
|
5
|
+
const ref = { origin: schema.origin, kind: 'class', name };
|
|
6
|
+
if (declaration.kind === 'node') {
|
|
7
|
+
result.set(definitionRefIndex(ref), { ref, kind: 'node', owner: schema, declaration });
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
result.set(definitionRefIndex(ref), { ref, kind: 'edge', owner: schema, declaration });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
export function resolveIndexedReference(indexes, ref) {
|
|
16
|
+
return ref.kind === 'class' ? indexes.get(definitionRefIndex(ref)) : undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SourceDomain } from '../../domain/model/domain.js';
|
|
2
|
+
import type { DomainSchema } from '../model/schema.js';
|
|
3
|
+
/** Resolve one accepted Schema through its exact retained source closure. */
|
|
4
|
+
export declare function resolve<const S extends DomainSchema>(schema: S): SourceDomain<S>;
|