@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,29 @@
|
|
|
1
|
+
import type { Key as SemanticKey } from '../../addressing/index.js';
|
|
2
|
+
import type { Revision } from '../../addressing/index.js';
|
|
3
|
+
import type { DomainSchema } from '../model/schema.js';
|
|
4
|
+
import { Key } from '../../addressing/index.js';
|
|
5
|
+
export type DependencyMeaningChangeKind = 'missing' | 'changed';
|
|
6
|
+
export type MeaningFingerprint = `sha256:${string}`;
|
|
7
|
+
export interface DependencyMeaningChange {
|
|
8
|
+
readonly key: SemanticKey;
|
|
9
|
+
readonly kind: DependencyMeaningChangeKind;
|
|
10
|
+
readonly sourceFingerprint: MeaningFingerprint;
|
|
11
|
+
readonly targetFingerprint?: MeaningFingerprint;
|
|
12
|
+
}
|
|
13
|
+
export interface DependencyMeaningComparison {
|
|
14
|
+
readonly version: 1;
|
|
15
|
+
readonly dependency: Key.Origin;
|
|
16
|
+
readonly source: Revision;
|
|
17
|
+
readonly target: Revision;
|
|
18
|
+
readonly footprint: readonly SemanticKey[];
|
|
19
|
+
readonly changes: readonly DependencyMeaningChange[];
|
|
20
|
+
readonly fingerprint: MeaningFingerprint;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compare the exact V1 meaning one accepted Domain used from a retained dependency with a
|
|
24
|
+
* candidate revision of that same dependency origin. This operation is pure and makes no
|
|
25
|
+
* lifecycle-compatibility decision.
|
|
26
|
+
*/
|
|
27
|
+
export declare function compareDependencyMeaning(dependent: DomainSchema, target: DomainSchema): DependencyMeaningComparison;
|
|
28
|
+
/** Compare one explicit non-empty source member surface and its reachable V1 meaning. */
|
|
29
|
+
export declare function compareMemberMeaning(source: DomainSchema, target: DomainSchema, roots: readonly [SemanticKey, ...SemanticKey[]]): DependencyMeaningComparison;
|
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import { Key, MethodKey, PropertyKey } from '../../addressing/index.js';
|
|
3
|
+
import { compareDefinitionRefs, compareUnicode, definitionRefIndex, } from '../../addressing/ordering.js';
|
|
4
|
+
import { isValueObject as isJsonObject } from '../../language/value/model/object.js';
|
|
5
|
+
import { SCHEMA_ARRAY_KEYWORDS, SCHEMA_MAP_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, } from '../../language/value/syntax/keywords.js';
|
|
6
|
+
import { digestDomainSchemaBytes } from '../canonical/domain.digest.js';
|
|
7
|
+
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
8
|
+
import { SchemaError, diagnostic } from '../diagnostic.js';
|
|
9
|
+
import { knownDomainClosure, lookupForDomainClosure } from '../resolution/closure.js';
|
|
10
|
+
import { resolve } from '../resolution/domain.js';
|
|
11
|
+
import { collectCallableRefs, collectClassRefs, collectPolicyDefinitionRefs, collectValueDefinitionRefs, } from '../resolution/origins.js';
|
|
12
|
+
import { validateDomainSchemaSemantics } from '../validation/domain.js';
|
|
13
|
+
const VALUE_SCHEMA_ANNOTATIONS = new Set([
|
|
14
|
+
'$comment',
|
|
15
|
+
'contentEncoding',
|
|
16
|
+
'contentMediaType',
|
|
17
|
+
'contentSchema',
|
|
18
|
+
'default',
|
|
19
|
+
'deprecated',
|
|
20
|
+
'description',
|
|
21
|
+
'examples',
|
|
22
|
+
'format',
|
|
23
|
+
'readOnly',
|
|
24
|
+
'title',
|
|
25
|
+
'writeOnly',
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Compare the exact V1 meaning one accepted Domain used from a retained dependency with a
|
|
29
|
+
* candidate revision of that same dependency origin. This operation is pure and makes no
|
|
30
|
+
* lifecycle-compatibility decision.
|
|
31
|
+
*/
|
|
32
|
+
export function compareDependencyMeaning(dependent, target) {
|
|
33
|
+
resolve(dependent);
|
|
34
|
+
const closure = knownDomainClosure(dependent) ?? [];
|
|
35
|
+
const source = closure.find((candidate) => candidate.schema.origin === target.origin)?.schema;
|
|
36
|
+
if (source === undefined) {
|
|
37
|
+
throw new SchemaError([
|
|
38
|
+
diagnostic('DM_DEPENDENCY_NOT_RETAINED', '/target/origin', `Domain ${dependent.origin} was not admitted with a dependency at ${target.origin}.`),
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
const schemas = new Map([
|
|
42
|
+
[dependent.origin, dependent],
|
|
43
|
+
...closure.map(({ schema: candidate }) => [candidate.origin, candidate]),
|
|
44
|
+
]);
|
|
45
|
+
const sourceMeanings = collectDependencyMeanings(dependent, source.origin, schemas);
|
|
46
|
+
return compareSourceMeanings(source, target, sourceMeanings);
|
|
47
|
+
}
|
|
48
|
+
/** Compare one explicit non-empty source member surface and its reachable V1 meaning. */
|
|
49
|
+
export function compareMemberMeaning(source, target, roots) {
|
|
50
|
+
if (source.origin !== target.origin) {
|
|
51
|
+
throw new SchemaError([
|
|
52
|
+
diagnostic('DM_MEMBER_ORIGIN_MISMATCH', '/target/origin', `Member comparison target ${target.origin} does not match source ${source.origin}.`),
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
if (!Array.isArray(roots) || roots.length === 0 || new Set(roots).size !== roots.length) {
|
|
56
|
+
throw new SchemaError([
|
|
57
|
+
diagnostic('DM_MEMBER_ROOT_INVALID', '/roots', 'Member comparison roots must be one non-empty duplicate-free Key set.'),
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
resolve(source);
|
|
61
|
+
const closure = knownDomainClosure(source) ?? [];
|
|
62
|
+
const schemas = new Map([
|
|
63
|
+
[source.origin, source],
|
|
64
|
+
...closure.map(({ schema: candidate }) => [candidate.origin, candidate]),
|
|
65
|
+
]);
|
|
66
|
+
const coordinates = roots.map((key, index) => coordinateForKey(source, key, index));
|
|
67
|
+
const sourceMeanings = collectReachableMeanings(coordinates, source.origin, schemas);
|
|
68
|
+
return compareSourceMeanings(source, target, sourceMeanings);
|
|
69
|
+
}
|
|
70
|
+
function compareSourceMeanings(source, target, sourceMeanings) {
|
|
71
|
+
// Prove the candidate still has an exact accepted semantic context before comparing it.
|
|
72
|
+
resolve(target);
|
|
73
|
+
const footprint = Object.freeze([...sourceMeanings.keys()].sort(compareUnicode));
|
|
74
|
+
const changes = [];
|
|
75
|
+
const comparisonCoordinates = [];
|
|
76
|
+
for (const key of footprint) {
|
|
77
|
+
const sourceMeaning = sourceMeanings.get(key);
|
|
78
|
+
const targetMeaning = meaningForCoordinate(target, sourceMeaning.coordinate);
|
|
79
|
+
const targetFingerprint = targetMeaning === undefined ? undefined : fingerprintMeaning(targetMeaning);
|
|
80
|
+
comparisonCoordinates.push([
|
|
81
|
+
key,
|
|
82
|
+
sourceMeaning.fingerprint,
|
|
83
|
+
targetFingerprint ?? null,
|
|
84
|
+
]);
|
|
85
|
+
if (targetFingerprint === undefined) {
|
|
86
|
+
changes.push(Object.freeze({
|
|
87
|
+
key,
|
|
88
|
+
kind: 'missing',
|
|
89
|
+
sourceFingerprint: sourceMeaning.fingerprint,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
else if (targetFingerprint !== sourceMeaning.fingerprint) {
|
|
93
|
+
changes.push(Object.freeze({
|
|
94
|
+
key,
|
|
95
|
+
kind: 'changed',
|
|
96
|
+
sourceFingerprint: sourceMeaning.fingerprint,
|
|
97
|
+
targetFingerprint,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const sourceRevision = revisionOfDomainSchema(source);
|
|
102
|
+
const targetRevision = revisionOfDomainSchema(target);
|
|
103
|
+
const immutableChanges = Object.freeze(changes);
|
|
104
|
+
const fingerprint = fingerprintMeaning({
|
|
105
|
+
version: 1,
|
|
106
|
+
dependency: source.origin,
|
|
107
|
+
source: sourceRevision,
|
|
108
|
+
target: targetRevision,
|
|
109
|
+
coordinates: comparisonCoordinates,
|
|
110
|
+
});
|
|
111
|
+
return Object.freeze({
|
|
112
|
+
version: 1,
|
|
113
|
+
dependency: source.origin,
|
|
114
|
+
source: sourceRevision,
|
|
115
|
+
target: targetRevision,
|
|
116
|
+
footprint,
|
|
117
|
+
changes: immutableChanges,
|
|
118
|
+
fingerprint,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function collectDependencyMeanings(dependent, dependencyOrigin, schemas) {
|
|
122
|
+
return collectReachableMeanings(collectSchemaSemanticRefs(dependent).map(memberCoordinate), dependencyOrigin, schemas);
|
|
123
|
+
}
|
|
124
|
+
function collectReachableMeanings(roots, selectedOrigin, schemas) {
|
|
125
|
+
const meanings = new Map();
|
|
126
|
+
const pending = [];
|
|
127
|
+
const visited = new Set();
|
|
128
|
+
for (const coordinate of roots) {
|
|
129
|
+
if (coordinate.kind === 'member') {
|
|
130
|
+
pending.push(coordinate.ref);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const owner = schemas.get(Key.origin(coordinate.key));
|
|
134
|
+
const meaning = owner === undefined ? undefined : meaningForCoordinate(owner, coordinate);
|
|
135
|
+
if (owner === undefined || meaning === undefined) {
|
|
136
|
+
throw new SchemaError([
|
|
137
|
+
diagnostic('DM_MEMBER_ROOT_INVALID', '/roots', `Member comparison root ${coordinate.key} does not exist in its source context.`, coordinate.key),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
retainMeaning(meanings, selectedOrigin, coordinate, meaning);
|
|
141
|
+
collectCoordinateSemanticRefs(owner, coordinate, (candidate) => pending.push(requireMemberRef(candidate)));
|
|
142
|
+
}
|
|
143
|
+
for (let index = 0; index < pending.length; index += 1) {
|
|
144
|
+
const ref = pending[index];
|
|
145
|
+
const refIndex = definitionRefIndex(ref);
|
|
146
|
+
if (visited.has(refIndex))
|
|
147
|
+
continue;
|
|
148
|
+
visited.add(refIndex);
|
|
149
|
+
const owner = schemas.get(ref.origin);
|
|
150
|
+
if (owner === undefined) {
|
|
151
|
+
throw new SchemaError([
|
|
152
|
+
diagnostic('DM_DEPENDENCY_CONTEXT_INVALID', '', `Retained acceptance context cannot resolve ${keyForDefinitionRef(ref)}.`, keyForDefinitionRef(ref)),
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
const primary = memberCoordinate(ref);
|
|
156
|
+
const primaryMeaning = meaningForCoordinate(owner, primary);
|
|
157
|
+
if (primaryMeaning === undefined) {
|
|
158
|
+
throw new SchemaError([
|
|
159
|
+
diagnostic('DM_DEPENDENCY_CONTEXT_INVALID', '', `Retained acceptance context has no meaning for ${primary.key}.`, primary.key),
|
|
160
|
+
]);
|
|
161
|
+
}
|
|
162
|
+
retainMeaning(meanings, selectedOrigin, primary, primaryMeaning);
|
|
163
|
+
collectMemberSemanticRefs(owner, ref, (candidate) => pending.push(requireMemberRef(candidate)));
|
|
164
|
+
if (!isDefinitionRef(ref))
|
|
165
|
+
continue;
|
|
166
|
+
const analysis = effectiveDefinition(owner, ref);
|
|
167
|
+
if (analysis === undefined)
|
|
168
|
+
continue;
|
|
169
|
+
collectEffectiveMeanings(analysis, selectedOrigin, meanings, (candidate) => pending.push(requireMemberRef(candidate)));
|
|
170
|
+
}
|
|
171
|
+
return meanings;
|
|
172
|
+
}
|
|
173
|
+
function collectCoordinateSemanticRefs(owner, coordinate, add) {
|
|
174
|
+
const analysis = effectiveDefinition(owner, coordinate.owner);
|
|
175
|
+
if (analysis === undefined)
|
|
176
|
+
return;
|
|
177
|
+
if (coordinate.kind === 'property') {
|
|
178
|
+
const field = analysis.properties.get(coordinate.key);
|
|
179
|
+
if (field !== undefined)
|
|
180
|
+
collectValueDefinitionRefs(semanticValueSchema(field.schema), add);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const method = [...analysis.methods.values()].find((candidate) => MethodKey.of(candidate.owner, candidate.name) === coordinate.key);
|
|
184
|
+
if (method !== undefined)
|
|
185
|
+
collectCallableRefs(semanticMethod(method.declaration), add);
|
|
186
|
+
}
|
|
187
|
+
function collectEffectiveMeanings(analysis, dependencyOrigin, meanings, add) {
|
|
188
|
+
for (const field of analysis.properties.values()) {
|
|
189
|
+
const coordinate = propertyCoordinate(field.owner, field.name);
|
|
190
|
+
retainMeaning(meanings, dependencyOrigin, coordinate, propertyMeaning(field));
|
|
191
|
+
add(field.owner);
|
|
192
|
+
collectValueDefinitionRefs(semanticValueSchema(field.schema), add);
|
|
193
|
+
}
|
|
194
|
+
for (const method of analysis.methods.values()) {
|
|
195
|
+
const coordinate = methodCoordinate(method.owner, method.name);
|
|
196
|
+
retainMeaning(meanings, dependencyOrigin, coordinate, methodMeaning(method));
|
|
197
|
+
add(method.owner);
|
|
198
|
+
collectCallableRefs(semanticMethod(method.declaration), add);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function retainMeaning(meanings, dependencyOrigin, coordinate, meaning) {
|
|
202
|
+
if (Key.origin(coordinate.key) !== dependencyOrigin)
|
|
203
|
+
return;
|
|
204
|
+
const fingerprint = fingerprintMeaning(meaning);
|
|
205
|
+
const previous = meanings.get(coordinate.key);
|
|
206
|
+
if (previous !== undefined && previous.fingerprint !== fingerprint) {
|
|
207
|
+
throw new SchemaError([
|
|
208
|
+
diagnostic('DM_MEANING_INCONSISTENT', '', `Semantic coordinate ${coordinate.key} produced inconsistent effective meaning.`, coordinate.key),
|
|
209
|
+
]);
|
|
210
|
+
}
|
|
211
|
+
meanings.set(coordinate.key, Object.freeze({ coordinate, fingerprint }));
|
|
212
|
+
}
|
|
213
|
+
function collectSchemaSemanticRefs(owner) {
|
|
214
|
+
const refs = new Map();
|
|
215
|
+
const add = (ref) => {
|
|
216
|
+
const member = requireMemberRef(ref);
|
|
217
|
+
refs.set(definitionRefIndex(member), member);
|
|
218
|
+
};
|
|
219
|
+
for (const declaration of Object.values(owner.classes)) {
|
|
220
|
+
collectClassRefs(semanticDefinition(declaration), add);
|
|
221
|
+
}
|
|
222
|
+
for (const declaration of Object.values(owner.functions)) {
|
|
223
|
+
collectCallableRefs(semanticFunction(declaration), add);
|
|
224
|
+
}
|
|
225
|
+
for (const declaration of Object.values(owner.policies)) {
|
|
226
|
+
collectPolicyDefinitionRefs(semanticPolicy(declaration), add);
|
|
227
|
+
}
|
|
228
|
+
for (const declaration of Object.values(owner.views)) {
|
|
229
|
+
if (declaration.target.kind === 'definition')
|
|
230
|
+
declaration.target.definitions.forEach(add);
|
|
231
|
+
}
|
|
232
|
+
for (const node of Object.values(owner.core.nodes))
|
|
233
|
+
add(node.class);
|
|
234
|
+
for (const edge of owner.core.edges) {
|
|
235
|
+
add(edge.class);
|
|
236
|
+
if (edge.source.kind !== 'domain')
|
|
237
|
+
add(edge.source);
|
|
238
|
+
if (edge.target.kind !== 'domain')
|
|
239
|
+
add(edge.target);
|
|
240
|
+
}
|
|
241
|
+
return [...refs.values()].sort(compareDefinitionRefs);
|
|
242
|
+
}
|
|
243
|
+
function collectMemberSemanticRefs(owner, ref, add) {
|
|
244
|
+
switch (ref.kind) {
|
|
245
|
+
case 'class': {
|
|
246
|
+
const declaration = owner.classes[ref.name];
|
|
247
|
+
if (declaration !== undefined) {
|
|
248
|
+
collectClassRefs(semanticDefinition(declaration), add);
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
case 'function': {
|
|
253
|
+
const declaration = owner.functions[ref.name];
|
|
254
|
+
if (declaration !== undefined)
|
|
255
|
+
collectCallableRefs(semanticFunction(declaration), add);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
case 'policy': {
|
|
259
|
+
const declaration = owner.policies[ref.name];
|
|
260
|
+
if (declaration !== undefined) {
|
|
261
|
+
collectPolicyDefinitionRefs(semanticPolicy(declaration), add);
|
|
262
|
+
}
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
case 'view': {
|
|
266
|
+
const declaration = owner.views[ref.name];
|
|
267
|
+
if (declaration?.target.kind === 'definition')
|
|
268
|
+
declaration.target.definitions.forEach(add);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
case 'core': {
|
|
272
|
+
const node = owner.core.nodes[ref.name];
|
|
273
|
+
if (node === undefined)
|
|
274
|
+
return;
|
|
275
|
+
add(node.class);
|
|
276
|
+
for (const edge of incidentCoreEdges(owner, ref.name)) {
|
|
277
|
+
add(edge.class);
|
|
278
|
+
if (edge.source.kind !== 'domain')
|
|
279
|
+
add(edge.source);
|
|
280
|
+
if (edge.target.kind !== 'domain')
|
|
281
|
+
add(edge.target);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function meaningForCoordinate(owner, coordinate) {
|
|
287
|
+
if (Key.origin(coordinate.key) !== owner.origin)
|
|
288
|
+
return undefined;
|
|
289
|
+
if (coordinate.kind === 'member')
|
|
290
|
+
return memberMeaning(owner, coordinate.ref);
|
|
291
|
+
const analysis = effectiveDefinition(owner, coordinate.owner);
|
|
292
|
+
if (analysis === undefined)
|
|
293
|
+
return undefined;
|
|
294
|
+
if (coordinate.kind === 'property') {
|
|
295
|
+
const field = analysis.properties.get(coordinate.key);
|
|
296
|
+
return field === undefined ? undefined : propertyMeaning(field);
|
|
297
|
+
}
|
|
298
|
+
const method = [...analysis.methods.values()].find((candidate) => MethodKey.of(candidate.owner, candidate.name) === coordinate.key);
|
|
299
|
+
return method === undefined ? undefined : methodMeaning(method);
|
|
300
|
+
}
|
|
301
|
+
function memberMeaning(owner, ref) {
|
|
302
|
+
if (ref.origin !== owner.origin)
|
|
303
|
+
return undefined;
|
|
304
|
+
switch (ref.kind) {
|
|
305
|
+
case 'class':
|
|
306
|
+
return definitionMeaning(owner, ref);
|
|
307
|
+
case 'function': {
|
|
308
|
+
const declaration = owner.functions[ref.name];
|
|
309
|
+
return declaration === undefined
|
|
310
|
+
? undefined
|
|
311
|
+
: { kind: ref.kind, declaration: semanticFunction(declaration) };
|
|
312
|
+
}
|
|
313
|
+
case 'policy': {
|
|
314
|
+
const declaration = owner.policies[ref.name];
|
|
315
|
+
return declaration === undefined
|
|
316
|
+
? undefined
|
|
317
|
+
: { kind: ref.kind, declaration: semanticPolicy(declaration) };
|
|
318
|
+
}
|
|
319
|
+
case 'view': {
|
|
320
|
+
const declaration = owner.views[ref.name];
|
|
321
|
+
return declaration === undefined
|
|
322
|
+
? undefined
|
|
323
|
+
: { kind: ref.kind, declaration: semanticView(declaration) };
|
|
324
|
+
}
|
|
325
|
+
case 'core': {
|
|
326
|
+
const node = owner.core.nodes[ref.name];
|
|
327
|
+
return node === undefined
|
|
328
|
+
? undefined
|
|
329
|
+
: {
|
|
330
|
+
kind: ref.kind,
|
|
331
|
+
node,
|
|
332
|
+
edges: incidentCoreEdges(owner, ref.name),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function definitionMeaning(owner, ref) {
|
|
338
|
+
const declaration = owner.classes[ref.name];
|
|
339
|
+
const effective = effectiveDefinition(owner, ref);
|
|
340
|
+
if (declaration === undefined || effective === undefined || ref.origin !== owner.origin)
|
|
341
|
+
return undefined;
|
|
342
|
+
return {
|
|
343
|
+
kind: ref.kind,
|
|
344
|
+
declaration: semanticDefinition(declaration),
|
|
345
|
+
effective: {
|
|
346
|
+
properties: [...effective.properties.keys()].sort(compareUnicode),
|
|
347
|
+
methods: [...effective.methods.values()]
|
|
348
|
+
.map((method) => MethodKey.of(method.owner, method.name))
|
|
349
|
+
.sort(compareUnicode),
|
|
350
|
+
...(effective.data === undefined
|
|
351
|
+
? {}
|
|
352
|
+
: {
|
|
353
|
+
data: {
|
|
354
|
+
owner: keyForDefinitionRef(effective.data.owner),
|
|
355
|
+
declaration: effective.data.declaration,
|
|
356
|
+
},
|
|
357
|
+
}),
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function effectiveDefinition(owner, ref) {
|
|
362
|
+
const validation = validateDomainSchemaSemantics(owner, lookupForDomainClosure(owner));
|
|
363
|
+
if (validation.diagnostics.length > 0)
|
|
364
|
+
return undefined;
|
|
365
|
+
return validation.analysis.definitions.get(definitionRefIndex(ref));
|
|
366
|
+
}
|
|
367
|
+
function propertyMeaning(field) {
|
|
368
|
+
return {
|
|
369
|
+
kind: 'property',
|
|
370
|
+
owner: keyForDefinitionRef(field.owner),
|
|
371
|
+
name: field.name,
|
|
372
|
+
schema: semanticValueSchema(field.schema),
|
|
373
|
+
required: field.required,
|
|
374
|
+
visibility: field.visibility,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function methodMeaning(method) {
|
|
378
|
+
return {
|
|
379
|
+
kind: 'method',
|
|
380
|
+
owner: keyForDefinitionRef(method.owner),
|
|
381
|
+
name: method.name,
|
|
382
|
+
declaration: semanticMethod(method.declaration),
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function semanticDefinition(declaration) {
|
|
386
|
+
const { description: _description, ...rest } = declaration;
|
|
387
|
+
const semantic = {
|
|
388
|
+
...rest,
|
|
389
|
+
properties: Object.fromEntries(Object.entries(declaration.properties).map(([name, property]) => [
|
|
390
|
+
name,
|
|
391
|
+
{
|
|
392
|
+
...property,
|
|
393
|
+
schema: semanticValueSchema(property.schema),
|
|
394
|
+
},
|
|
395
|
+
])),
|
|
396
|
+
};
|
|
397
|
+
if ('methods' in declaration) {
|
|
398
|
+
semantic.methods = Object.fromEntries(Object.entries(declaration.methods).map(([name, method]) => [name, semanticMethod(method)]));
|
|
399
|
+
}
|
|
400
|
+
return semantic;
|
|
401
|
+
}
|
|
402
|
+
function semanticFunction(declaration) {
|
|
403
|
+
const { description: _description, ...rest } = declaration;
|
|
404
|
+
return {
|
|
405
|
+
...rest,
|
|
406
|
+
input: semanticValueSchema(declaration.input),
|
|
407
|
+
output: semanticOutput(declaration.output),
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function semanticMethod(declaration) {
|
|
411
|
+
const { description: _description, ...rest } = declaration;
|
|
412
|
+
return {
|
|
413
|
+
...rest,
|
|
414
|
+
input: semanticValueSchema(declaration.input),
|
|
415
|
+
output: semanticOutput(declaration.output),
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function semanticOutput(output) {
|
|
419
|
+
switch (output.mode) {
|
|
420
|
+
case 'value':
|
|
421
|
+
return { mode: 'value', schema: semanticValueSchema(output.schema) };
|
|
422
|
+
case 'stream':
|
|
423
|
+
return { mode: 'stream', item: semanticValueSchema(output.item) };
|
|
424
|
+
case 'binary':
|
|
425
|
+
return { mode: 'binary' };
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function semanticPolicy(declaration) {
|
|
429
|
+
const { description: _description, ...semantic } = declaration;
|
|
430
|
+
return semantic;
|
|
431
|
+
}
|
|
432
|
+
function semanticView(declaration) {
|
|
433
|
+
const { description: _description, ...semantic } = declaration;
|
|
434
|
+
return semantic;
|
|
435
|
+
}
|
|
436
|
+
function semanticValueSchema(value) {
|
|
437
|
+
if (typeof value === 'boolean')
|
|
438
|
+
return value;
|
|
439
|
+
const semantic = {};
|
|
440
|
+
for (const [keyword, entry] of Object.entries(value)) {
|
|
441
|
+
if (VALUE_SCHEMA_ANNOTATIONS.has(keyword))
|
|
442
|
+
continue;
|
|
443
|
+
if (SCHEMA_SINGLE_KEYWORDS.has(keyword) && isJsonSchema(entry)) {
|
|
444
|
+
semantic[keyword] = semanticValueSchema(entry);
|
|
445
|
+
}
|
|
446
|
+
else if (SCHEMA_ARRAY_KEYWORDS.has(keyword) && Array.isArray(entry)) {
|
|
447
|
+
semantic[keyword] = entry.map((item) => isJsonSchema(item) ? semanticValueSchema(item) : item);
|
|
448
|
+
}
|
|
449
|
+
else if (SCHEMA_MAP_KEYWORDS.has(keyword) && isJsonObject(entry)) {
|
|
450
|
+
semantic[keyword] = Object.fromEntries(Object.entries(entry).map(([name, item]) => [
|
|
451
|
+
name,
|
|
452
|
+
isJsonSchema(item) ? semanticValueSchema(item) : item,
|
|
453
|
+
]));
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
semantic[keyword] = entry;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return semantic;
|
|
460
|
+
}
|
|
461
|
+
function coordinateForKey(source, input, index) {
|
|
462
|
+
let key;
|
|
463
|
+
try {
|
|
464
|
+
key = Key(input);
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
return invalidMemberRoot(input, index, 'is not a canonical semantic Key');
|
|
468
|
+
}
|
|
469
|
+
if (Key.origin(key) !== source.origin) {
|
|
470
|
+
return invalidMemberRoot(key, index, `belongs to ${Key.origin(key)}, not source ${source.origin}`);
|
|
471
|
+
}
|
|
472
|
+
const reference = keyReference(key);
|
|
473
|
+
let coordinate;
|
|
474
|
+
if ((reference.member === 'property' || reference.member === 'method') &&
|
|
475
|
+
reference.ownerKind === 'class' &&
|
|
476
|
+
reference.ownerName !== undefined) {
|
|
477
|
+
const owner = definitionRefFor(source, reference.ownerKind, reference.ownerName);
|
|
478
|
+
if (owner === undefined) {
|
|
479
|
+
return invalidMemberRoot(key, index, 'has no exact owning Definition');
|
|
480
|
+
}
|
|
481
|
+
coordinate =
|
|
482
|
+
reference.member === 'property'
|
|
483
|
+
? propertyCoordinate(owner, reference.name)
|
|
484
|
+
: methodCoordinate(owner, reference.name);
|
|
485
|
+
}
|
|
486
|
+
else if (reference.kind !== 'core') {
|
|
487
|
+
const member = memberRefFor(source, {
|
|
488
|
+
origin: source.origin,
|
|
489
|
+
kind: reference.kind,
|
|
490
|
+
name: reference.name,
|
|
491
|
+
});
|
|
492
|
+
if (member === undefined)
|
|
493
|
+
return invalidMemberRoot(key, index, 'does not exist in the source');
|
|
494
|
+
coordinate = memberCoordinate(member);
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
coordinate = memberCoordinate({
|
|
498
|
+
origin: source.origin,
|
|
499
|
+
kind: 'core',
|
|
500
|
+
name: reference.name,
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
if (meaningForCoordinate(source, coordinate) === undefined) {
|
|
504
|
+
return invalidMemberRoot(key, index, 'does not exist in the source');
|
|
505
|
+
}
|
|
506
|
+
return coordinate;
|
|
507
|
+
}
|
|
508
|
+
function memberRefFor(source, ref) {
|
|
509
|
+
const name = ref.name;
|
|
510
|
+
const owner = definitionRefFor(source, ref.kind, name);
|
|
511
|
+
if (owner !== undefined)
|
|
512
|
+
return owner;
|
|
513
|
+
switch (ref.kind) {
|
|
514
|
+
case 'function':
|
|
515
|
+
return source.functions[name] === undefined
|
|
516
|
+
? undefined
|
|
517
|
+
: { origin: source.origin, kind: 'function', name };
|
|
518
|
+
case 'policy':
|
|
519
|
+
return source.policies[name] === undefined
|
|
520
|
+
? undefined
|
|
521
|
+
: { origin: source.origin, kind: 'policy', name };
|
|
522
|
+
case 'view':
|
|
523
|
+
return source.views[name] === undefined
|
|
524
|
+
? undefined
|
|
525
|
+
: { origin: source.origin, kind: 'view', name };
|
|
526
|
+
default:
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function definitionRefFor(source, namespace, name) {
|
|
531
|
+
if (namespace === 'class') {
|
|
532
|
+
return source.classes[name] === undefined
|
|
533
|
+
? undefined
|
|
534
|
+
: { origin: source.origin, kind: 'class', name };
|
|
535
|
+
}
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
function invalidMemberRoot(key, index, reason) {
|
|
539
|
+
throw new SchemaError([
|
|
540
|
+
diagnostic('DM_MEMBER_ROOT_INVALID', `/roots/${index}`, `Member comparison root ${JSON.stringify(key)} ${reason}.`, typeof key === 'string' ? key : undefined),
|
|
541
|
+
]);
|
|
542
|
+
}
|
|
543
|
+
function memberCoordinate(ref) {
|
|
544
|
+
return Object.freeze({ kind: 'member', key: keyForDefinitionRef(ref), ref });
|
|
545
|
+
}
|
|
546
|
+
function propertyCoordinate(owner, name) {
|
|
547
|
+
return Object.freeze({ kind: 'property', key: PropertyKey.of(owner, name), owner, name });
|
|
548
|
+
}
|
|
549
|
+
function methodCoordinate(owner, name) {
|
|
550
|
+
return Object.freeze({ kind: 'method', key: MethodKey.of(owner, name), owner, name });
|
|
551
|
+
}
|
|
552
|
+
function keyForDefinitionRef(ref) {
|
|
553
|
+
return ref.kind === 'core'
|
|
554
|
+
? Key.of(ref)
|
|
555
|
+
: Key.of(ref);
|
|
556
|
+
}
|
|
557
|
+
function keyReference(key) {
|
|
558
|
+
const semantic = key.slice(key.indexOf(':') + 1);
|
|
559
|
+
const parts = semantic.split('.');
|
|
560
|
+
if (parts[0] === 'core' && parts.length === 2) {
|
|
561
|
+
return { kind: 'core', name: parts[1] };
|
|
562
|
+
}
|
|
563
|
+
if (parts.length === 2) {
|
|
564
|
+
return { kind: parts[0], name: parts[1] };
|
|
565
|
+
}
|
|
566
|
+
if (parts.length === 4 &&
|
|
567
|
+
parts[0] === 'class' &&
|
|
568
|
+
(parts[2] === 'property' || parts[2] === 'method')) {
|
|
569
|
+
return {
|
|
570
|
+
kind: 'class',
|
|
571
|
+
name: parts[3],
|
|
572
|
+
member: parts[2],
|
|
573
|
+
ownerKind: 'class',
|
|
574
|
+
ownerName: parts[1],
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
throw new SchemaError([
|
|
578
|
+
diagnostic('DM_MEMBER_ROOT_INVALID', '/roots', `Key ${key} has no supported V1 shape.`, key),
|
|
579
|
+
]);
|
|
580
|
+
}
|
|
581
|
+
function incidentCoreEdges(owner, name) {
|
|
582
|
+
return owner.core.edges.filter((edge) => (edge.source.kind === 'core' && edge.source.name === name) ||
|
|
583
|
+
(edge.target.kind === 'core' && edge.target.name === name));
|
|
584
|
+
}
|
|
585
|
+
function fingerprintMeaning(value) {
|
|
586
|
+
return digestDomainSchemaBytes(json.encode(value));
|
|
587
|
+
}
|
|
588
|
+
function isDefinitionRef(ref) {
|
|
589
|
+
return ref.kind === 'class';
|
|
590
|
+
}
|
|
591
|
+
function requireMemberRef(ref) {
|
|
592
|
+
switch (ref.kind) {
|
|
593
|
+
case 'class':
|
|
594
|
+
case 'function':
|
|
595
|
+
case 'policy':
|
|
596
|
+
case 'view':
|
|
597
|
+
return ref;
|
|
598
|
+
case 'core':
|
|
599
|
+
return ref;
|
|
600
|
+
}
|
|
601
|
+
return ref;
|
|
602
|
+
}
|
|
603
|
+
function isJsonSchema(value) {
|
|
604
|
+
return typeof value === 'boolean' || isJsonObject(value);
|
|
605
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Key } from '../../addressing/index.js';
|
|
2
|
+
import type { Revision } from '../../addressing/index.js';
|
|
3
|
+
import type { DomainSchema } from '../model/schema.js';
|
|
4
|
+
/** Exact revision-addressed lookup used while accepting a dependency closure. */
|
|
5
|
+
export interface DomainSchemaLookup {
|
|
6
|
+
get(origin: Key.Origin, revision: Revision): DomainSchema | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface DomainSchemaEntry {
|
|
9
|
+
readonly revision: Revision;
|
|
10
|
+
readonly schema: DomainSchema;
|
|
11
|
+
}
|
|
12
|
+
export declare class MemoryDomainSchemaLookup implements DomainSchemaLookup {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(entries?: readonly DomainSchemaEntry[]);
|
|
15
|
+
get(origin: Key.Origin, revision: Revision): DomainSchema | undefined;
|
|
16
|
+
set(entry: DomainSchemaEntry): this;
|
|
17
|
+
}
|
|
18
|
+
export declare function emptyDomainSchemaLookup(): DomainSchemaLookup;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
2
|
+
export class MemoryDomainSchemaLookup {
|
|
3
|
+
#entries = new Map();
|
|
4
|
+
constructor(entries = []) {
|
|
5
|
+
for (const entry of entries)
|
|
6
|
+
this.set(entry);
|
|
7
|
+
}
|
|
8
|
+
get(origin, revision) {
|
|
9
|
+
return this.#entries.get(lookupKey(origin, revision));
|
|
10
|
+
}
|
|
11
|
+
set(entry) {
|
|
12
|
+
const { revision, schema } = entry;
|
|
13
|
+
const actualRevision = revisionOfDomainSchema(schema);
|
|
14
|
+
if (revision !== actualRevision) {
|
|
15
|
+
throw new Error(`Schema lookup revision ${revision} disagrees with ${schema.origin}@${actualRevision}`);
|
|
16
|
+
}
|
|
17
|
+
const key = lookupKey(schema.origin, revision);
|
|
18
|
+
const existing = this.#entries.get(key);
|
|
19
|
+
if (existing !== undefined && existing !== schema) {
|
|
20
|
+
throw new Error(`Schema lookup entry ${schema.origin}@${revision} is already bound`);
|
|
21
|
+
}
|
|
22
|
+
this.#entries.set(key, schema);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function emptyDomainSchemaLookup() {
|
|
27
|
+
return { get: () => undefined };
|
|
28
|
+
}
|
|
29
|
+
function lookupKey(origin, revision) {
|
|
30
|
+
return `${origin}\u0000${revision}`;
|
|
31
|
+
}
|