@astrale-os/kernel-dsl 1.0.0-beta.3 → 1.0.0-beta.31
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/v1/addressing/class-key.js +3 -3
- package/dist/v1/addressing/definition-ref.js +21 -37
- package/dist/v1/addressing/domain-dependency.d.ts +0 -6
- package/dist/v1/addressing/domain-dependency.js +1 -6
- package/dist/v1/addressing/key.d.ts +4 -1
- package/dist/v1/addressing/key.js +23 -3
- package/dist/v1/addressing/ordering.d.ts +2 -0
- package/dist/v1/addressing/ordering.js +2 -0
- package/dist/v1/addressing/patterns.d.ts +1 -1
- package/dist/v1/addressing/patterns.js +2 -6
- package/dist/v1/builder/callable/authoring.d.ts +11 -5
- package/dist/v1/builder/callable/authoring.js +2 -0
- package/dist/v1/builder/class/authoring.d.ts +94 -224
- package/dist/v1/builder/class/authoring.js +30 -35
- package/dist/v1/builder/class/handle.d.ts +27 -0
- package/dist/v1/builder/class/handle.js +1 -0
- package/dist/v1/builder/class/input.d.ts +159 -0
- package/dist/v1/builder/class/projection.d.ts +129 -0
- package/dist/v1/builder/class/projection.js +1 -0
- package/dist/v1/builder/class/property.d.ts +3 -9
- package/dist/v1/builder/class/property.js +1 -0
- package/dist/v1/builder/core/authoring.d.ts +1 -1
- package/dist/v1/builder/index.d.ts +10 -2
- package/dist/v1/builder/index.js +2 -0
- package/dist/v1/builder/lowering/callable.js +1 -0
- package/dist/v1/builder/lowering/class.d.ts +9 -1
- package/dist/v1/builder/lowering/class.js +62 -17
- package/dist/v1/builder/lowering/policy.js +6 -24
- package/dist/v1/builder/lowering/property-keys.d.ts +27 -0
- package/dist/v1/builder/lowering/property-keys.js +108 -0
- package/dist/v1/builder/lowering/schema/compile.js +13 -6
- package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
- package/dist/v1/builder/lowering/schema/context.js +36 -7
- package/dist/v1/builder/lowering/schema/lifetime.d.ts +11 -0
- package/dist/v1/builder/lowering/schema/lifetime.js +55 -0
- package/dist/v1/builder/lowering/value/compile.js +29 -22
- package/dist/v1/builder/lowering/value/file.d.ts +7 -0
- package/dist/v1/builder/lowering/value/file.js +14 -0
- package/dist/v1/builder/lowering/value/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +41 -7
- package/dist/v1/builder/policy/authoring.d.ts +80 -9
- package/dist/v1/builder/policy/authoring.js +99 -68
- package/dist/v1/builder/policy/legacy/edge.d.ts +28 -0
- package/dist/v1/builder/policy/legacy/edge.js +16 -0
- package/dist/v1/builder/schema/define.d.ts +0 -1
- package/dist/v1/builder/schema/diagnostic.d.ts +3 -2
- package/dist/v1/builder/schema/diagnostic.js +5 -10
- package/dist/v1/builder/schema/input.d.ts +4 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
- package/dist/v1/builder/schema/projection/class.d.ts +78 -16
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/domain.d.ts +13 -2
- package/dist/v1/builder/schema/projection/identity.d.ts +74 -9
- package/dist/v1/builder/schema/projection/model.d.ts +4 -2
- package/dist/v1/builder/schema/projection/property.d.ts +38 -4
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +5 -4
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- package/dist/v1/builder/schema/rule.d.ts +316 -0
- package/dist/v1/builder/schema/rule.js +192 -0
- package/dist/v1/builder/value/file.d.ts +34 -0
- package/dist/v1/builder/value/file.js +77 -0
- package/dist/v1/builder/value/full-match.d.ts +0 -1
- package/dist/v1/builder/value/full-match.js +0 -1
- package/dist/v1/builder/value/path-metadata.d.ts +1 -1
- package/dist/v1/builder/value/path.d.ts +1 -1
- package/dist/v1/bundle/codec.js +55 -74
- package/dist/v1/bundle/diagnostic.d.ts +3 -1
- package/dist/v1/bundle/diagnostic.js +9 -7
- package/dist/v1/bundle/index.d.ts +2 -0
- package/dist/v1/bundle/index.js +1 -0
- package/dist/v1/bundle/model.js +1 -1
- package/dist/v1/bundle/rule.d.ts +14 -0
- package/dist/v1/bundle/rule.js +41 -0
- package/dist/v1/bundle/structure.js +6 -8
- package/dist/v1/compiled/admission/accept.js +9 -15
- package/dist/v1/compiled/admission/closure.js +17 -34
- package/dist/v1/compiled/admission/diagnostic.d.ts +23 -1
- package/dist/v1/compiled/admission/diagnostic.js +40 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +7 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +48 -19
- package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
- package/dist/v1/compiled/admission/semantics/core.js +56 -24
- package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
- package/dist/v1/compiled/admission/semantics/edge.js +6 -65
- package/dist/v1/compiled/admission/semantics/policy/admit.js +4 -19
- package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -5
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
- package/dist/v1/compiled/admission/semantics/policy/parity.js +44 -53
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +7 -21
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
- package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
- package/dist/v1/compiled/admission/wire/callable.d.ts +5 -2
- package/dist/v1/compiled/admission/wire/callable.js +24 -20
- package/dist/v1/compiled/admission/wire/class.js +79 -30
- package/dist/v1/compiled/admission/wire/entry.d.ts +1 -1
- package/dist/v1/compiled/admission/wire/entry.js +36 -13
- package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
- package/dist/v1/compiled/admission/wire/policy.js +27 -20
- package/dist/v1/compiled/admission/wire/program.d.ts +13 -3
- package/dist/v1/compiled/admission/wire/program.js +39 -44
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -1
- package/dist/v1/compiled/admission/wire/property.js +8 -5
- package/dist/v1/compiled/admission/wire/value.d.ts +0 -2
- package/dist/v1/compiled/admission/wire/value.js +0 -7
- package/dist/v1/compiled/codec/json.js +4 -3
- package/dist/v1/compiled/compiler/compile.js +15 -33
- package/dist/v1/compiled/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/index.d.ts +2 -0
- package/dist/v1/compiled/index.js +1 -0
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +13 -52
- package/dist/v1/compiled/model/schema.d.ts +3 -0
- package/dist/v1/compiled/rule.d.ts +49 -0
- package/dist/v1/compiled/rule.js +169 -0
- package/dist/v1/domain/create.js +9 -10
- package/dist/v1/domain/model/domain.d.ts +2 -7
- package/dist/v1/domain/model/input.d.ts +19 -10
- package/dist/v1/domain/namespace/member-collection.js +8 -7
- package/dist/v1/domain/projection/classes.js +11 -8
- package/dist/v1/domain/validation/create.d.ts +7 -16
- package/dist/v1/domain/validation/create.js +35 -81
- package/dist/v1/index.d.ts +5 -3
- package/dist/v1/index.js +1 -1
- package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
- package/dist/v1/language/.spec/schemas/value-schema.schema.json +23 -0
- package/dist/v1/language/callable/admission.d.ts +15 -0
- package/dist/v1/language/callable/admission.js +44 -0
- package/dist/v1/language/callable/model/callable.d.ts +10 -0
- package/dist/v1/language/callable/resolved.d.ts +26 -5
- package/dist/v1/language/chain.d.ts +7 -0
- package/dist/v1/language/chain.js +24 -0
- package/dist/v1/language/class/inheritance.d.ts +36 -5
- package/dist/v1/language/class/inheritance.js +85 -1
- package/dist/v1/language/class/lifetime.d.ts +50 -11
- package/dist/v1/language/class/lifetime.js +89 -20
- package/dist/v1/language/class/model/class.d.ts +45 -9
- package/dist/v1/language/class/model/edge.d.ts +31 -2
- package/dist/v1/language/class/model/property.d.ts +16 -7
- package/dist/v1/language/class/property-values.js +2 -4
- package/dist/v1/language/class/resolved.d.ts +9 -4
- package/dist/v1/language/class/unique.d.ts +143 -0
- package/dist/v1/language/class/unique.js +264 -0
- package/dist/v1/language/core/facts.d.ts +85 -0
- package/dist/v1/language/core/facts.js +116 -0
- package/dist/v1/language/cycle.d.ts +10 -0
- package/dist/v1/language/cycle.js +30 -0
- package/dist/v1/language/definition/metadata.d.ts +38 -0
- package/dist/v1/language/definition/metadata.js +51 -0
- package/dist/v1/language/freeze.d.ts +5 -0
- package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
- package/dist/v1/language/index.d.ts +7 -2
- package/dist/v1/language/index.js +5 -1
- package/dist/v1/language/limits.d.ts +83 -0
- package/dist/v1/language/limits.js +77 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +8 -8
- package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
- package/dist/v1/language/policy/analysis/budgets.js +140 -20
- package/dist/v1/language/policy/analysis/checks.js +8 -6
- package/dist/v1/language/policy/analysis/composition.d.ts +4 -0
- package/dist/v1/language/policy/analysis/composition.js +11 -0
- package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
- package/dist/v1/language/policy/analysis/typing.js +456 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -9
- package/dist/v1/language/policy/model/policy.js +42 -4
- package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
- package/dist/v1/language/policy/normalization/normalize.js +46 -68
- package/dist/v1/language/suspended.d.ts +7 -0
- package/dist/v1/language/suspended.js +23 -0
- package/dist/v1/language/validation/diagnostic.d.ts +15 -1
- package/dist/v1/language/validation/diagnostic.js +21 -0
- package/dist/v1/language/validation/rule.d.ts +45 -0
- package/dist/v1/language/validation/rule.js +109 -0
- package/dist/v1/language/value/compile/fields.js +16 -16
- package/dist/v1/language/value/compile/load.d.ts +5 -0
- package/dist/v1/language/value/compile/load.js +13 -0
- package/dist/v1/language/value/evaluate/assertions.d.ts +5 -1
- package/dist/v1/language/value/evaluate/assertions.js +19 -8
- package/dist/v1/language/value/evaluate/evaluator.js +117 -120
- package/dist/v1/language/value/evaluate/preparation.d.ts +16 -0
- package/dist/v1/language/value/evaluate/preparation.js +100 -47
- package/dist/v1/language/value/evaluate/program.d.ts +2 -1
- package/dist/v1/language/value/evaluate/program.js +6 -6
- package/dist/v1/language/value/evaluate/validate.d.ts +3 -3
- package/dist/v1/language/value/evaluate/validate.js +15 -11
- package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
- package/dist/v1/language/value/evaluate/validity.optimization.js +338 -0
- package/dist/v1/language/value/files.d.ts +44 -0
- package/dist/v1/language/value/files.js +151 -0
- package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
- package/dist/v1/language/value/inclusion/arrays.js +85 -0
- package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
- package/dist/v1/language/value/inclusion/assertions.js +28 -0
- package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
- package/dist/v1/language/value/inclusion/combinators.js +67 -0
- package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
- package/dist/v1/language/value/inclusion/equivalence.js +76 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +140 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +29 -3
- package/dist/v1/language/value/inclusion/includes.js +58 -723
- package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
- package/dist/v1/language/value/inclusion/keywords.js +31 -0
- package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
- package/dist/v1/language/value/inclusion/kinds.js +57 -0
- package/dist/v1/language/value/inclusion/location.d.ts +24 -0
- package/dist/v1/language/value/inclusion/location.js +66 -0
- package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
- package/dist/v1/language/value/inclusion/numbers.js +41 -0
- package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
- package/dist/v1/language/value/inclusion/objects.js +190 -0
- package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
- package/dist/v1/language/value/inclusion/strings.js +29 -0
- package/dist/v1/language/value/inclusion/types.d.ts +3 -0
- package/dist/v1/language/value/inclusion/types.js +34 -0
- package/dist/v1/language/value/model/blob.d.ts +6 -0
- package/dist/v1/language/value/model/blob.js +8 -0
- package/dist/v1/language/value/model/file.d.ts +41 -0
- package/dist/v1/language/value/model/file.js +122 -0
- package/dist/v1/language/value/ordering.d.ts +14 -0
- package/dist/v1/language/value/ordering.js +144 -77
- package/dist/v1/language/value/profile/canonicalize.d.ts +6 -1
- package/dist/v1/language/value/profile/canonicalize.js +67 -87
- package/dist/v1/language/value/profile/json.validate.d.ts +12 -0
- package/dist/v1/language/value/profile/json.validate.js +18 -5
- package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +1 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.js +21 -5
- package/dist/v1/language/value/profile/rules.js +27 -44
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/profile/vocabulary.d.ts +36 -2
- package/dist/v1/language/value/profile/vocabulary.js +58 -5
- package/dist/v1/language/value/reference/closure.js +6 -6
- package/dist/v1/language/value/reference/recursion.js +9 -48
- package/dist/v1/language/value/reference/references.d.ts +3 -1
- package/dist/v1/language/value/reference/references.js +7 -7
- package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
- package/dist/v1/language/value/reference/registry.index.js +33 -16
- package/dist/v1/language/value/regexp/ast.js +6 -7
- package/dist/v1/language/value/regexp/compile.d.ts +5 -11
- package/dist/v1/language/value/regexp/compile.js +14 -12
- package/dist/v1/language/value/regexp/syntax.js +3 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +1 -1
- package/dist/v1/language/value/regexp/unicode.js +1 -1
- package/dist/v1/language/value/syntax/keywords.d.ts +3 -3
- package/dist/v1/language/value/syntax/keywords.js +4 -20
- package/dist/v1/language/value/syntax/node-path/validate.js +2 -3
- package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
- package/dist/v1/language/value/syntax/pointer.js +5 -2
- package/dist/v1/language/value/syntax/walk.d.ts +9 -0
- package/dist/v1/language/value/syntax/walk.js +37 -20
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2596 -0
- package/dist/v1/schema/admission/accept.d.ts +3 -1
- package/dist/v1/schema/admission/accept.js +6 -14
- package/dist/v1/schema/admission/callable.d.ts +21 -0
- package/dist/v1/schema/admission/callable.js +96 -0
- package/dist/v1/schema/analysis/class.d.ts +4 -0
- package/dist/v1/schema/analysis/class.js +57 -17
- package/dist/v1/schema/canonical/revision.d.ts +4 -1
- package/dist/v1/schema/canonical/revision.js +8 -5
- package/dist/v1/schema/compatibility/api.d.ts +4 -1
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +9 -4
- package/dist/v1/schema/compatibility/comparators/classes.js +50 -29
- package/dist/v1/schema/compatibility/comparators/index.d.ts +1 -1
- package/dist/v1/schema/compatibility/comparators/members.js +1 -1
- package/dist/v1/schema/compatibility/comparators/values.js +2 -2
- package/dist/v1/schema/compatibility/context.d.ts +5 -2
- package/dist/v1/schema/compatibility/context.js +8 -6
- package/dist/v1/schema/compatibility/coordinate.js +3 -3
- package/dist/v1/schema/compatibility/diff.js +2 -4
- package/dist/v1/schema/compatibility/extension.d.ts +11 -0
- package/dist/v1/schema/compatibility/extension.js +22 -0
- package/dist/v1/schema/compatibility/fields.d.ts +20 -4
- package/dist/v1/schema/compatibility/fields.js +13 -3
- package/dist/v1/schema/compatibility/meaning/footprint.js +16 -51
- package/dist/v1/schema/compatibility/model.d.ts +17 -5
- package/dist/v1/schema/compatibility/references.d.ts +0 -3
- package/dist/v1/schema/compatibility/references.js +1 -9
- package/dist/v1/schema/compatibility/report.js +1 -1
- package/dist/v1/schema/compatibility/rule.d.ts +13 -0
- package/dist/v1/schema/compatibility/rule.js +23 -0
- package/dist/v1/schema/compatibility/scope.d.ts +2 -0
- package/dist/v1/schema/compatibility/scope.js +4 -1
- package/dist/v1/schema/compatibility/structure/index.js +6 -4
- package/dist/v1/schema/compatibility/structure/requirements.js +58 -61
- package/dist/v1/schema/compatibility/versioning/index.js +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.js +30 -2
- package/dist/v1/schema/compatibility/walk.d.ts +17 -0
- package/dist/v1/schema/compatibility/walk.js +41 -0
- package/dist/v1/schema/diagnostic.d.ts +17 -3
- package/dist/v1/schema/diagnostic.js +14 -11
- package/dist/v1/schema/enforcement/changes.d.ts +590 -0
- package/dist/v1/schema/enforcement/changes.js +566 -0
- package/dist/v1/schema/enforcement/derived.d.ts +236 -0
- package/dist/v1/schema/enforcement/derived.js +243 -0
- package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
- package/dist/v1/schema/enforcement/dispose.js +275 -0
- package/dist/v1/schema/enforcement/facts.d.ts +89 -0
- package/dist/v1/schema/enforcement/facts.js +70 -0
- package/dist/v1/schema/enforcement/fields.d.ts +65 -0
- package/dist/v1/schema/enforcement/fields.js +36 -0
- package/dist/v1/schema/enforcement/index.d.ts +39 -0
- package/dist/v1/schema/enforcement/index.js +10 -0
- package/dist/v1/schema/enforcement/install.d.ts +1634 -0
- package/dist/v1/schema/enforcement/install.js +1223 -0
- package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
- package/dist/v1/schema/enforcement/lifecycle.js +91 -0
- package/dist/v1/schema/enforcement/model.d.ts +253 -0
- package/dist/v1/schema/enforcement/model.js +1 -0
- package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
- package/dist/v1/schema/enforcement/obligations.js +240 -0
- package/dist/v1/schema/enforcement/write.d.ts +1314 -0
- package/dist/v1/schema/enforcement/write.js +1017 -0
- package/dist/v1/schema/index.d.ts +11 -1
- package/dist/v1/schema/index.js +5 -0
- package/dist/v1/schema/model/schema.d.ts +23 -1
- package/dist/v1/schema/model/schema.js +1 -1
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +50 -13
- package/dist/v1/schema/resolution/closure.js +2 -1
- package/dist/v1/schema/resolution/context.js +17 -18
- package/dist/v1/schema/resolution/domain.d.ts +5 -0
- package/dist/v1/schema/resolution/domain.js +6 -12
- package/dist/v1/schema/resolution/origins.js +6 -8
- package/dist/v1/schema/rule.d.ts +25 -0
- package/dist/v1/schema/rule.js +459 -0
- package/dist/v1/schema/validation/callable.d.ts +35 -2
- package/dist/v1/schema/validation/callable.js +65 -9
- package/dist/v1/schema/validation/class.d.ts +6 -2
- package/dist/v1/schema/validation/class.js +128 -105
- package/dist/v1/schema/validation/core.js +103 -173
- package/dist/v1/schema/validation/domain.js +25 -15
- package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
- package/dist/v1/schema/validation/domain.json-schema.js +222 -0
- package/dist/v1/schema/validation/domain.route.d.ts +6 -1
- package/dist/v1/schema/validation/domain.route.js +18 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +7797 -0
- package/dist/v1/schema/validation/domain.structure.js +516 -160
- package/dist/v1/schema/validation/icon.d.ts +4 -0
- package/dist/v1/schema/validation/icon.js +29 -0
- package/dist/v1/schema/validation/json.json-schema.d.ts +40 -0
- package/dist/v1/schema/validation/json.json-schema.js +46 -0
- package/dist/v1/schema/validation/policy/budgets.d.ts +37 -2
- package/dist/v1/schema/validation/policy/budgets.js +94 -121
- package/dist/v1/schema/validation/policy/context.d.ts +6 -5
- package/dist/v1/schema/validation/policy/context.js +7 -10
- package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
- package/dist/v1/schema/validation/policy/objects.js +6 -14
- package/dist/v1/schema/validation/policy/references.js +20 -62
- package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
- package/dist/v1/schema/validation/policy/typing.js +22 -356
- package/dist/v1/schema/validation/policy/uses.d.ts +40 -3
- package/dist/v1/schema/validation/policy/uses.js +63 -91
- package/dist/v1/schema/validation/policy/validate.js +5 -5
- package/dist/v1/schema/validation/value-api.d.ts +27 -1
- package/dist/v1/schema/validation/value-api.js +37 -2
- package/dist/v1/schema/validation/value.d.ts +3 -0
- package/dist/v1/schema/validation/value.js +9 -17
- package/dist/v1/schema/validation/value.json-schema.d.ts +54 -0
- package/dist/v1/schema/validation/value.json-schema.js +163 -0
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/accept.d.ts +9 -3
- package/dist/value/accept.js +25 -1
- package/dist/value/canonical.d.ts +22 -1
- package/dist/value/canonical.js +114 -21
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/equal.d.ts +9 -1
- package/dist/value/equal.js +37 -3
- package/dist/value/immutable.optimization.d.ts +2 -0
- package/dist/value/immutable.optimization.js +4 -0
- package/dist/value/index.d.ts +5 -3
- package/dist/value/index.js +2 -1
- package/dist/value/json.d.ts +2 -2
- package/dist/value/json.js +2 -2
- package/dist/value/limits.d.ts +11 -0
- package/dist/value/rule.d.ts +12 -0
- package/dist/value/rule.js +50 -0
- package/dist/value/types.d.ts +6 -0
- package/dist/value/unicode.d.ts +2 -1
- package/dist/value/unicode.js +2 -0
- package/package.json +15 -4
- package/dist/v1/builder/lowering/core-properties.d.ts +0 -10
- package/dist/v1/builder/lowering/core-properties.js +0 -76
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
- package/dist/v1/compiled/admission/semantics/cardinality.js +0 -113
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
- package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
- package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
- package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
- package/dist/v1/compiled/admission/wire/pattern.d.ts +0 -12
- package/dist/v1/compiled/admission/wire/pattern.js +0 -111
- package/dist/v1/language/class/index.d.ts +0 -8
- package/dist/v1/language/class/index.js +0 -1
- package/dist/v1/language/core/index.d.ts +0 -2
- package/dist/v1/language/value/index.d.ts +0 -11
- package/dist/v1/language/value/index.js +0 -8
- package/dist/v1/schema/canonical/domain.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.js +0 -5
- package/dist/v1/schema/canonical/domain.js +0 -5
- package/dist/v1/schema/canonical/freeze.d.ts +0 -1
- /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Admit, encode, inspect, and semantically resolve canonical V1 DomainSchemas. */
|
|
2
2
|
import type { SourceDomain } from '../domain/index.js';
|
|
3
3
|
import type { DomainSchema } from './model/schema.js';
|
|
4
|
-
export type { DomainSchema, DomainSchemaIR, DomainOfSchema as DomainOf } from './model/schema.js';
|
|
4
|
+
export type { DomainSchema, DomainSchemaIR, DomainSchemaDocument as Document, DomainOfSchema as DomainOf, } from './model/schema.js';
|
|
5
5
|
export type ResolvedDomainOf<Schema extends DomainSchema> = SourceDomain<Schema>;
|
|
6
6
|
export interface Resolve {
|
|
7
7
|
<const Schema extends DomainSchema>(schema: Schema): ResolvedDomainOf<Schema>;
|
|
@@ -9,6 +9,8 @@ export interface Resolve {
|
|
|
9
9
|
export declare const resolve: Resolve;
|
|
10
10
|
export type { SchemaDiagnosticCode as DiagnosticCode } from './diagnostic.js';
|
|
11
11
|
export { acceptDomainSchema as accept } from './admission/accept.js';
|
|
12
|
+
export { acceptCallable } from './admission/callable.js';
|
|
13
|
+
export type { AcceptedCallable } from './admission/callable.js';
|
|
12
14
|
export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
|
|
13
15
|
export { revisionOfDomainSchema as revision } from './canonical/revision.js';
|
|
14
16
|
export { ANNOTATION_KEYWORDS, FIELD_ROLES, callableFingerprint } from './compatibility/index.js';
|
|
@@ -20,6 +22,14 @@ export { compile, load } from '../compiled/index.js';
|
|
|
20
22
|
export type { CompiledSchema, DomainOfCompiled } from '../compiled/index.js';
|
|
21
23
|
export { SchemaError as Error } from './diagnostic.js';
|
|
22
24
|
export type { SchemaDiagnostic as Diagnostic } from './diagnostic.js';
|
|
25
|
+
export { RULES } from './rule.js';
|
|
26
|
+
export type { SchemaRule as Rule, SchemaRuleStage as RuleStage } from './rule.js';
|
|
27
|
+
export * as enforcement from './enforcement/index.js';
|
|
28
|
+
export { limits } from '../language/limits.js';
|
|
29
|
+
export type { LimitKey } from '../language/limits.js';
|
|
30
|
+
export { measurePolicies } from './validation/policy/budgets.js';
|
|
31
|
+
export type { PolicyMeasures } from './validation/policy/budgets.js';
|
|
32
|
+
export type { CheckMeasure, PolicyMeasure } from '../language/policy/analysis/budgets.js';
|
|
23
33
|
export type { DomainSchemaLookup as Lookup } from './dependency/lookup.js';
|
|
24
34
|
export type { DomainSchemaHeader as Header } from './codec/header.js';
|
|
25
35
|
export type { DomainDependency } from '../addressing/index.js';
|
package/dist/v1/schema/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { resolve as resolveDomainSchema } from './resolution/domain.js';
|
|
3
3
|
export const resolve = resolveDomainSchema;
|
|
4
4
|
export { acceptDomainSchema as accept } from './admission/accept.js';
|
|
5
|
+
export { acceptCallable } from './admission/callable.js';
|
|
5
6
|
export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
|
|
6
7
|
export { revisionOfDomainSchema as revision } from './canonical/revision.js';
|
|
7
8
|
export { ANNOTATION_KEYWORDS, FIELD_ROLES, callableFingerprint } from './compatibility/index.js';
|
|
@@ -10,5 +11,9 @@ export { header } from './codec/header.js';
|
|
|
10
11
|
export { DOMAIN_FORMAT as FORMAT, DOMAIN_VERSION as VERSION } from './model/format.js';
|
|
11
12
|
export { compile, load } from '../compiled/index.js';
|
|
12
13
|
export { SchemaError as Error } from './diagnostic.js';
|
|
14
|
+
export { RULES } from './rule.js';
|
|
15
|
+
export * as enforcement from './enforcement/index.js';
|
|
16
|
+
export { limits } from '../language/limits.js';
|
|
17
|
+
export { measurePolicies } from './validation/policy/budgets.js';
|
|
13
18
|
/** The versioned value-schema grammar embedded in declarations. */
|
|
14
19
|
export * as values from './validation/value-api.js';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { Key, Revision } from '../../addressing/index.js';
|
|
2
3
|
import type { DomainDependencyMap, ViewRef } from '../../addressing/index.js';
|
|
3
4
|
import type { Domain, DomainOfSource, DomainSource } from '../../domain/model/domain.js';
|
|
4
5
|
import type { FunctionDefinition } from '../../language/callable/model/callable.js';
|
|
5
6
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
7
|
+
import type { PropertyValues } from '../../language/class/property-values.js';
|
|
6
8
|
import type { CoreContent } from '../../language/core/model/core.js';
|
|
9
|
+
import type { DomainIcon } from '../../language/definition/metadata.js';
|
|
7
10
|
import type { PolicyDefinition } from '../../language/policy/model/policy.js';
|
|
8
11
|
import type { ViewDefinition } from '../../language/view/model/view.js';
|
|
9
12
|
export interface DomainSchemaIR {
|
|
@@ -12,6 +15,8 @@ export interface DomainSchemaIR {
|
|
|
12
15
|
readonly origin: Key.Origin;
|
|
13
16
|
/** Human-facing display name of the Domain, projected as its Domain Node `name`. */
|
|
14
17
|
readonly name: string;
|
|
18
|
+
/** Presentation icon of the Domain, projected as its Domain Node `iconSmall`, `iconMedium` and `iconLarge`. */
|
|
19
|
+
readonly icon?: DomainIcon;
|
|
15
20
|
/** The one View this Domain opens by default, projected as its `entrypoint` Edge. */
|
|
16
21
|
readonly entrypoint?: ViewRef;
|
|
17
22
|
readonly dependencies: DomainDependencyMap;
|
|
@@ -21,6 +26,23 @@ export interface DomainSchemaIR {
|
|
|
21
26
|
readonly views: Readonly<Record<string, ViewDefinition>>;
|
|
22
27
|
readonly core: CoreContent;
|
|
23
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The JSON document of a Domain schema, as tools write and exchange it: `DomainSchemaIR` without
|
|
31
|
+
* its in-process proofs. The structure the Kernel enforces has this type, which the build checks
|
|
32
|
+
* (`validation/domain.structure.typecheck.ts`), and the published JSON Schema describes it.
|
|
33
|
+
*/
|
|
34
|
+
export interface DomainSchemaDocument extends DocumentOf<DomainSchemaIR> {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The JSON document a model type describes. A `Revision` and `PropertyValues` are in-process
|
|
38
|
+
* proofs: the document carries them as plain text and plain values.
|
|
39
|
+
*/
|
|
40
|
+
export type DocumentOf<Model> = [JsonValue] extends [Model] ? Model : DocumentOfEach<Model>;
|
|
41
|
+
type DocumentOfEach<Model> = Model extends Revision ? string : Model extends PropertyValues ? {
|
|
42
|
+
readonly [Key in keyof Model as Key extends string ? Key : never]: DocumentOf<Model[Key]>;
|
|
43
|
+
} : Model extends string | number | boolean | null | undefined ? Model : {
|
|
44
|
+
readonly [Key in keyof Model]: DocumentOf<Model[Key]>;
|
|
45
|
+
};
|
|
24
46
|
declare const DOMAIN_SCHEMA_BRAND: unique symbol;
|
|
25
47
|
/**
|
|
26
48
|
* Accepted canonical schema carrying its exact resolved Domain projection.
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { CallableDefinition } from '../../language/callable/model/callable.js';
|
|
1
2
|
import type { DomainSchemaIR } from '../model/schema.js';
|
|
2
3
|
export declare function normalizeDomainSchema(schema: DomainSchemaIR): DomainSchemaIR;
|
|
4
|
+
export declare function canonicalizeCallable(value: CallableDefinition): CallableDefinition;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { compareDefinitionRefs, compareUnicode } from '../../addressing/ordering.js';
|
|
3
3
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
4
|
+
import { compareEdgeUniqueFields, compareEdgeUniqueTuples, compareNodeUniqueTuples, } from '../../language/class/unique.js';
|
|
5
|
+
import { DOMAIN_ICON_SIZES } from '../../language/definition/metadata.js';
|
|
6
|
+
import { CLASS_OPERATIONS } from '../../language/policy/model/policy.js';
|
|
4
7
|
import { normalizeClassRule, normalizePolicyChecks, normalizePolicyExpression, } from '../../language/policy/normalization/normalize.js';
|
|
5
|
-
import { admitStateTopology } from '../../language/state/topology.js';
|
|
6
8
|
import { canonicalizeValueSchema } from '../../language/value/profile/canonicalize.js';
|
|
7
9
|
export function normalizeDomainSchema(schema) {
|
|
8
10
|
const classes = mapRecord(schema.classes, canonicalizeClass);
|
|
@@ -14,6 +16,7 @@ export function normalizeDomainSchema(schema) {
|
|
|
14
16
|
version: 'v1',
|
|
15
17
|
origin: schema.origin,
|
|
16
18
|
name: schema.name,
|
|
19
|
+
...(schema.icon === undefined ? {} : { icon: canonicalizeDomainIcon(schema.icon) }),
|
|
17
20
|
...(schema.entrypoint === undefined
|
|
18
21
|
? {}
|
|
19
22
|
: {
|
|
@@ -41,6 +44,17 @@ export function normalizeDomainSchema(schema) {
|
|
|
41
44
|
};
|
|
42
45
|
return copyJsonValue(normalized);
|
|
43
46
|
}
|
|
47
|
+
/** Sizes smallest first, and each drawing as `svg` then `dark`: one icon has one canonical form. */
|
|
48
|
+
function canonicalizeDomainIcon(icon) {
|
|
49
|
+
const canonical = {};
|
|
50
|
+
for (const size of DOMAIN_ICON_SIZES) {
|
|
51
|
+
const art = icon[size];
|
|
52
|
+
if (art === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
canonical[size] = { svg: art.svg, ...(art.dark === undefined ? {} : { dark: art.dark }) };
|
|
55
|
+
}
|
|
56
|
+
return canonical;
|
|
57
|
+
}
|
|
44
58
|
function canonicalizePolicy(value) {
|
|
45
59
|
return {
|
|
46
60
|
ref: value.ref,
|
|
@@ -61,6 +75,7 @@ function canonicalizeClass(value) {
|
|
|
61
75
|
ref: value.ref,
|
|
62
76
|
kind: value.kind,
|
|
63
77
|
abstract: value.abstract,
|
|
78
|
+
...(value.inheritance === undefined ? {} : { inheritance: value.inheritance }),
|
|
64
79
|
extends: [...value.extends].sort(compareDefinitionRefs),
|
|
65
80
|
properties: mapRecord(value.properties, canonicalizeProperty),
|
|
66
81
|
};
|
|
@@ -70,7 +85,8 @@ function canonicalizeClass(value) {
|
|
|
70
85
|
methods: mapRecord(value.methods, canonicalizeMethod),
|
|
71
86
|
...(value.data === undefined ? {} : { data: { mediaType: value.data.mediaType } }),
|
|
72
87
|
...(value.icon === undefined ? {} : { icon: value.icon }),
|
|
73
|
-
policies:
|
|
88
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
89
|
+
...(value.unique === undefined ? {} : { unique: canonicalizeNodeUnique(value.unique) }),
|
|
74
90
|
};
|
|
75
91
|
}
|
|
76
92
|
return value.orientation === 'directed'
|
|
@@ -78,23 +94,36 @@ function canonicalizeClass(value) {
|
|
|
78
94
|
...base,
|
|
79
95
|
orientation: 'directed',
|
|
80
96
|
endpoints: canonicalizeDirectedEndpoints(value.endpoints),
|
|
81
|
-
policies: value.policies,
|
|
97
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
82
98
|
constraints: value.constraints,
|
|
99
|
+
...(value.unique === undefined ? {} : { unique: canonicalizeUnique(value.unique) }),
|
|
83
100
|
}
|
|
84
101
|
: {
|
|
85
102
|
...base,
|
|
86
103
|
orientation: 'undirected',
|
|
87
104
|
endpoints: canonicalizeIncidentEndpoints(value.endpoints),
|
|
88
|
-
policies: value.policies,
|
|
105
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
89
106
|
constraints: value.constraints,
|
|
90
107
|
};
|
|
91
108
|
}
|
|
109
|
+
/** A set of Node key tuples, each a set of Property keys, both in their canonical order. */
|
|
110
|
+
function canonicalizeNodeUnique(tuples) {
|
|
111
|
+
return tuples
|
|
112
|
+
.map((tuple) => [...tuple].sort(compareUnicode))
|
|
113
|
+
.sort(compareNodeUniqueTuples);
|
|
114
|
+
}
|
|
115
|
+
/** A set of key tuples, each a set of fields: fields and tuples take their canonical order. */
|
|
116
|
+
function canonicalizeUnique(tuples) {
|
|
117
|
+
return tuples
|
|
118
|
+
.map((tuple) => [...tuple].sort(compareEdgeUniqueFields))
|
|
119
|
+
.sort(compareEdgeUniqueTuples);
|
|
120
|
+
}
|
|
92
121
|
/** A rule keeps one spelling: normalized checks, or the Policy a lone `self` check names. */
|
|
93
|
-
function
|
|
94
|
-
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
122
|
+
function canonicalizeClassPolicies(value) {
|
|
123
|
+
return Object.fromEntries(CLASS_OPERATIONS.flatMap((operation) => {
|
|
124
|
+
const policy = value[operation];
|
|
125
|
+
return policy === undefined ? [] : [[operation, normalizeClassRule(policy)]];
|
|
126
|
+
}));
|
|
98
127
|
}
|
|
99
128
|
function canonicalizeFunction(value) {
|
|
100
129
|
return {
|
|
@@ -102,7 +131,7 @@ function canonicalizeFunction(value) {
|
|
|
102
131
|
...canonicalizeCallable(value),
|
|
103
132
|
};
|
|
104
133
|
}
|
|
105
|
-
function canonicalizeCallable(value) {
|
|
134
|
+
export function canonicalizeCallable(value) {
|
|
106
135
|
const base = {
|
|
107
136
|
...withDescription(value),
|
|
108
137
|
input: isBinaryInput(value.input)
|
|
@@ -115,6 +144,8 @@ function canonicalizeCallable(value) {
|
|
|
115
144
|
output: canonicalizeCallableOutput(value.output),
|
|
116
145
|
// Ordinary execution has one canonical form, so existing revisions never move.
|
|
117
146
|
...(value.execution?.durable === true ? { execution: { durable: true } } : {}),
|
|
147
|
+
// Absence is the one spelling of a call admitted afresh; validation refuses any other.
|
|
148
|
+
...(value.admission === undefined ? {} : { admission: { maxAge: value.admission.maxAge } }),
|
|
118
149
|
};
|
|
119
150
|
return value.auth === 'authorized'
|
|
120
151
|
? {
|
|
@@ -154,15 +185,21 @@ function canonicalizeProperty(value) {
|
|
|
154
185
|
? {}
|
|
155
186
|
: {
|
|
156
187
|
auto: {
|
|
188
|
+
// The distinct events of a non-empty list are a non-empty list.
|
|
157
189
|
on: [...new Set(value.auto.on)].sort(compareUnicode),
|
|
158
190
|
set: value.auto.set,
|
|
159
191
|
},
|
|
160
192
|
}),
|
|
161
193
|
...(value.immutable === undefined ? {} : { immutable: value.immutable }),
|
|
162
194
|
...(value.description === undefined ? {} : { description: value.description }),
|
|
163
|
-
...(value.state === undefined
|
|
164
|
-
|
|
165
|
-
|
|
195
|
+
...(value.state === undefined ? {} : { state: canonicalizeStateTopology(value.state) }),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** Orders a topology the structure shaped; only validation judges what it declares. */
|
|
199
|
+
function canonicalizeStateTopology(value) {
|
|
200
|
+
return {
|
|
201
|
+
initial: value.initial,
|
|
202
|
+
transitions: mapRecord(value.transitions, (events) => mapRecord(events, (target) => target)),
|
|
166
203
|
};
|
|
167
204
|
}
|
|
168
205
|
function canonicalizeDirectedEndpoints(value) {
|
|
@@ -20,8 +20,9 @@ export function requireDomainClosure(schema) {
|
|
|
20
20
|
const closure = knownDomainClosure(schema);
|
|
21
21
|
if (closure !== undefined)
|
|
22
22
|
return closure;
|
|
23
|
+
// What the value lacks is the exact closure of its dependencies, retained only by acceptance.
|
|
23
24
|
throw new SchemaError([
|
|
24
|
-
diagnostic('DV_ACCEPTANCE_CONTEXT', '', `DomainSchema ${schema.origin} has no retained acceptance context; accept it again against its exact lookup.`),
|
|
25
|
+
diagnostic('DV_ACCEPTANCE_CONTEXT', '/dependencies', `DomainSchema ${schema.origin} has no retained acceptance context; accept it again against its exact lookup.`),
|
|
25
26
|
]);
|
|
26
27
|
}
|
|
27
28
|
export function lookupForDomainClosure(schema) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { dependencyLimits } from '../../addressing/domain-dependency.js';
|
|
2
1
|
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
2
|
import { DOMAIN_REVISION_PATTERN } from '../../addressing/patterns.js';
|
|
3
|
+
import { chainDepths } from '../../language/chain.js';
|
|
4
|
+
import { limits } from '../../language/limits.js';
|
|
5
|
+
import { escapePointerToken } from '../../language/value/syntax/pointer.js';
|
|
4
6
|
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
5
7
|
import { diagnostic } from '../diagnostic.js';
|
|
6
8
|
import { indexSchemaDefinitions } from './definition.index.js';
|
|
@@ -10,11 +12,11 @@ export function buildDomainResolutionContext(candidate, lookup) {
|
|
|
10
12
|
const dependencies = new Map();
|
|
11
13
|
const definitions = new Map();
|
|
12
14
|
const directOrigins = new Set();
|
|
13
|
-
if (Object.keys(candidate.dependencies).length >
|
|
14
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A Domain may declare at most ${
|
|
15
|
+
if (Object.keys(candidate.dependencies).length > limits.dependency.direct) {
|
|
16
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A Domain may declare at most ${limits.dependency.direct} direct dependency aliases.`));
|
|
15
17
|
}
|
|
16
18
|
for (const [alias, dependency] of Object.entries(candidate.dependencies)) {
|
|
17
|
-
const pointer = `/dependencies/${
|
|
19
|
+
const pointer = `/dependencies/${escapePointerToken(alias)}`;
|
|
18
20
|
if (!DOMAIN_REVISION_PATTERN.test(dependency.revision))
|
|
19
21
|
continue;
|
|
20
22
|
if (dependency.origin === candidate.origin) {
|
|
@@ -78,7 +80,6 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
78
80
|
{
|
|
79
81
|
schema: candidate,
|
|
80
82
|
key: `${candidate.origin}\u0000candidate`,
|
|
81
|
-
depth: 0,
|
|
82
83
|
edges: Object.entries(candidate.dependencies),
|
|
83
84
|
index: 0,
|
|
84
85
|
},
|
|
@@ -94,7 +95,7 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
94
95
|
continue;
|
|
95
96
|
}
|
|
96
97
|
const [alias, dependency] = edge;
|
|
97
|
-
const pointer = frames.length === 1 ? `/dependencies/${
|
|
98
|
+
const pointer = frames.length === 1 ? `/dependencies/${escapePointerToken(alias)}` : '/dependencies';
|
|
98
99
|
if (activeOrigins.has(dependency.origin)) {
|
|
99
100
|
diagnostics.push(diagnostic('DV_DEPENDENCY_ACYCLIC', pointer, `Dependency cycle reaches ${dependency.origin}.`));
|
|
100
101
|
continue;
|
|
@@ -120,18 +121,13 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
122
123
|
dependencies.set(nested.origin, nested);
|
|
123
|
-
if (dependencies.size + 1 >
|
|
124
|
+
if (dependencies.size + 1 > limits.dependency.closure) {
|
|
124
125
|
if (!closureLimitReported) {
|
|
125
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A dependency closure may contain at most ${
|
|
126
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A dependency closure may contain at most ${limits.dependency.closure} Domains.`));
|
|
126
127
|
closureLimitReported = true;
|
|
127
128
|
}
|
|
128
129
|
continue;
|
|
129
130
|
}
|
|
130
|
-
const depth = frame.depth + 1;
|
|
131
|
-
if (depth > dependencyLimits.depth) {
|
|
132
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', pointer, `Dependency depth ${depth} exceeds the maximum ${dependencyLimits.depth}.`));
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
131
|
const key = `${dependency.origin}\u0000${dependency.revision}`;
|
|
136
132
|
if (visited.has(key))
|
|
137
133
|
continue;
|
|
@@ -139,20 +135,23 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
139
135
|
frames.push({
|
|
140
136
|
schema: nested,
|
|
141
137
|
key,
|
|
142
|
-
depth,
|
|
143
138
|
edges: Object.entries(nested.dependencies),
|
|
144
139
|
index: 0,
|
|
145
140
|
});
|
|
146
141
|
}
|
|
142
|
+
const depths = chainDepths([candidate], (schema) => Object.values(schema.dependencies).flatMap(({ origin }) => dependencies.get(origin) ?? []));
|
|
143
|
+
const depth = depths.get(candidate);
|
|
144
|
+
if (depth > limits.dependency.depth) {
|
|
145
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `Dependency depth ${depth} exceeds the maximum ${limits.dependency.depth}.`));
|
|
146
|
+
}
|
|
147
147
|
}
|
|
148
148
|
function validateDependencyUse(candidate, directOrigins, diagnostics) {
|
|
149
|
+
// Each reference that cannot resolve is reported where it is written; the dependency it lacks
|
|
150
|
+
// belongs in the dependency map.
|
|
149
151
|
const used = collectUsedForeignOrigins(candidate);
|
|
150
152
|
for (const origin of used) {
|
|
151
153
|
if (!directOrigins.has(origin)) {
|
|
152
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_DIRECT', '', `Foreign origin ${origin} is referenced without an exact direct dependency.`));
|
|
154
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_DIRECT', '/dependencies', `Foreign origin ${origin} is referenced without an exact direct dependency.`));
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
|
-
function escapeToken(value) {
|
|
157
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
158
|
-
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { SourceDomain } from '../../domain/model/domain.js';
|
|
2
|
+
import type { CallableValidation } from '../../domain/model/input.js';
|
|
3
|
+
import type { JsonSchema } from '../../language/value/model/schema.js';
|
|
4
|
+
import type { ValueSchemaRegistry } from '../../language/value/reference/registry.js';
|
|
2
5
|
import type { DomainSchema } from '../model/schema.js';
|
|
6
|
+
import { type PatternPool } from '../../language/value/evaluate/preparation.js';
|
|
3
7
|
/**
|
|
4
8
|
* Resolve one accepted Schema through its exact retained source closure. Acceptance validated it
|
|
5
9
|
* against that closure, which is the only way a Schema retains one, so it is not validated again.
|
|
6
10
|
*/
|
|
7
11
|
export declare function resolve<const S extends DomainSchema>(schema: S): SourceDomain<S>;
|
|
12
|
+
export declare function callableValidation(input: JsonSchema, output: JsonSchema | undefined, registry: ValueSchemaRegistry, patterns: PatternPool): CallableValidation;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Key, MethodKey, PropertyKey } from '../../addressing/index.js';
|
|
2
2
|
import { compareUnicode } from '../../addressing/ordering.js';
|
|
3
3
|
import { createDomain, createSourceDomain } from '../../domain/create.js';
|
|
4
|
-
import { createDomainValidation,
|
|
4
|
+
import { createDomainValidation, validateInputField } from '../../domain/validation/create.js';
|
|
5
5
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
6
6
|
import { inputFieldNodes } from '../../language/value/compile/fields.js';
|
|
7
7
|
import { prepareValueSchema } from '../../language/value/evaluate/preparation.js';
|
|
8
|
-
import { validateValueProgram } from '../../language/value/evaluate/program.js';
|
|
9
8
|
import { validateJsonInstance, validatePreparedInstance, } from '../../language/value/evaluate/validate.js';
|
|
10
9
|
import { classifyPreparedOrdering } from '../../language/value/ordering.js';
|
|
11
10
|
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
@@ -88,7 +87,7 @@ function sourceValidation(closure, registries) {
|
|
|
88
87
|
}
|
|
89
88
|
return createDomainValidation(properties, callables);
|
|
90
89
|
}
|
|
91
|
-
function callableValidation(input, output, registry, patterns) {
|
|
90
|
+
export function callableValidation(input, output, registry, patterns) {
|
|
92
91
|
const prepared = prepareValueSchema(input, registry, '', patterns);
|
|
93
92
|
if (!prepared.compiled) {
|
|
94
93
|
throw new TypeError(`Accepted callable input cannot be prepared: ${prepared.message}`);
|
|
@@ -97,16 +96,11 @@ function callableValidation(input, output, registry, patterns) {
|
|
|
97
96
|
const fields = inputFieldNodes(inputProgram);
|
|
98
97
|
return Object.freeze({
|
|
99
98
|
...(fields === undefined ? {} : { fields: Object.freeze(Object.keys(fields)) }),
|
|
100
|
-
validateInput: (value) => validatePreparedInstance(prepared.value, value),
|
|
101
|
-
validateInputField(field, value)
|
|
102
|
-
|
|
103
|
-
return nodes === undefined
|
|
104
|
-
? unknownInputField(field)
|
|
105
|
-
: validateValueProgram(inputProgram, value, nodes);
|
|
106
|
-
},
|
|
107
|
-
validateOutput: (value) => output === undefined
|
|
99
|
+
validateInput: (value, options) => validatePreparedInstance(prepared.value, value, options),
|
|
100
|
+
validateInputField: (field, value) => validateInputField(inputProgram, fields, field, value),
|
|
101
|
+
validateOutput: (value, options) => output === undefined
|
|
108
102
|
? []
|
|
109
|
-
: validateJsonInstance(output, value, registry, '', patterns),
|
|
103
|
+
: validateJsonInstance(output, value, registry, '', patterns, options),
|
|
110
104
|
});
|
|
111
105
|
}
|
|
112
106
|
function definitionsOf(schema) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compareDefinitionRefs, definitionRefIndex } from '../../addressing/ordering.js';
|
|
2
2
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
3
|
-
import { isClassRuleChecks, policyVariableClass } from '../../language/policy/model/policy.js';
|
|
3
|
+
import { CLASS_OPERATIONS, isClassRuleChecks, PolicyComposition, policyVariableClass, } from '../../language/policy/model/policy.js';
|
|
4
4
|
import { isValueObject as isJsonObject } from '../../language/value/model/object.js';
|
|
5
5
|
import { walkSchema } from '../../language/value/syntax/walk.js';
|
|
6
6
|
/** Collect only semantic refs, never strings or objects embedded as JSON data. */
|
|
@@ -58,7 +58,8 @@ export function collectClassRefs(declaration, add) {
|
|
|
58
58
|
Object.values(declaration.methods).forEach((method) => collectCallableRefs(method, add));
|
|
59
59
|
}
|
|
60
60
|
export function collectClassPolicyRefs(declaration, add) {
|
|
61
|
-
for (const
|
|
61
|
+
for (const operation of CLASS_OPERATIONS) {
|
|
62
|
+
const policy = declaration.policies[operation];
|
|
62
63
|
if (isClassRuleChecks(policy))
|
|
63
64
|
collectPolicyCheckRefs(policy, add);
|
|
64
65
|
else if (typeof policy === 'object')
|
|
@@ -94,8 +95,7 @@ function collectPolicyExpressionRefs(expression, add) {
|
|
|
94
95
|
collectPolicyPatternRefs(expression.match, add);
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
refs.forEach((ref) => add(ref, 'policy'));
|
|
98
|
+
PolicyComposition.of(expression).operands.forEach((ref) => add(ref, 'policy'));
|
|
99
99
|
}
|
|
100
100
|
function collectPolicyPatternRefs(expression, add) {
|
|
101
101
|
if ('sameNode' in expression) {
|
|
@@ -120,8 +120,7 @@ function collectPolicyPatternRefs(expression, add) {
|
|
|
120
120
|
collectPolicyPatternRefs(expression.exists.where, add);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
children.forEach((child) => collectPolicyPatternRefs(child, add));
|
|
123
|
+
PolicyComposition.of(expression).operands.forEach((child) => collectPolicyPatternRefs(child, add));
|
|
125
124
|
}
|
|
126
125
|
function collectPolicyCheckRefs(expression, add) {
|
|
127
126
|
if ('sameNode' in expression) {
|
|
@@ -136,8 +135,7 @@ function collectPolicyCheckRefs(expression, add) {
|
|
|
136
135
|
add(expression.object.ref, 'policy');
|
|
137
136
|
return;
|
|
138
137
|
}
|
|
139
|
-
|
|
140
|
-
children.forEach((child) => collectPolicyCheckRefs(child, add));
|
|
138
|
+
PolicyComposition.of(expression).operands.forEach((child) => collectPolicyCheckRefs(child, add));
|
|
141
139
|
}
|
|
142
140
|
export function collectValueDefinitionRefs(schema, add) {
|
|
143
141
|
walkSchema(schema, ({ schema: current }) => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DiagnosticRule } from '../language/validation/rule.js';
|
|
2
|
+
import type { SchemaDiagnosticCode } from './diagnostic.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a rule reads to decide. `structure`: the shape of the document alone. `rule`: the whole
|
|
5
|
+
* document. `context`: the document and its environment, so one document can be accepted in one
|
|
6
|
+
* environment and refused in another. The environment is what the lookup serves for the pinned
|
|
7
|
+
* dependencies, their accepted Schemas or their absence, and, for a Schema already accepted, the
|
|
8
|
+
* closure its acceptance retained.
|
|
9
|
+
*/
|
|
10
|
+
export type SchemaRuleStage = 'structure' | 'rule' | 'context';
|
|
11
|
+
/**
|
|
12
|
+
* The rule one Schema diagnostic code reports. A final `{/path*}` of its positions stands for any
|
|
13
|
+
* further tokens; `{endpoint}` is `source`, `target`, `0` or `1`; `{count}` is `outgoing`,
|
|
14
|
+
* `incoming` or `incident`; `{operation}` is `read` or `traverse`; `{key}` is a Property key;
|
|
15
|
+
* `{size}` is `small`, `medium` or `large`. A condition is a fragment such as `#/$defs/edge-class/if`.
|
|
16
|
+
*/
|
|
17
|
+
export interface SchemaRule extends DiagnosticRule {
|
|
18
|
+
readonly stage: SchemaRuleStage;
|
|
19
|
+
/**
|
|
20
|
+
* What the feature the rule guards enforces, where it enforces something: on data, the statement of
|
|
21
|
+
* each row of `enforcement` which names the rule; on calls and reads, which no table holds, its own.
|
|
22
|
+
*/
|
|
23
|
+
readonly enforces?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const RULES: Readonly<Record<SchemaDiagnosticCode, SchemaRule>>;
|