@astrale-os/kernel-dsl 0.2.0-beta.3 → 0.2.0-beta.30
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 +0 -1
- package/dist/index.js +0 -1
- package/dist/upgrade/contract.d.ts +0 -1
- package/dist/upgrade/contract.js +0 -1
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade/index.js +0 -1
- 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 +10 -4
- package/dist/v1/addressing/index.js +5 -3
- package/dist/v1/addressing/key.d.ts +14 -16
- package/dist/v1/addressing/key.js +24 -34
- 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 +12 -3
- package/dist/v1/addressing/patterns.js +11 -2
- package/dist/v1/addressing/property-key.d.ts +10 -15
- package/dist/v1/addressing/property-key.js +24 -15
- 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 +118 -0
- package/dist/v1/builder/{callable.js → callable/authoring.js} +28 -7
- package/dist/v1/builder/class/authoring.d.ts +380 -0
- package/dist/v1/builder/class/authoring.js +134 -0
- package/dist/v1/builder/class/property.d.ts +58 -0
- package/dist/v1/builder/class/property.js +57 -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 -22
- package/dist/v1/builder/index.js +11 -11
- package/dist/v1/builder/lowering/callable.d.ts +24 -0
- package/dist/v1/builder/{compiler → lowering}/callable.js +39 -38
- package/dist/v1/builder/lowering/class.d.ts +22 -0
- package/dist/v1/builder/lowering/class.js +134 -0
- package/dist/v1/builder/lowering/core-properties.d.ts +10 -0
- package/dist/v1/builder/{compiler/core.properties.js → lowering/core-properties.js} +14 -8
- package/dist/v1/builder/lowering/core.d.ts +22 -0
- package/dist/v1/builder/{compiler → lowering}/core.js +17 -11
- package/dist/v1/builder/lowering/policy.d.ts +16 -0
- package/dist/v1/builder/{compiler → lowering}/policy.js +20 -14
- package/dist/v1/builder/{compiler/schema.capture.d.ts → lowering/schema/capture.d.ts} +2 -3
- package/dist/v1/builder/lowering/schema/capture.js +70 -0
- package/dist/v1/builder/{compiler/schema.d.ts → lowering/schema/compile.d.ts} +4 -4
- package/dist/v1/builder/{compiler/schema.js → lowering/schema/compile.js} +34 -44
- package/dist/v1/builder/lowering/schema/context.d.ts +44 -0
- package/dist/v1/builder/{compiler/schema.context.js → lowering/schema/context.js} +92 -81
- package/dist/v1/builder/lowering/schema/ownership.d.ts +8 -0
- package/dist/v1/builder/{compiler/schema.ownership.js → lowering/schema/ownership.js} +1 -2
- package/dist/v1/builder/lowering/value/compile.d.ts +15 -0
- package/dist/v1/builder/{compiler/value.js → lowering/value/compile.js} +44 -61
- package/dist/v1/builder/lowering/value/path.d.ts +3 -0
- package/dist/v1/builder/{compiler/value.path.js → lowering/value/path.js} +1 -2
- package/dist/v1/builder/{compiler/value.zod.d.ts → lowering/value/zod.d.ts} +8 -9
- package/dist/v1/builder/{compiler/value.zod.js → lowering/value/zod.js} +10 -11
- package/dist/v1/builder/lowering/view.d.ts +11 -0
- package/dist/v1/builder/{compiler → lowering}/view.js +7 -7
- package/dist/v1/builder/{policy.d.ts → policy/authoring.d.ts} +28 -17
- package/dist/v1/builder/policy/authoring.js +115 -0
- package/dist/v1/builder/schema/define.d.ts +11 -0
- package/dist/v1/builder/{schema.js → schema/define.js} +1 -2
- package/dist/v1/builder/schema/diagnostic.d.ts +16 -0
- package/dist/v1/builder/schema/diagnostic.js +31 -0
- package/dist/v1/builder/{internal/authoring.d.ts → schema/handle.d.ts} +1 -2
- package/dist/v1/builder/{internal/authoring.js → schema/handle.js} +0 -1
- package/dist/v1/builder/schema/input.d.ts +15 -0
- package/dist/v1/builder/schema/input.js +1 -0
- package/dist/v1/builder/{internal/authoring.lazy.d.ts → schema/lazy.d.ts} +0 -1
- package/dist/v1/builder/{internal/authoring.lazy.js → schema/lazy.js} +0 -1
- package/dist/v1/builder/schema/projection.d.ts +370 -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/{internal/path.metadata.js → value/path-metadata.js} +0 -1
- package/dist/v1/builder/value/path.d.ts +8 -0
- package/dist/v1/builder/{path.js → value/path.js} +4 -5
- package/dist/v1/builder/{value-schema.d.ts → value/schema.d.ts} +2 -3
- package/dist/v1/builder/{value-schema.js → value/schema.js} +0 -1
- 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 +0 -1
- package/dist/v1/bundle/codec.js +36 -19
- 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 +3 -2
- package/dist/v1/bundle/index.js +2 -2
- package/dist/v1/bundle/model.d.ts +1 -4
- package/dist/v1/bundle/model.js +0 -6
- package/dist/v1/bundle/structure.d.ts +1 -2
- package/dist/v1/bundle/structure.js +6 -6
- 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 +950 -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 +1157 -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/generated.d.ts +10 -0
- package/dist/v1/compiled/generated.js +15 -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 +9 -0
- package/dist/v1/compiled/loader/load.js +147 -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 +181 -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 +14 -5
- package/dist/v1/index.js +6 -3
- 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 +37 -0
- package/dist/v1/language/class/model/class.js +1 -0
- package/dist/v1/{schema/definition → language/class/model}/data.d.ts +2 -3
- package/dist/v1/{schema/definition → language/class/model}/data.js +0 -1
- package/dist/v1/{schema/definition → language/class/model}/edge.d.ts +9 -6
- package/dist/v1/language/class/model/edge.js +1 -0
- package/dist/v1/language/class/model/property.d.ts +17 -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 +119 -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/{schema → language/definition}/metadata.d.ts +0 -1
- package/dist/v1/{schema → language/definition}/metadata.js +0 -1
- package/dist/v1/language/definition.d.ts +7 -0
- package/dist/v1/language/definition.js +1 -0
- package/dist/v1/language/index.d.ts +26 -0
- package/dist/v1/language/index.js +3 -0
- package/dist/v1/{schema/policy/validation → language/policy/analysis}/branches.d.ts +4 -5
- package/dist/v1/{schema/policy/validation → language/policy/analysis}/branches.js +43 -24
- package/dist/v1/{schema/policy/validation → language/policy/analysis}/budgets.d.ts +1 -4
- package/dist/v1/language/policy/analysis/budgets.js +25 -0
- package/dist/v1/language/policy/index.d.ts +4 -0
- package/dist/v1/language/policy/index.js +2 -0
- package/dist/v1/{schema/policy/ast.d.ts → language/policy/model/policy.d.ts} +45 -10
- package/dist/v1/language/policy/model/policy.js +9 -0
- package/dist/v1/language/policy/normalization/normalize.d.ts +4 -0
- package/dist/v1/{schema/policy → language/policy/normalization}/normalize.js +65 -20
- 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/state/index.d.ts +3 -0
- package/dist/v1/language/state/index.js +1 -0
- package/dist/v1/language/state/machine.d.ts +28 -0
- package/dist/v1/language/state/machine.js +40 -0
- package/dist/v1/language/state/topology.d.ts +14 -0
- package/dist/v1/language/state/topology.js +69 -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/{schema/compiled/program.d.ts → language/value/compile/load.d.ts} +1 -2
- package/dist/v1/{schema/compiled/program.js → language/value/compile/load.js} +2 -3
- package/dist/v1/language/value/compile/model.d.ts +27 -0
- package/dist/v1/language/value/compile/model.js +1 -0
- package/dist/v1/{schema/value/instance → language/value/evaluate}/assertions.d.ts +0 -1
- package/dist/v1/{schema/value/instance → language/value/evaluate}/assertions.js +1 -2
- package/dist/v1/{schema/value/instance → language/value/evaluate}/evaluator.d.ts +0 -1
- package/dist/v1/{schema/value/instance → language/value/evaluate}/evaluator.js +3 -4
- package/dist/v1/{schema/value/instance → language/value/evaluate}/preparation.d.ts +2 -3
- package/dist/v1/{schema/value/instance → language/value/evaluate}/preparation.js +6 -8
- package/dist/v1/language/value/evaluate/program.d.ts +3 -0
- package/dist/v1/language/value/evaluate/program.js +16 -0
- package/dist/v1/{schema/value/instance → language/value/evaluate}/types.d.ts +4 -5
- package/dist/v1/{schema/value/instance → language/value/evaluate}/types.js +0 -1
- package/dist/v1/{schema/value/instance.validate.d.ts → language/value/evaluate/validate.d.ts} +4 -5
- package/dist/v1/{schema/value/instance.validate.js → language/value/evaluate/validate.js} +4 -5
- package/dist/v1/language/value/index.d.ts +11 -0
- package/dist/v1/language/value/index.js +8 -0
- package/dist/v1/{schema/value → language/value/model}/instant.d.ts +1 -1
- package/dist/v1/{schema/value → language/value/model}/instant.js +1 -1
- package/dist/v1/{schema/value → language/value/model}/object.d.ts +1 -1
- package/dist/v1/{schema/value → language/value/model}/object.js +0 -1
- package/dist/v1/{schema/value → language/value/model}/schema.d.ts +3 -4
- package/dist/v1/{schema/value → language/value/model}/schema.js +0 -2
- package/dist/v1/{schema → language}/value/ordering.d.ts +5 -3
- package/dist/v1/{schema → language}/value/ordering.js +15 -13
- package/dist/v1/{schema → language}/value/profile/canonicalize.d.ts +2 -3
- package/dist/v1/{schema → language}/value/profile/canonicalize.js +4 -7
- package/dist/v1/language/value/profile/json.validate.d.ts +2 -0
- package/dist/v1/{schema → language}/value/profile/json.validate.js +1 -2
- package/dist/v1/{schema → language}/value/profile/meta-schema.compiled.d.ts +0 -1
- package/dist/v1/{schema → language}/value/profile/meta-schema.compiled.js +0 -1
- package/dist/v1/language/value/profile/meta-schema.d.ts +4 -0
- package/dist/v1/{schema → language}/value/profile/meta-schema.js +1 -2
- package/dist/v1/language/value/profile/rules.d.ts +3 -0
- package/dist/v1/{schema → language}/value/profile/rules.js +7 -50
- package/dist/v1/language/value/profile/validate.d.ts +4 -0
- package/dist/v1/{schema → language}/value/profile/validate.js +13 -21
- package/dist/v1/{schema → language}/value/profile/vocabulary.d.ts +0 -1
- package/dist/v1/{schema → language}/value/profile/vocabulary.js +0 -1
- package/dist/v1/language/value/reference/closure.d.ts +11 -0
- package/dist/v1/{schema/value/resources → language/value/reference}/closure.js +13 -21
- package/dist/v1/{schema/value/resources → language/value/reference}/recursion.d.ts +3 -4
- package/dist/v1/{schema/value/resources → language/value/reference}/recursion.js +5 -6
- package/dist/v1/language/value/reference/references.d.ts +17 -0
- package/dist/v1/language/value/reference/references.js +45 -0
- package/dist/v1/{schema/value → language/value/reference}/registry.d.ts +9 -7
- package/dist/v1/language/value/reference/registry.index.d.ts +14 -0
- package/dist/v1/{schema/value/resources → language/value/reference}/registry.index.js +7 -45
- package/dist/v1/language/value/reference/registry.js +1 -0
- package/dist/v1/{schema → language}/value/regexp/ast.d.ts +0 -1
- package/dist/v1/{schema → language}/value/regexp/ast.js +0 -1
- package/dist/v1/{schema → language}/value/regexp/compile.d.ts +1 -2
- package/dist/v1/{schema → language}/value/regexp/compile.js +8 -12
- package/dist/v1/{schema → language}/value/regexp/lower.d.ts +1 -2
- package/dist/v1/{schema → language}/value/regexp/lower.js +2 -3
- package/dist/v1/{schema → language}/value/regexp/matcher.d.ts +1 -2
- package/dist/v1/{schema → language}/value/regexp/matcher.js +0 -1
- package/dist/v1/{schema → language}/value/regexp/pattern.d.ts +0 -1
- package/dist/v1/{schema → language}/value/regexp/pattern.js +0 -1
- package/dist/v1/{schema → language}/value/regexp/syntax.d.ts +0 -1
- package/dist/v1/{schema → language}/value/regexp/syntax.js +0 -1
- package/dist/v1/{schema/value → language/value/syntax}/full-match.d.ts +0 -1
- package/dist/v1/{schema/value → language/value/syntax}/full-match.js +5 -6
- package/dist/v1/{schema/value/location → language/value/syntax}/keywords.d.ts +0 -1
- package/dist/v1/{schema/value/location → language/value/syntax}/keywords.js +0 -1
- package/dist/v1/{schema/value/extensions → language/value/syntax}/node-path/schema.d.ts +1 -2
- package/dist/v1/{schema/value/extensions → language/value/syntax}/node-path/schema.js +2 -3
- package/dist/v1/language/value/syntax/node-path/validate.d.ts +4 -0
- package/dist/v1/{schema/value/extensions → language/value/syntax}/node-path/validate.js +16 -18
- package/dist/v1/{schema/value/location → language/value/syntax}/pointer.d.ts +0 -1
- package/dist/v1/{schema/value/location → language/value/syntax}/pointer.js +1 -2
- package/dist/v1/{schema/value/location → language/value/syntax}/walk.d.ts +1 -2
- package/dist/v1/{schema/value/location → language/value/syntax}/walk.js +1 -2
- 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/{domain.accept.js → admission/accept.js} +8 -9
- package/dist/v1/schema/{definition/analysis.d.ts → analysis/class.d.ts} +17 -18
- package/dist/v1/schema/{definition/analysis.js → analysis/class.js} +21 -30
- package/dist/v1/schema/canonical/domain.d.ts +2 -2
- package/dist/v1/schema/canonical/domain.digest.d.ts +1 -2
- package/dist/v1/schema/canonical/domain.digest.js +2 -6
- package/dist/v1/schema/canonical/domain.js +3 -224
- package/dist/v1/schema/canonical/freeze.d.ts +0 -1
- package/dist/v1/schema/canonical/freeze.js +0 -1
- package/dist/v1/schema/{domain.revision.d.ts → canonical/revision.d.ts} +2 -3
- package/dist/v1/schema/{domain.revision.js → canonical/revision.js} +7 -5
- package/dist/v1/schema/codec/header.d.ts +17 -0
- package/dist/v1/schema/codec/header.js +26 -0
- package/dist/v1/schema/{domain.codec.d.ts → codec/schema.d.ts} +2 -3
- package/dist/v1/schema/{domain.codec.js → codec/schema.js} +4 -5
- package/dist/v1/schema/{dependency.meaning.d.ts → compatibility/meaning.d.ts} +4 -5
- package/dist/v1/schema/{dependency.meaning.js → compatibility/meaning.js} +121 -124
- package/dist/v1/schema/{domain.lookup.d.ts → dependency/lookup.d.ts} +3 -4
- package/dist/v1/schema/{domain.lookup.js → dependency/lookup.js} +1 -2
- package/dist/v1/schema/diagnostic.d.ts +7 -7
- package/dist/v1/schema/diagnostic.js +9 -9
- package/dist/v1/schema/index.d.ts +24 -40
- package/dist/v1/schema/index.js +11 -18
- 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 +210 -0
- package/dist/v1/schema/resolution/closure.d.ts +3 -4
- package/dist/v1/schema/resolution/closure.js +6 -7
- package/dist/v1/schema/resolution/context.d.ts +11 -12
- package/dist/v1/schema/resolution/context.js +82 -50
- package/dist/v1/schema/resolution/definition.index.d.ts +13 -35
- package/dist/v1/schema/resolution/definition.index.js +8 -18
- 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 +11 -14
- package/dist/v1/schema/resolution/origins.js +52 -45
- package/dist/v1/schema/resolution/value.registry.d.ts +3 -4
- package/dist/v1/schema/resolution/value.registry.js +7 -14
- 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 +241 -0
- package/dist/v1/schema/validation/core.d.ts +5 -0
- package/dist/v1/schema/{core/validate.js → validation/core.js} +39 -30
- package/dist/v1/schema/validation/domain.d.ts +11 -0
- package/dist/v1/schema/{domain.validate.js → validation/domain.js} +12 -12
- package/dist/v1/schema/validation/domain.route.d.ts +1 -2
- package/dist/v1/schema/validation/domain.route.js +3 -4
- package/dist/v1/schema/validation/domain.structure.d.ts +3 -4
- package/dist/v1/schema/validation/domain.structure.js +217 -210
- package/dist/v1/schema/validation/policy/budgets.d.ts +4 -0
- package/dist/v1/schema/{policy/validation → validation/policy}/budgets.js +22 -35
- package/dist/v1/schema/validation/policy/context.d.ts +28 -0
- package/dist/v1/schema/{policy/validation → validation/policy}/context.js +23 -33
- package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
- package/dist/v1/schema/validation/policy/objects.js +64 -0
- package/dist/v1/schema/{policy/validation → validation/policy}/references.d.ts +0 -1
- package/dist/v1/schema/{policy/validation → validation/policy}/references.js +32 -13
- package/dist/v1/schema/{policy/validation → validation/policy}/typing.d.ts +4 -8
- package/dist/v1/schema/{policy/validation → validation/policy}/typing.js +56 -69
- package/dist/v1/schema/{policy/validation → validation/policy}/uses.d.ts +0 -1
- package/dist/v1/schema/{policy/validation → validation/policy}/uses.js +36 -113
- package/dist/v1/schema/{policy/validation → validation/policy}/validate.d.ts +3 -4
- package/dist/v1/schema/{policy/validation → validation/policy}/validate.js +0 -1
- package/dist/v1/schema/{value/index.d.ts → validation/value-api.d.ts} +9 -10
- package/dist/v1/schema/{value/index.js → validation/value-api.js} +4 -5
- package/dist/v1/schema/validation/value.d.ts +4 -5
- package/dist/v1/schema/validation/value.js +4 -9
- package/dist/v1/schema/validation/view.d.ts +3 -0
- package/dist/v1/schema/{view/validate.js → validation/view.js} +11 -4
- package/dist/v1/value/full-match.d.ts +2 -0
- package/dist/v1/value/full-match.js +2 -0
- package/dist/v1.d.ts +1 -2
- package/dist/v1.js +1 -2
- package/dist/value/accept.d.ts +0 -1
- package/dist/value/accept.js +0 -1
- package/dist/value/canonical.d.ts +3 -1
- package/dist/value/canonical.js +11 -5
- package/dist/value/decode.d.ts +0 -1
- package/dist/value/decode.js +0 -1
- package/dist/value/equal.d.ts +0 -1
- package/dist/value/equal.js +0 -1
- package/dist/value/error.d.ts +0 -1
- package/dist/value/error.js +0 -1
- package/dist/value/index.d.ts +0 -1
- package/dist/value/index.js +0 -1
- package/dist/value/json.d.ts +1 -2
- package/dist/value/json.js +1 -2
- package/dist/value/limits.d.ts +0 -1
- package/dist/value/limits.js +0 -1
- package/dist/value/types.d.ts +0 -1
- package/dist/value/types.js +0 -1
- package/dist/value/unicode.d.ts +0 -1
- package/dist/value/unicode.js +0 -1
- package/dist/version/dispatch.d.ts +0 -1
- package/dist/version/dispatch.js +0 -1
- package/dist/version/index.d.ts +0 -1
- package/dist/version/index.js +0 -1
- package/package.json +53 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/upgrade/contract.d.ts.map +0 -1
- package/dist/upgrade/contract.js.map +0 -1
- package/dist/upgrade/index.d.ts.map +0 -1
- package/dist/upgrade/index.js.map +0 -1
- package/dist/v1/addressing/index.d.ts.map +0 -1
- package/dist/v1/addressing/index.js.map +0 -1
- package/dist/v1/addressing/key.d.ts.map +0 -1
- package/dist/v1/addressing/key.js.map +0 -1
- package/dist/v1/addressing/patterns.d.ts.map +0 -1
- package/dist/v1/addressing/patterns.js.map +0 -1
- package/dist/v1/addressing/property-key.d.ts.map +0 -1
- package/dist/v1/addressing/property-key.js.map +0 -1
- package/dist/v1/addressing/ref.d.ts +0 -35
- package/dist/v1/addressing/ref.d.ts.map +0 -1
- package/dist/v1/addressing/ref.js +0 -94
- package/dist/v1/addressing/ref.js.map +0 -1
- package/dist/v1/addressing/schema-ref.d.ts +0 -8
- package/dist/v1/addressing/schema-ref.d.ts.map +0 -1
- package/dist/v1/addressing/schema-ref.js +0 -2
- package/dist/v1/addressing/schema-ref.js.map +0 -1
- package/dist/v1/builder/callable.d.ts +0 -91
- package/dist/v1/builder/callable.d.ts.map +0 -1
- package/dist/v1/builder/callable.js.map +0 -1
- package/dist/v1/builder/compiler/callable.d.ts +0 -20
- package/dist/v1/builder/compiler/callable.d.ts.map +0 -1
- package/dist/v1/builder/compiler/callable.js.map +0 -1
- package/dist/v1/builder/compiler/core.d.ts +0 -6
- package/dist/v1/builder/compiler/core.d.ts.map +0 -1
- package/dist/v1/builder/compiler/core.js.map +0 -1
- package/dist/v1/builder/compiler/core.properties.d.ts +0 -6
- package/dist/v1/builder/compiler/core.properties.d.ts.map +0 -1
- package/dist/v1/builder/compiler/core.properties.js.map +0 -1
- package/dist/v1/builder/compiler/definition.d.ts +0 -32
- package/dist/v1/builder/compiler/definition.d.ts.map +0 -1
- package/dist/v1/builder/compiler/definition.js +0 -197
- package/dist/v1/builder/compiler/definition.js.map +0 -1
- package/dist/v1/builder/compiler/policy.d.ts +0 -17
- package/dist/v1/builder/compiler/policy.d.ts.map +0 -1
- package/dist/v1/builder/compiler/policy.js.map +0 -1
- package/dist/v1/builder/compiler/schema.capture.d.ts.map +0 -1
- package/dist/v1/builder/compiler/schema.capture.js +0 -85
- package/dist/v1/builder/compiler/schema.capture.js.map +0 -1
- package/dist/v1/builder/compiler/schema.context.d.ts +0 -45
- package/dist/v1/builder/compiler/schema.context.d.ts.map +0 -1
- package/dist/v1/builder/compiler/schema.context.js.map +0 -1
- package/dist/v1/builder/compiler/schema.d.ts.map +0 -1
- package/dist/v1/builder/compiler/schema.js.map +0 -1
- package/dist/v1/builder/compiler/schema.ownership.d.ts +0 -9
- package/dist/v1/builder/compiler/schema.ownership.d.ts.map +0 -1
- package/dist/v1/builder/compiler/schema.ownership.js.map +0 -1
- package/dist/v1/builder/compiler/value.d.ts +0 -26
- package/dist/v1/builder/compiler/value.d.ts.map +0 -1
- package/dist/v1/builder/compiler/value.js.map +0 -1
- package/dist/v1/builder/compiler/value.path.d.ts +0 -4
- package/dist/v1/builder/compiler/value.path.d.ts.map +0 -1
- package/dist/v1/builder/compiler/value.path.js.map +0 -1
- package/dist/v1/builder/compiler/value.zod.d.ts.map +0 -1
- package/dist/v1/builder/compiler/value.zod.js.map +0 -1
- package/dist/v1/builder/compiler/view.d.ts +0 -12
- package/dist/v1/builder/compiler/view.d.ts.map +0 -1
- package/dist/v1/builder/compiler/view.js.map +0 -1
- package/dist/v1/builder/core.d.ts +0 -27
- package/dist/v1/builder/core.d.ts.map +0 -1
- package/dist/v1/builder/core.js +0 -21
- package/dist/v1/builder/core.js.map +0 -1
- package/dist/v1/builder/definition.d.ts +0 -155
- package/dist/v1/builder/definition.d.ts.map +0 -1
- package/dist/v1/builder/definition.js +0 -141
- package/dist/v1/builder/definition.js.map +0 -1
- package/dist/v1/builder/full-match.d.ts +0 -5
- package/dist/v1/builder/full-match.d.ts.map +0 -1
- package/dist/v1/builder/full-match.js +0 -12
- package/dist/v1/builder/full-match.js.map +0 -1
- package/dist/v1/builder/index.d.ts.map +0 -1
- package/dist/v1/builder/index.js.map +0 -1
- package/dist/v1/builder/internal/authoring.d.ts.map +0 -1
- package/dist/v1/builder/internal/authoring.js.map +0 -1
- package/dist/v1/builder/internal/authoring.lazy.d.ts.map +0 -1
- package/dist/v1/builder/internal/authoring.lazy.js.map +0 -1
- package/dist/v1/builder/internal/diagnostic.d.ts +0 -4
- package/dist/v1/builder/internal/diagnostic.d.ts.map +0 -1
- package/dist/v1/builder/internal/diagnostic.js +0 -16
- package/dist/v1/builder/internal/diagnostic.js.map +0 -1
- package/dist/v1/builder/internal/path.metadata.d.ts +0 -5
- package/dist/v1/builder/internal/path.metadata.d.ts.map +0 -1
- package/dist/v1/builder/internal/path.metadata.js.map +0 -1
- package/dist/v1/builder/path.d.ts +0 -9
- package/dist/v1/builder/path.d.ts.map +0 -1
- package/dist/v1/builder/path.js.map +0 -1
- package/dist/v1/builder/policy.d.ts.map +0 -1
- package/dist/v1/builder/policy.js +0 -79
- package/dist/v1/builder/policy.js.map +0 -1
- package/dist/v1/builder/property.d.ts +0 -37
- package/dist/v1/builder/property.d.ts.map +0 -1
- package/dist/v1/builder/property.js +0 -36
- package/dist/v1/builder/property.js.map +0 -1
- package/dist/v1/builder/schema.d.ts +0 -6
- package/dist/v1/builder/schema.d.ts.map +0 -1
- package/dist/v1/builder/schema.input.d.ts +0 -19
- package/dist/v1/builder/schema.input.d.ts.map +0 -1
- package/dist/v1/builder/schema.input.js +0 -2
- package/dist/v1/builder/schema.input.js.map +0 -1
- package/dist/v1/builder/schema.js.map +0 -1
- package/dist/v1/builder/value-schema.d.ts.map +0 -1
- package/dist/v1/builder/value-schema.js.map +0 -1
- package/dist/v1/builder/view.d.ts +0 -19
- package/dist/v1/builder/view.d.ts.map +0 -1
- package/dist/v1/builder/view.js +0 -7
- package/dist/v1/builder/view.js.map +0 -1
- package/dist/v1/builder.d.ts +0 -3
- package/dist/v1/builder.d.ts.map +0 -1
- package/dist/v1/builder.js +0 -2
- package/dist/v1/builder.js.map +0 -1
- package/dist/v1/bundle/codec.d.ts.map +0 -1
- package/dist/v1/bundle/codec.js.map +0 -1
- package/dist/v1/bundle/index.d.ts.map +0 -1
- package/dist/v1/bundle/index.js.map +0 -1
- package/dist/v1/bundle/model.d.ts.map +0 -1
- package/dist/v1/bundle/model.js.map +0 -1
- package/dist/v1/bundle/structure.d.ts.map +0 -1
- package/dist/v1/bundle/structure.js.map +0 -1
- package/dist/v1/bundle.d.ts +0 -3
- package/dist/v1/bundle.d.ts.map +0 -1
- package/dist/v1/bundle.js +0 -3
- package/dist/v1/bundle.js.map +0 -1
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
- package/dist/v1/schema/callable.d.ts +0 -29
- package/dist/v1/schema/callable.d.ts.map +0 -1
- package/dist/v1/schema/callable.js +0 -2
- package/dist/v1/schema/callable.js.map +0 -1
- package/dist/v1/schema/canonical/domain.d.ts.map +0 -1
- package/dist/v1/schema/canonical/domain.digest.d.ts.map +0 -1
- package/dist/v1/schema/canonical/domain.digest.js.map +0 -1
- package/dist/v1/schema/canonical/domain.js.map +0 -1
- package/dist/v1/schema/canonical/freeze.d.ts.map +0 -1
- package/dist/v1/schema/canonical/freeze.js.map +0 -1
- package/dist/v1/schema/compiled/admission.d.ts +0 -4
- package/dist/v1/schema/compiled/admission.d.ts.map +0 -1
- package/dist/v1/schema/compiled/admission.js +0 -217
- package/dist/v1/schema/compiled/admission.js.map +0 -1
- package/dist/v1/schema/compiled/authored-validator.d.ts +0 -5
- package/dist/v1/schema/compiled/authored-validator.d.ts.map +0 -1
- package/dist/v1/schema/compiled/authored-validator.js +0 -7
- package/dist/v1/schema/compiled/authored-validator.js.map +0 -1
- package/dist/v1/schema/compiled/compiler.d.ts +0 -5
- package/dist/v1/schema/compiled/compiler.d.ts.map +0 -1
- package/dist/v1/schema/compiled/compiler.js +0 -86
- package/dist/v1/schema/compiled/compiler.js.map +0 -1
- package/dist/v1/schema/compiled/model.d.ts +0 -61
- package/dist/v1/schema/compiled/model.d.ts.map +0 -1
- package/dist/v1/schema/compiled/model.js +0 -2
- package/dist/v1/schema/compiled/model.js.map +0 -1
- package/dist/v1/schema/compiled/program.d.ts.map +0 -1
- package/dist/v1/schema/compiled/program.js.map +0 -1
- package/dist/v1/schema/compiled/validator.d.ts +0 -23
- package/dist/v1/schema/compiled/validator.d.ts.map +0 -1
- package/dist/v1/schema/compiled/validator.js +0 -62
- package/dist/v1/schema/compiled/validator.js.map +0 -1
- package/dist/v1/schema/core/declaration.d.ts +0 -17
- package/dist/v1/schema/core/declaration.d.ts.map +0 -1
- package/dist/v1/schema/core/declaration.js +0 -2
- package/dist/v1/schema/core/declaration.js.map +0 -1
- package/dist/v1/schema/core/validate.d.ts +0 -6
- package/dist/v1/schema/core/validate.d.ts.map +0 -1
- package/dist/v1/schema/core/validate.js.map +0 -1
- package/dist/v1/schema/definition/analysis.d.ts.map +0 -1
- package/dist/v1/schema/definition/analysis.js.map +0 -1
- package/dist/v1/schema/definition/class.d.ts +0 -28
- package/dist/v1/schema/definition/class.d.ts.map +0 -1
- package/dist/v1/schema/definition/class.js +0 -2
- package/dist/v1/schema/definition/class.js.map +0 -1
- package/dist/v1/schema/definition/data.d.ts.map +0 -1
- package/dist/v1/schema/definition/data.js.map +0 -1
- package/dist/v1/schema/definition/edge.d.ts.map +0 -1
- package/dist/v1/schema/definition/edge.js +0 -2
- package/dist/v1/schema/definition/edge.js.map +0 -1
- package/dist/v1/schema/definition/interface.d.ts +0 -22
- package/dist/v1/schema/definition/interface.d.ts.map +0 -1
- package/dist/v1/schema/definition/interface.js +0 -2
- package/dist/v1/schema/definition/interface.js.map +0 -1
- package/dist/v1/schema/definition/property.d.ts +0 -18
- package/dist/v1/schema/definition/property.d.ts.map +0 -1
- package/dist/v1/schema/definition/property.js +0 -2
- package/dist/v1/schema/definition/property.js.map +0 -1
- package/dist/v1/schema/definition/validate.d.ts +0 -5
- package/dist/v1/schema/definition/validate.d.ts.map +0 -1
- package/dist/v1/schema/definition/validate.js +0 -221
- package/dist/v1/schema/definition/validate.js.map +0 -1
- package/dist/v1/schema/dependency.meaning.d.ts.map +0 -1
- package/dist/v1/schema/dependency.meaning.js.map +0 -1
- package/dist/v1/schema/diagnostic.d.ts.map +0 -1
- package/dist/v1/schema/diagnostic.js.map +0 -1
- package/dist/v1/schema/domain.accept.d.ts +0 -4
- package/dist/v1/schema/domain.accept.d.ts.map +0 -1
- package/dist/v1/schema/domain.accept.js.map +0 -1
- package/dist/v1/schema/domain.codec.d.ts.map +0 -1
- package/dist/v1/schema/domain.codec.js.map +0 -1
- package/dist/v1/schema/domain.header.d.ts +0 -15
- package/dist/v1/schema/domain.header.d.ts.map +0 -1
- package/dist/v1/schema/domain.header.js +0 -21
- package/dist/v1/schema/domain.header.js.map +0 -1
- package/dist/v1/schema/domain.ir.d.ts +0 -40
- package/dist/v1/schema/domain.ir.d.ts.map +0 -1
- package/dist/v1/schema/domain.ir.js +0 -5
- package/dist/v1/schema/domain.ir.js.map +0 -1
- package/dist/v1/schema/domain.lookup.d.ts.map +0 -1
- package/dist/v1/schema/domain.lookup.js.map +0 -1
- package/dist/v1/schema/domain.resolve.d.ts +0 -26
- package/dist/v1/schema/domain.resolve.d.ts.map +0 -1
- package/dist/v1/schema/domain.resolve.js +0 -43
- package/dist/v1/schema/domain.resolve.js.map +0 -1
- package/dist/v1/schema/domain.revision.d.ts.map +0 -1
- package/dist/v1/schema/domain.revision.js.map +0 -1
- package/dist/v1/schema/domain.validate.d.ts +0 -12
- package/dist/v1/schema/domain.validate.d.ts.map +0 -1
- package/dist/v1/schema/domain.validate.js.map +0 -1
- package/dist/v1/schema/index.d.ts.map +0 -1
- package/dist/v1/schema/index.js.map +0 -1
- package/dist/v1/schema/metadata.d.ts.map +0 -1
- package/dist/v1/schema/metadata.js.map +0 -1
- package/dist/v1/schema/policy/ast.d.ts.map +0 -1
- package/dist/v1/schema/policy/ast.js +0 -2
- package/dist/v1/schema/policy/ast.js.map +0 -1
- package/dist/v1/schema/policy/normalize.d.ts +0 -5
- package/dist/v1/schema/policy/normalize.d.ts.map +0 -1
- package/dist/v1/schema/policy/normalize.js.map +0 -1
- package/dist/v1/schema/policy/validation/branches.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/branches.js.map +0 -1
- package/dist/v1/schema/policy/validation/budgets.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/budgets.js.map +0 -1
- package/dist/v1/schema/policy/validation/context.d.ts +0 -28
- package/dist/v1/schema/policy/validation/context.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/context.js.map +0 -1
- package/dist/v1/schema/policy/validation/references.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/references.js.map +0 -1
- package/dist/v1/schema/policy/validation/typing.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/typing.js.map +0 -1
- package/dist/v1/schema/policy/validation/uses.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/uses.js.map +0 -1
- package/dist/v1/schema/policy/validation/validate.d.ts.map +0 -1
- package/dist/v1/schema/policy/validation/validate.js.map +0 -1
- package/dist/v1/schema/reference.d.ts +0 -43
- package/dist/v1/schema/reference.d.ts.map +0 -1
- package/dist/v1/schema/reference.js +0 -31
- package/dist/v1/schema/reference.js.map +0 -1
- package/dist/v1/schema/resolution/closure.d.ts.map +0 -1
- package/dist/v1/schema/resolution/closure.js.map +0 -1
- package/dist/v1/schema/resolution/context.d.ts.map +0 -1
- package/dist/v1/schema/resolution/context.js.map +0 -1
- package/dist/v1/schema/resolution/definition.index.d.ts.map +0 -1
- package/dist/v1/schema/resolution/definition.index.js.map +0 -1
- package/dist/v1/schema/resolution/origins.d.ts.map +0 -1
- package/dist/v1/schema/resolution/origins.js.map +0 -1
- package/dist/v1/schema/resolution/value.registry.d.ts.map +0 -1
- package/dist/v1/schema/resolution/value.registry.js.map +0 -1
- package/dist/v1/schema/validation/domain.route.d.ts.map +0 -1
- package/dist/v1/schema/validation/domain.route.js.map +0 -1
- package/dist/v1/schema/validation/domain.structure.d.ts.map +0 -1
- package/dist/v1/schema/validation/domain.structure.js.map +0 -1
- package/dist/v1/schema/validation/value.d.ts.map +0 -1
- package/dist/v1/schema/validation/value.js.map +0 -1
- package/dist/v1/schema/value/extensions/node-path/schema.d.ts.map +0 -1
- package/dist/v1/schema/value/extensions/node-path/schema.js.map +0 -1
- package/dist/v1/schema/value/extensions/node-path/validate.d.ts +0 -5
- package/dist/v1/schema/value/extensions/node-path/validate.d.ts.map +0 -1
- package/dist/v1/schema/value/extensions/node-path/validate.js.map +0 -1
- package/dist/v1/schema/value/full-match.d.ts.map +0 -1
- package/dist/v1/schema/value/full-match.js.map +0 -1
- package/dist/v1/schema/value/index.d.ts.map +0 -1
- package/dist/v1/schema/value/index.js.map +0 -1
- package/dist/v1/schema/value/instance/assertions.d.ts.map +0 -1
- package/dist/v1/schema/value/instance/assertions.js.map +0 -1
- package/dist/v1/schema/value/instance/evaluator.d.ts.map +0 -1
- package/dist/v1/schema/value/instance/evaluator.js.map +0 -1
- package/dist/v1/schema/value/instance/preparation.d.ts.map +0 -1
- package/dist/v1/schema/value/instance/preparation.js.map +0 -1
- package/dist/v1/schema/value/instance/types.d.ts.map +0 -1
- package/dist/v1/schema/value/instance/types.js.map +0 -1
- package/dist/v1/schema/value/instance.validate.d.ts.map +0 -1
- package/dist/v1/schema/value/instance.validate.js.map +0 -1
- package/dist/v1/schema/value/instant.d.ts.map +0 -1
- package/dist/v1/schema/value/instant.js.map +0 -1
- package/dist/v1/schema/value/location/keywords.d.ts.map +0 -1
- package/dist/v1/schema/value/location/keywords.js.map +0 -1
- package/dist/v1/schema/value/location/pointer.d.ts.map +0 -1
- package/dist/v1/schema/value/location/pointer.js.map +0 -1
- package/dist/v1/schema/value/location/walk.d.ts.map +0 -1
- package/dist/v1/schema/value/location/walk.js.map +0 -1
- package/dist/v1/schema/value/object.d.ts.map +0 -1
- package/dist/v1/schema/value/object.js.map +0 -1
- package/dist/v1/schema/value/ordering.d.ts.map +0 -1
- package/dist/v1/schema/value/ordering.js.map +0 -1
- package/dist/v1/schema/value/profile/canonicalize.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/canonicalize.js.map +0 -1
- package/dist/v1/schema/value/profile/dialect.d.ts +0 -5
- package/dist/v1/schema/value/profile/dialect.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/dialect.js +0 -36
- package/dist/v1/schema/value/profile/dialect.js.map +0 -1
- package/dist/v1/schema/value/profile/json.validate.d.ts +0 -3
- package/dist/v1/schema/value/profile/json.validate.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/json.validate.js.map +0 -1
- package/dist/v1/schema/value/profile/meta-schema.compiled.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/meta-schema.compiled.js.map +0 -1
- package/dist/v1/schema/value/profile/meta-schema.d.ts +0 -5
- package/dist/v1/schema/value/profile/meta-schema.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/meta-schema.js.map +0 -1
- package/dist/v1/schema/value/profile/rules.d.ts +0 -5
- package/dist/v1/schema/value/profile/rules.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/rules.js.map +0 -1
- package/dist/v1/schema/value/profile/validate.d.ts +0 -5
- package/dist/v1/schema/value/profile/validate.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/validate.js.map +0 -1
- package/dist/v1/schema/value/profile/vocabulary.d.ts.map +0 -1
- package/dist/v1/schema/value/profile/vocabulary.js.map +0 -1
- package/dist/v1/schema/value/regexp/ast.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/ast.js.map +0 -1
- package/dist/v1/schema/value/regexp/compile.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/compile.js.map +0 -1
- package/dist/v1/schema/value/regexp/linear.d.ts +0 -20
- package/dist/v1/schema/value/regexp/linear.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/linear.js +0 -24
- package/dist/v1/schema/value/regexp/linear.js.map +0 -1
- package/dist/v1/schema/value/regexp/lower.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/lower.js.map +0 -1
- package/dist/v1/schema/value/regexp/matcher.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/matcher.js.map +0 -1
- package/dist/v1/schema/value/regexp/pattern.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/pattern.js.map +0 -1
- package/dist/v1/schema/value/regexp/syntax.d.ts.map +0 -1
- package/dist/v1/schema/value/regexp/syntax.js.map +0 -1
- package/dist/v1/schema/value/registry.d.ts.map +0 -1
- package/dist/v1/schema/value/registry.js +0 -2
- package/dist/v1/schema/value/registry.js.map +0 -1
- package/dist/v1/schema/value/resources/closure.d.ts +0 -12
- package/dist/v1/schema/value/resources/closure.d.ts.map +0 -1
- package/dist/v1/schema/value/resources/closure.js.map +0 -1
- package/dist/v1/schema/value/resources/recursion.d.ts.map +0 -1
- package/dist/v1/schema/value/resources/recursion.js.map +0 -1
- package/dist/v1/schema/value/resources/references.d.ts +0 -25
- package/dist/v1/schema/value/resources/references.d.ts.map +0 -1
- package/dist/v1/schema/value/resources/references.js +0 -93
- package/dist/v1/schema/value/resources/references.js.map +0 -1
- package/dist/v1/schema/value/resources/registry.index.d.ts +0 -22
- package/dist/v1/schema/value/resources/registry.index.d.ts.map +0 -1
- package/dist/v1/schema/value/resources/registry.index.js.map +0 -1
- package/dist/v1/schema/value/schema.d.ts.map +0 -1
- package/dist/v1/schema/value/schema.js.map +0 -1
- package/dist/v1/schema/view/declaration.d.ts +0 -14
- package/dist/v1/schema/view/declaration.d.ts.map +0 -1
- package/dist/v1/schema/view/declaration.js +0 -2
- package/dist/v1/schema/view/declaration.js.map +0 -1
- package/dist/v1/schema/view/validate.d.ts +0 -4
- package/dist/v1/schema/view/validate.d.ts.map +0 -1
- package/dist/v1/schema/view/validate.js.map +0 -1
- package/dist/v1/schema.d.ts +0 -3
- package/dist/v1/schema.d.ts.map +0 -1
- package/dist/v1/schema.js +0 -3
- package/dist/v1/schema.js.map +0 -1
- package/dist/v1.d.ts.map +0 -1
- package/dist/v1.js.map +0 -1
- package/dist/value/accept.d.ts.map +0 -1
- package/dist/value/accept.js.map +0 -1
- package/dist/value/canonical.d.ts.map +0 -1
- package/dist/value/canonical.js.map +0 -1
- package/dist/value/decode.d.ts.map +0 -1
- package/dist/value/decode.js.map +0 -1
- package/dist/value/equal.d.ts.map +0 -1
- package/dist/value/equal.js.map +0 -1
- package/dist/value/error.d.ts.map +0 -1
- package/dist/value/error.js.map +0 -1
- package/dist/value/index.d.ts.map +0 -1
- package/dist/value/index.js.map +0 -1
- package/dist/value/json.d.ts.map +0 -1
- package/dist/value/json.js.map +0 -1
- package/dist/value/limits.d.ts.map +0 -1
- package/dist/value/limits.js.map +0 -1
- package/dist/value/types.d.ts.map +0 -1
- package/dist/value/types.js.map +0 -1
- package/dist/value/unicode.d.ts.map +0 -1
- package/dist/value/unicode.js.map +0 -1
- package/dist/version/dispatch.d.ts.map +0 -1
- package/dist/version/dispatch.js.map +0 -1
- package/dist/version/index.d.ts.map +0 -1
- package/dist/version/index.js.map +0 -1
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
import { accept as acceptPortable } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import { dependencyLimits } from '../../addressing/domain-dependency.js';
|
|
3
|
+
import { isDefinitionRef, Key } from '../../addressing/index.js';
|
|
4
|
+
import { DEPENDENCY_ALIAS_PATTERN, DOMAIN_ORIGIN_PATTERN, DOMAIN_REVISION_PATTERN, MEMBER_NAME_PATTERN, } from '../../addressing/patterns.js';
|
|
5
|
+
import { MEDIA_TYPE_PATTERN } from '../../language/class/model/data.js';
|
|
6
|
+
import { PropertyValues } from '../../language/class/property-values.js';
|
|
7
|
+
import { admitStateTopology } from '../../language/state/topology.js';
|
|
8
|
+
import { classifyValueProgramOrdering } from '../../language/value/ordering.js';
|
|
9
|
+
import { invalidCompiled } from '../diagnostic.js';
|
|
10
|
+
import { revisionOfCompiledEntry } from './revision.js';
|
|
11
|
+
import { validateCompiledSemantics } from './semantics.js';
|
|
12
|
+
const MAXIMUM_COMPILED_SCHEMA_MEMBERS = 1_000_000;
|
|
13
|
+
function pointer(parent, member) {
|
|
14
|
+
return `${parent}/${String(member).replaceAll('~', '~0').replaceAll('/', '~1')}`;
|
|
15
|
+
}
|
|
16
|
+
/** Admit one detached compiled closure before indices and declarations become executable. */
|
|
17
|
+
export function acceptCompiledSchema(input) {
|
|
18
|
+
const root = object(acceptPortable(input, { limits: { maxMembers: MAXIMUM_COMPILED_SCHEMA_MEMBERS } }), 'CompiledSchema', '');
|
|
19
|
+
exact(root, ['format', 'version', 'root', 'closure'], 'CompiledSchema', '');
|
|
20
|
+
if (root.format !== 'astrale.dsl.compiled-schema')
|
|
21
|
+
invalid('format', undefined, '/format');
|
|
22
|
+
if (root.version !== 1)
|
|
23
|
+
invalid('version', undefined, '/version');
|
|
24
|
+
const rootPin = dependency(root.root, 'root', '/root');
|
|
25
|
+
const closure = array(root.closure, 'closure', '/closure').map((value, index) => entry(value, index, `/closure/${index}`));
|
|
26
|
+
if (closure.length > dependencyLimits.closure) {
|
|
27
|
+
invalid('dependency closure limit', 'COMPILED_DEPENDENCY_LIMITS', '/closure');
|
|
28
|
+
}
|
|
29
|
+
const closureOrigins = new Set();
|
|
30
|
+
for (const [index, value] of closure.entries()) {
|
|
31
|
+
if (closureOrigins.has(value.origin))
|
|
32
|
+
invalid('closure origins', undefined, `/closure/${index}/origin`);
|
|
33
|
+
closureOrigins.add(value.origin);
|
|
34
|
+
}
|
|
35
|
+
const byOrigin = new Map(closure.map((value) => [value.origin, value]));
|
|
36
|
+
const rootEntry = byOrigin.get(rootPin.origin);
|
|
37
|
+
if (rootEntry?.revision !== rootPin.revision)
|
|
38
|
+
invalid('root pin', undefined, '/root');
|
|
39
|
+
for (const [entryIndex, owner] of closure.entries()) {
|
|
40
|
+
if (Object.keys(owner.dependencies).length > dependencyLimits.direct) {
|
|
41
|
+
invalid('direct dependency limit', 'COMPILED_DEPENDENCY_LIMITS', `/closure/${entryIndex}/dependencies`);
|
|
42
|
+
}
|
|
43
|
+
for (const [alias, pin] of Object.entries(owner.dependencies)) {
|
|
44
|
+
if (byOrigin.get(pin.origin)?.revision !== pin.revision)
|
|
45
|
+
invalid('dependency closure', undefined, pointer(`/closure/${entryIndex}/dependencies`, alias));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const reachable = new Set();
|
|
49
|
+
const visit = (origin) => {
|
|
50
|
+
if (reachable.has(origin))
|
|
51
|
+
return;
|
|
52
|
+
reachable.add(origin);
|
|
53
|
+
const owner = byOrigin.get(origin);
|
|
54
|
+
if (owner !== undefined) {
|
|
55
|
+
for (const { origin: dependencyOrigin } of Object.values(owner.dependencies)) {
|
|
56
|
+
visit(dependencyOrigin);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
visit(rootPin.origin);
|
|
61
|
+
if (reachable.size !== closure.length) {
|
|
62
|
+
const unrelatedIndex = closure.findIndex(({ origin }) => !reachable.has(origin));
|
|
63
|
+
invalid('unrelated closure entry', undefined, `/closure/${unrelatedIndex}`);
|
|
64
|
+
}
|
|
65
|
+
const candidate = {
|
|
66
|
+
format: 'astrale.dsl.compiled-schema',
|
|
67
|
+
version: 1,
|
|
68
|
+
root: rootPin,
|
|
69
|
+
closure,
|
|
70
|
+
};
|
|
71
|
+
validateClosure(candidate);
|
|
72
|
+
validateCompiledSemantics(candidate);
|
|
73
|
+
return deepFreeze(candidate);
|
|
74
|
+
}
|
|
75
|
+
function entry(input, entryIndex, path) {
|
|
76
|
+
const value = object(input, `closure[${entryIndex}]`, path);
|
|
77
|
+
exact(value, ['origin', 'revision', 'dependencies', 'definitions', 'facts', 'values'], 'entry', path);
|
|
78
|
+
const origin = originValue(value.origin, 'entry origin', `${path}/origin`);
|
|
79
|
+
const revision = revisionValue(value.revision, 'entry revision', `${path}/revision`);
|
|
80
|
+
const dependenciesPath = `${path}/dependencies`;
|
|
81
|
+
const dependencies = dependencyMap(value.dependencies, dependenciesPath);
|
|
82
|
+
const dependencyOrigins = new Set();
|
|
83
|
+
for (const [alias, dependency] of Object.entries(dependencies)) {
|
|
84
|
+
if (dependencyOrigins.has(dependency.origin))
|
|
85
|
+
invalid('duplicate dependency', undefined, `${pointer(dependenciesPath, alias)}/origin`);
|
|
86
|
+
dependencyOrigins.add(dependency.origin);
|
|
87
|
+
}
|
|
88
|
+
const valuesPath = `${path}/values`;
|
|
89
|
+
const values = array(value.values, 'values', valuesPath).map((item, index) => program(item, index, `${valuesPath}/${index}`));
|
|
90
|
+
const definitionsPath = `${path}/definitions`;
|
|
91
|
+
const definitions = object(value.definitions, 'definitions', definitionsPath);
|
|
92
|
+
exact(definitions, ['classes', 'functions', 'policies', 'views', 'core'], 'definitions', definitionsPath);
|
|
93
|
+
const classesPath = `${definitionsPath}/classes`;
|
|
94
|
+
const classes = array(definitions.classes, 'classes', classesPath).map((item, index) => compiledClass(item, values, `${classesPath}/${index}`));
|
|
95
|
+
const functionsPath = `${definitionsPath}/functions`;
|
|
96
|
+
const functions = array(definitions.functions, 'functions', functionsPath).map((item, index) => compiledFunction(item, values, `${functionsPath}/${index}`));
|
|
97
|
+
const factsPath = `${path}/facts`;
|
|
98
|
+
const facts = object(value.facts, 'facts', factsPath);
|
|
99
|
+
exact(facts, ['core'], 'facts', factsPath);
|
|
100
|
+
const policiesPath = `${definitionsPath}/policies`;
|
|
101
|
+
const viewsPath = `${definitionsPath}/views`;
|
|
102
|
+
const coreDefinitionsPath = `${definitionsPath}/core`;
|
|
103
|
+
const coreFactsPath = `${factsPath}/core`;
|
|
104
|
+
const accepted = {
|
|
105
|
+
origin,
|
|
106
|
+
revision,
|
|
107
|
+
dependencies,
|
|
108
|
+
definitions: {
|
|
109
|
+
classes,
|
|
110
|
+
functions,
|
|
111
|
+
policies: array(definitions.policies, 'policies', policiesPath).map((item, index) => compiledPolicy(item, `${policiesPath}/${index}`)),
|
|
112
|
+
views: array(definitions.views, 'views', viewsPath).map((item, index) => compiledView(item, `${viewsPath}/${index}`)),
|
|
113
|
+
core: array(definitions.core, 'core definitions', coreDefinitionsPath).map((item, index) => compiledCoreDefinition(item, `${coreDefinitionsPath}/${index}`)),
|
|
114
|
+
},
|
|
115
|
+
facts: {
|
|
116
|
+
core: array(facts.core, 'core facts', coreFactsPath).map((item, index) => compiledCoreEdge(item, `${coreFactsPath}/${index}`)),
|
|
117
|
+
},
|
|
118
|
+
values,
|
|
119
|
+
};
|
|
120
|
+
const collections = [
|
|
121
|
+
['classes', accepted.definitions.classes],
|
|
122
|
+
['functions', accepted.definitions.functions],
|
|
123
|
+
['policies', accepted.definitions.policies],
|
|
124
|
+
['views', accepted.definitions.views],
|
|
125
|
+
['core', accepted.definitions.core],
|
|
126
|
+
];
|
|
127
|
+
for (const [collection, definitions] of collections) {
|
|
128
|
+
for (const [index, definition] of definitions.entries()) {
|
|
129
|
+
if (definition.ref.origin !== origin)
|
|
130
|
+
invalid('Definition owner origin', undefined, `${definitionsPath}/${collection}/${index}/ref/origin`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (revisionOfCompiledEntry(accepted) !== revision) {
|
|
134
|
+
invalid('entry revision', 'COMPILED_CANONICAL_MISMATCH', `${path}/revision`);
|
|
135
|
+
}
|
|
136
|
+
return accepted;
|
|
137
|
+
}
|
|
138
|
+
function compiledClass(input, values, path) {
|
|
139
|
+
const value = object(input, 'Compiled Class', path);
|
|
140
|
+
if (value.kind !== 'node' && value.kind !== 'edge')
|
|
141
|
+
invalid('Class kind', undefined, `${path}/kind`);
|
|
142
|
+
exact(value, value.kind === 'node'
|
|
143
|
+
? ['ref', 'kind', 'abstract', 'extends', 'properties', 'methods', 'policies']
|
|
144
|
+
: [
|
|
145
|
+
'ref',
|
|
146
|
+
'kind',
|
|
147
|
+
'abstract',
|
|
148
|
+
'extends',
|
|
149
|
+
'orientation',
|
|
150
|
+
'endpoints',
|
|
151
|
+
'constraints',
|
|
152
|
+
'properties',
|
|
153
|
+
'policies',
|
|
154
|
+
], 'Compiled Class', path, value.kind === 'node' ? ['data', 'description', 'icon'] : ['description']);
|
|
155
|
+
definitionRef(value.ref, 'class', 'Class ref', `${path}/ref`);
|
|
156
|
+
boolean(value.abstract, 'Class abstract', `${path}/abstract`);
|
|
157
|
+
description(value.description, 'Class description', `${path}/description`);
|
|
158
|
+
const extendsPath = `${path}/extends`;
|
|
159
|
+
const parents = array(value.extends, 'Class extends', extendsPath).map((parent, index) => definitionRef(parent, 'class', 'Class parent', `${extendsPath}/${index}`));
|
|
160
|
+
unique(parents.map(Key.of), 'Class parents', extendsPath);
|
|
161
|
+
const propertiesPath = `${path}/properties`;
|
|
162
|
+
const properties = array(value.properties, 'Class properties', propertiesPath).map((property, index) => compiledProperty(property, values, value.kind === 'node', `${propertiesPath}/${index}`));
|
|
163
|
+
unique(properties.map((property) => property.name), 'Class Properties', propertiesPath);
|
|
164
|
+
if (value.kind === 'node') {
|
|
165
|
+
if (value.data !== undefined)
|
|
166
|
+
dataDefinition(value.data, `${path}/data`);
|
|
167
|
+
boundedString(value.icon, 1, 8000, 'Class icon', `${path}/icon`);
|
|
168
|
+
classPolicies(value.policies, `${path}/policies`);
|
|
169
|
+
const methodsPath = `${path}/methods`;
|
|
170
|
+
const methods = array(value.methods, 'Class methods', methodsPath);
|
|
171
|
+
for (const [index, method] of methods.entries())
|
|
172
|
+
compiledCallable(method, values, true, `${methodsPath}/${index}`);
|
|
173
|
+
unique(methods.map((method, index) => string(object(method, 'Compiled Method', `${methodsPath}/${index}`).name, 'Method name', `${methodsPath}/${index}/name`)), 'Class Methods', methodsPath);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
classPolicies(value.policies, `${path}/policies`);
|
|
177
|
+
edgeContract(value, path);
|
|
178
|
+
}
|
|
179
|
+
return { ...value, properties };
|
|
180
|
+
}
|
|
181
|
+
function compiledFunction(input, values, path) {
|
|
182
|
+
const value = object(input, 'Compiled Function', path);
|
|
183
|
+
compiledCallable(value, values, false, path);
|
|
184
|
+
definitionRef(value.ref, 'function', 'Function ref', `${path}/ref`);
|
|
185
|
+
return value;
|
|
186
|
+
}
|
|
187
|
+
function compiledProperty(input, values, node, path) {
|
|
188
|
+
const value = object(input, 'Compiled Property', path);
|
|
189
|
+
exact(value, ['name', 'required', 'value'], 'Compiled Property', path, [
|
|
190
|
+
'auto',
|
|
191
|
+
'description',
|
|
192
|
+
'ordering',
|
|
193
|
+
'state',
|
|
194
|
+
]);
|
|
195
|
+
memberName(value.name, 'Property name', `${path}/name`);
|
|
196
|
+
boolean(value.required, 'Property required', `${path}/required`);
|
|
197
|
+
description(value.description, 'Property description', `${path}/description`);
|
|
198
|
+
if (value.auto !== undefined)
|
|
199
|
+
propertyAuto(value.auto, `${path}/auto`);
|
|
200
|
+
const valueIndex = index(value.value, values.length, 'Property value', `${path}/value`);
|
|
201
|
+
let state;
|
|
202
|
+
if (value.state !== undefined) {
|
|
203
|
+
if (!node)
|
|
204
|
+
invalid('Property state placement', 'COMPILED_SOURCE_INVALID', `${path}/state`);
|
|
205
|
+
let topology;
|
|
206
|
+
try {
|
|
207
|
+
topology = admitStateTopology(value.state);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
invalid('Property state topology', 'COMPILED_SOURCE_INVALID', `${path}/state`);
|
|
211
|
+
}
|
|
212
|
+
const program = values[valueIndex];
|
|
213
|
+
const schema = program.nodes[program.root].schema;
|
|
214
|
+
const states = Object.keys(topology.transitions);
|
|
215
|
+
const schemaObject = schema;
|
|
216
|
+
const schemaMatches = schema !== null &&
|
|
217
|
+
typeof schema === 'object' &&
|
|
218
|
+
!Array.isArray(schema) &&
|
|
219
|
+
Object.keys(schemaObject).length === 2 &&
|
|
220
|
+
schemaObject.type === 'string' &&
|
|
221
|
+
Array.isArray(schemaObject.enum) &&
|
|
222
|
+
schemaObject.enum.length === states.length &&
|
|
223
|
+
schemaObject.enum.every((state, index) => state === states[index]);
|
|
224
|
+
if (!value.required || value.auto !== undefined || !schemaMatches) {
|
|
225
|
+
invalid('Property state contract', 'COMPILED_SOURCE_INVALID', `${path}/state`);
|
|
226
|
+
}
|
|
227
|
+
state = topology;
|
|
228
|
+
}
|
|
229
|
+
if (value.ordering !== classifyValueProgramOrdering(values[valueIndex])) {
|
|
230
|
+
invalid('Property ordering', 'COMPILED_CANONICAL_MISMATCH', `${path}/ordering`);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
...value,
|
|
234
|
+
...(state === undefined ? {} : { state }),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function compiledCallable(input, values, method, path) {
|
|
238
|
+
const value = object(input, 'Compiled Callable', path);
|
|
239
|
+
exact(value, method
|
|
240
|
+
? ['name', 'auth', 'static', 'inheritance', 'input', 'output']
|
|
241
|
+
: ['ref', 'auth', 'input', 'output'], 'Compiled Callable', path, ['policy', 'description', 'fields']);
|
|
242
|
+
if (method) {
|
|
243
|
+
memberName(value.name, 'Method name', `${path}/name`);
|
|
244
|
+
boolean(value.static, 'Method static', `${path}/static`);
|
|
245
|
+
if (value.inheritance !== 'abstract' &&
|
|
246
|
+
value.inheritance !== 'default' &&
|
|
247
|
+
value.inheritance !== 'sealed') {
|
|
248
|
+
invalid('Method inheritance', undefined, `${path}/inheritance`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (value.auth !== 'anonymous' && value.auth !== 'authenticated' && value.auth !== 'authorized') {
|
|
252
|
+
invalid('Callable auth', undefined, `${path}/auth`);
|
|
253
|
+
}
|
|
254
|
+
description(value.description, 'Callable description', `${path}/description`);
|
|
255
|
+
if (value.policy !== undefined) {
|
|
256
|
+
if (value.auth !== 'authorized' || (method && value.inheritance === 'abstract')) {
|
|
257
|
+
invalid('Callable Policy placement', undefined, `${path}/policy`);
|
|
258
|
+
}
|
|
259
|
+
policyCheck(value.policy, 0, `${path}/policy`);
|
|
260
|
+
}
|
|
261
|
+
const inputIndex = index(value.input, values.length, 'Callable input', `${path}/input`);
|
|
262
|
+
if (value.fields !== undefined) {
|
|
263
|
+
const fieldsPath = `${path}/fields`;
|
|
264
|
+
for (const [field, nodes] of Object.entries(object(value.fields, 'Callable fields', fieldsPath))) {
|
|
265
|
+
const fieldPath = pointer(fieldsPath, field);
|
|
266
|
+
const fieldNodes = array(nodes, 'Callable field nodes', fieldPath);
|
|
267
|
+
if (fieldNodes.length === 0)
|
|
268
|
+
invalid('Callable field nodes', undefined, fieldPath);
|
|
269
|
+
for (const [indexValue, node] of fieldNodes.entries()) {
|
|
270
|
+
index(node, values[inputIndex].nodes.length, 'Callable field', `${fieldPath}/${indexValue}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const outputPath = `${path}/output`;
|
|
275
|
+
const output = object(value.output, 'Callable output', outputPath);
|
|
276
|
+
if (output.mode === 'binary')
|
|
277
|
+
exact(output, ['mode'], 'binary output', outputPath);
|
|
278
|
+
else {
|
|
279
|
+
if (output.mode !== 'value' && output.mode !== 'stream')
|
|
280
|
+
invalid('Callable output mode', undefined, `${outputPath}/mode`);
|
|
281
|
+
exact(output, ['mode', 'value'], 'Callable output', outputPath);
|
|
282
|
+
index(output.value, values.length, 'Callable output value', `${outputPath}/value`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function compiledPolicy(input, path) {
|
|
286
|
+
const value = object(input, 'Policy', path);
|
|
287
|
+
exact(value, ['ref', 'expression'], 'Policy', path, ['description']);
|
|
288
|
+
definitionRef(value.ref, 'policy', 'Policy ref', `${path}/ref`);
|
|
289
|
+
description(value.description, 'Policy description', `${path}/description`);
|
|
290
|
+
policyExpression(value.expression, 0, `${path}/expression`);
|
|
291
|
+
return value;
|
|
292
|
+
}
|
|
293
|
+
function compiledView(input, path) {
|
|
294
|
+
const value = object(input, 'View', path);
|
|
295
|
+
exact(value, ['ref', 'target'], 'View', path, ['description']);
|
|
296
|
+
definitionRef(value.ref, 'view', 'View ref', `${path}/ref`);
|
|
297
|
+
description(value.description, 'View description', `${path}/description`);
|
|
298
|
+
const targetPath = `${path}/target`;
|
|
299
|
+
const target = object(value.target, 'View target', targetPath);
|
|
300
|
+
if (target.kind === 'domain') {
|
|
301
|
+
exact(target, ['kind'], 'Domain View target', targetPath);
|
|
302
|
+
}
|
|
303
|
+
else if (target.kind === 'definition') {
|
|
304
|
+
exact(target, ['kind', 'definitions'], 'Definition View target', targetPath);
|
|
305
|
+
const definitionsPath = `${targetPath}/definitions`;
|
|
306
|
+
const definitions = array(target.definitions, 'View target definitions', definitionsPath).map((item, index) => definitionRef(item, 'class', 'View target Class', `${definitionsPath}/${index}`));
|
|
307
|
+
if (definitions.length === 0)
|
|
308
|
+
invalid('View target definitions', undefined, definitionsPath);
|
|
309
|
+
unique(definitions.map(Key.of), 'View target definitions', definitionsPath);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
invalid('View target', undefined, targetPath);
|
|
313
|
+
}
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
function compiledCoreDefinition(input, path) {
|
|
317
|
+
const value = object(input, 'Core Definition', path);
|
|
318
|
+
exact(value, ['ref', 'class', 'properties'], 'Core Definition', path);
|
|
319
|
+
definitionRef(value.ref, 'core', 'Core ref', `${path}/ref`);
|
|
320
|
+
definitionRef(value.class, 'class', 'Core Class', `${path}/class`);
|
|
321
|
+
propertyValues(value.properties, 'Core Properties', `${path}/properties`);
|
|
322
|
+
return value;
|
|
323
|
+
}
|
|
324
|
+
function compiledCoreEdge(input, path) {
|
|
325
|
+
const value = object(input, 'Core Edge', path);
|
|
326
|
+
exact(value, ['class', 'source', 'target', 'properties'], 'Core Edge', path);
|
|
327
|
+
definitionRef(value.class, 'class', 'Core Edge Class', `${path}/class`);
|
|
328
|
+
coreEndpoint(value.source, 'Core Edge source', `${path}/source`);
|
|
329
|
+
coreEndpoint(value.target, 'Core Edge target', `${path}/target`);
|
|
330
|
+
propertyValues(value.properties, 'Core Edge Properties', `${path}/properties`);
|
|
331
|
+
return value;
|
|
332
|
+
}
|
|
333
|
+
function propertyAuto(input, path) {
|
|
334
|
+
const value = object(input, 'Property auto', path);
|
|
335
|
+
exact(value, ['on', 'set'], 'Property auto', path);
|
|
336
|
+
const eventsPath = `${path}/on`;
|
|
337
|
+
const events = array(value.on, 'Property auto events', eventsPath);
|
|
338
|
+
if (events.length === 0 || events.some((event) => event !== 'create' && event !== 'update')) {
|
|
339
|
+
invalid('Property auto events', undefined, eventsPath);
|
|
340
|
+
}
|
|
341
|
+
unique(events.map(String), 'Property auto events', eventsPath);
|
|
342
|
+
if (value.set !== 'instant')
|
|
343
|
+
invalid('Property auto setter', undefined, `${path}/set`);
|
|
344
|
+
}
|
|
345
|
+
function classPolicies(input, path) {
|
|
346
|
+
const value = object(input, 'Class Policies', path);
|
|
347
|
+
exact(value, [], 'Class Policies', path, ['read', 'traverse']);
|
|
348
|
+
if (value.read !== undefined)
|
|
349
|
+
definitionRef(value.read, 'policy', 'Class read Policy', `${path}/read`);
|
|
350
|
+
if (value.traverse !== undefined)
|
|
351
|
+
definitionRef(value.traverse, 'policy', 'Class traverse Policy', `${path}/traverse`);
|
|
352
|
+
}
|
|
353
|
+
function edgeContract(value, path) {
|
|
354
|
+
const constraintsPath = `${path}/constraints`;
|
|
355
|
+
const constraints = object(value.constraints, 'Edge constraints', constraintsPath);
|
|
356
|
+
exact(constraints, [], 'Edge constraints', constraintsPath, ['noSelf', 'acyclic']);
|
|
357
|
+
if (constraints.noSelf !== undefined && constraints.noSelf !== true)
|
|
358
|
+
invalid('Edge noSelf constraint', undefined, `${constraintsPath}/noSelf`);
|
|
359
|
+
if (constraints.acyclic !== undefined && constraints.acyclic !== true)
|
|
360
|
+
invalid('Edge acyclic constraint', undefined, `${constraintsPath}/acyclic`);
|
|
361
|
+
if (value.orientation === 'directed') {
|
|
362
|
+
const endpointsPath = `${path}/endpoints`;
|
|
363
|
+
const endpoints = object(value.endpoints, 'directed Edge endpoints', endpointsPath);
|
|
364
|
+
exact(endpoints, ['source', 'target'], 'directed Edge endpoints', endpointsPath);
|
|
365
|
+
edgeEndpoint(endpoints.source, 'outgoing', 'directed Edge source', `${endpointsPath}/source`);
|
|
366
|
+
edgeEndpoint(endpoints.target, 'incoming', 'directed Edge target', `${endpointsPath}/target`);
|
|
367
|
+
if (object(endpoints.source, 'directed Edge source', `${endpointsPath}/source`).role ===
|
|
368
|
+
object(endpoints.target, 'directed Edge target', `${endpointsPath}/target`).role) {
|
|
369
|
+
invalid('Edge endpoint roles', undefined, endpointsPath);
|
|
370
|
+
}
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (value.orientation !== 'undirected' || constraints.acyclic !== undefined) {
|
|
374
|
+
invalid('Edge orientation', undefined, `${path}/orientation`);
|
|
375
|
+
}
|
|
376
|
+
const endpointsPath = `${path}/endpoints`;
|
|
377
|
+
const endpoints = array(value.endpoints, 'undirected Edge endpoints', endpointsPath);
|
|
378
|
+
if (endpoints.length !== 2)
|
|
379
|
+
invalid('undirected Edge endpoints', undefined, endpointsPath);
|
|
380
|
+
edgeEndpoint(endpoints[0], 'incident', 'undirected first endpoint', `${endpointsPath}/0`);
|
|
381
|
+
edgeEndpoint(endpoints[1], 'incident', 'undirected second endpoint', `${endpointsPath}/1`);
|
|
382
|
+
if (object(endpoints[0], 'undirected first endpoint', `${endpointsPath}/0`).role ===
|
|
383
|
+
object(endpoints[1], 'undirected second endpoint', `${endpointsPath}/1`).role) {
|
|
384
|
+
invalid('Edge endpoint roles', undefined, endpointsPath);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function edgeEndpoint(input, count, label, path) {
|
|
388
|
+
const value = object(input, label, path);
|
|
389
|
+
exact(value, ['role', 'accepts', count], label, path);
|
|
390
|
+
memberName(value.role, `${label} role`, `${path}/role`);
|
|
391
|
+
const acceptsPath = `${path}/accepts`;
|
|
392
|
+
const accepts = array(value.accepts, `${label} accepts`, acceptsPath).map((item, index) => definitionRef(item, 'class', `${label} accepted Class`, `${acceptsPath}/${index}`));
|
|
393
|
+
if (accepts.length === 0)
|
|
394
|
+
invalid(`${label} accepts`, undefined, acceptsPath);
|
|
395
|
+
unique(accepts.map(Key.of), `${label} accepts`, acceptsPath);
|
|
396
|
+
if (value[count] !== '0..*' &&
|
|
397
|
+
value[count] !== '1..*' &&
|
|
398
|
+
value[count] !== '0..1' &&
|
|
399
|
+
value[count] !== '1') {
|
|
400
|
+
invalid(`${label} ${count}`, undefined, `${path}/${count}`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function policyExpression(input, depth, path) {
|
|
404
|
+
if (depth > 64)
|
|
405
|
+
invalid('Policy expression depth', undefined, path);
|
|
406
|
+
const value = object(input, 'Policy expression', path);
|
|
407
|
+
if (Object.hasOwn(value, 'match')) {
|
|
408
|
+
exact(value, ['match'], 'Policy expression', path);
|
|
409
|
+
policyPattern(value.match, depth + 1, `${path}/match`);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const member = Object.hasOwn(value, 'allOf') ? 'allOf' : 'anyOf';
|
|
413
|
+
exact(value, [member], 'Policy expression', path);
|
|
414
|
+
const memberPath = pointer(path, member);
|
|
415
|
+
const refs = array(value[member], `Policy ${member}`, memberPath).map((item, index) => definitionRef(item, 'policy', `Policy ${member} ref`, `${memberPath}/${index}`));
|
|
416
|
+
if (refs.length === 0)
|
|
417
|
+
invalid(`Policy ${member}`, undefined, memberPath);
|
|
418
|
+
unique(refs.map(Key.of), `Policy ${member}`, memberPath);
|
|
419
|
+
}
|
|
420
|
+
function policyPattern(input, depth, path) {
|
|
421
|
+
if (depth > 64)
|
|
422
|
+
invalid('Policy pattern depth', undefined, path);
|
|
423
|
+
const value = object(input, 'Policy pattern', path);
|
|
424
|
+
if (Object.hasOwn(value, 'sameNode')) {
|
|
425
|
+
exact(value, ['sameNode'], 'Policy equality', path);
|
|
426
|
+
const pair = object(value.sameNode, 'Policy equality', `${path}/sameNode`);
|
|
427
|
+
exact(pair, ['left', 'right'], 'Policy equality operands', `${path}/sameNode`);
|
|
428
|
+
policyTerm(pair.left, false, `${path}/sameNode/left`);
|
|
429
|
+
policyTerm(pair.right, false, `${path}/sameNode/right`);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (Object.hasOwn(value, 'exists')) {
|
|
433
|
+
exact(value, ['exists'], 'Policy exists', path);
|
|
434
|
+
const existsPath = `${path}/exists`;
|
|
435
|
+
const exists = object(value.exists, 'Policy exists', existsPath);
|
|
436
|
+
exact(exists, ['nodes', 'where'], 'Policy exists', existsPath);
|
|
437
|
+
const nodesPath = `${existsPath}/nodes`;
|
|
438
|
+
const nodes = array(exists.nodes, 'Policy variables', nodesPath);
|
|
439
|
+
if (nodes.length < 1 || nodes.length > 4)
|
|
440
|
+
invalid('Policy variables', undefined, nodesPath);
|
|
441
|
+
for (const [index, node] of nodes.entries()) {
|
|
442
|
+
const variablePath = `${nodesPath}/${index}`;
|
|
443
|
+
const variable = object(node, 'Policy variable', variablePath);
|
|
444
|
+
policyTerm(variable.variable, true, `${variablePath}/variable`);
|
|
445
|
+
if (Object.hasOwn(variable, 'class')) {
|
|
446
|
+
exact(variable, ['variable', 'class'], 'Policy variable', variablePath);
|
|
447
|
+
definitionRef(variable.class, 'class', 'Policy variable Class', `${variablePath}/class`);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
exact(variable, ['variable', 'selector'], 'Policy variable', variablePath);
|
|
451
|
+
const selectorPath = `${variablePath}/selector`;
|
|
452
|
+
const selector = object(variable.selector, 'Policy variable selector', selectorPath);
|
|
453
|
+
if (selector.kind === 'any') {
|
|
454
|
+
exact(selector, ['kind'], 'Policy variable selector', selectorPath);
|
|
455
|
+
}
|
|
456
|
+
else if (selector.kind === 'satisfies') {
|
|
457
|
+
exact(selector, ['kind', 'class'], 'Policy variable selector', selectorPath);
|
|
458
|
+
definitionRef(selector.class, 'class', 'Policy variable selector Class', `${selectorPath}/class`);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
invalid('Policy variable selector kind', undefined, `${selectorPath}/kind`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
policyPattern(exists.where, depth + 1, `${existsPath}/where`);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (Object.hasOwn(value, 'allOf') || Object.hasOwn(value, 'anyOf')) {
|
|
469
|
+
const member = Object.hasOwn(value, 'allOf') ? 'allOf' : 'anyOf';
|
|
470
|
+
exact(value, [member], 'Policy pattern composition', path);
|
|
471
|
+
const memberPath = pointer(path, member);
|
|
472
|
+
const expressions = array(value[member], `Policy pattern ${member}`, memberPath);
|
|
473
|
+
if (expressions.length === 0)
|
|
474
|
+
invalid(`Policy pattern ${member}`, undefined, memberPath);
|
|
475
|
+
for (const [index, expression] of expressions.entries())
|
|
476
|
+
policyPattern(expression, depth + 1, `${memberPath}/${index}`);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
exact(value, ['source', 'class', 'target'], 'Policy Edge pattern', path, ['repeat']);
|
|
480
|
+
policyTerm(value.source, false, `${path}/source`);
|
|
481
|
+
definitionRef(value.class, 'class', 'Policy Edge Class', `${path}/class`);
|
|
482
|
+
policyTerm(value.target, false, `${path}/target`);
|
|
483
|
+
if (value.repeat !== undefined) {
|
|
484
|
+
const repeatPath = `${path}/repeat`;
|
|
485
|
+
const repeat = object(value.repeat, 'Policy repeat', repeatPath);
|
|
486
|
+
exact(repeat, ['min', 'max'], 'Policy repeat', repeatPath);
|
|
487
|
+
const minimum = boundedInteger(repeat.min, 0, 3, 'Policy repeat minimum', `${repeatPath}/min`);
|
|
488
|
+
const maximum = boundedInteger(repeat.max, 0, 3, 'Policy repeat maximum', `${repeatPath}/max`);
|
|
489
|
+
if (minimum > maximum)
|
|
490
|
+
invalid('Policy repeat order', undefined, repeatPath);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function policyTerm(input, variableOnly, path) {
|
|
494
|
+
const value = object(input, 'Policy pattern term', path);
|
|
495
|
+
if (!variableOnly && value.kind === 'ref') {
|
|
496
|
+
exact(value, ['kind', 'ref'], 'Policy reference term', path);
|
|
497
|
+
definitionRef(value.ref, undefined, 'Policy reference term', `${path}/ref`);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (value.kind === 'variable') {
|
|
501
|
+
exact(value, ['kind', 'id'], 'Policy variable term', path);
|
|
502
|
+
integer(value.id, 'Policy variable id', `${path}/id`);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (variableOnly ||
|
|
506
|
+
(value.kind !== 'subject' &&
|
|
507
|
+
value.kind !== 'object' &&
|
|
508
|
+
value.kind !== 'source' &&
|
|
509
|
+
value.kind !== 'target')) {
|
|
510
|
+
invalid('Policy pattern term', undefined, `${path}/kind`);
|
|
511
|
+
}
|
|
512
|
+
exact(value, ['kind'], 'Policy pattern term', path);
|
|
513
|
+
}
|
|
514
|
+
function policyCheck(input, depth, path) {
|
|
515
|
+
if (depth > 64)
|
|
516
|
+
invalid('Callable Policy depth', undefined, path);
|
|
517
|
+
const value = object(input, 'Callable Policy', path);
|
|
518
|
+
if (Object.hasOwn(value, 'sameNode')) {
|
|
519
|
+
exact(value, ['sameNode'], 'Callable equality', path);
|
|
520
|
+
const pair = object(value.sameNode, 'Callable equality', `${path}/sameNode`);
|
|
521
|
+
exact(pair, ['left', 'right'], 'Callable equality operands', `${path}/sameNode`);
|
|
522
|
+
policyCheckObject(pair.left, `${path}/sameNode/left`);
|
|
523
|
+
policyCheckObject(pair.right, `${path}/sameNode/right`);
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
if (Object.hasOwn(value, 'check')) {
|
|
527
|
+
exact(value, ['check', 'object'], 'Callable Policy check', path);
|
|
528
|
+
definitionRef(value.check, 'policy', 'Callable Policy ref', `${path}/check`);
|
|
529
|
+
policyCheckObject(value.object, `${path}/object`);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
const member = Object.hasOwn(value, 'allOf') ? 'allOf' : 'anyOf';
|
|
533
|
+
exact(value, [member], 'Callable Policy composition', path);
|
|
534
|
+
const memberPath = pointer(path, member);
|
|
535
|
+
const expressions = array(value[member], `Callable Policy ${member}`, memberPath);
|
|
536
|
+
if (expressions.length === 0)
|
|
537
|
+
invalid(`Callable Policy ${member}`, undefined, memberPath);
|
|
538
|
+
for (const [index, expression] of expressions.entries())
|
|
539
|
+
policyCheck(expression, depth + 1, `${memberPath}/${index}`);
|
|
540
|
+
}
|
|
541
|
+
function policyCheckObject(input, objectPath) {
|
|
542
|
+
const target = object(input, 'Callable Policy object', objectPath);
|
|
543
|
+
if (target.kind === 'self')
|
|
544
|
+
exact(target, ['kind'], 'Callable Policy self', objectPath);
|
|
545
|
+
else if (target.kind === 'input') {
|
|
546
|
+
exact(target, ['kind', 'field'], 'Callable Policy input', objectPath);
|
|
547
|
+
memberName(target.field, 'Callable Policy input field', `${objectPath}/field`);
|
|
548
|
+
}
|
|
549
|
+
else if (target.kind === 'ref') {
|
|
550
|
+
exact(target, ['kind', 'ref'], 'Callable Policy object ref', objectPath);
|
|
551
|
+
definitionRef(target.ref, undefined, 'Callable Policy object ref', `${objectPath}/ref`);
|
|
552
|
+
}
|
|
553
|
+
else
|
|
554
|
+
invalid('Callable Policy object', undefined, `${objectPath}/kind`);
|
|
555
|
+
}
|
|
556
|
+
function coreEndpoint(input, label, path) {
|
|
557
|
+
const value = object(input, label, path);
|
|
558
|
+
if (value.kind === 'domain')
|
|
559
|
+
exact(value, ['kind'], label, path);
|
|
560
|
+
else
|
|
561
|
+
definitionRef(value, 'core', label, path);
|
|
562
|
+
}
|
|
563
|
+
function definitionRef(input, kind, label, path) {
|
|
564
|
+
if (!isDefinitionRef(input) || (kind !== undefined && input.kind !== kind))
|
|
565
|
+
invalid(label, undefined, path);
|
|
566
|
+
return input;
|
|
567
|
+
}
|
|
568
|
+
function propertyValues(input, label, path) {
|
|
569
|
+
try {
|
|
570
|
+
PropertyValues.accept(input, path);
|
|
571
|
+
}
|
|
572
|
+
catch {
|
|
573
|
+
invalid(label, undefined, path);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function dataDefinition(input, path) {
|
|
577
|
+
const value = object(input, 'Class data', path);
|
|
578
|
+
exact(value, ['mediaType'], 'Class data', path);
|
|
579
|
+
if (typeof value.mediaType !== 'string' || !MEDIA_TYPE_PATTERN.test(value.mediaType))
|
|
580
|
+
invalid('Class data mediaType', undefined, `${path}/mediaType`);
|
|
581
|
+
}
|
|
582
|
+
function validateClosure(candidate) {
|
|
583
|
+
validateDependencyCycles(candidate);
|
|
584
|
+
const definitions = new Map();
|
|
585
|
+
for (const [entryIndex, entry] of candidate.closure.entries()) {
|
|
586
|
+
const collections = [
|
|
587
|
+
['classes', entry.definitions.classes],
|
|
588
|
+
['functions', entry.definitions.functions],
|
|
589
|
+
['policies', entry.definitions.policies],
|
|
590
|
+
['views', entry.definitions.views],
|
|
591
|
+
['core', entry.definitions.core],
|
|
592
|
+
];
|
|
593
|
+
for (const [collection, values] of collections) {
|
|
594
|
+
for (const [definitionIndex, definition] of values.entries()) {
|
|
595
|
+
const path = `/closure/${entryIndex}/definitions/${collection}/${definitionIndex}`;
|
|
596
|
+
const key = Key.of(definition.ref);
|
|
597
|
+
if (definitions.has(key))
|
|
598
|
+
invalid('duplicate Definition', undefined, `${path}/ref`);
|
|
599
|
+
definitions.set(key, { value: definition, path });
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const requireDefinition = (ref, label, path) => {
|
|
604
|
+
const result = definitions.get(Key.of(ref));
|
|
605
|
+
if (result === undefined)
|
|
606
|
+
invalid(label, 'COMPILED_SOURCE_INVALID', path);
|
|
607
|
+
return result.value;
|
|
608
|
+
};
|
|
609
|
+
for (const [entryIndex, entry] of candidate.closure.entries()) {
|
|
610
|
+
const visibleOrigins = new Set([
|
|
611
|
+
entry.origin,
|
|
612
|
+
...Object.values(entry.dependencies).map(({ origin }) => origin),
|
|
613
|
+
]);
|
|
614
|
+
const collections = [
|
|
615
|
+
['definitions/classes', entry.definitions.classes],
|
|
616
|
+
['definitions/functions', entry.definitions.functions],
|
|
617
|
+
['definitions/policies', entry.definitions.policies],
|
|
618
|
+
['definitions/views', entry.definitions.views],
|
|
619
|
+
['definitions/core', entry.definitions.core],
|
|
620
|
+
['facts/core', entry.facts.core],
|
|
621
|
+
];
|
|
622
|
+
for (const [collection, values] of collections) {
|
|
623
|
+
for (const [definitionIndex, definition] of values.entries()) {
|
|
624
|
+
walk(definition, `/closure/${entryIndex}/${collection}/${definitionIndex}`, (ref, path) => {
|
|
625
|
+
const resolved = requireDefinition(ref, 'unresolved Definition ref', path);
|
|
626
|
+
if (!visibleOrigins.has(ref.origin))
|
|
627
|
+
invalid('non-direct dependency ref', 'COMPILED_SOURCE_INVALID', path);
|
|
628
|
+
if (resolved.ref === undefined)
|
|
629
|
+
invalid('resolved Definition', 'COMPILED_SOURCE_INVALID', path);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const classes = new Map();
|
|
635
|
+
for (const [entryIndex, entry] of candidate.closure.entries())
|
|
636
|
+
for (const [classIndex, definition] of entry.definitions.classes.entries())
|
|
637
|
+
classes.set(Key.of(definition.ref), {
|
|
638
|
+
value: definition,
|
|
639
|
+
path: `/closure/${entryIndex}/definitions/classes/${classIndex}`,
|
|
640
|
+
});
|
|
641
|
+
const visiting = new Set();
|
|
642
|
+
const visited = new Set();
|
|
643
|
+
const visitClass = (key) => {
|
|
644
|
+
if (visited.has(key))
|
|
645
|
+
return;
|
|
646
|
+
if (visiting.has(key))
|
|
647
|
+
invalid('Class inheritance cycle', 'COMPILED_SOURCE_INVALID', `${classes.get(key)?.path ?? ''}/extends`);
|
|
648
|
+
const definition = classes.get(key);
|
|
649
|
+
if (definition === undefined)
|
|
650
|
+
invalid('Class inheritance ref', 'COMPILED_SOURCE_INVALID', '/closure');
|
|
651
|
+
visiting.add(key);
|
|
652
|
+
for (const [parentIndex, parentRef] of definition.value.extends.entries()) {
|
|
653
|
+
const parent = classes.get(Key.of(parentRef));
|
|
654
|
+
if (parent === undefined || parent.value.kind !== definition.value.kind) {
|
|
655
|
+
invalid('Class inheritance kind', 'COMPILED_SOURCE_INVALID', `${definition.path}/extends/${parentIndex}`);
|
|
656
|
+
}
|
|
657
|
+
visitClass(Key.of(parentRef));
|
|
658
|
+
}
|
|
659
|
+
visiting.delete(key);
|
|
660
|
+
visited.add(key);
|
|
661
|
+
};
|
|
662
|
+
for (const key of classes.keys())
|
|
663
|
+
visitClass(key);
|
|
664
|
+
for (const definition of classes.values()) {
|
|
665
|
+
if (definition.value.kind !== 'edge')
|
|
666
|
+
continue;
|
|
667
|
+
const endpoints = definition.value.orientation === 'directed'
|
|
668
|
+
? [
|
|
669
|
+
definition.value.endpoints.source,
|
|
670
|
+
definition.value.endpoints.target,
|
|
671
|
+
]
|
|
672
|
+
: definition.value.endpoints;
|
|
673
|
+
for (const [endpointIndex, endpoint] of endpoints.entries()) {
|
|
674
|
+
const endpointPath = definition.value.orientation === 'directed'
|
|
675
|
+
? `${definition.path}/endpoints/${endpointIndex === 0 ? 'source' : 'target'}`
|
|
676
|
+
: `${definition.path}/endpoints/${endpointIndex}`;
|
|
677
|
+
for (const [acceptedIndex, accepted] of endpoint.accepts.entries()) {
|
|
678
|
+
if (classes.get(Key.of(accepted))?.value.kind !== 'node') {
|
|
679
|
+
invalid('Edge endpoint Class', 'COMPILED_SOURCE_INVALID', `${endpointPath}/accepts/${acceptedIndex}`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
for (const [entryIndex, entry] of candidate.closure.entries()) {
|
|
685
|
+
for (const [definitionIndex, definition] of entry.definitions.core.entries()) {
|
|
686
|
+
const owner = classes.get(Key.of(definition.class));
|
|
687
|
+
if (owner?.value.kind !== 'node' || owner.value.abstract) {
|
|
688
|
+
invalid('Core exact Class', 'COMPILED_SOURCE_INVALID', `/closure/${entryIndex}/definitions/core/${definitionIndex}/class`);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
for (const [edgeIndex, edge] of entry.facts.core.entries()) {
|
|
692
|
+
const owner = classes.get(Key.of(edge.class));
|
|
693
|
+
if (owner?.value.kind !== 'edge' || owner.value.abstract) {
|
|
694
|
+
invalid('Core Edge exact Class', 'COMPILED_SOURCE_INVALID', `/closure/${entryIndex}/facts/core/${edgeIndex}/class`);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function validateDependencyCycles(candidate) {
|
|
700
|
+
const byOrigin = new Map(candidate.closure.map((entry, index) => [entry.origin, { entry, index }]));
|
|
701
|
+
const active = new Set();
|
|
702
|
+
const visited = new Set();
|
|
703
|
+
const frames = [];
|
|
704
|
+
const push = (origin, depth) => {
|
|
705
|
+
if (depth > dependencyLimits.depth) {
|
|
706
|
+
invalid('dependency depth limit', 'COMPILED_DEPENDENCY_LIMITS', `/closure/${byOrigin.get(origin)?.index ?? 0}/dependencies`);
|
|
707
|
+
}
|
|
708
|
+
active.add(origin);
|
|
709
|
+
frames.push({
|
|
710
|
+
origin,
|
|
711
|
+
depth,
|
|
712
|
+
dependencies: Object.values(byOrigin.get(origin)?.entry.dependencies ?? {}),
|
|
713
|
+
index: 0,
|
|
714
|
+
});
|
|
715
|
+
};
|
|
716
|
+
push(candidate.root.origin, 0);
|
|
717
|
+
while (frames.length > 0) {
|
|
718
|
+
const frame = frames.at(-1);
|
|
719
|
+
const dependency = frame.dependencies[frame.index++];
|
|
720
|
+
if (dependency === undefined) {
|
|
721
|
+
frames.pop();
|
|
722
|
+
active.delete(frame.origin);
|
|
723
|
+
visited.add(frame.origin);
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
if (active.has(dependency.origin)) {
|
|
727
|
+
invalid('dependency cycle', 'COMPILED_DEPENDENCY_CYCLE', `/closure/${byOrigin.get(dependency.origin)?.index ?? 0}/dependencies`);
|
|
728
|
+
}
|
|
729
|
+
if (!visited.has(dependency.origin))
|
|
730
|
+
push(dependency.origin, frame.depth + 1);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function walk(input, path, visit) {
|
|
734
|
+
if (isDefinitionRef(input)) {
|
|
735
|
+
visit(input, path);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
if (input === null || typeof input !== 'object')
|
|
739
|
+
return;
|
|
740
|
+
if (Array.isArray(input)) {
|
|
741
|
+
for (const [index, value] of input.entries())
|
|
742
|
+
walk(value, `${path}/${index}`, visit);
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
for (const [key, value] of Object.entries(input))
|
|
746
|
+
walk(value, pointer(path, key), visit);
|
|
747
|
+
}
|
|
748
|
+
function program(input, programIndex, path) {
|
|
749
|
+
const value = object(input, `values[${programIndex}]`, path);
|
|
750
|
+
exact(value, ['root', 'nodes', 'patterns'], 'ValueProgram', path);
|
|
751
|
+
const nodesPath = `${path}/nodes`;
|
|
752
|
+
const nodes = array(value.nodes, 'ValueProgram nodes', nodesPath).map((node, index) => valueNode(node, index, `${nodesPath}/${index}`));
|
|
753
|
+
const root = index(value.root, nodes.length, 'ValueProgram root', `${path}/root`);
|
|
754
|
+
const patternsPath = `${path}/patterns`;
|
|
755
|
+
const patterns = array(value.patterns, 'ValueProgram patterns', patternsPath).map((item, index) => pattern(item, index, `${patternsPath}/${index}`));
|
|
756
|
+
unique(patterns.map(({ source }) => source), 'patterns', patternsPath);
|
|
757
|
+
for (const [nodeIndex, node] of nodes.entries()) {
|
|
758
|
+
for (const [name, child] of Object.entries(node.children))
|
|
759
|
+
index(child, nodes.length, 'ValueNode child', pointer(`${nodesPath}/${nodeIndex}/children`, name));
|
|
760
|
+
if (node.reference !== undefined)
|
|
761
|
+
index(node.reference, nodes.length, 'ValueNode reference', `${nodesPath}/${nodeIndex}/reference`);
|
|
762
|
+
}
|
|
763
|
+
return { root, nodes, patterns };
|
|
764
|
+
}
|
|
765
|
+
function valueNode(input, nodeIndex, path) {
|
|
766
|
+
const value = object(input, `nodes[${nodeIndex}]`, path);
|
|
767
|
+
exact(value, ['schema', 'children'], 'ValueNode', path, ['reference']);
|
|
768
|
+
const children = {};
|
|
769
|
+
const childrenPath = `${path}/children`;
|
|
770
|
+
for (const [name, child] of Object.entries(object(value.children, 'ValueNode children', childrenPath))) {
|
|
771
|
+
children[name] = integer(child, 'ValueNode child', pointer(childrenPath, name));
|
|
772
|
+
}
|
|
773
|
+
return {
|
|
774
|
+
schema: value.schema,
|
|
775
|
+
children,
|
|
776
|
+
...(value.reference === undefined
|
|
777
|
+
? {}
|
|
778
|
+
: { reference: integer(value.reference, 'reference', `${path}/reference`) }),
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function pattern(input, patternIndex, path) {
|
|
782
|
+
const value = object(input, `patterns[${patternIndex}]`, path);
|
|
783
|
+
exact(value, ['source', 'start', 'states'], 'Pattern', path);
|
|
784
|
+
if (typeof value.source !== 'string')
|
|
785
|
+
invalid('Pattern source', undefined, `${path}/source`);
|
|
786
|
+
const statesPath = `${path}/states`;
|
|
787
|
+
const states = array(value.states, 'Pattern states', statesPath).map((item, stateIndex) => {
|
|
788
|
+
const statePath = `${statesPath}/${stateIndex}`;
|
|
789
|
+
const state = object(item, 'Pattern state', statePath);
|
|
790
|
+
exact(state, ['epsilon', 'transitions'], 'Pattern state', statePath, ['accepting']);
|
|
791
|
+
if (state.accepting !== undefined && state.accepting !== true)
|
|
792
|
+
invalid('accepting', undefined, `${statePath}/accepting`);
|
|
793
|
+
const epsilonPath = `${statePath}/epsilon`;
|
|
794
|
+
const transitionsPath = `${statePath}/transitions`;
|
|
795
|
+
return {
|
|
796
|
+
epsilon: array(state.epsilon, 'epsilon', epsilonPath).map((target, index) => integer(target, 'epsilon', `${epsilonPath}/${index}`)),
|
|
797
|
+
transitions: array(state.transitions, 'transitions', transitionsPath).map((transitionValue, transitionIndex) => {
|
|
798
|
+
const transitionPath = `${transitionsPath}/${transitionIndex}`;
|
|
799
|
+
const transition = object(transitionValue, 'transition', transitionPath);
|
|
800
|
+
exact(transition, ['to', 'ranges'], 'transition', transitionPath);
|
|
801
|
+
const rangesPath = `${transitionPath}/ranges`;
|
|
802
|
+
return {
|
|
803
|
+
to: integer(transition.to, 'transition target', `${transitionPath}/to`),
|
|
804
|
+
ranges: array(transition.ranges, 'ranges', rangesPath).map((rangeValue, rangeIndex) => {
|
|
805
|
+
const rangePath = `${rangesPath}/${rangeIndex}`;
|
|
806
|
+
const range = array(rangeValue, 'range', rangePath);
|
|
807
|
+
if (range.length !== 2)
|
|
808
|
+
invalid('range', undefined, rangePath);
|
|
809
|
+
const minimum = scalar(range[0], 'range minimum', `${rangePath}/0`);
|
|
810
|
+
const maximum = scalar(range[1], 'range maximum', `${rangePath}/1`);
|
|
811
|
+
if (minimum > maximum)
|
|
812
|
+
invalid('range order', undefined, rangePath);
|
|
813
|
+
return [minimum, maximum];
|
|
814
|
+
}),
|
|
815
|
+
};
|
|
816
|
+
}),
|
|
817
|
+
...(state.accepting === true ? { accepting: true } : {}),
|
|
818
|
+
};
|
|
819
|
+
});
|
|
820
|
+
const start = index(value.start, states.length, 'Pattern start', `${path}/start`);
|
|
821
|
+
for (const [stateIndex, state] of states.entries()) {
|
|
822
|
+
state.epsilon.forEach((target, indexValue) => index(target, states.length, 'epsilon', `${statesPath}/${stateIndex}/epsilon/${indexValue}`));
|
|
823
|
+
state.transitions.forEach(({ to }, transitionIndex) => index(to, states.length, 'transition', `${statesPath}/${stateIndex}/transitions/${transitionIndex}/to`));
|
|
824
|
+
}
|
|
825
|
+
return { source: value.source, start, states };
|
|
826
|
+
}
|
|
827
|
+
function dependency(input, label, path) {
|
|
828
|
+
const value = object(input, label, path);
|
|
829
|
+
exact(value, ['origin', 'revision'], label, path);
|
|
830
|
+
return {
|
|
831
|
+
origin: originValue(value.origin, label, `${path}/origin`),
|
|
832
|
+
revision: revisionValue(value.revision, label, `${path}/revision`),
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function dependencyMap(input, path) {
|
|
836
|
+
const value = object(input, 'dependencies', path);
|
|
837
|
+
const accepted = Object.create(null);
|
|
838
|
+
for (const [alias, inputDependency] of Object.entries(value).sort(([left], [right]) => compare(left, right))) {
|
|
839
|
+
const aliasPath = pointer(path, alias);
|
|
840
|
+
if (!DEPENDENCY_ALIAS_PATTERN.test(alias) ||
|
|
841
|
+
alias === '__proto__' ||
|
|
842
|
+
alias === 'prototype' ||
|
|
843
|
+
alias === 'constructor') {
|
|
844
|
+
invalid('dependency alias', undefined, aliasPath);
|
|
845
|
+
}
|
|
846
|
+
accepted[alias] = dependency(inputDependency, `dependency ${alias}`, aliasPath);
|
|
847
|
+
}
|
|
848
|
+
return accepted;
|
|
849
|
+
}
|
|
850
|
+
function originValue(input, label, path) {
|
|
851
|
+
if (typeof input !== 'string' || !DOMAIN_ORIGIN_PATTERN.test(input))
|
|
852
|
+
invalid(label, undefined, path);
|
|
853
|
+
return input;
|
|
854
|
+
}
|
|
855
|
+
function revisionValue(input, label, path) {
|
|
856
|
+
if (typeof input !== 'string' || !DOMAIN_REVISION_PATTERN.test(input))
|
|
857
|
+
invalid(label, undefined, path);
|
|
858
|
+
return input;
|
|
859
|
+
}
|
|
860
|
+
function object(input, label, path) {
|
|
861
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
862
|
+
invalid(label, undefined, path);
|
|
863
|
+
return input;
|
|
864
|
+
}
|
|
865
|
+
function array(input, label, path) {
|
|
866
|
+
if (!Array.isArray(input))
|
|
867
|
+
invalid(label, undefined, path);
|
|
868
|
+
return input;
|
|
869
|
+
}
|
|
870
|
+
function exact(value, required, label, path, optional = []) {
|
|
871
|
+
const allowed = new Set([...required, ...optional]);
|
|
872
|
+
const unknown = Object.keys(value)
|
|
873
|
+
.filter((key) => !allowed.has(key))
|
|
874
|
+
.sort(compare)[0];
|
|
875
|
+
if (unknown !== undefined)
|
|
876
|
+
invalid(label, undefined, pointer(path, unknown));
|
|
877
|
+
const missing = required.find((key) => !Object.hasOwn(value, key));
|
|
878
|
+
if (missing !== undefined)
|
|
879
|
+
invalid(label, undefined, pointer(path, missing));
|
|
880
|
+
}
|
|
881
|
+
function integer(input, label, path) {
|
|
882
|
+
if (!Number.isSafeInteger(input) || input < 0)
|
|
883
|
+
invalid(label, undefined, path);
|
|
884
|
+
return input;
|
|
885
|
+
}
|
|
886
|
+
function boundedInteger(input, minimum, maximum, label, path) {
|
|
887
|
+
const value = integer(input, label, path);
|
|
888
|
+
if (value < minimum || value > maximum)
|
|
889
|
+
invalid(label, undefined, path);
|
|
890
|
+
return value;
|
|
891
|
+
}
|
|
892
|
+
function boolean(input, label, path) {
|
|
893
|
+
if (typeof input !== 'boolean')
|
|
894
|
+
invalid(label, undefined, path);
|
|
895
|
+
return input;
|
|
896
|
+
}
|
|
897
|
+
function string(input, label, path) {
|
|
898
|
+
if (typeof input !== 'string')
|
|
899
|
+
invalid(label, undefined, path);
|
|
900
|
+
return input;
|
|
901
|
+
}
|
|
902
|
+
function memberName(input, label, path) {
|
|
903
|
+
const value = string(input, label, path);
|
|
904
|
+
if (!MEMBER_NAME_PATTERN.test(value))
|
|
905
|
+
invalid(label, undefined, path);
|
|
906
|
+
return value;
|
|
907
|
+
}
|
|
908
|
+
function boundedString(input, minimum, maximum, label, path) {
|
|
909
|
+
if (input === undefined)
|
|
910
|
+
return;
|
|
911
|
+
const value = string(input, label, path);
|
|
912
|
+
if (value.length < minimum || value.length > maximum)
|
|
913
|
+
invalid(label, undefined, path);
|
|
914
|
+
}
|
|
915
|
+
function description(input, label, path) {
|
|
916
|
+
boundedString(input, 1, 1000, label, path);
|
|
917
|
+
}
|
|
918
|
+
function unique(values, label, path) {
|
|
919
|
+
const seen = new Set();
|
|
920
|
+
for (const [indexValue, value] of values.entries()) {
|
|
921
|
+
if (seen.has(value))
|
|
922
|
+
invalid(label, undefined, `${path}/${indexValue}`);
|
|
923
|
+
seen.add(value);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function index(input, length, label, path) {
|
|
927
|
+
const value = integer(input, label, path);
|
|
928
|
+
if (value >= length)
|
|
929
|
+
invalid(label, undefined, path);
|
|
930
|
+
return value;
|
|
931
|
+
}
|
|
932
|
+
function scalar(input, label, path) {
|
|
933
|
+
const value = integer(input, label, path);
|
|
934
|
+
if (value > 0x10ffff)
|
|
935
|
+
invalid(label, undefined, path);
|
|
936
|
+
return value;
|
|
937
|
+
}
|
|
938
|
+
function invalid(label, code = 'COMPILED_STRUCTURE_INVALID', path = '') {
|
|
939
|
+
return invalidCompiled(code, `Invalid compiled Schema ${label}.`, path);
|
|
940
|
+
}
|
|
941
|
+
function compare(left, right) {
|
|
942
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
943
|
+
}
|
|
944
|
+
function deepFreeze(input) {
|
|
945
|
+
if (input === null || typeof input !== 'object' || Object.isFrozen(input))
|
|
946
|
+
return input;
|
|
947
|
+
for (const value of Object.values(input))
|
|
948
|
+
deepFreeze(value);
|
|
949
|
+
return Object.freeze(input);
|
|
950
|
+
}
|