@astrale-os/kernel-dsl 1.0.0-beta.3 → 1.0.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/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 +12 -51
- 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 +15 -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 +16 -3
- 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 +14 -10
- 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 +5 -13
- 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
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import { defaultLimits } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import * as metadata from '../language/definition/metadata.js';
|
|
3
|
+
import { deepFreeze } from '../language/freeze.js';
|
|
4
|
+
import { limits } from '../language/limits.js';
|
|
5
|
+
import { DISPOSE } from './enforcement/dispose.js';
|
|
6
|
+
import { WRITE } from './enforcement/write.js';
|
|
7
|
+
const ANY = ['{/path*}'];
|
|
8
|
+
const CHECKS = [
|
|
9
|
+
'/classes/{class}/policies/{operation}{/path*}',
|
|
10
|
+
'/functions/{function}/policy{/path*}',
|
|
11
|
+
'/classes/{class}/methods/{method}/policy{/path*}',
|
|
12
|
+
];
|
|
13
|
+
const DEPENDENCIES = ['/dependencies/{alias}', '/dependencies'];
|
|
14
|
+
const count = (value) => value.toLocaleString('en-US');
|
|
15
|
+
const { dependency, inheritance, policy } = limits;
|
|
16
|
+
const at = (field) => [
|
|
17
|
+
`/functions/{function}${field}`,
|
|
18
|
+
`/classes/{class}/methods/{method}${field}`,
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Every Schema diagnostic code with the rule it reports. A code added to the DSL does not compile
|
|
22
|
+
* until it is described here.
|
|
23
|
+
*/
|
|
24
|
+
const DECLARED = {
|
|
25
|
+
DV_ACCEPTANCE_CONTEXT: {
|
|
26
|
+
stage: 'context',
|
|
27
|
+
positions: ['/dependencies'],
|
|
28
|
+
statement: 'A Schema is resolved, compiled or bundled only with the exact dependency closure its acceptance retained in this process.',
|
|
29
|
+
},
|
|
30
|
+
DV_CALLABLE_ADMISSION: {
|
|
31
|
+
stage: 'rule',
|
|
32
|
+
positions: at('/admission/maxAge'),
|
|
33
|
+
statement: 'An admission age is an integer number of seconds from 1 to 300.',
|
|
34
|
+
enforces: 'A destination decides a call only under an admission at most that many seconds old.',
|
|
35
|
+
},
|
|
36
|
+
DV_CALLABLE_AUTH: {
|
|
37
|
+
stage: 'rule',
|
|
38
|
+
positions: at('/auth'),
|
|
39
|
+
statement: 'A durable Function or Method is authenticated or authorized, never anonymous.',
|
|
40
|
+
enforces: 'A durable call runs as an Execution that records its caller and its admitted input, is resubmitted from them, and settles one value outcome.',
|
|
41
|
+
},
|
|
42
|
+
DV_CALLABLE_IO: {
|
|
43
|
+
stage: 'rule',
|
|
44
|
+
// A Method takes a value input only: its input has no mode.
|
|
45
|
+
positions: ['/functions/{function}/input/mode', ...at('/output/mode')],
|
|
46
|
+
statement: 'A durable Function or Method takes a value input and returns a value output.',
|
|
47
|
+
},
|
|
48
|
+
DV_CLASS_ABSTRACT: {
|
|
49
|
+
stage: 'rule',
|
|
50
|
+
positions: ['/classes/{class}/policies'],
|
|
51
|
+
statement: 'An abstract Class declares no read or traverse Policy.',
|
|
52
|
+
},
|
|
53
|
+
DV_CLASS_ACYCLIC: {
|
|
54
|
+
stage: 'rule',
|
|
55
|
+
positions: ['/classes/{class}/extends/{index}'],
|
|
56
|
+
statement: 'No Class extends itself, directly or through its ancestors.',
|
|
57
|
+
},
|
|
58
|
+
DV_CLASS_INHERITANCE: {
|
|
59
|
+
stage: 'context',
|
|
60
|
+
positions: ['/classes/{class}/extends/{index}'],
|
|
61
|
+
statement: 'No Class extends a final Class, of its own Domain or of a dependency.',
|
|
62
|
+
},
|
|
63
|
+
DV_CLASS_KIND: {
|
|
64
|
+
stage: 'context',
|
|
65
|
+
positions: ['/classes/{class}/extends/{index}'],
|
|
66
|
+
statement: 'A Class extends only Classes of its own kind: a Node Class Node Classes, an Edge Class Edge Classes.',
|
|
67
|
+
},
|
|
68
|
+
DV_CORE_EDGE_CLASS: {
|
|
69
|
+
stage: 'context',
|
|
70
|
+
positions: ['/core/edges/{index}/class', '/core/edges/{index}'],
|
|
71
|
+
statement: 'A Core Edge is of a concrete Edge Class of its Domain whose endpoints accept the Classes of its source and target.',
|
|
72
|
+
},
|
|
73
|
+
DV_CORE_EDGE_CONSTRAINTS: {
|
|
74
|
+
stage: 'context',
|
|
75
|
+
positions: ['/core/edges', '/core/edges/{index}', '/core/nodes/{slug}'],
|
|
76
|
+
statement: 'The Core Edges of a Schema hold the noSelf and acyclic constraints of their Classes, and every Core Node, and every Definition a Core Edge names, the Edge counts of the concrete Edge Classes whose endpoints accept it, each over its own Edges, a Definition its maximum only.',
|
|
77
|
+
},
|
|
78
|
+
DV_CORE_EDGE_KEY: {
|
|
79
|
+
stage: 'rule',
|
|
80
|
+
positions: ['/core/edges/{index}'],
|
|
81
|
+
statement: 'No two Core Edges share their Edge Class, source and target.',
|
|
82
|
+
},
|
|
83
|
+
DV_CORE_EDGE_PROPERTIES: {
|
|
84
|
+
stage: 'context',
|
|
85
|
+
positions: ['/core/edges/{index}/properties{/path*}'],
|
|
86
|
+
statement: 'The Properties of a Core Edge satisfy its Class: every required Property that no automatic program writes is present, every automatic one is absent, and each value fits its schema. Each value is judged alone, against the schema of its Property, as the root of its local references.',
|
|
87
|
+
},
|
|
88
|
+
DV_CORE_EDGE_UNIQUE: {
|
|
89
|
+
stage: 'context',
|
|
90
|
+
positions: ['/core/edges/{index}'],
|
|
91
|
+
statement: 'No two Core Edges hold one key under a unique tuple that covers their Classes.',
|
|
92
|
+
},
|
|
93
|
+
DV_CORE_NODE_CLASS: {
|
|
94
|
+
stage: 'rule',
|
|
95
|
+
positions: ['/core/nodes/{slug}/class'],
|
|
96
|
+
statement: 'A Core Node is of a concrete Node Class of its Domain.',
|
|
97
|
+
},
|
|
98
|
+
DV_CORE_NODE_PROPERTIES: {
|
|
99
|
+
stage: 'context',
|
|
100
|
+
positions: ['/core/nodes/{slug}/properties{/path*}'],
|
|
101
|
+
statement: 'The Properties of a Core Node satisfy its Class: every required Property that no automatic program writes is present, every automatic one is absent, and each value fits its schema. Each value is judged alone, against the schema of its Property, as the root of its local references.',
|
|
102
|
+
},
|
|
103
|
+
DV_CORE_NODE_UNIQUE: {
|
|
104
|
+
stage: 'context',
|
|
105
|
+
positions: ['/core/nodes/{slug}'],
|
|
106
|
+
statement: 'No two Core Nodes hold one key under a unique tuple that covers their Classes.',
|
|
107
|
+
},
|
|
108
|
+
DV_CORE_REF: {
|
|
109
|
+
stage: 'rule',
|
|
110
|
+
positions: ['/core/edges/{index}/source', '/core/edges/{index}/target'],
|
|
111
|
+
statement: 'A Core Edge endpoint names its Domain or a Definition its Domain declares and projects: a Class, Function, executable Method, Policy, View or Core Node.',
|
|
112
|
+
},
|
|
113
|
+
DV_DATA_COMPOSITION: {
|
|
114
|
+
stage: 'context',
|
|
115
|
+
positions: ['/classes/{class}/extends/{index}', '/classes/{class}/data'],
|
|
116
|
+
statement: 'A Node Class has at most one data declaration, its own or inherited from one declaring Class, and declares none of its own when it inherits one.',
|
|
117
|
+
},
|
|
118
|
+
DV_DEPENDENCY_ACYCLIC: {
|
|
119
|
+
stage: 'context',
|
|
120
|
+
positions: [...DEPENDENCIES],
|
|
121
|
+
statement: 'The dependency closure of a Domain has no cycle and never reaches its own origin.',
|
|
122
|
+
},
|
|
123
|
+
DV_DEPENDENCY_DIRECT: {
|
|
124
|
+
stage: 'rule',
|
|
125
|
+
positions: ['/dependencies'],
|
|
126
|
+
statement: 'Every origin a reference names, other than the Domain’s own, is a direct dependency.',
|
|
127
|
+
},
|
|
128
|
+
DV_DEPENDENCY_EXACT: {
|
|
129
|
+
stage: 'context',
|
|
130
|
+
positions: [...DEPENDENCIES],
|
|
131
|
+
statement: 'The lookup serves every dependency of the closure exactly: the Schema of its origin whose revision is the one pinned.',
|
|
132
|
+
},
|
|
133
|
+
DV_DEPENDENCY_LIMITS: {
|
|
134
|
+
stage: 'context',
|
|
135
|
+
positions: ['/dependencies', '/dependencies/{alias}'],
|
|
136
|
+
statement: `A Domain has at most ${dependency.direct} direct dependencies, a closure of at most ${dependency.closure} Domains and a longest chain of at most ${dependency.depth} dependencies.`,
|
|
137
|
+
limits: ['dependency.direct', 'dependency.closure', 'dependency.depth'],
|
|
138
|
+
},
|
|
139
|
+
DV_DEPENDENCY_REVISION_COHERENCE: {
|
|
140
|
+
stage: 'context',
|
|
141
|
+
positions: [...DEPENDENCIES],
|
|
142
|
+
statement: 'The dependency closure holds at most one revision of each origin.',
|
|
143
|
+
},
|
|
144
|
+
DV_DEPENDENCY_UNIQUE: {
|
|
145
|
+
stage: 'rule',
|
|
146
|
+
positions: ['/dependencies/{alias}/origin'],
|
|
147
|
+
statement: 'A Domain depends on each origin through one alias, and never on its own origin.',
|
|
148
|
+
},
|
|
149
|
+
DV_DOMAIN_ICON: {
|
|
150
|
+
stage: 'rule',
|
|
151
|
+
positions: ['/icon', '/icon/{size}/svg', '/icon/{size}/dark'],
|
|
152
|
+
statement: `A Domain icon draws at least one size, and each of its SVG texts is within the bound of its size in bytes of UTF-8 (small ${count(metadata.domainIcon.small)}, medium ${count(metadata.domainIcon.medium)}, large ${count(metadata.domainIcon.large)}): one complete <svg> element with a visible vector element, no script, foreignObject, iframe, embed, object, image, use, style, animate, set or discard element, no DOCTYPE or ENTITY, no on* or style attribute, no href, no javascript: and no url( but a local url(#id).`,
|
|
153
|
+
},
|
|
154
|
+
DV_EDGE_ACCEPTS: {
|
|
155
|
+
stage: 'context',
|
|
156
|
+
positions: ['/classes/{class}/endpoints/{endpoint}/accepts/{index}'],
|
|
157
|
+
statement: 'An Edge endpoint accepts only Node Classes of its Domain or of a direct dependency.',
|
|
158
|
+
},
|
|
159
|
+
DV_EDGE_CLASS_COMPOSITION: {
|
|
160
|
+
stage: 'context',
|
|
161
|
+
positions: ['/classes/{class}/extends/{index}'],
|
|
162
|
+
statement: 'An Edge Class refines each Edge Class it extends: the same orientation, endpoints whose accepted Classes and counts fit within its parent’s, its parent’s constraints and Property contract.',
|
|
163
|
+
},
|
|
164
|
+
DV_EDGE_FOREIGN_MINIMUM: {
|
|
165
|
+
stage: 'rule',
|
|
166
|
+
positions: ['/classes/{class}/endpoints/{endpoint}/{count}'],
|
|
167
|
+
statement: 'An Edge endpoint that accepts a Class another Domain owns requires no minimum count: neither 1 nor 1..*.',
|
|
168
|
+
},
|
|
169
|
+
DV_EDGE_LIFETIME: {
|
|
170
|
+
stage: 'rule',
|
|
171
|
+
positions: ['/classes/{class}/endpoints/{endpoint}/onDelete'],
|
|
172
|
+
statement: 'An endpoint that can hold a Node of another Domain does not declare restrict, and no endpoint declares detach in an Edge Class with an endpoint that requires an Edge.',
|
|
173
|
+
},
|
|
174
|
+
DV_EDGE_ROLE: {
|
|
175
|
+
stage: 'rule',
|
|
176
|
+
positions: ['/classes/{class}/endpoints/{endpoint}/role'],
|
|
177
|
+
statement: 'The two endpoints of an Edge Class have distinct roles.',
|
|
178
|
+
},
|
|
179
|
+
DV_EDGE_UNIQUE: {
|
|
180
|
+
stage: 'context',
|
|
181
|
+
positions: ['/classes/{class}/unique/{index}/{index}/property'],
|
|
182
|
+
statement: 'Each Property a unique tuple of an Edge Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean or instant that no automatic program writes.',
|
|
183
|
+
},
|
|
184
|
+
DV_ENTRYPOINT: {
|
|
185
|
+
stage: 'rule',
|
|
186
|
+
positions: ['/entrypoint'],
|
|
187
|
+
statement: 'The entrypoint names a View its Domain declares.',
|
|
188
|
+
},
|
|
189
|
+
DV_INHERITANCE_LIMITS: {
|
|
190
|
+
stage: 'context',
|
|
191
|
+
positions: ['/classes/{class}/extends'],
|
|
192
|
+
statement: `A Class has at most ${inheritance.depth} parents on its longest chain of parents, those of its dependencies included.`,
|
|
193
|
+
limits: ['inheritance.depth'],
|
|
194
|
+
},
|
|
195
|
+
DV_JSON_VALUE: {
|
|
196
|
+
stage: 'structure',
|
|
197
|
+
positions: ANY,
|
|
198
|
+
statement: `The document is portable JSON: as text, UTF-8 that parses, within ${count(defaultLimits.maxBytes)} bytes, with no byte-order mark and no repeated member name; as a value, null, booleans, finite numbers other than negative zero, strings, arrays and plain objects, with no string or member name that holds U+0000 or a lone surrogate or exceeds ${count(defaultLimits.maxStringBytes)} bytes of UTF-8, at most ${count(defaultLimits.maxDepth)} nested arrays and objects, and at most ${count(defaultLimits.maxMembers)} members and items in all. A Bundle holds a closure whole, so as a whole it holds at most ${count(limits.closure.members)} members and items, and each Domain in it the limits above.`,
|
|
199
|
+
limits: ['closure.members'],
|
|
200
|
+
conditions: ['#/$defs/portable-string/not'],
|
|
201
|
+
},
|
|
202
|
+
DV_METHOD_ABSTRACT: {
|
|
203
|
+
stage: 'rule',
|
|
204
|
+
positions: [
|
|
205
|
+
'/classes/{class}/methods/{method}/policy',
|
|
206
|
+
'/classes/{class}/methods/{method}/admission',
|
|
207
|
+
],
|
|
208
|
+
statement: 'An abstract Method of an abstract Class has no executable declaration, so it declares neither a Policy nor an admission age.',
|
|
209
|
+
},
|
|
210
|
+
DV_METHOD_COMPOSITION: {
|
|
211
|
+
stage: 'context',
|
|
212
|
+
positions: ['/classes/{class}/methods', '/classes/{class}/methods/{method}'],
|
|
213
|
+
statement: 'A Class keeps the exact signature of every abstract Method it inherits, declares locally a Method it inherits ambiguously, and, when concrete, declares locally every abstract Method it inherits.',
|
|
214
|
+
},
|
|
215
|
+
DV_NODE_UNIQUE: {
|
|
216
|
+
stage: 'context',
|
|
217
|
+
positions: ['/classes/{class}/unique/{index}/{index}'],
|
|
218
|
+
statement: 'Each Property a unique tuple of a Node Class names is a Property of the Class, own or inherited, that is keyable: a string, number, boolean or instant that no automatic program writes.',
|
|
219
|
+
},
|
|
220
|
+
DV_PROPERTY_AUTO: {
|
|
221
|
+
stage: 'context',
|
|
222
|
+
positions: [
|
|
223
|
+
'/classes/{class}/properties/{property}/auto/on',
|
|
224
|
+
'/classes/{class}/properties/{property}/auto/set',
|
|
225
|
+
],
|
|
226
|
+
statement: 'A required automatic Property is written on create, and the instant setter writes only a Property whose schema is an instant.',
|
|
227
|
+
},
|
|
228
|
+
DV_PROPERTY_IMMUTABLE: {
|
|
229
|
+
stage: 'rule',
|
|
230
|
+
positions: ['/classes/{class}/properties/{property}/immutable'],
|
|
231
|
+
statement: 'An immutable Property is neither automatic nor a State Property, and a required one is immutable from create, not once.',
|
|
232
|
+
},
|
|
233
|
+
DV_PROPERTY_STATE: {
|
|
234
|
+
stage: 'rule',
|
|
235
|
+
positions: ['/classes/{class}/properties/{property}/state'],
|
|
236
|
+
statement: 'A State Property is required and not automatic, has the string enumeration of exactly its states as schema, and a topology whose initial state and transition targets are its states.',
|
|
237
|
+
},
|
|
238
|
+
DV_REF_RESOLVES: {
|
|
239
|
+
stage: 'context',
|
|
240
|
+
positions: [
|
|
241
|
+
'/classes/{class}/ref',
|
|
242
|
+
'/classes/{class}/extends/{index}',
|
|
243
|
+
'/functions/{function}/ref',
|
|
244
|
+
'/policies/{policy}/ref',
|
|
245
|
+
'/views/{view}/ref',
|
|
246
|
+
'/core/nodes/{slug}/ref',
|
|
247
|
+
],
|
|
248
|
+
statement: 'A declaration’s ref is its own key, and every Class a Class extends exists in its Domain or in a direct dependency.',
|
|
249
|
+
},
|
|
250
|
+
DV_VALUE_SCHEMA: {
|
|
251
|
+
stage: 'context',
|
|
252
|
+
positions: [
|
|
253
|
+
'/classes/{class}/properties/{property}/schema{/path*}',
|
|
254
|
+
...at('/input{/path*}'),
|
|
255
|
+
...at('/output/schema{/path*}'),
|
|
256
|
+
...at('/output/item{/path*}'),
|
|
257
|
+
],
|
|
258
|
+
statement: 'Every embedded value schema is in the value language: its diagnostic names the refusal in `valueCode`, and the schema of an automatic or State Property is not a blob.',
|
|
259
|
+
conditions: ['#/$defs/node-property-definition/allOf/0/if'],
|
|
260
|
+
},
|
|
261
|
+
PL_BUDGET: {
|
|
262
|
+
stage: 'rule',
|
|
263
|
+
positions: ['/policies/{policy}', ...CHECKS],
|
|
264
|
+
statement: `A Policy stays within its budgets once expanded: pattern depth ${policy.patternDepth}, ${policy.normalizedBranches} normalized branches, ${policy.edgePredicates} Edge predicates a branch and ${policy.referencedDomains} referenced Domains; and checks within depth ${policy.checkDepth}, ${policy.checkBranches} branches and ${policy.checkLeaves} leaves.`,
|
|
265
|
+
limits: [
|
|
266
|
+
'policy.patternDepth',
|
|
267
|
+
'policy.normalizedBranches',
|
|
268
|
+
'policy.edgePredicates',
|
|
269
|
+
'policy.referencedDomains',
|
|
270
|
+
'policy.checkDepth',
|
|
271
|
+
'policy.checkBranches',
|
|
272
|
+
'policy.checkLeaves',
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
PL_COMPOSITION: {
|
|
276
|
+
stage: 'rule',
|
|
277
|
+
positions: ['/policies/{policy}'],
|
|
278
|
+
statement: 'Named Policies compose without a cycle.',
|
|
279
|
+
},
|
|
280
|
+
PL_CONNECTIVITY: {
|
|
281
|
+
stage: 'rule',
|
|
282
|
+
positions: ['/policies/{policy}/expression/match', ...CHECKS],
|
|
283
|
+
statement: 'Every normalized branch of a Policy pattern connects its subject with each object, endpoint and variable it names, and every branch of a check tree checks a Policy.',
|
|
284
|
+
},
|
|
285
|
+
PL_REF: {
|
|
286
|
+
stage: 'context',
|
|
287
|
+
positions: ['/policies/{policy}/expression{/path*}', ...CHECKS],
|
|
288
|
+
statement: 'Every reference in a Policy resolves: a named Policy to one its Domain declares, a Class to a Node or Edge Class of its Domain or of a direct dependency, an object to a projected Definition.',
|
|
289
|
+
},
|
|
290
|
+
PL_REPEAT: {
|
|
291
|
+
stage: 'rule',
|
|
292
|
+
positions: ['/policies/{policy}/expression{/path*}'],
|
|
293
|
+
statement: 'The minimum of a repeated Edge pattern is at most its maximum.',
|
|
294
|
+
},
|
|
295
|
+
PL_TARGET: {
|
|
296
|
+
stage: 'rule',
|
|
297
|
+
positions: ['/policies/{policy}', '/policies/{policy}/expression/match'],
|
|
298
|
+
statement: 'Every normalized branch of a Policy targets either its object or its source and target endpoints, without mixing the two.',
|
|
299
|
+
},
|
|
300
|
+
PL_TYPING: {
|
|
301
|
+
stage: 'context',
|
|
302
|
+
positions: ['/policies/{policy}'],
|
|
303
|
+
statement: 'Every expanded branch of a named Policy is typed at its own use: its endpoint and repeat contracts do not contradict.',
|
|
304
|
+
},
|
|
305
|
+
PL_USE: {
|
|
306
|
+
stage: 'context',
|
|
307
|
+
positions: [...CHECKS],
|
|
308
|
+
statement: 'A Policy holds where it is used: a Class Policy for every Node or source and target pair of its Class, each check for the objects it admits, and each check tree can admit every Class its object accepts.',
|
|
309
|
+
enforces: 'A read Policy decides which callers observe the values of a Class’s Nodes or Edges, a traverse Policy which callers use them structurally; an absent one admits every caller.',
|
|
310
|
+
},
|
|
311
|
+
PL_VARIABLE_SCOPE: {
|
|
312
|
+
stage: 'rule',
|
|
313
|
+
positions: ['/policies/{policy}/expression{/path*}'],
|
|
314
|
+
statement: 'Every Policy variable is declared once, by one exists, is used only inside it, shadows no enclosing variable, and is used at least once.',
|
|
315
|
+
},
|
|
316
|
+
STRUCTURE_BINARY_INPUT: {
|
|
317
|
+
stage: 'structure',
|
|
318
|
+
positions: ['/functions/{function}/input'],
|
|
319
|
+
statement: 'A Function input in binary mode is a binary input: it declares its metadata and maximumBytes.',
|
|
320
|
+
conditions: ['#/$defs/function-definition/properties/input/anyOf/1/not'],
|
|
321
|
+
},
|
|
322
|
+
STRUCTURE_CALLABLE_POLICY_AUTH: {
|
|
323
|
+
stage: 'structure',
|
|
324
|
+
positions: at('/policy'),
|
|
325
|
+
statement: 'Only an authorized Function or Method declares a Policy.',
|
|
326
|
+
conditions: ['#/$defs/function-definition/if', '#/$defs/method-definition/if'],
|
|
327
|
+
},
|
|
328
|
+
STRUCTURE_DEPENDENCY_ALIAS: {
|
|
329
|
+
stage: 'structure',
|
|
330
|
+
positions: ['/dependencies/{alias}'],
|
|
331
|
+
statement: 'A dependency alias is neither prototype nor constructor.',
|
|
332
|
+
conditions: ['#/$defs/dependency-alias/not'],
|
|
333
|
+
},
|
|
334
|
+
STRUCTURE_DOMAIN_NAME: {
|
|
335
|
+
stage: 'structure',
|
|
336
|
+
positions: ['/name'],
|
|
337
|
+
statement: 'The Domain name is one line of text, without control characters or surrounding spaces.',
|
|
338
|
+
},
|
|
339
|
+
STRUCTURE_DUPLICATE_ITEM: {
|
|
340
|
+
stage: 'structure',
|
|
341
|
+
positions: [
|
|
342
|
+
'/classes/{class}/extends/{index}',
|
|
343
|
+
'/classes/{class}/endpoints/{endpoint}/accepts/{index}',
|
|
344
|
+
'/classes/{class}/properties/{property}/auto/on/{index}',
|
|
345
|
+
'/classes/{class}/unique/{index}',
|
|
346
|
+
'/classes/{class}/unique/{index}/{index}',
|
|
347
|
+
],
|
|
348
|
+
statement: 'A set holds no item twice: extends, accepts, auto.on, unique and each unique tuple, where two tuples of the same fields are one.',
|
|
349
|
+
},
|
|
350
|
+
STRUCTURE_EDGE_BLOB: {
|
|
351
|
+
stage: 'structure',
|
|
352
|
+
positions: ['/classes/{class}/properties/{property}/schema/x-astrale-value-kind'],
|
|
353
|
+
statement: 'The schema of an Edge Property is not a blob: only a Node holds Blob contents.',
|
|
354
|
+
conditions: ['#/$defs/edge-property-definition/properties/schema/not'],
|
|
355
|
+
},
|
|
356
|
+
STRUCTURE_EDGE_ORIENTATION: {
|
|
357
|
+
stage: 'structure',
|
|
358
|
+
positions: [
|
|
359
|
+
'/classes/{class}/endpoints',
|
|
360
|
+
'/classes/{class}/unique',
|
|
361
|
+
'/classes/{class}/constraints/acyclic',
|
|
362
|
+
],
|
|
363
|
+
statement: 'A directed Edge Class has source and target endpoints and an undirected one two incident endpoints, and only a directed one declares unique tuples or is acyclic.',
|
|
364
|
+
conditions: ['#/$defs/edge-class/if'],
|
|
365
|
+
},
|
|
366
|
+
STRUCTURE_FORMAT: {
|
|
367
|
+
stage: 'structure',
|
|
368
|
+
positions: ANY,
|
|
369
|
+
statement: 'A string matches the pattern of its position: an origin, a member name, a revision, a media type, a dependency alias or a Core slug.',
|
|
370
|
+
},
|
|
371
|
+
STRUCTURE_KEY: {
|
|
372
|
+
stage: 'structure',
|
|
373
|
+
positions: ANY,
|
|
374
|
+
statement: 'Every key of a record matches the pattern of the names it holds.',
|
|
375
|
+
},
|
|
376
|
+
STRUCTURE_MAXIMUM: {
|
|
377
|
+
stage: 'structure',
|
|
378
|
+
positions: ANY,
|
|
379
|
+
statement: 'A string, list or number is no greater than the bound of its position.',
|
|
380
|
+
limits: ['policy.variablesPerExists', 'policy.repetition'],
|
|
381
|
+
},
|
|
382
|
+
STRUCTURE_MINIMUM: {
|
|
383
|
+
stage: 'structure',
|
|
384
|
+
positions: ANY,
|
|
385
|
+
statement: 'A string, list or number is no less than the bound of its position.',
|
|
386
|
+
},
|
|
387
|
+
STRUCTURE_PROPERTY_KEY: {
|
|
388
|
+
stage: 'structure',
|
|
389
|
+
positions: [
|
|
390
|
+
'/classes/{class}/unique/{index}/{index}',
|
|
391
|
+
'/classes/{class}/unique/{index}/{index}/property',
|
|
392
|
+
'/core/nodes/{slug}/properties/{key}',
|
|
393
|
+
'/core/edges/{index}/properties/{key}',
|
|
394
|
+
],
|
|
395
|
+
statement: 'A Property is named by its canonical key, <origin>:class.<Class>.property.<name>.',
|
|
396
|
+
},
|
|
397
|
+
STRUCTURE_PROTO_KEY: {
|
|
398
|
+
stage: 'structure',
|
|
399
|
+
positions: ANY,
|
|
400
|
+
statement: 'No object of the document has a member named __proto__, except the transitions of a State.',
|
|
401
|
+
conditions: [
|
|
402
|
+
'#/$defs/json-value/anyOf/5/propertyNames/not',
|
|
403
|
+
'#/$defs/value-schema/anyOf/1/propertyNames/not',
|
|
404
|
+
],
|
|
405
|
+
},
|
|
406
|
+
STRUCTURE_REQUIRED: {
|
|
407
|
+
stage: 'structure',
|
|
408
|
+
positions: ANY,
|
|
409
|
+
statement: 'Every required field is present.',
|
|
410
|
+
},
|
|
411
|
+
STRUCTURE_STATE_TRANSITIONS: {
|
|
412
|
+
stage: 'structure',
|
|
413
|
+
positions: ['/classes/{class}/properties/{property}/state/transitions'],
|
|
414
|
+
statement: 'State transitions map each non-empty state name to a map from non-empty event names to non-empty state names.',
|
|
415
|
+
},
|
|
416
|
+
STRUCTURE_TYPE: {
|
|
417
|
+
stage: 'structure',
|
|
418
|
+
positions: ANY,
|
|
419
|
+
statement: 'Every value has the JSON type of its position.',
|
|
420
|
+
},
|
|
421
|
+
STRUCTURE_UNION: {
|
|
422
|
+
stage: 'structure',
|
|
423
|
+
positions: ANY,
|
|
424
|
+
statement: 'A value matches one of the variants of its position.',
|
|
425
|
+
},
|
|
426
|
+
STRUCTURE_UNKNOWN_FIELD: {
|
|
427
|
+
stage: 'structure',
|
|
428
|
+
positions: ANY,
|
|
429
|
+
statement: 'An object has only the fields of its position.',
|
|
430
|
+
},
|
|
431
|
+
STRUCTURE_VALUE: {
|
|
432
|
+
stage: 'structure',
|
|
433
|
+
positions: ANY,
|
|
434
|
+
statement: 'A literal or enumerated position holds one of its values.',
|
|
435
|
+
},
|
|
436
|
+
UNSUPPORTED_DOCUMENT_FORMAT: {
|
|
437
|
+
stage: 'structure',
|
|
438
|
+
positions: ['/format'],
|
|
439
|
+
statement: 'The document format is astrale.dsl.',
|
|
440
|
+
},
|
|
441
|
+
UNSUPPORTED_DSL_VERSION: {
|
|
442
|
+
stage: 'structure',
|
|
443
|
+
positions: ['/version'],
|
|
444
|
+
statement: 'The document version is one this DSL reads: v1.',
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
const ROWS = [
|
|
448
|
+
...Object.values(WRITE),
|
|
449
|
+
...Object.values(DISPOSE),
|
|
450
|
+
];
|
|
451
|
+
/**
|
|
452
|
+
* What a rule's feature enforces on data is the statement of each row which names the rule, so a
|
|
453
|
+
* rule restates none. A rule keeps its own sentence only for what no table holds: calls, reads.
|
|
454
|
+
*/
|
|
455
|
+
function withItsRows([code, rule]) {
|
|
456
|
+
const statements = ROWS.filter((row) => row.accepted === code).map((row) => row.statement);
|
|
457
|
+
return [code, statements.length === 0 ? rule : { ...rule, enforces: statements.join(' ') }];
|
|
458
|
+
}
|
|
459
|
+
export const RULES = deepFreeze(Object.fromEntries(Object.entries(DECLARED).map(withItsRows)));
|
|
@@ -1,4 +1,37 @@
|
|
|
1
|
+
import type { ClassRef } from '../../addressing/index.js';
|
|
2
|
+
import type { CallableDefinition } from '../../language/callable/model/callable.js';
|
|
3
|
+
import type { ValueSchemaRegistry } from '../../language/value/reference/registry.js';
|
|
1
4
|
import type { SchemaDiagnostic } from '../diagnostic.js';
|
|
2
5
|
import type { DomainSchemaIR } from '../model/schema.js';
|
|
3
|
-
/**
|
|
4
|
-
|
|
6
|
+
/**
|
|
7
|
+
* One callable contract a Domain schema declares: where it is written, and the Node Class that
|
|
8
|
+
* receives its call, which its Policy names `self`. A contract is validated by the same rules
|
|
9
|
+
* wherever it is: in a Domain schema, at its declaration, or on the Node of a Function instance,
|
|
10
|
+
* which carries it (`acceptCallable`).
|
|
11
|
+
*/
|
|
12
|
+
export interface DeclaredContract {
|
|
13
|
+
readonly contract: CallableDefinition;
|
|
14
|
+
/** Its declaration's JSON Pointer, which its diagnostics point within. */
|
|
15
|
+
readonly pointer: string;
|
|
16
|
+
/** The owner of an instance Method; a Function and a static Method have none. */
|
|
17
|
+
readonly receiver?: ClassRef;
|
|
18
|
+
/** The Node Class and name of a Method; absent for a Function. */
|
|
19
|
+
readonly method?: {
|
|
20
|
+
readonly owner: ClassRef;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Every callable contract one Domain schema declares: each Function, then each Node Method. */
|
|
25
|
+
export declare function declaredContracts(schema: DomainSchemaIR): readonly DeclaredContract[];
|
|
26
|
+
/**
|
|
27
|
+
* Validate the ref of every Function declaration, then the value schemas, execution modifier and
|
|
28
|
+
* admission age of every declared contract.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateContracts(schema: DomainSchemaIR, registry: ValueSchemaRegistry): readonly SchemaDiagnostic[];
|
|
31
|
+
/**
|
|
32
|
+
* Validate one callable contract written at `pointer`, except its Policy (`validateContractPolicy`):
|
|
33
|
+
* its value schemas against the owner registry, its execution modifier and its admission age.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateContract(contract: CallableDefinition, pointer: string, registry: ValueSchemaRegistry, diagnostics: SchemaDiagnostic[]): void;
|
|
36
|
+
/** Validate the execution modifier and admission age of one callable contract at `pointer`. */
|
|
37
|
+
export declare function validateCallableModifiers(declaration: CallableDefinition, pointer: string, diagnostics: SchemaDiagnostic[]): void;
|
|
@@ -1,21 +1,80 @@
|
|
|
1
|
+
import { equalDefinitionRefs } from '../../addressing/definition-ref.js';
|
|
2
|
+
import { Key } from '../../addressing/key.js';
|
|
3
|
+
import { isAdmissionMaxAge, MAXIMUM_ADMISSION_AGE_SECONDS, } from '../../language/callable/admission.js';
|
|
1
4
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
5
|
+
import { escapePointerToken } from '../../language/value/syntax/pointer.js';
|
|
2
6
|
import { diagnostic } from '../diagnostic.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
import { validateCallable } from './value.js';
|
|
8
|
+
/** Every callable contract one Domain schema declares: each Function, then each Node Method. */
|
|
9
|
+
export function declaredContracts(schema) {
|
|
10
|
+
const contracts = [];
|
|
6
11
|
for (const [name, declaration] of Object.entries(schema.functions)) {
|
|
7
|
-
|
|
12
|
+
contracts.push({ contract: declaration, pointer: `/functions/${escapePointerToken(name)}` });
|
|
8
13
|
}
|
|
9
14
|
for (const [name, declaration] of Object.entries(schema.classes)) {
|
|
10
15
|
if (declaration.kind !== 'node')
|
|
11
16
|
continue;
|
|
17
|
+
const owner = { origin: schema.origin, kind: 'class', name };
|
|
12
18
|
for (const [method, value] of Object.entries(declaration.methods)) {
|
|
13
|
-
const pointer = `/classes/${
|
|
14
|
-
|
|
19
|
+
const pointer = `/classes/${escapePointerToken(name)}/methods/${escapePointerToken(method)}`;
|
|
20
|
+
contracts.push({
|
|
21
|
+
contract: value,
|
|
22
|
+
pointer,
|
|
23
|
+
...(value.static ? {} : { receiver: owner }),
|
|
24
|
+
method: { owner, name: method },
|
|
25
|
+
});
|
|
15
26
|
}
|
|
16
27
|
}
|
|
28
|
+
return contracts;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate the ref of every Function declaration, then the value schemas, execution modifier and
|
|
32
|
+
* admission age of every declared contract.
|
|
33
|
+
*/
|
|
34
|
+
export function validateContracts(schema, registry) {
|
|
35
|
+
const diagnostics = [];
|
|
36
|
+
for (const [name, declaration] of Object.entries(schema.functions)) {
|
|
37
|
+
validateFunctionRef(schema.origin, name, declaration.ref, diagnostics);
|
|
38
|
+
}
|
|
39
|
+
for (const { contract, pointer } of declaredContracts(schema)) {
|
|
40
|
+
validateContract(contract, pointer, registry, diagnostics);
|
|
41
|
+
}
|
|
17
42
|
return Object.freeze(diagnostics);
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A Function declaration names itself by its ref: its own key in its own Domain. The ref belongs to
|
|
46
|
+
* the declaration, not to its contract, which a Node carries without one.
|
|
47
|
+
*/
|
|
48
|
+
function validateFunctionRef(origin, name, declared, diagnostics) {
|
|
49
|
+
const ref = { origin, kind: 'function', name };
|
|
50
|
+
if (equalDefinitionRefs(declared, ref))
|
|
51
|
+
return;
|
|
52
|
+
diagnostics.push(diagnostic('DV_REF_RESOLVES', `/functions/${escapePointerToken(name)}/ref`, `Function ref must be exactly ${Key.of(ref)}.`, Key.of(declared)));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate one callable contract written at `pointer`, except its Policy (`validateContractPolicy`):
|
|
56
|
+
* its value schemas against the owner registry, its execution modifier and its admission age.
|
|
57
|
+
*/
|
|
58
|
+
export function validateContract(contract, pointer, registry, diagnostics) {
|
|
59
|
+
validateCallable(contract, pointer, registry, diagnostics);
|
|
60
|
+
validateCallableModifiers(contract, pointer, diagnostics);
|
|
61
|
+
}
|
|
62
|
+
/** Validate the execution modifier and admission age of one callable contract at `pointer`. */
|
|
63
|
+
export function validateCallableModifiers(declaration, pointer, diagnostics) {
|
|
64
|
+
validateExecution(declaration, pointer, diagnostics);
|
|
65
|
+
validateAdmission(declaration, pointer, diagnostics);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An admission age is a whole number of seconds within the language ceiling. It has no zero
|
|
69
|
+
* spelling: an absent admission age is the one canonical form of a call admitted afresh.
|
|
70
|
+
*/
|
|
71
|
+
function validateAdmission(declaration, pointer, diagnostics) {
|
|
72
|
+
if (declaration.admission === undefined)
|
|
73
|
+
return;
|
|
74
|
+
if (isAdmissionMaxAge(declaration.admission.maxAge))
|
|
75
|
+
return;
|
|
76
|
+
diagnostics.push(diagnostic('DV_CALLABLE_ADMISSION', `${pointer}/admission/maxAge`, `An admission age is an integer number of seconds from 1 to ${MAXIMUM_ADMISSION_AGE_SECONDS}; omit it to admit every call afresh.`));
|
|
77
|
+
}
|
|
19
78
|
/**
|
|
20
79
|
* An Execution records its initiating caller and its admitted input, from which the run is
|
|
21
80
|
* resubmitted, and retains one portable outcome. A durable callable therefore needs a known caller,
|
|
@@ -34,6 +93,3 @@ function validateExecution(declaration, pointer, diagnostics) {
|
|
|
34
93
|
diagnostics.push(diagnostic('DV_CALLABLE_IO', `${pointer}/output/mode`, 'A durable callable requires a value output.'));
|
|
35
94
|
}
|
|
36
95
|
}
|
|
37
|
-
function escapePointer(value) {
|
|
38
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
39
|
-
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { ClassRef } from '../../addressing/index.js';
|
|
2
2
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
3
|
+
import type { ValueSchemaRegistry } from '../../language/value/reference/registry.js';
|
|
3
4
|
import type { DefinitionAnalysisResult } from '../analysis/class.js';
|
|
4
5
|
import type { SchemaDiagnostic } from '../diagnostic.js';
|
|
5
6
|
import type { DomainResolutionContext } from '../resolution/context.js';
|
|
6
|
-
/**
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Validate the semantic contracts owned by Class declarations. `registry` is the candidate's value
|
|
9
|
+
* registry; each dependency's is built at most once, so the Classes share them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateDefinitions(environment: DomainResolutionContext, analysis: DefinitionAnalysisResult, registry: ValueSchemaRegistry): readonly SchemaDiagnostic[];
|
|
8
12
|
/** Whether `child` safely refines its parent Edge contract `parent`. */
|
|
9
13
|
export declare function edgeContractRefines(environment: DomainResolutionContext, child: Extract<ClassDefinition, {
|
|
10
14
|
readonly kind: 'edge';
|