@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,49 @@
|
|
|
1
|
+
import type { BoundaryErrorCode } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { LimitKey } from '../language/limits.js';
|
|
3
|
+
import type { DiagnosticCode as ValueDiagnosticCode } from '../language/validation/diagnostic.js';
|
|
4
|
+
import type { SchemaDiagnosticCode } from '../schema/diagnostic.js';
|
|
5
|
+
import type { CompiledDiagnosticCode } from './diagnostic.js';
|
|
6
|
+
/** The rule one diagnostic code of a compiled Schema reports. */
|
|
7
|
+
export interface CompiledRule {
|
|
8
|
+
/** The positions its diagnostics point at, as the positions of `schema.Rule`. */
|
|
9
|
+
readonly positions: readonly [string, ...string[]];
|
|
10
|
+
/** The rule, in one plain sentence. */
|
|
11
|
+
readonly statement: string;
|
|
12
|
+
/** The limits of `schema.limits` the rule enforces, by key, where it enforces some. */
|
|
13
|
+
readonly limits?: readonly [LimitKey, ...LimitKey[]];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Every diagnostic code of a compiled Schema with the rule it reports, frozen. A code added here
|
|
17
|
+
* does not compile until it is described.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COMPILED_RULES: Readonly<Record<CompiledDiagnosticCode, CompiledRule>>;
|
|
20
|
+
/** How admission of a compiled Schema holds one rule of the language. */
|
|
21
|
+
export type ReadmittedRule = {
|
|
22
|
+
/** A compiled Schema breaking the rule is refused, under one of these codes. */
|
|
23
|
+
readonly kind: 'refused';
|
|
24
|
+
readonly answers: readonly [CompiledDiagnosticCode, ...CompiledDiagnosticCode[]];
|
|
25
|
+
/** The part of the rule a compiled Schema may break and still load. */
|
|
26
|
+
readonly except?: string;
|
|
27
|
+
} | {
|
|
28
|
+
/** The portable value boundary refuses it before admission: `COMPILED_STRUCTURE_INVALID`, caused by one of these. */
|
|
29
|
+
readonly kind: 'portable';
|
|
30
|
+
readonly answers: readonly [BoundaryErrorCode, ...BoundaryErrorCode[]];
|
|
31
|
+
} | {
|
|
32
|
+
/** A compiled Schema has no position for what the rule reads. */
|
|
33
|
+
readonly kind: 'unsayable';
|
|
34
|
+
readonly because: string;
|
|
35
|
+
} | {
|
|
36
|
+
/** A compiled Schema breaking the rule loads, for the reason given. */
|
|
37
|
+
readonly kind: 'unapplied';
|
|
38
|
+
readonly because: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Every rule of a source with how admission of a compiled Schema holds it, frozen. A rule added to
|
|
42
|
+
* the language does not compile until it is placed here.
|
|
43
|
+
*/
|
|
44
|
+
export declare const READMITTED_RULES: Readonly<Record<SchemaDiagnosticCode, ReadmittedRule>>;
|
|
45
|
+
/**
|
|
46
|
+
* Every rule of a value schema with how admission of a compiled Schema holds it, frozen. A rule added
|
|
47
|
+
* to the value language does not compile until it is placed here.
|
|
48
|
+
*/
|
|
49
|
+
export declare const READMITTED_VALUE_RULES: Readonly<Record<Extract<ValueDiagnosticCode, `VS_${string}`>, ReadmittedRule>>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { deepFreeze } from '../language/freeze.js';
|
|
2
|
+
import { limits } from '../language/limits.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every diagnostic code of a compiled Schema with the rule it reports, frozen. A code added here
|
|
5
|
+
* does not compile until it is described.
|
|
6
|
+
*/
|
|
7
|
+
export const COMPILED_RULES = deepFreeze({
|
|
8
|
+
COMPILED_STRUCTURE_INVALID: {
|
|
9
|
+
positions: ['{/path*}'],
|
|
10
|
+
statement: `A compiled Schema is a portable value, has its format and version and exactly the fields of its wire shape, holds each origin once in its closure, spells each Class rule in its normal form, and its root and every pin name a revision of that closure. It holds at most ${limits.closure.members} members and items. An entry past the limits of the canonical encoder has no revision, so it is refused here.`,
|
|
11
|
+
limits: ['closure.members'],
|
|
12
|
+
},
|
|
13
|
+
COMPILED_CANONICAL_MISMATCH: {
|
|
14
|
+
positions: ['/closure/{index}/revision', '/closure/{index}{/path*}/execution/durable'],
|
|
15
|
+
statement: 'A compiled Schema holds the canonical form of what it says: an entry the revision of its own content, a Callable no execution unless durable. What a revision leaves out stands outside this rule: the graph and machines of a value program, the pattern table of an entry, the ordering of a Property and the input fields of a Callable are derived from what the revision covers, so a document saying otherwise loads and answers as that part says.',
|
|
16
|
+
},
|
|
17
|
+
COMPILED_DEPENDENCY_LIMITS: {
|
|
18
|
+
positions: ['/closure', '/closure/{index}/dependencies'],
|
|
19
|
+
statement: `A compiled Schema has a closure of at most ${limits.dependency.closure} Domains, each with at most ${limits.dependency.direct} direct dependencies, at most ${limits.dependency.depth} deep.`,
|
|
20
|
+
limits: ['dependency.closure', 'dependency.direct', 'dependency.depth'],
|
|
21
|
+
},
|
|
22
|
+
COMPILED_SOURCE_INVALID: {
|
|
23
|
+
positions: ['/closure/{index}{/path*}'],
|
|
24
|
+
statement: 'A compiled entry holds the rules of the language `READMITTED_RULES` places under this code: admission applies them to it again.',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const WIRE = { kind: 'refused', answers: ['COMPILED_STRUCTURE_INVALID'] };
|
|
28
|
+
const SOURCE = { kind: 'refused', answers: ['COMPILED_SOURCE_INVALID'] };
|
|
29
|
+
const WIRE_OR_SOURCE = {
|
|
30
|
+
kind: 'refused',
|
|
31
|
+
answers: ['COMPILED_STRUCTURE_INVALID', 'COMPILED_SOURCE_INVALID'],
|
|
32
|
+
};
|
|
33
|
+
const PORTABLE = {
|
|
34
|
+
kind: 'portable',
|
|
35
|
+
answers: [
|
|
36
|
+
'VALUE_TYPE',
|
|
37
|
+
'VALUE_NUMBER',
|
|
38
|
+
'VALUE_STRING',
|
|
39
|
+
'VALUE_ARRAY',
|
|
40
|
+
'VALUE_OBJECT',
|
|
41
|
+
'VALUE_CYCLE',
|
|
42
|
+
'VALUE_LIMIT',
|
|
43
|
+
'VALUE_REFLECTION',
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Every rule of a source with how admission of a compiled Schema holds it, frozen. A rule added to
|
|
48
|
+
* the language does not compile until it is placed here.
|
|
49
|
+
*/
|
|
50
|
+
export const READMITTED_RULES = deepFreeze({
|
|
51
|
+
UNSUPPORTED_DOCUMENT_FORMAT: WIRE,
|
|
52
|
+
UNSUPPORTED_DSL_VERSION: WIRE,
|
|
53
|
+
DV_JSON_VALUE: PORTABLE,
|
|
54
|
+
STRUCTURE_BINARY_INPUT: WIRE,
|
|
55
|
+
STRUCTURE_CALLABLE_POLICY_AUTH: WIRE,
|
|
56
|
+
STRUCTURE_DEPENDENCY_ALIAS: WIRE,
|
|
57
|
+
STRUCTURE_DOMAIN_NAME: WIRE,
|
|
58
|
+
STRUCTURE_DUPLICATE_ITEM: WIRE,
|
|
59
|
+
STRUCTURE_EDGE_BLOB: {
|
|
60
|
+
kind: 'unapplied',
|
|
61
|
+
because: 'Admission does not read the value kind of an Edge Property.',
|
|
62
|
+
},
|
|
63
|
+
STRUCTURE_EDGE_ORIENTATION: WIRE,
|
|
64
|
+
STRUCTURE_FORMAT: WIRE,
|
|
65
|
+
STRUCTURE_KEY: WIRE,
|
|
66
|
+
STRUCTURE_MAXIMUM: WIRE,
|
|
67
|
+
STRUCTURE_MINIMUM: WIRE,
|
|
68
|
+
STRUCTURE_PROPERTY_KEY: WIRE_OR_SOURCE,
|
|
69
|
+
STRUCTURE_PROTO_KEY: WIRE,
|
|
70
|
+
STRUCTURE_REQUIRED: WIRE,
|
|
71
|
+
STRUCTURE_STATE_TRANSITIONS: SOURCE,
|
|
72
|
+
STRUCTURE_TYPE: WIRE,
|
|
73
|
+
STRUCTURE_UNION: WIRE,
|
|
74
|
+
STRUCTURE_UNKNOWN_FIELD: WIRE_OR_SOURCE,
|
|
75
|
+
STRUCTURE_VALUE: WIRE,
|
|
76
|
+
DV_ACCEPTANCE_CONTEXT: {
|
|
77
|
+
kind: 'unsayable',
|
|
78
|
+
because: 'A compiled Schema carries its closure, so no acceptance in this process precedes it.',
|
|
79
|
+
},
|
|
80
|
+
DV_CALLABLE_ADMISSION: SOURCE,
|
|
81
|
+
DV_CALLABLE_AUTH: SOURCE,
|
|
82
|
+
DV_CALLABLE_IO: SOURCE,
|
|
83
|
+
DV_CLASS_ABSTRACT: SOURCE,
|
|
84
|
+
DV_CLASS_ACYCLIC: SOURCE,
|
|
85
|
+
DV_CLASS_INHERITANCE: SOURCE,
|
|
86
|
+
DV_CLASS_KIND: SOURCE,
|
|
87
|
+
DV_CORE_EDGE_CLASS: SOURCE,
|
|
88
|
+
DV_CORE_EDGE_CONSTRAINTS: SOURCE,
|
|
89
|
+
DV_CORE_EDGE_KEY: SOURCE,
|
|
90
|
+
DV_CORE_EDGE_PROPERTIES: SOURCE,
|
|
91
|
+
DV_CORE_EDGE_UNIQUE: SOURCE,
|
|
92
|
+
DV_CORE_NODE_CLASS: SOURCE,
|
|
93
|
+
DV_CORE_NODE_PROPERTIES: SOURCE,
|
|
94
|
+
DV_CORE_NODE_UNIQUE: SOURCE,
|
|
95
|
+
DV_CORE_REF: SOURCE,
|
|
96
|
+
DV_DATA_COMPOSITION: SOURCE,
|
|
97
|
+
DV_DEPENDENCY_ACYCLIC: WIRE,
|
|
98
|
+
DV_DEPENDENCY_DIRECT: SOURCE,
|
|
99
|
+
DV_DEPENDENCY_EXACT: WIRE,
|
|
100
|
+
DV_DEPENDENCY_LIMITS: { kind: 'refused', answers: ['COMPILED_DEPENDENCY_LIMITS'] },
|
|
101
|
+
DV_DEPENDENCY_REVISION_COHERENCE: WIRE,
|
|
102
|
+
DV_DEPENDENCY_UNIQUE: WIRE,
|
|
103
|
+
DV_DOMAIN_ICON: WIRE,
|
|
104
|
+
DV_EDGE_ACCEPTS: SOURCE,
|
|
105
|
+
DV_EDGE_CLASS_COMPOSITION: SOURCE,
|
|
106
|
+
DV_EDGE_FOREIGN_MINIMUM: {
|
|
107
|
+
kind: 'unapplied',
|
|
108
|
+
because: 'Admission reads an Edge count only against the Core facts of its entry.',
|
|
109
|
+
},
|
|
110
|
+
DV_EDGE_LIFETIME: {
|
|
111
|
+
kind: 'unapplied',
|
|
112
|
+
because: 'Admission reads `onDelete` only as a value of its position.',
|
|
113
|
+
},
|
|
114
|
+
DV_EDGE_ROLE: WIRE,
|
|
115
|
+
DV_EDGE_UNIQUE: SOURCE,
|
|
116
|
+
DV_ENTRYPOINT: WIRE,
|
|
117
|
+
DV_INHERITANCE_LIMITS: SOURCE,
|
|
118
|
+
DV_METHOD_ABSTRACT: SOURCE,
|
|
119
|
+
DV_METHOD_COMPOSITION: SOURCE,
|
|
120
|
+
DV_NODE_UNIQUE: SOURCE,
|
|
121
|
+
DV_PROPERTY_AUTO: SOURCE,
|
|
122
|
+
DV_PROPERTY_IMMUTABLE: SOURCE,
|
|
123
|
+
DV_PROPERTY_STATE: SOURCE,
|
|
124
|
+
DV_REF_RESOLVES: WIRE_OR_SOURCE,
|
|
125
|
+
DV_VALUE_SCHEMA: {
|
|
126
|
+
kind: 'refused',
|
|
127
|
+
answers: ['COMPILED_STRUCTURE_INVALID', 'COMPILED_SOURCE_INVALID'],
|
|
128
|
+
except: 'Every rule of a value schema but its pattern sources, its numbers and what deriving its graph reads, as `READMITTED_VALUE_RULES` places each.',
|
|
129
|
+
},
|
|
130
|
+
PL_BUDGET: SOURCE,
|
|
131
|
+
PL_COMPOSITION: SOURCE,
|
|
132
|
+
PL_CONNECTIVITY: SOURCE,
|
|
133
|
+
PL_REF: SOURCE,
|
|
134
|
+
PL_REPEAT: WIRE,
|
|
135
|
+
PL_TARGET: SOURCE,
|
|
136
|
+
PL_TYPING: SOURCE,
|
|
137
|
+
PL_USE: SOURCE,
|
|
138
|
+
PL_VARIABLE_SCOPE: SOURCE,
|
|
139
|
+
});
|
|
140
|
+
const VALUE_INDICES = {
|
|
141
|
+
kind: 'unapplied',
|
|
142
|
+
because: 'Admission derives the graph, the machines and the ordering of a value program from its root schema, which it evaluates as it stands.',
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Every rule of a value schema with how admission of a compiled Schema holds it, frozen. A rule added
|
|
146
|
+
* to the value language does not compile until it is placed here.
|
|
147
|
+
*/
|
|
148
|
+
export const READMITTED_VALUE_RULES = deepFreeze({
|
|
149
|
+
VS_DIALECT: VALUE_INDICES,
|
|
150
|
+
VS_DYNAMIC_FORBIDDEN: VALUE_INDICES,
|
|
151
|
+
VS_KEYWORD_CLOSED: VALUE_INDICES,
|
|
152
|
+
VS_META_SCHEMA: {
|
|
153
|
+
kind: 'refused',
|
|
154
|
+
answers: ['COMPILED_SOURCE_INVALID'],
|
|
155
|
+
except: 'Every other form of a keyword: its graph derives all the same.',
|
|
156
|
+
},
|
|
157
|
+
VS_NUMBER_DOMAIN: PORTABLE,
|
|
158
|
+
VS_PATH_EXTENSION: VALUE_INDICES,
|
|
159
|
+
VS_RECURSION_PRODUCTIVE: SOURCE,
|
|
160
|
+
VS_REFERENCE_FORM: SOURCE,
|
|
161
|
+
VS_REFERENCE_RESOLUTION: SOURCE,
|
|
162
|
+
VS_REGEX_PORTABLE: SOURCE,
|
|
163
|
+
VS_RESOURCE_ID: VALUE_INDICES,
|
|
164
|
+
VS_VALUE_KIND: VALUE_INDICES,
|
|
165
|
+
VS_VALUE_KIND_JSON: {
|
|
166
|
+
kind: 'unapplied',
|
|
167
|
+
because: 'It warns the author of a source, and a compiled Schema has no author to warn.',
|
|
168
|
+
},
|
|
169
|
+
});
|
package/dist/v1/domain/create.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Key, MethodKey } from '../addressing/index.js';
|
|
2
|
+
import { compareCodeUnits } from '../addressing/ordering.js';
|
|
2
3
|
import { frozenRecord } from './namespace/member-collection.js';
|
|
3
4
|
import { createClasses } from './projection/classes.js';
|
|
4
5
|
const admittedDomains = new WeakSet();
|
|
@@ -43,7 +44,7 @@ export function createDomain(input) {
|
|
|
43
44
|
const visibleOrigins = new Set(visibleEntries.map(({ origin }) => origin));
|
|
44
45
|
const local = [...definitionsByKey.values()]
|
|
45
46
|
.filter(({ ref }) => ref.origin === entry.origin)
|
|
46
|
-
.sort((left, right) =>
|
|
47
|
+
.sort((left, right) => compareCodeUnits(left.key, right.key));
|
|
47
48
|
const classes = namespace(local, 'class');
|
|
48
49
|
const functions = namespace(local, 'function');
|
|
49
50
|
const policies = namespace(local, 'policy');
|
|
@@ -86,7 +87,7 @@ export function createDomain(input) {
|
|
|
86
87
|
revision: entry.revision,
|
|
87
88
|
closure: Object.freeze(visibleEntries
|
|
88
89
|
.map(({ origin, revision }) => Object.freeze({ origin, revision }))
|
|
89
|
-
.sort((left, right) =>
|
|
90
|
+
.sort((left, right) => compareCodeUnits(left.origin, right.origin))),
|
|
90
91
|
dependencies,
|
|
91
92
|
classes,
|
|
92
93
|
functions,
|
|
@@ -122,7 +123,7 @@ function createDefinitions(declarations, classesByKey, input) {
|
|
|
122
123
|
continue;
|
|
123
124
|
if (isFunctionDefinition(definition)) {
|
|
124
125
|
const key = Key.of(definition.ref);
|
|
125
|
-
const
|
|
126
|
+
const { fields, validateInput, validateInputField, validateOutput } = input.validation.callable(key);
|
|
126
127
|
const resolved = Object.freeze({
|
|
127
128
|
ref: definition.ref,
|
|
128
129
|
key,
|
|
@@ -130,13 +131,14 @@ function createDefinitions(declarations, classesByKey, input) {
|
|
|
130
131
|
input: definition.input,
|
|
131
132
|
output: definition.output,
|
|
132
133
|
...(definition.execution === undefined ? {} : { execution: definition.execution }),
|
|
134
|
+
...(definition.admission === undefined ? {} : { admission: definition.admission }),
|
|
133
135
|
auth: definition.auth,
|
|
134
136
|
policy: definition.policy,
|
|
135
|
-
...(
|
|
137
|
+
...(fields === undefined ? {} : { inputFields: fields }),
|
|
136
138
|
definition,
|
|
137
|
-
validateInput
|
|
138
|
-
validateInputField
|
|
139
|
-
validateOutput
|
|
139
|
+
validateInput,
|
|
140
|
+
validateInputField,
|
|
141
|
+
validateOutput,
|
|
140
142
|
});
|
|
141
143
|
definitionsByKey.set(key, resolved);
|
|
142
144
|
continue;
|
|
@@ -249,6 +251,3 @@ function isViewDefinition(value) {
|
|
|
249
251
|
function isCoreDefinition(value) {
|
|
250
252
|
return value.ref.kind === 'core';
|
|
251
253
|
}
|
|
252
|
-
function compare(left, right) {
|
|
253
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
254
|
-
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { DefinitionKey, DefinitionRef, Key, Revision } from '../../addressing/index.js';
|
|
2
2
|
import type { DomainDependency } from '../../addressing/index.js';
|
|
3
|
-
import type { MethodOwnerKeyOf, ResolvedCallable, ResolvedFunction } from '../../language/
|
|
4
|
-
import type { AnyResolvedClass } from '../../language/class/resolved.js';
|
|
5
|
-
import type { ResolvedCoreDefinition, ResolvedCoreEdge } from '../../language/core/resolved.js';
|
|
6
|
-
import type { ResolvedPolicy } from '../../language/policy/resolved.js';
|
|
7
|
-
import type { ResolvedDefinition, ResolvedDefinitionOf } from '../../language/resolved.js';
|
|
8
|
-
import type { ResolvedView } from '../../language/view/resolved.js';
|
|
3
|
+
import type { AnyResolvedClass, MethodOwnerKeyOf, PropertyInputOf, ResolvedCallable, ResolvedCoreDefinition, ResolvedCoreEdge, ResolvedDefinition, ResolvedDefinitionOf, ResolvedFunction, ResolvedPolicy, ResolvedView } from '../../language/index.js';
|
|
9
4
|
export type ClassNamespace<Classes extends Readonly<Record<string, unknown>> = Readonly<Record<string, AnyResolvedClass>>> = Readonly<Classes>;
|
|
10
5
|
export type FunctionNamespace<Functions extends Readonly<Record<string, unknown>> = Readonly<Record<string, ResolvedFunction>>> = Readonly<Functions>;
|
|
11
6
|
export type PolicyNamespace<Policies extends Readonly<Record<string, unknown>> = Readonly<Record<string, ResolvedPolicy>>> = Readonly<Policies>;
|
|
@@ -53,6 +48,6 @@ export type MethodOwnerOf<Work extends Domain, Method> = Extract<ClassesOf<Work>
|
|
|
53
48
|
export type FunctionsOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, infer Functions> ? Functions : never;
|
|
54
49
|
export type PoliciesOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, infer Policies> ? Policies : never;
|
|
55
50
|
export type ViewsOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, infer Views> ? Views : never;
|
|
56
|
-
export type PropertyInputFor<Class extends AnyResolvedClass> =
|
|
51
|
+
export type PropertyInputFor<Class extends AnyResolvedClass> = PropertyInputOf<Class>;
|
|
57
52
|
export type PropertyValuesFor<Class extends AnyResolvedClass> = ReturnType<Class['properties']['from']>;
|
|
58
53
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StructuralOptions } from '@astrale-os/kernel-dsl/value';
|
|
1
2
|
import type { Key as AddressKey, PropertyKey, Revision } from '../../addressing/index.js';
|
|
2
3
|
import type { DomainDependency, DomainDependencyMap } from '../../addressing/index.js';
|
|
3
4
|
import type { CoreEdge } from '../../language/core/model/core.js';
|
|
@@ -21,14 +22,18 @@ export interface DomainInput {
|
|
|
21
22
|
}
|
|
22
23
|
/** Already-bound validation semantics supplied by source compilation or compiled loading. */
|
|
23
24
|
export interface DomainValidation {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
property(key: PropertyKey): PropertyValidation;
|
|
26
|
+
callable(key: AddressKey.Callable): CallableValidation;
|
|
27
|
+
}
|
|
28
|
+
export interface PropertyValidation {
|
|
29
|
+
readonly ordering?: OrderingKind;
|
|
30
|
+
validate(input: unknown): readonly Diagnostic[];
|
|
31
|
+
/** The admitted program `validate` evaluates. */
|
|
32
|
+
program(): ValueProgram;
|
|
33
|
+
}
|
|
34
|
+
export interface CallableValidation {
|
|
35
|
+
readonly fields?: readonly string[];
|
|
36
|
+
validateInput(input: unknown, options?: StructuralOptions): readonly Diagnostic[];
|
|
37
|
+
validateInputField(field: string, input: unknown): readonly Diagnostic[];
|
|
38
|
+
validateOutput(output: unknown): readonly Diagnostic[];
|
|
34
39
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { PropertyKey as PropertyKeyValue } from '../../addressing/index.js';
|
|
2
|
+
import { compareCodeUnits } from '../../addressing/ordering.js';
|
|
2
3
|
import { createPropertyValues } from '../../language/class/property-values.js';
|
|
4
|
+
import { isBlobReceipt, isBlobValueSchema } from '../../language/value/model/blob.js';
|
|
3
5
|
const PROPERTY_OPERATIONS = new Set(['byKey', 'get', 'from']);
|
|
4
6
|
const METHOD_OPERATIONS = new Set(['byKey', 'get']);
|
|
5
7
|
export function createPropertyCollection(values) {
|
|
6
|
-
const ordered = [...values].sort((left, right) =>
|
|
8
|
+
const ordered = [...values].sort((left, right) => compareCodeUnits(left.key, right.key));
|
|
7
9
|
const byKey = frozenRecord(ordered.map((value) => [value.key, value]));
|
|
8
10
|
const named = uniqueNames(ordered);
|
|
9
11
|
const collection = {
|
|
@@ -22,7 +24,9 @@ export function createPropertyCollection(values) {
|
|
|
22
24
|
if (entries.has(property.key)) {
|
|
23
25
|
throw new TypeError(`Property ${property.key} is supplied through both ${JSON.stringify(source.get(property.key))} and ${JSON.stringify(candidate)}.`);
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
// A receipt stands in for a blob's Ref until a write; only the issuing Kernel can judge it.
|
|
28
|
+
const receipt = isBlobReceipt(value) && isBlobValueSchema(property.definition.schema);
|
|
29
|
+
const diagnostics = receipt ? [] : property.validate(value);
|
|
26
30
|
if (diagnostics.length > 0) {
|
|
27
31
|
throw new TypeError(`Invalid value for Property ${property.key}: ${diagnostics.map(({ message }) => message).join('; ')}`);
|
|
28
32
|
}
|
|
@@ -39,7 +43,7 @@ export function createPropertyCollection(values) {
|
|
|
39
43
|
return Object.freeze(collection);
|
|
40
44
|
}
|
|
41
45
|
export function createMethodCollection(values) {
|
|
42
|
-
const ordered = [...values].sort((left, right) =>
|
|
46
|
+
const ordered = [...values].sort((left, right) => compareCodeUnits(left.key, right.key));
|
|
43
47
|
const byKey = frozenRecord(ordered.map((value) => [value.key, value]));
|
|
44
48
|
const named = uniqueNames(ordered);
|
|
45
49
|
const collection = {
|
|
@@ -71,11 +75,8 @@ function installShortcuts(target, named, reserved) {
|
|
|
71
75
|
}
|
|
72
76
|
export function frozenRecord(entries) {
|
|
73
77
|
const output = Object.create(null);
|
|
74
|
-
for (const [key, value] of [...entries].sort(([left], [right]) =>
|
|
78
|
+
for (const [key, value] of [...entries].sort(([left], [right]) => compareCodeUnits(left, right))) {
|
|
75
79
|
Object.defineProperty(output, key, { enumerable: true, value });
|
|
76
80
|
}
|
|
77
81
|
return Object.freeze(output);
|
|
78
82
|
}
|
|
79
|
-
function compare(left, right) {
|
|
80
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
81
|
-
}
|
|
@@ -38,15 +38,15 @@ export function createClasses(definitions, validation) {
|
|
|
38
38
|
const ownProperties = [];
|
|
39
39
|
for (const [name, propertyDefinition] of Object.entries(definition.properties)) {
|
|
40
40
|
const propertyKey = PropertyKeyValue.of(ref, name);
|
|
41
|
-
const ordering = validation.
|
|
41
|
+
const { ordering, validate, program } = validation.property(propertyKey);
|
|
42
42
|
const property = Object.freeze({
|
|
43
43
|
owner: shell,
|
|
44
44
|
name,
|
|
45
45
|
key: propertyKey,
|
|
46
46
|
definition: propertyDefinition,
|
|
47
47
|
...(ordering === undefined ? {} : { ordering }),
|
|
48
|
-
validate
|
|
49
|
-
program
|
|
48
|
+
validate,
|
|
49
|
+
program,
|
|
50
50
|
});
|
|
51
51
|
ownProperties.push(property);
|
|
52
52
|
effectiveProperties.set(property.key, property);
|
|
@@ -59,7 +59,7 @@ export function createClasses(definitions, validation) {
|
|
|
59
59
|
if (definition.kind === 'node') {
|
|
60
60
|
for (const [name, methodDefinition] of Object.entries(definition.methods)) {
|
|
61
61
|
const methodKey = MethodKeyValue.of(ref, name);
|
|
62
|
-
const
|
|
62
|
+
const { fields, validateInput, validateInputField, validateOutput } = validation.callable(methodKey);
|
|
63
63
|
const method = Object.freeze({
|
|
64
64
|
owner: shell,
|
|
65
65
|
name,
|
|
@@ -70,16 +70,19 @@ export function createClasses(definitions, validation) {
|
|
|
70
70
|
...(methodDefinition.execution === undefined
|
|
71
71
|
? {}
|
|
72
72
|
: { execution: methodDefinition.execution }),
|
|
73
|
+
...(methodDefinition.admission === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: { admission: methodDefinition.admission }),
|
|
73
76
|
auth: methodDefinition.auth,
|
|
74
77
|
policy: methodDefinition.policy,
|
|
75
78
|
static: methodDefinition.static,
|
|
76
79
|
abstract: methodDefinition.abstract,
|
|
77
80
|
executable: isMethodExecutable(definition, methodDefinition),
|
|
78
|
-
...(
|
|
81
|
+
...(fields === undefined ? {} : { inputFields: fields }),
|
|
79
82
|
definition: methodDefinition,
|
|
80
|
-
validateInput
|
|
81
|
-
validateInputField
|
|
82
|
-
validateOutput
|
|
83
|
+
validateInput,
|
|
84
|
+
validateInputField,
|
|
85
|
+
validateOutput,
|
|
83
86
|
});
|
|
84
87
|
(methodDefinition.static ? ownStaticMethods : ownInstanceMethods).push(method);
|
|
85
88
|
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import type { Key, PropertyKey } from '../../addressing/index.js';
|
|
2
2
|
import type { Diagnostic } from '../../language/validation/diagnostic.js';
|
|
3
3
|
import type { ValueProgram } from '../../language/value/compile/model.js';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
program(): ValueProgram;
|
|
10
|
-
}
|
|
11
|
-
export interface CallableValidation {
|
|
12
|
-
readonly fields?: readonly string[];
|
|
13
|
-
validateInput(input: unknown): readonly Diagnostic[];
|
|
14
|
-
validateInputField(field: string, input: unknown): readonly Diagnostic[];
|
|
15
|
-
validateOutput(output: unknown): readonly Diagnostic[];
|
|
16
|
-
}
|
|
17
|
-
/** Build the one Domain-level router shared by source resolution and compiled loading. */
|
|
4
|
+
import type { CallableValidation, DomainValidation, PropertyValidation } from '../model/input.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build the one Domain-level router shared by source resolution and compiled loading. The Domain
|
|
7
|
+
* built from the same entries asks only for the Properties and Callables they declare.
|
|
8
|
+
*/
|
|
18
9
|
export declare function createDomainValidation(properties: ReadonlyMap<PropertyKey, PropertyValidation>, callables: ReadonlyMap<Key.Callable, CallableValidation>): DomainValidation;
|
|
19
|
-
|
|
20
|
-
export declare function
|
|
10
|
+
/** Validate one input field against the nodes its input names it by: only its own names are fields. */
|
|
11
|
+
export declare function validateInputField(input: ValueProgram, fields: Readonly<Record<string, readonly number[]>> | undefined, field: string, value: unknown): readonly Diagnostic[];
|
|
@@ -1,87 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { validateValueProgram } from '../../language/value/evaluate/program.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build the one Domain-level router shared by source resolution and compiled loading. The Domain
|
|
4
|
+
* built from the same entries asks only for the Properties and Callables they declare.
|
|
5
|
+
*/
|
|
2
6
|
export function createDomainValidation(properties, callables) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return target === undefined ? unknownTarget('Property', key) : target.validate(input);
|
|
8
|
-
},
|
|
9
|
-
propertyProgram(key) {
|
|
10
|
-
const target = properties.get(key);
|
|
11
|
-
if (target === undefined)
|
|
12
|
-
throw new TypeError(`Property ${key} is absent.`);
|
|
13
|
-
return target.program();
|
|
14
|
-
},
|
|
15
|
-
propertyOrdering: (key) => properties.get(key)?.ordering,
|
|
16
|
-
callableExists: (key) => callables.has(key),
|
|
17
|
-
callableInput(key, input) {
|
|
18
|
-
const target = callables.get(key);
|
|
19
|
-
return target === undefined ? unknownTarget('Callable', key) : target.validateInput(input);
|
|
20
|
-
},
|
|
21
|
-
callableFields: (key) => callables.get(key)?.fields,
|
|
22
|
-
callableInputField(key, field, input) {
|
|
23
|
-
const target = callables.get(key);
|
|
24
|
-
return target === undefined
|
|
25
|
-
? unknownTarget('Callable', key)
|
|
26
|
-
: target.validateInputField(field, input);
|
|
27
|
-
},
|
|
28
|
-
callableOutput(key, output) {
|
|
29
|
-
const target = callables.get(key);
|
|
30
|
-
return target === undefined ? unknownTarget('Callable', key) : target.validateOutput(output);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
return Object.freeze(validation);
|
|
7
|
+
return Object.freeze({
|
|
8
|
+
property: (key) => properties.get(key) ?? absentProperty(key),
|
|
9
|
+
callable: (key) => callables.get(key) ?? absentCallable(key),
|
|
10
|
+
});
|
|
34
11
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const owner = values.find((value) => value.propertyExists(key));
|
|
40
|
-
return owner === undefined ? unknownTarget('Property', key) : owner.property(key, input);
|
|
41
|
-
},
|
|
42
|
-
propertyProgram(key) {
|
|
43
|
-
const owner = values.find((value) => value.propertyExists(key));
|
|
44
|
-
if (owner === undefined)
|
|
45
|
-
throw new TypeError(`Property ${key} is absent.`);
|
|
46
|
-
return owner.propertyProgram(key);
|
|
47
|
-
},
|
|
48
|
-
propertyOrdering: (key) => values.find((value) => value.propertyExists(key))?.propertyOrdering(key),
|
|
49
|
-
callableExists: (key) => values.some((value) => value.callableExists(key)),
|
|
50
|
-
callableInput(key, input) {
|
|
51
|
-
const owner = values.find((value) => value.callableExists(key));
|
|
52
|
-
return owner === undefined ? unknownTarget('Callable', key) : owner.callableInput(key, input);
|
|
53
|
-
},
|
|
54
|
-
callableFields: (key) => values.find((value) => value.callableExists(key))?.callableFields(key),
|
|
55
|
-
callableInputField(key, field, input) {
|
|
56
|
-
const owner = values.find((value) => value.callableExists(key));
|
|
57
|
-
return owner === undefined
|
|
58
|
-
? unknownTarget('Callable', key)
|
|
59
|
-
: owner.callableInputField(key, field, input);
|
|
60
|
-
},
|
|
61
|
-
callableOutput(key, output) {
|
|
62
|
-
const owner = values.find((value) => value.callableExists(key));
|
|
63
|
-
return owner === undefined
|
|
64
|
-
? unknownTarget('Callable', key)
|
|
65
|
-
: owner.callableOutput(key, output);
|
|
66
|
-
},
|
|
12
|
+
// An absent entry fails only when it is asked to validate, never when it is looked up.
|
|
13
|
+
function absentProperty(key) {
|
|
14
|
+
const absent = () => {
|
|
15
|
+
throw new TypeError(`Property ${key} is absent.`);
|
|
67
16
|
};
|
|
68
|
-
return Object.freeze(
|
|
17
|
+
return Object.freeze({ validate: absent, program: absent });
|
|
69
18
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
19
|
+
function absentCallable(key) {
|
|
20
|
+
const absent = () => {
|
|
21
|
+
throw new TypeError(`Callable ${key} is absent.`);
|
|
22
|
+
};
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
validateInput: absent,
|
|
25
|
+
validateInputField: absent,
|
|
26
|
+
validateOutput: absent,
|
|
27
|
+
});
|
|
78
28
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
29
|
+
/** Validate one input field against the nodes its input names it by: only its own names are fields. */
|
|
30
|
+
export function validateInputField(input, fields, field, value) {
|
|
31
|
+
if (fields === undefined || !Object.hasOwn(fields, field)) {
|
|
32
|
+
return [
|
|
33
|
+
Object.freeze({
|
|
34
|
+
code: 'CALLABLE_INPUT_FIELD_UNKNOWN',
|
|
35
|
+
pointer: '',
|
|
36
|
+
message: `Input field ${field} is absent.`,
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
return validateValueProgram(input, value, fields[field]);
|
|
87
41
|
}
|
package/dist/v1/index.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/** Stable aggregate facade for the V1 language. */
|
|
2
|
-
export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
|
|
2
|
+
export { auto, core, defineClass, defineSchema, edgeClass, file, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
|
|
3
3
|
export { stateMachine } from './language/state/index.js';
|
|
4
4
|
export { isBinaryInput } from './language/callable/model/callable.js';
|
|
5
5
|
export type { EventOf, StateMachine, StateOf } from './language/state/index.js';
|
|
6
6
|
export { PropertyValues } from './language/index.js';
|
|
7
7
|
export * as metadata from './language/definition/metadata.js';
|
|
8
|
-
export type {
|
|
8
|
+
export type { DomainIcon, DomainIconArt } from './language/definition/metadata.js';
|
|
9
|
+
export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableInputModeOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, Inheritance, BinaryInput, BinaryInputProjection, CallableInputContract, MethodDefinition, MethodOwnerKeyOf, CallablePolicy, ClassPolicy, ClassRuleChecks, ClassRuleObject, ClassWritePolicy, CreateRuleChecks, EdgeClassPolicy, EdgeClassWritePolicy, EdgeRuleChecks, NodeClassCreatePolicy, NodeClassPolicy, NodeClassWritePolicy, PolicyCheckExpression, PolicyDefinition, PropertyImmutability, PropertyInputOf, PropertyAccessOf, PropertyOutputOf, PropertyShortcutsOf, PropertyValuesOf, ResolvedClass, ResolvedCoreDefinition, ResolvedCoreEndpoint, ResolvedData, ResolvedFunction, ExecutableMethod, ResolvedMethod, ResolvedMethodCollection, ResolvedPolicy, ResolvedProperty, ResolvedView, MethodAccessOf, SelfMethodsOf, SelfPropertiesOf, SelfStaticMethodsOf, StaticMethodsOf, ViewDefinition, } from './language/index.js';
|
|
9
10
|
export { acceptDefinitionRef, callableAddress, ClassKey, equalDefinitionRefs, isDefinitionRef, Key, MethodKey, PropertyKey, } from './addressing/index.js';
|
|
10
11
|
export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodAddress, PolicyRef, Revision, ViewRef, } from './addressing/index.js';
|
|
11
12
|
export type { Definition } from './language/index.js';
|
|
12
13
|
export type { Domain, MethodOwnerOf, SourceDomain } from './domain/index.js';
|
|
13
14
|
export { isDomain } from './domain/index.js';
|
|
14
15
|
export type * as builder from './builder/index.js';
|
|
15
|
-
export type { PathAuthoring, TypedValueSchema } from './builder/index.js';
|
|
16
|
+
export type { FileAuthoring, PathAuthoring, TypedValueSchema } from './builder/index.js';
|
|
16
17
|
export type { PropertyValues as PropertyValuesValue } from './language/index.js';
|
|
18
|
+
export type { BlobReceipt, BlobRef } from './language/value/model/blob.js';
|
|
17
19
|
export type { CompiledSchema } from './compiled/index.js';
|
|
18
20
|
export * as schema from './schema/index.js';
|
|
19
21
|
export * as bundle from './bundle/index.js';
|
package/dist/v1/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Stable aggregate facade for the V1 language. */
|
|
2
|
-
export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
|
|
2
|
+
export { auto, core, defineClass, defineSchema, edgeClass, file, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
|
|
3
3
|
export { stateMachine } from './language/state/index.js';
|
|
4
4
|
export { isBinaryInput } from './language/callable/model/callable.js';
|
|
5
5
|
export { PropertyValues } from './language/index.js';
|