@astrale-os/kernel-dsl 1.0.0-beta.3 → 1.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v1/addressing/class-key.js +3 -3
- package/dist/v1/addressing/definition-ref.js +21 -37
- package/dist/v1/addressing/domain-dependency.d.ts +0 -6
- package/dist/v1/addressing/domain-dependency.js +1 -6
- package/dist/v1/addressing/key.d.ts +4 -1
- package/dist/v1/addressing/key.js +23 -3
- package/dist/v1/addressing/ordering.d.ts +2 -0
- package/dist/v1/addressing/ordering.js +2 -0
- package/dist/v1/addressing/patterns.d.ts +1 -1
- package/dist/v1/addressing/patterns.js +2 -6
- package/dist/v1/builder/callable/authoring.d.ts +11 -5
- package/dist/v1/builder/callable/authoring.js +2 -0
- package/dist/v1/builder/class/authoring.d.ts +94 -224
- package/dist/v1/builder/class/authoring.js +30 -35
- package/dist/v1/builder/class/handle.d.ts +27 -0
- package/dist/v1/builder/class/handle.js +1 -0
- package/dist/v1/builder/class/input.d.ts +159 -0
- package/dist/v1/builder/class/projection.d.ts +129 -0
- package/dist/v1/builder/class/projection.js +1 -0
- package/dist/v1/builder/class/property.d.ts +3 -9
- package/dist/v1/builder/class/property.js +1 -0
- package/dist/v1/builder/core/authoring.d.ts +1 -1
- package/dist/v1/builder/index.d.ts +10 -2
- package/dist/v1/builder/index.js +2 -0
- package/dist/v1/builder/lowering/callable.js +1 -0
- package/dist/v1/builder/lowering/class.d.ts +9 -1
- package/dist/v1/builder/lowering/class.js +62 -17
- package/dist/v1/builder/lowering/policy.js +6 -24
- package/dist/v1/builder/lowering/property-keys.d.ts +27 -0
- package/dist/v1/builder/lowering/property-keys.js +108 -0
- package/dist/v1/builder/lowering/schema/compile.js +13 -6
- package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
- package/dist/v1/builder/lowering/schema/context.js +36 -7
- package/dist/v1/builder/lowering/schema/lifetime.d.ts +11 -0
- package/dist/v1/builder/lowering/schema/lifetime.js +55 -0
- package/dist/v1/builder/lowering/value/compile.js +29 -22
- package/dist/v1/builder/lowering/value/file.d.ts +7 -0
- package/dist/v1/builder/lowering/value/file.js +14 -0
- package/dist/v1/builder/lowering/value/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +41 -7
- package/dist/v1/builder/policy/authoring.d.ts +80 -9
- package/dist/v1/builder/policy/authoring.js +99 -68
- package/dist/v1/builder/policy/legacy/edge.d.ts +28 -0
- package/dist/v1/builder/policy/legacy/edge.js +16 -0
- package/dist/v1/builder/schema/define.d.ts +0 -1
- package/dist/v1/builder/schema/diagnostic.d.ts +3 -2
- package/dist/v1/builder/schema/diagnostic.js +5 -10
- package/dist/v1/builder/schema/input.d.ts +4 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
- package/dist/v1/builder/schema/projection/class.d.ts +78 -16
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/domain.d.ts +13 -2
- package/dist/v1/builder/schema/projection/identity.d.ts +74 -9
- package/dist/v1/builder/schema/projection/model.d.ts +4 -2
- package/dist/v1/builder/schema/projection/property.d.ts +38 -4
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +5 -4
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- package/dist/v1/builder/schema/rule.d.ts +316 -0
- package/dist/v1/builder/schema/rule.js +192 -0
- package/dist/v1/builder/value/file.d.ts +34 -0
- package/dist/v1/builder/value/file.js +77 -0
- package/dist/v1/builder/value/full-match.d.ts +0 -1
- package/dist/v1/builder/value/full-match.js +0 -1
- package/dist/v1/builder/value/path-metadata.d.ts +1 -1
- package/dist/v1/builder/value/path.d.ts +1 -1
- package/dist/v1/bundle/codec.js +55 -74
- package/dist/v1/bundle/diagnostic.d.ts +3 -1
- package/dist/v1/bundle/diagnostic.js +9 -7
- package/dist/v1/bundle/index.d.ts +2 -0
- package/dist/v1/bundle/index.js +1 -0
- package/dist/v1/bundle/model.js +1 -1
- package/dist/v1/bundle/rule.d.ts +14 -0
- package/dist/v1/bundle/rule.js +41 -0
- package/dist/v1/bundle/structure.js +6 -8
- package/dist/v1/compiled/admission/accept.js +9 -15
- package/dist/v1/compiled/admission/closure.js +17 -34
- package/dist/v1/compiled/admission/diagnostic.d.ts +23 -1
- package/dist/v1/compiled/admission/diagnostic.js +40 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +7 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +48 -19
- package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
- package/dist/v1/compiled/admission/semantics/core.js +56 -24
- package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
- package/dist/v1/compiled/admission/semantics/edge.js +6 -65
- package/dist/v1/compiled/admission/semantics/policy/admit.js +4 -19
- package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -5
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
- package/dist/v1/compiled/admission/semantics/policy/parity.js +44 -53
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +7 -21
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
- package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
- package/dist/v1/compiled/admission/wire/callable.d.ts +5 -2
- package/dist/v1/compiled/admission/wire/callable.js +24 -20
- package/dist/v1/compiled/admission/wire/class.js +79 -30
- package/dist/v1/compiled/admission/wire/entry.d.ts +1 -1
- package/dist/v1/compiled/admission/wire/entry.js +36 -13
- package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
- package/dist/v1/compiled/admission/wire/policy.js +27 -20
- package/dist/v1/compiled/admission/wire/program.d.ts +13 -3
- package/dist/v1/compiled/admission/wire/program.js +39 -44
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -1
- package/dist/v1/compiled/admission/wire/property.js +8 -5
- package/dist/v1/compiled/admission/wire/value.d.ts +0 -2
- package/dist/v1/compiled/admission/wire/value.js +0 -7
- package/dist/v1/compiled/codec/json.js +4 -3
- package/dist/v1/compiled/compiler/compile.js +15 -33
- package/dist/v1/compiled/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/index.d.ts +2 -0
- package/dist/v1/compiled/index.js +1 -0
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +13 -52
- package/dist/v1/compiled/model/schema.d.ts +3 -0
- package/dist/v1/compiled/rule.d.ts +49 -0
- package/dist/v1/compiled/rule.js +169 -0
- package/dist/v1/domain/create.js +9 -10
- package/dist/v1/domain/model/domain.d.ts +2 -7
- package/dist/v1/domain/model/input.d.ts +19 -10
- package/dist/v1/domain/namespace/member-collection.js +8 -7
- package/dist/v1/domain/projection/classes.js +11 -8
- package/dist/v1/domain/validation/create.d.ts +7 -16
- package/dist/v1/domain/validation/create.js +35 -81
- package/dist/v1/index.d.ts +5 -3
- package/dist/v1/index.js +1 -1
- package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
- package/dist/v1/language/.spec/schemas/value-schema.schema.json +23 -0
- package/dist/v1/language/callable/admission.d.ts +15 -0
- package/dist/v1/language/callable/admission.js +44 -0
- package/dist/v1/language/callable/model/callable.d.ts +10 -0
- package/dist/v1/language/callable/resolved.d.ts +26 -5
- package/dist/v1/language/chain.d.ts +7 -0
- package/dist/v1/language/chain.js +24 -0
- package/dist/v1/language/class/inheritance.d.ts +36 -5
- package/dist/v1/language/class/inheritance.js +85 -1
- package/dist/v1/language/class/lifetime.d.ts +50 -11
- package/dist/v1/language/class/lifetime.js +89 -20
- package/dist/v1/language/class/model/class.d.ts +45 -9
- package/dist/v1/language/class/model/edge.d.ts +31 -2
- package/dist/v1/language/class/model/property.d.ts +16 -7
- package/dist/v1/language/class/property-values.js +2 -4
- package/dist/v1/language/class/resolved.d.ts +9 -4
- package/dist/v1/language/class/unique.d.ts +143 -0
- package/dist/v1/language/class/unique.js +264 -0
- package/dist/v1/language/core/facts.d.ts +85 -0
- package/dist/v1/language/core/facts.js +116 -0
- package/dist/v1/language/cycle.d.ts +10 -0
- package/dist/v1/language/cycle.js +30 -0
- package/dist/v1/language/definition/metadata.d.ts +38 -0
- package/dist/v1/language/definition/metadata.js +51 -0
- package/dist/v1/language/freeze.d.ts +5 -0
- package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
- package/dist/v1/language/index.d.ts +7 -2
- package/dist/v1/language/index.js +5 -1
- package/dist/v1/language/limits.d.ts +83 -0
- package/dist/v1/language/limits.js +77 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +8 -8
- package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
- package/dist/v1/language/policy/analysis/budgets.js +140 -20
- package/dist/v1/language/policy/analysis/checks.js +8 -6
- package/dist/v1/language/policy/analysis/composition.d.ts +4 -0
- package/dist/v1/language/policy/analysis/composition.js +11 -0
- package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
- package/dist/v1/language/policy/analysis/typing.js +456 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -9
- package/dist/v1/language/policy/model/policy.js +42 -4
- package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
- package/dist/v1/language/policy/normalization/normalize.js +46 -68
- package/dist/v1/language/suspended.d.ts +7 -0
- package/dist/v1/language/suspended.js +23 -0
- package/dist/v1/language/validation/diagnostic.d.ts +15 -1
- package/dist/v1/language/validation/diagnostic.js +21 -0
- package/dist/v1/language/validation/rule.d.ts +45 -0
- package/dist/v1/language/validation/rule.js +109 -0
- package/dist/v1/language/value/compile/fields.js +16 -16
- package/dist/v1/language/value/compile/load.d.ts +5 -0
- package/dist/v1/language/value/compile/load.js +13 -0
- package/dist/v1/language/value/evaluate/assertions.d.ts +5 -1
- package/dist/v1/language/value/evaluate/assertions.js +19 -8
- package/dist/v1/language/value/evaluate/evaluator.js +117 -120
- package/dist/v1/language/value/evaluate/preparation.d.ts +16 -0
- package/dist/v1/language/value/evaluate/preparation.js +100 -47
- package/dist/v1/language/value/evaluate/program.d.ts +2 -1
- package/dist/v1/language/value/evaluate/program.js +6 -6
- package/dist/v1/language/value/evaluate/validate.d.ts +3 -3
- package/dist/v1/language/value/evaluate/validate.js +15 -11
- package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
- package/dist/v1/language/value/evaluate/validity.optimization.js +338 -0
- package/dist/v1/language/value/files.d.ts +44 -0
- package/dist/v1/language/value/files.js +151 -0
- package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
- package/dist/v1/language/value/inclusion/arrays.js +85 -0
- package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
- package/dist/v1/language/value/inclusion/assertions.js +28 -0
- package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
- package/dist/v1/language/value/inclusion/combinators.js +67 -0
- package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
- package/dist/v1/language/value/inclusion/equivalence.js +76 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +140 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +29 -3
- package/dist/v1/language/value/inclusion/includes.js +58 -723
- package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
- package/dist/v1/language/value/inclusion/keywords.js +31 -0
- package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
- package/dist/v1/language/value/inclusion/kinds.js +57 -0
- package/dist/v1/language/value/inclusion/location.d.ts +24 -0
- package/dist/v1/language/value/inclusion/location.js +66 -0
- package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
- package/dist/v1/language/value/inclusion/numbers.js +41 -0
- package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
- package/dist/v1/language/value/inclusion/objects.js +190 -0
- package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
- package/dist/v1/language/value/inclusion/strings.js +29 -0
- package/dist/v1/language/value/inclusion/types.d.ts +3 -0
- package/dist/v1/language/value/inclusion/types.js +34 -0
- package/dist/v1/language/value/model/blob.d.ts +6 -0
- package/dist/v1/language/value/model/blob.js +8 -0
- package/dist/v1/language/value/model/file.d.ts +41 -0
- package/dist/v1/language/value/model/file.js +122 -0
- package/dist/v1/language/value/ordering.d.ts +14 -0
- package/dist/v1/language/value/ordering.js +144 -77
- package/dist/v1/language/value/profile/canonicalize.d.ts +6 -1
- package/dist/v1/language/value/profile/canonicalize.js +67 -87
- package/dist/v1/language/value/profile/json.validate.d.ts +12 -0
- package/dist/v1/language/value/profile/json.validate.js +18 -5
- package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +1 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.js +21 -5
- package/dist/v1/language/value/profile/rules.js +27 -44
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/profile/vocabulary.d.ts +36 -2
- package/dist/v1/language/value/profile/vocabulary.js +58 -5
- package/dist/v1/language/value/reference/closure.js +6 -6
- package/dist/v1/language/value/reference/recursion.js +9 -48
- package/dist/v1/language/value/reference/references.d.ts +3 -1
- package/dist/v1/language/value/reference/references.js +7 -7
- package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
- package/dist/v1/language/value/reference/registry.index.js +33 -16
- package/dist/v1/language/value/regexp/ast.js +6 -7
- package/dist/v1/language/value/regexp/compile.d.ts +5 -11
- package/dist/v1/language/value/regexp/compile.js +14 -12
- package/dist/v1/language/value/regexp/syntax.js +3 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +1 -1
- package/dist/v1/language/value/regexp/unicode.js +1 -1
- package/dist/v1/language/value/syntax/keywords.d.ts +3 -3
- package/dist/v1/language/value/syntax/keywords.js +4 -20
- package/dist/v1/language/value/syntax/node-path/validate.js +2 -3
- package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
- package/dist/v1/language/value/syntax/pointer.js +5 -2
- package/dist/v1/language/value/syntax/walk.d.ts +9 -0
- package/dist/v1/language/value/syntax/walk.js +37 -20
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2596 -0
- package/dist/v1/schema/admission/accept.d.ts +3 -1
- package/dist/v1/schema/admission/accept.js +6 -14
- package/dist/v1/schema/admission/callable.d.ts +21 -0
- package/dist/v1/schema/admission/callable.js +96 -0
- package/dist/v1/schema/analysis/class.d.ts +4 -0
- package/dist/v1/schema/analysis/class.js +57 -17
- package/dist/v1/schema/canonical/revision.d.ts +4 -1
- package/dist/v1/schema/canonical/revision.js +8 -5
- package/dist/v1/schema/compatibility/api.d.ts +4 -1
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +9 -4
- package/dist/v1/schema/compatibility/comparators/classes.js +50 -29
- package/dist/v1/schema/compatibility/comparators/index.d.ts +1 -1
- package/dist/v1/schema/compatibility/comparators/members.js +1 -1
- package/dist/v1/schema/compatibility/comparators/values.js +2 -2
- package/dist/v1/schema/compatibility/context.d.ts +5 -2
- package/dist/v1/schema/compatibility/context.js +8 -6
- package/dist/v1/schema/compatibility/coordinate.js +3 -3
- package/dist/v1/schema/compatibility/diff.js +2 -4
- package/dist/v1/schema/compatibility/extension.d.ts +11 -0
- package/dist/v1/schema/compatibility/extension.js +22 -0
- package/dist/v1/schema/compatibility/fields.d.ts +20 -4
- package/dist/v1/schema/compatibility/fields.js +13 -3
- package/dist/v1/schema/compatibility/meaning/footprint.js +16 -51
- package/dist/v1/schema/compatibility/model.d.ts +17 -5
- package/dist/v1/schema/compatibility/references.d.ts +0 -3
- package/dist/v1/schema/compatibility/references.js +1 -9
- package/dist/v1/schema/compatibility/report.js +1 -1
- package/dist/v1/schema/compatibility/rule.d.ts +13 -0
- package/dist/v1/schema/compatibility/rule.js +23 -0
- package/dist/v1/schema/compatibility/scope.d.ts +2 -0
- package/dist/v1/schema/compatibility/scope.js +4 -1
- package/dist/v1/schema/compatibility/structure/index.js +6 -4
- package/dist/v1/schema/compatibility/structure/requirements.js +58 -61
- package/dist/v1/schema/compatibility/versioning/index.js +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.js +30 -2
- package/dist/v1/schema/compatibility/walk.d.ts +17 -0
- package/dist/v1/schema/compatibility/walk.js +41 -0
- package/dist/v1/schema/diagnostic.d.ts +17 -3
- package/dist/v1/schema/diagnostic.js +14 -11
- package/dist/v1/schema/enforcement/changes.d.ts +590 -0
- package/dist/v1/schema/enforcement/changes.js +566 -0
- package/dist/v1/schema/enforcement/derived.d.ts +236 -0
- package/dist/v1/schema/enforcement/derived.js +243 -0
- package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
- package/dist/v1/schema/enforcement/dispose.js +275 -0
- package/dist/v1/schema/enforcement/facts.d.ts +89 -0
- package/dist/v1/schema/enforcement/facts.js +70 -0
- package/dist/v1/schema/enforcement/fields.d.ts +65 -0
- package/dist/v1/schema/enforcement/fields.js +36 -0
- package/dist/v1/schema/enforcement/index.d.ts +39 -0
- package/dist/v1/schema/enforcement/index.js +10 -0
- package/dist/v1/schema/enforcement/install.d.ts +1634 -0
- package/dist/v1/schema/enforcement/install.js +1223 -0
- package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
- package/dist/v1/schema/enforcement/lifecycle.js +91 -0
- package/dist/v1/schema/enforcement/model.d.ts +253 -0
- package/dist/v1/schema/enforcement/model.js +1 -0
- package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
- package/dist/v1/schema/enforcement/obligations.js +240 -0
- package/dist/v1/schema/enforcement/write.d.ts +1314 -0
- package/dist/v1/schema/enforcement/write.js +1017 -0
- package/dist/v1/schema/index.d.ts +11 -1
- package/dist/v1/schema/index.js +5 -0
- package/dist/v1/schema/model/schema.d.ts +23 -1
- package/dist/v1/schema/model/schema.js +1 -1
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +50 -13
- package/dist/v1/schema/resolution/closure.js +2 -1
- package/dist/v1/schema/resolution/context.js +17 -18
- package/dist/v1/schema/resolution/domain.d.ts +5 -0
- package/dist/v1/schema/resolution/domain.js +6 -12
- package/dist/v1/schema/resolution/origins.js +6 -8
- package/dist/v1/schema/rule.d.ts +25 -0
- package/dist/v1/schema/rule.js +459 -0
- package/dist/v1/schema/validation/callable.d.ts +35 -2
- package/dist/v1/schema/validation/callable.js +65 -9
- package/dist/v1/schema/validation/class.d.ts +6 -2
- package/dist/v1/schema/validation/class.js +128 -105
- package/dist/v1/schema/validation/core.js +103 -173
- package/dist/v1/schema/validation/domain.js +25 -15
- package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
- package/dist/v1/schema/validation/domain.json-schema.js +222 -0
- package/dist/v1/schema/validation/domain.route.d.ts +6 -1
- package/dist/v1/schema/validation/domain.route.js +18 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +7797 -0
- package/dist/v1/schema/validation/domain.structure.js +516 -160
- package/dist/v1/schema/validation/icon.d.ts +4 -0
- package/dist/v1/schema/validation/icon.js +29 -0
- package/dist/v1/schema/validation/json.json-schema.d.ts +40 -0
- package/dist/v1/schema/validation/json.json-schema.js +46 -0
- package/dist/v1/schema/validation/policy/budgets.d.ts +37 -2
- package/dist/v1/schema/validation/policy/budgets.js +94 -121
- package/dist/v1/schema/validation/policy/context.d.ts +6 -5
- package/dist/v1/schema/validation/policy/context.js +7 -10
- package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
- package/dist/v1/schema/validation/policy/objects.js +6 -14
- package/dist/v1/schema/validation/policy/references.js +20 -62
- package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
- package/dist/v1/schema/validation/policy/typing.js +22 -356
- package/dist/v1/schema/validation/policy/uses.d.ts +40 -3
- package/dist/v1/schema/validation/policy/uses.js +63 -91
- package/dist/v1/schema/validation/policy/validate.js +5 -5
- package/dist/v1/schema/validation/value-api.d.ts +27 -1
- package/dist/v1/schema/validation/value-api.js +37 -2
- package/dist/v1/schema/validation/value.d.ts +3 -0
- package/dist/v1/schema/validation/value.js +9 -17
- package/dist/v1/schema/validation/value.json-schema.d.ts +54 -0
- package/dist/v1/schema/validation/value.json-schema.js +163 -0
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/accept.d.ts +9 -3
- package/dist/value/accept.js +25 -1
- package/dist/value/canonical.d.ts +22 -1
- package/dist/value/canonical.js +114 -21
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/equal.d.ts +9 -1
- package/dist/value/equal.js +37 -3
- package/dist/value/immutable.optimization.d.ts +2 -0
- package/dist/value/immutable.optimization.js +4 -0
- package/dist/value/index.d.ts +5 -3
- package/dist/value/index.js +2 -1
- package/dist/value/json.d.ts +2 -2
- package/dist/value/json.js +2 -2
- package/dist/value/limits.d.ts +11 -0
- package/dist/value/rule.d.ts +12 -0
- package/dist/value/rule.js +50 -0
- package/dist/value/types.d.ts +6 -0
- package/dist/value/unicode.d.ts +2 -1
- package/dist/value/unicode.js +2 -0
- package/package.json +15 -4
- package/dist/v1/builder/lowering/core-properties.d.ts +0 -10
- package/dist/v1/builder/lowering/core-properties.js +0 -76
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
- package/dist/v1/compiled/admission/semantics/cardinality.js +0 -113
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
- package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
- package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
- package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
- package/dist/v1/compiled/admission/wire/pattern.d.ts +0 -12
- package/dist/v1/compiled/admission/wire/pattern.js +0 -111
- package/dist/v1/language/class/index.d.ts +0 -8
- package/dist/v1/language/class/index.js +0 -1
- package/dist/v1/language/core/index.d.ts +0 -2
- package/dist/v1/language/value/index.d.ts +0 -11
- package/dist/v1/language/value/index.js +0 -8
- package/dist/v1/schema/canonical/domain.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.js +0 -5
- package/dist/v1/schema/canonical/domain.js +0 -5
- package/dist/v1/schema/canonical/freeze.d.ts +0 -1
- /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BoundaryErrorCode, DecodeErrorCode } from './error.js';
|
|
2
|
+
import type { Limits } from './limits.js';
|
|
3
|
+
/** The rule one portable value code reports, stated once, and the limits it enforces. */
|
|
4
|
+
export interface PortableValueRule {
|
|
5
|
+
readonly statement: string;
|
|
6
|
+
readonly limits?: readonly [keyof Limits, ...(keyof Limits)[]];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Every code of a refused host value or JSON text with the rule it reports, frozen. A code added
|
|
10
|
+
* here does not compile until it is described.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PORTABLE_VALUE_RULES: Readonly<Record<BoundaryErrorCode | DecodeErrorCode, PortableValueRule>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every code of a refused host value or JSON text with the rule it reports, frozen. A code added
|
|
3
|
+
* here does not compile until it is described.
|
|
4
|
+
*/
|
|
5
|
+
export const PORTABLE_VALUE_RULES = Object.freeze({
|
|
6
|
+
VALUE_TYPE: {
|
|
7
|
+
statement: 'A portable value is null, a boolean, a number, a string, an array or an object: a function, a bigint, a symbol or undefined is none, anywhere in it.',
|
|
8
|
+
},
|
|
9
|
+
VALUE_NUMBER: {
|
|
10
|
+
statement: 'A portable number is finite and is not negative zero.',
|
|
11
|
+
},
|
|
12
|
+
VALUE_STRING: {
|
|
13
|
+
statement: 'A portable string, a member name included, holds Unicode scalar values and no U+0000.',
|
|
14
|
+
},
|
|
15
|
+
VALUE_ARRAY: {
|
|
16
|
+
statement: 'A portable array has a valid length and no hole, no symbol or other member than its indexes, and each element an enumerable data property.',
|
|
17
|
+
},
|
|
18
|
+
VALUE_OBJECT: {
|
|
19
|
+
statement: 'A portable object has no prototype or one with none of its own, no symbol member, and each member an enumerable data property.',
|
|
20
|
+
},
|
|
21
|
+
VALUE_CYCLE: {
|
|
22
|
+
statement: 'A portable value does not contain itself.',
|
|
23
|
+
},
|
|
24
|
+
VALUE_LIMIT: {
|
|
25
|
+
statement: 'A portable value holds within the limits of its admission: its nesting, its total of members and elements, the bytes of one string, and the bytes of its canonical JSON where it is captured immutable, serialized or measured.',
|
|
26
|
+
limits: ['maxDepth', 'maxMembers', 'maxStringBytes', 'maxBytes'],
|
|
27
|
+
},
|
|
28
|
+
VALUE_REFLECTION: {
|
|
29
|
+
statement: 'A host value whose reflection throws is refused, with what it threw as the cause.',
|
|
30
|
+
},
|
|
31
|
+
JSON_SYNTAX: {
|
|
32
|
+
statement: 'JSON text is exactly one strict JSON value, without a byte order mark.',
|
|
33
|
+
},
|
|
34
|
+
JSON_UTF8: {
|
|
35
|
+
statement: 'JSON bytes are valid UTF-8.',
|
|
36
|
+
},
|
|
37
|
+
JSON_DUPLICATE_MEMBER: {
|
|
38
|
+
statement: 'A JSON object names each member once, compared after decoding.',
|
|
39
|
+
},
|
|
40
|
+
JSON_NUMBER: {
|
|
41
|
+
statement: 'A JSON number resolves to a finite binary64 and not to negative zero.',
|
|
42
|
+
},
|
|
43
|
+
JSON_STRING: {
|
|
44
|
+
statement: 'A JSON string, a member name included, holds Unicode scalar values and no U+0000.',
|
|
45
|
+
},
|
|
46
|
+
JSON_LIMIT: {
|
|
47
|
+
statement: 'JSON text holds within the limits of its decoding: its bytes, its nesting, its total of members and elements, and the bytes of one string.',
|
|
48
|
+
limits: ['maxBytes', 'maxDepth', 'maxMembers', 'maxStringBytes'],
|
|
49
|
+
},
|
|
50
|
+
});
|
package/dist/value/types.d.ts
CHANGED
|
@@ -4,3 +4,9 @@ export type Object = {
|
|
|
4
4
|
readonly [name: string]: Value;
|
|
5
5
|
};
|
|
6
6
|
export type Value = Primitive | Array | Object;
|
|
7
|
+
/**
|
|
8
|
+
* The value kind of a property (page "Fondations Query v7", § Atoms et value kinds, Y4): what a
|
|
9
|
+
* graph language may test on its values. The schema of the property derives it; `null` is a point
|
|
10
|
+
* of every kind, outside every order (R6).
|
|
11
|
+
*/
|
|
12
|
+
export type ValueKind = 'text' | 'number' | 'instant' | 'enum' | 'boolean' | 'set' | 'json';
|
package/dist/value/unicode.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import type { Primitive } from './types.js';
|
|
|
3
3
|
export declare function canonicalPrimitiveBytes(value: Primitive): number;
|
|
4
4
|
export declare function utf8Length(value: string, max?: number): number;
|
|
5
5
|
export declare function assertHostString(value: string, pointer: string, maxBytes: number): number;
|
|
6
|
-
|
|
6
|
+
/** Its UTF-8 length, once it is a portable string within `maxBytes`. */
|
|
7
|
+
export declare function assertDecodedString(value: string, offset: number, maxBytes: number): number;
|
|
7
8
|
export declare function assertSourceString(value: string, maxBytes: number): void;
|
package/dist/value/unicode.js
CHANGED
|
@@ -63,6 +63,7 @@ export function assertHostString(value, pointer, maxBytes) {
|
|
|
63
63
|
}
|
|
64
64
|
return length;
|
|
65
65
|
}
|
|
66
|
+
/** Its UTF-8 length, once it is a portable string within `maxBytes`. */
|
|
66
67
|
export function assertDecodedString(value, offset, maxBytes) {
|
|
67
68
|
if (value.includes('\u0000')) {
|
|
68
69
|
throw new DecodeError('JSON_STRING', 'JSON string contains U+0000', offset);
|
|
@@ -74,6 +75,7 @@ export function assertDecodedString(value, offset, maxBytes) {
|
|
|
74
75
|
if (length > maxBytes) {
|
|
75
76
|
throw new DecodeError('JSON_LIMIT', `JSON string exceeds the ${maxBytes}-byte UTF-8 limit`, offset);
|
|
76
77
|
}
|
|
78
|
+
return length;
|
|
77
79
|
}
|
|
78
80
|
export function assertSourceString(value, maxBytes) {
|
|
79
81
|
const length = utf8Length(value, maxBytes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-dsl",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.31",
|
|
4
4
|
"description": "Astrale Kernel DSL - Schema authoring, inference, and IR serialization",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
"types": "./dist/v1/schema/compatibility/api.d.ts",
|
|
72
72
|
"import": "./dist/v1/schema/compatibility/api.js"
|
|
73
73
|
},
|
|
74
|
+
"./v1/schema/enforcement": {
|
|
75
|
+
"types": "./dist/v1/schema/enforcement/index.d.ts",
|
|
76
|
+
"import": "./dist/v1/schema/enforcement/index.js"
|
|
77
|
+
},
|
|
74
78
|
"./v1/schema/fingerprint": {
|
|
75
79
|
"types": "./dist/v1/schema/fingerprint.d.ts",
|
|
76
80
|
"import": "./dist/v1/schema/fingerprint.js"
|
|
@@ -79,6 +83,13 @@
|
|
|
79
83
|
"types": "./dist/v1/schema/revision.d.ts",
|
|
80
84
|
"import": "./dist/v1/schema/revision.js"
|
|
81
85
|
},
|
|
86
|
+
"./v1/schema/values": {
|
|
87
|
+
"types": "./dist/v1/schema/validation/value-api.d.ts",
|
|
88
|
+
"import": "./dist/v1/schema/validation/value-api.js"
|
|
89
|
+
},
|
|
90
|
+
"./v1/schema/domain-schema.schema.json": "./dist/v1/schema/.spec/schemas/domain-schema.schema.json",
|
|
91
|
+
"./v1/schema/value-schema.schema.json": "./dist/v1/language/.spec/schemas/value-schema.schema.json",
|
|
92
|
+
"./v1/schema/draft-2020-12.schema.json": "./dist/v1/language/.spec/schemas/draft-2020-12.schema.json",
|
|
82
93
|
"./v1/value/full-match": {
|
|
83
94
|
"types": "./dist/v1/value/full-match.d.ts",
|
|
84
95
|
"import": "./dist/v1/value/full-match.js"
|
|
@@ -95,15 +106,15 @@
|
|
|
95
106
|
"dependencies": {
|
|
96
107
|
"@noble/hashes": "2.3.0",
|
|
97
108
|
"jsonc-parser": "3.3.1",
|
|
98
|
-
"zod": "4.
|
|
109
|
+
"zod": "4.6.7"
|
|
99
110
|
},
|
|
100
111
|
"devDependencies": {
|
|
101
112
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
102
113
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
103
114
|
"ajv": "^8.20.0",
|
|
104
|
-
"re2js": "2.8.
|
|
115
|
+
"re2js": "2.8.7",
|
|
105
116
|
"typescript": "~6.0.3",
|
|
106
|
-
"vitest": "^5.0.
|
|
117
|
+
"vitest": "^5.0.5",
|
|
107
118
|
"yaml": "2.9.0"
|
|
108
119
|
},
|
|
109
120
|
"scripts": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CoreContent } from '../../language/core/model/core.js';
|
|
2
|
-
import type { DomainSchemaLookup } from '../../schema/dependency/lookup.js';
|
|
3
|
-
import type { DomainSchemaIR } from '../../schema/model/schema.js';
|
|
4
|
-
import type { UnqualifiedCoreContent } from './core.js';
|
|
5
|
-
type UnqualifiedDomainSchema = Omit<DomainSchemaIR, 'core'> & {
|
|
6
|
-
readonly core: UnqualifiedCoreContent;
|
|
7
|
-
};
|
|
8
|
-
/** Lower rich builder shorthand to the canonical full-key Core representation. */
|
|
9
|
-
export declare function canonicalizeCorePropertyKeys(candidate: UnqualifiedDomainSchema, lookup: DomainSchemaLookup): CoreContent;
|
|
10
|
-
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { PropertyKey as admitPropertyKey } from '../../addressing/index.js';
|
|
2
|
-
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
|
-
import { createPropertyValues } from '../../language/class/property-values.js';
|
|
4
|
-
import { analyzeDefinitions } from '../../schema/analysis/class.js';
|
|
5
|
-
import { buildDomainResolutionContext } from '../../schema/resolution/context.js';
|
|
6
|
-
import { escapeToken, fail } from '../schema/diagnostic.js';
|
|
7
|
-
/** Lower rich builder shorthand to the canonical full-key Core representation. */
|
|
8
|
-
export function canonicalizeCorePropertyKeys(candidate, lookup) {
|
|
9
|
-
// Core Property values do not participate in Class composition. Analyze the
|
|
10
|
-
// already-canonical Definition surface, then admit Core values below.
|
|
11
|
-
const analysisCandidate = {
|
|
12
|
-
...candidate,
|
|
13
|
-
core: { nodes: {}, edges: [] },
|
|
14
|
-
};
|
|
15
|
-
const definitions = analyzeDefinitions(buildDomainResolutionContext(analysisCandidate, lookup)).definitions;
|
|
16
|
-
const nodes = Object.fromEntries(Object.entries(candidate.core.nodes).map(([slug, node]) => {
|
|
17
|
-
const definition = definitions.get(definitionRefIndex(node.class));
|
|
18
|
-
if (definition === undefined) {
|
|
19
|
-
fail('BUILDER_CORE_PROPERTY', `/core/nodes/${escapeToken(slug)}/class`, 'Core property shorthand requires a resolvable concrete Class.');
|
|
20
|
-
}
|
|
21
|
-
return [
|
|
22
|
-
slug,
|
|
23
|
-
{
|
|
24
|
-
...node,
|
|
25
|
-
properties: qualify(node.properties, definition, `/core/nodes/${escapeToken(slug)}/properties`),
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
}));
|
|
29
|
-
const edges = candidate.core.edges.map((edge, index) => {
|
|
30
|
-
const definition = definitions.get(definitionRefIndex(edge.class));
|
|
31
|
-
if (definition === undefined) {
|
|
32
|
-
fail('BUILDER_CORE_PROPERTY', `/core/edges/${index}/class`, 'Core property shorthand requires a resolvable concrete Class.');
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
...edge,
|
|
36
|
-
properties: qualify(edge.properties, definition, `/core/edges/${index}/properties`),
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
return { nodes, edges };
|
|
40
|
-
}
|
|
41
|
-
function qualify(input, definition, pointer) {
|
|
42
|
-
const byName = new Map();
|
|
43
|
-
for (const [key, field] of definition.properties) {
|
|
44
|
-
const candidates = byName.get(field.name) ?? [];
|
|
45
|
-
candidates.push(key);
|
|
46
|
-
byName.set(field.name, candidates);
|
|
47
|
-
}
|
|
48
|
-
const result = {};
|
|
49
|
-
const sourceByKey = new Map();
|
|
50
|
-
for (const [inputKey, value] of Object.entries(input)) {
|
|
51
|
-
const key = resolveInputKey(inputKey, definition, byName, `${pointer}/${escapeToken(inputKey)}`);
|
|
52
|
-
const previous = sourceByKey.get(key);
|
|
53
|
-
if (previous !== undefined) {
|
|
54
|
-
fail('BUILDER_CORE_PROPERTY', `${pointer}/${escapeToken(inputKey)}`, `Property is supplied twice through ${JSON.stringify(previous)} and ${JSON.stringify(inputKey)}.`);
|
|
55
|
-
}
|
|
56
|
-
sourceByKey.set(key, inputKey);
|
|
57
|
-
result[key] = value;
|
|
58
|
-
}
|
|
59
|
-
return createPropertyValues(Object.entries(result).map(([key, value]) => [admitPropertyKey(key), value]));
|
|
60
|
-
}
|
|
61
|
-
function resolveInputKey(input, definition, byName, pointer) {
|
|
62
|
-
if (admitPropertyKey.is(input)) {
|
|
63
|
-
const key = admitPropertyKey(input);
|
|
64
|
-
if (!definition.properties.has(key)) {
|
|
65
|
-
fail('BUILDER_CORE_PROPERTY', pointer, `Property ${input} is not present on the Core Class.`);
|
|
66
|
-
}
|
|
67
|
-
return key;
|
|
68
|
-
}
|
|
69
|
-
const candidates = byName.get(input) ?? [];
|
|
70
|
-
if (candidates.length === 1)
|
|
71
|
-
return candidates[0];
|
|
72
|
-
if (candidates.length === 0) {
|
|
73
|
-
fail('BUILDER_CORE_PROPERTY', pointer, `Property ${JSON.stringify(input)} does not exist.`);
|
|
74
|
-
}
|
|
75
|
-
fail('BUILDER_CORE_PROPERTY', pointer, `Property ${JSON.stringify(input)} is ambiguous; use one of: ${candidates.join(', ')}.`);
|
|
76
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type CompiledSchemaEntry } from '../../model/schema.js';
|
|
2
|
-
import { type SemanticIndex } from './context.js';
|
|
3
|
-
import { type CoreNode, type CoreEdgeValue } from './core.js';
|
|
4
|
-
/** Check normalized Edge uniqueness, noSelf, cycles and complete Core degrees. */
|
|
5
|
-
export declare function validateCoreEdgeSet(context: SemanticIndex, entry: CompiledSchemaEntry, entryIndex: number, nodes: ReadonlyMap<string, CoreNode>, edges: readonly CoreEdgeValue[]): void;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Key } from '../../../addressing/index.js';
|
|
2
|
-
import { compareUnicode } from '../../../addressing/ordering.js';
|
|
3
|
-
import {} from '../../../language/class/model/edge.js';
|
|
4
|
-
import {} from '../../model/schema.js';
|
|
5
|
-
import { fail } from '../diagnostic.js';
|
|
6
|
-
import { isCompiledEdge, classSatisfiesAny, } from './context.js';
|
|
7
|
-
import {} from './core.js';
|
|
8
|
-
import { sameIncidentEndpoint, countBounds } from './edge.js';
|
|
9
|
-
/** Check normalized Edge uniqueness, noSelf, cycles and complete Core degrees. */
|
|
10
|
-
export function validateCoreEdgeSet(context, entry, entryIndex, nodes, edges) {
|
|
11
|
-
const seen = new Set();
|
|
12
|
-
const slices = new Map();
|
|
13
|
-
for (const edge of edges) {
|
|
14
|
-
const classKey = Key.of(edge.value.class);
|
|
15
|
-
const [source, target] = edge.class.value.orientation === 'undirected' &&
|
|
16
|
-
compareUnicode(edge.source.key, edge.target.key) > 0
|
|
17
|
-
? [edge.target.key, edge.source.key]
|
|
18
|
-
: [edge.source.key, edge.target.key];
|
|
19
|
-
const key = `${classKey}\u0000${source}\u0000${target}`;
|
|
20
|
-
if (seen.has(key))
|
|
21
|
-
fail(edge.pointer, 'Core Edge duplicates an exact normalized Edge identity.');
|
|
22
|
-
seen.add(key);
|
|
23
|
-
const values = slices.get(classKey) ?? [];
|
|
24
|
-
values.push(edge);
|
|
25
|
-
slices.set(classKey, values);
|
|
26
|
-
if (edge.class.value.constraints.noSelf === true && edge.source.key === edge.target.key)
|
|
27
|
-
fail(edge.pointer, 'Core Edge violates noSelf.');
|
|
28
|
-
}
|
|
29
|
-
for (const edgeClass of entry.definitions.classes) {
|
|
30
|
-
if (!isCompiledEdge(edgeClass))
|
|
31
|
-
continue;
|
|
32
|
-
const classEdges = slices.get(Key.of(edgeClass.ref)) ?? [];
|
|
33
|
-
if (edgeClass.constraints.acyclic === true && hasCycle(classEdges))
|
|
34
|
-
fail(`/closure/${entryIndex}/facts/core`, 'Core Edge set violates exact-Class acyclicity.');
|
|
35
|
-
validateCardinality(context, edgeClass, classEdges, nodes);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function validateCardinality(context, declaration, edges, nodes) {
|
|
39
|
-
for (const subject of cardinalitySubjects(edges, nodes)) {
|
|
40
|
-
if (declaration.orientation === 'directed') {
|
|
41
|
-
if (classSatisfiesAny(context, subject.class, declaration.endpoints.source.accepts))
|
|
42
|
-
checkCount(declaration.endpoints.source.outgoing, edges.filter(({ source }) => source.key === subject.key).length, subject.pointer, subject.minimum);
|
|
43
|
-
if (classSatisfiesAny(context, subject.class, declaration.endpoints.target.accepts))
|
|
44
|
-
checkCount(declaration.endpoints.target.incoming, edges.filter(({ target }) => target.key === subject.key).length, subject.pointer, subject.minimum);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const degree = edges.filter(({ source, target }) => source.key === subject.key || target.key === subject.key).length;
|
|
48
|
-
const [first, second] = declaration.endpoints;
|
|
49
|
-
if (classSatisfiesAny(context, subject.class, first.accepts))
|
|
50
|
-
checkCount(first.incident, degree, subject.pointer, subject.minimum);
|
|
51
|
-
if (!sameIncidentEndpoint(first, second) &&
|
|
52
|
-
classSatisfiesAny(context, subject.class, second.accepts))
|
|
53
|
-
checkCount(second.incident, degree, subject.pointer, subject.minimum);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Every declared Core Node proves its own complete degree, so both bounds hold. A Definition
|
|
59
|
-
* endpoint is only named by the Edges that reach it: the Domain may also create ordinary Edges of
|
|
60
|
-
* the same Class against it, so a minimum is unprovable here and only the maximum is enforced.
|
|
61
|
-
*/
|
|
62
|
-
function cardinalitySubjects(edges, nodes) {
|
|
63
|
-
const subjects = new Map();
|
|
64
|
-
for (const node of nodes.values()) {
|
|
65
|
-
subjects.set(node.key, {
|
|
66
|
-
key: node.key,
|
|
67
|
-
class: node.value.class,
|
|
68
|
-
pointer: node.pointer,
|
|
69
|
-
minimum: true,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
for (const edge of edges) {
|
|
73
|
-
for (const endpoint of [edge.source, edge.target]) {
|
|
74
|
-
if ('value' in endpoint || !('class' in endpoint) || subjects.has(endpoint.key))
|
|
75
|
-
continue;
|
|
76
|
-
subjects.set(endpoint.key, {
|
|
77
|
-
key: endpoint.key,
|
|
78
|
-
class: endpoint.class,
|
|
79
|
-
pointer: endpoint.pointer,
|
|
80
|
-
minimum: false,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return Object.freeze([...subjects.values()]);
|
|
85
|
-
}
|
|
86
|
-
function checkCount(count, degree, path, enforceMinimum) {
|
|
87
|
-
const [minimum, maximum] = countBounds(count);
|
|
88
|
-
if (degree > maximum || (degree < minimum && enforceMinimum))
|
|
89
|
-
fail(path, `Core degree ${degree} violates Edge count ${count}.`);
|
|
90
|
-
}
|
|
91
|
-
function hasCycle(edges) {
|
|
92
|
-
const outgoing = new Map();
|
|
93
|
-
for (const edge of edges) {
|
|
94
|
-
const values = outgoing.get(edge.source.key) ?? [];
|
|
95
|
-
values.push(edge.target.key);
|
|
96
|
-
outgoing.set(edge.source.key, values);
|
|
97
|
-
}
|
|
98
|
-
const visiting = new Set();
|
|
99
|
-
const visited = new Set();
|
|
100
|
-
const visit = (key) => {
|
|
101
|
-
if (visiting.has(key))
|
|
102
|
-
return true;
|
|
103
|
-
if (visited.has(key))
|
|
104
|
-
return false;
|
|
105
|
-
visiting.add(key);
|
|
106
|
-
if ((outgoing.get(key) ?? []).some(visit))
|
|
107
|
-
return true;
|
|
108
|
-
visiting.delete(key);
|
|
109
|
-
visited.add(key);
|
|
110
|
-
return false;
|
|
111
|
-
};
|
|
112
|
-
return [...outgoing.keys()].some(visit);
|
|
113
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Retain and merge term equalities while typing one Policy branch. */
|
|
2
|
-
export declare class CompiledUnionFind {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(values: Iterable<string>);
|
|
5
|
-
add(value: string): void;
|
|
6
|
-
find(value: string): string;
|
|
7
|
-
join(left: string, right: string): void;
|
|
8
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** Retain and merge term equalities while typing one Policy branch. */
|
|
2
|
-
export class CompiledUnionFind {
|
|
3
|
-
#parents = new Map();
|
|
4
|
-
constructor(values) {
|
|
5
|
-
for (const value of values)
|
|
6
|
-
this.add(value);
|
|
7
|
-
}
|
|
8
|
-
add(value) {
|
|
9
|
-
if (!this.#parents.has(value))
|
|
10
|
-
this.#parents.set(value, value);
|
|
11
|
-
}
|
|
12
|
-
find(value) {
|
|
13
|
-
this.add(value);
|
|
14
|
-
const parent = this.#parents.get(value);
|
|
15
|
-
if (parent === value)
|
|
16
|
-
return value;
|
|
17
|
-
const root = this.find(parent);
|
|
18
|
-
this.#parents.set(value, root);
|
|
19
|
-
return root;
|
|
20
|
-
}
|
|
21
|
-
join(left, right) {
|
|
22
|
-
const a = this.find(left);
|
|
23
|
-
const b = this.find(right);
|
|
24
|
-
if (a !== b)
|
|
25
|
-
this.#parents.set(b, a);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type PolicyExpression } from '../../../../language/policy/model/policy.js';
|
|
2
|
-
interface CompiledPatternMeasure {
|
|
3
|
-
readonly depth: number;
|
|
4
|
-
readonly edgeCounts: readonly number[];
|
|
5
|
-
readonly domains: ReadonlySet<string>;
|
|
6
|
-
}
|
|
7
|
-
/** Measure expanded Policy branches, depth and referenced Domains. */
|
|
8
|
-
export declare function measureCompiledPolicy(origin: string, name: string, normalized: ReadonlyMap<string, PolicyExpression>, visiting: Set<string>): CompiledPatternMeasure | undefined;
|
|
9
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { policyObjectOrigin, policyVariableClass } from '../../../../language/index.js';
|
|
2
|
-
import { BRANCH_OVERFLOW } from '../../../../language/policy/analysis/budgets.js';
|
|
3
|
-
import {} from '../../../../language/policy/model/policy.js';
|
|
4
|
-
/** Measure expanded Policy branches, depth and referenced Domains. */
|
|
5
|
-
export function measureCompiledPolicy(origin, name, normalized, visiting) {
|
|
6
|
-
if (visiting.has(name))
|
|
7
|
-
return undefined;
|
|
8
|
-
const expression = normalized.get(name);
|
|
9
|
-
if (expression === undefined)
|
|
10
|
-
return undefined;
|
|
11
|
-
if ('match' in expression)
|
|
12
|
-
return measureCompiledPattern(expression.match, origin);
|
|
13
|
-
const nested = new Set(visiting);
|
|
14
|
-
nested.add(name);
|
|
15
|
-
const refs = 'allOf' in expression ? expression.allOf : expression.anyOf;
|
|
16
|
-
const children = refs.map((ref) => ref.origin === origin ? measureCompiledPolicy(origin, ref.name, normalized, nested) : undefined);
|
|
17
|
-
if (children.some((value) => value === undefined))
|
|
18
|
-
return undefined;
|
|
19
|
-
return combineCompiledMeasures('allOf' in expression ? 'allOf' : 'anyOf', children);
|
|
20
|
-
}
|
|
21
|
-
function measureCompiledPattern(pattern, origin) {
|
|
22
|
-
if ('sameNode' in pattern)
|
|
23
|
-
return {
|
|
24
|
-
depth: 1,
|
|
25
|
-
edgeCounts: [1],
|
|
26
|
-
domains: new Set([
|
|
27
|
-
origin,
|
|
28
|
-
...[pattern.sameNode.left, pattern.sameNode.right].flatMap((term) => term.kind === 'ref' ? [policyObjectOrigin(term.ref)] : []),
|
|
29
|
-
]),
|
|
30
|
-
};
|
|
31
|
-
if ('source' in pattern)
|
|
32
|
-
return {
|
|
33
|
-
depth: 1,
|
|
34
|
-
edgeCounts: [1],
|
|
35
|
-
domains: new Set([
|
|
36
|
-
origin,
|
|
37
|
-
pattern.class.origin,
|
|
38
|
-
...[pattern.source, pattern.target].flatMap((term) => term.kind === 'ref' ? [policyObjectOrigin(term.ref)] : []),
|
|
39
|
-
]),
|
|
40
|
-
};
|
|
41
|
-
if ('exists' in pattern) {
|
|
42
|
-
const child = measureCompiledPattern(pattern.exists.where, origin);
|
|
43
|
-
return {
|
|
44
|
-
depth: child.depth + 1,
|
|
45
|
-
edgeCounts: child.edgeCounts,
|
|
46
|
-
domains: new Set([
|
|
47
|
-
...child.domains,
|
|
48
|
-
...pattern.exists.nodes.flatMap((node) => {
|
|
49
|
-
const ref = policyVariableClass(node);
|
|
50
|
-
return ref === undefined ? [] : [ref.origin];
|
|
51
|
-
}),
|
|
52
|
-
]),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return combineCompiledMeasures('allOf' in pattern ? 'allOf' : 'anyOf', ('allOf' in pattern ? pattern.allOf : pattern.anyOf).map((child) => measureCompiledPattern(child, origin)));
|
|
56
|
-
}
|
|
57
|
-
function combineCompiledMeasures(kind, children) {
|
|
58
|
-
const depth = 1 + Math.max(0, ...children.map((child) => child.depth));
|
|
59
|
-
const domains = new Set(children.flatMap((child) => [...child.domains]));
|
|
60
|
-
if (kind === 'anyOf')
|
|
61
|
-
return {
|
|
62
|
-
depth,
|
|
63
|
-
edgeCounts: children.flatMap((child) => child.edgeCounts).slice(0, BRANCH_OVERFLOW),
|
|
64
|
-
domains,
|
|
65
|
-
};
|
|
66
|
-
let edgeCounts = [0];
|
|
67
|
-
for (const child of children) {
|
|
68
|
-
const next = [];
|
|
69
|
-
for (const left of edgeCounts) {
|
|
70
|
-
for (const right of child.edgeCounts) {
|
|
71
|
-
next.push(left + right);
|
|
72
|
-
if (next.length >= BRANCH_OVERFLOW)
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
if (next.length >= BRANCH_OVERFLOW)
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
edgeCounts = next;
|
|
79
|
-
}
|
|
80
|
-
return { depth, edgeCounts, domains };
|
|
81
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CompiledPolicyTyping } from './typing.js';
|
|
2
|
-
import { type ClassRef } from '../../../../addressing/index.js';
|
|
3
|
-
import { type PatternEdgeUse } from '../../../../language/policy/analysis/branches.js';
|
|
4
|
-
/** One possible combination of endpoint constraints and term equalities. */
|
|
5
|
-
export interface CompiledEdgeVariant {
|
|
6
|
-
readonly constraints: readonly (readonly [string, readonly ClassRef[]])[];
|
|
7
|
-
readonly equalities: readonly (readonly [string, string])[];
|
|
8
|
-
}
|
|
9
|
-
/** Enumerate satisfiable endpoint variants for a branch’s Edge uses. */
|
|
10
|
-
export declare function compiledEdgeAlternatives(edges: readonly PatternEdgeUse[], typing: CompiledPolicyTyping): readonly (readonly CompiledEdgeVariant[])[];
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Key } from '../../../../addressing/index.js';
|
|
2
|
-
import { compareUnicode } from '../../../../addressing/ordering.js';
|
|
3
|
-
import {} from '../../../../language/class/model/edge.js';
|
|
4
|
-
import { termKey } from '../../../../language/policy/analysis/branches.js';
|
|
5
|
-
import { isCompiledEdge } from '../context.js';
|
|
6
|
-
/** Enumerate satisfiable endpoint variants for a branch’s Edge uses. */
|
|
7
|
-
export function compiledEdgeAlternatives(edges, typing) {
|
|
8
|
-
let result = [[]];
|
|
9
|
-
for (const edge of edges) {
|
|
10
|
-
const variants = compiledVariantsForEdge(edge, typing);
|
|
11
|
-
if (variants.length === 0)
|
|
12
|
-
return [];
|
|
13
|
-
result = result.flatMap((prefix) => variants.map((variant) => [...prefix, variant]));
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
function compiledVariantsForEdge(use, typing) {
|
|
18
|
-
const declaration = typing.context.classes.get(Key.of(use.pattern.class))?.value;
|
|
19
|
-
if (declaration === undefined || !isCompiledEdge(declaration))
|
|
20
|
-
return [];
|
|
21
|
-
const endpoints = declaration.orientation === 'directed'
|
|
22
|
-
? [declaration.endpoints.source, declaration.endpoints.target]
|
|
23
|
-
: declaration.endpoints;
|
|
24
|
-
const repeat = use.pattern.repeat ?? { min: 1, max: 1 };
|
|
25
|
-
const sourceKey = termKey(use.pattern.source, use.namespace);
|
|
26
|
-
const targetKey = termKey(use.pattern.target, use.namespace);
|
|
27
|
-
const variants = [];
|
|
28
|
-
for (let length = repeat.min; length <= repeat.max; length++) {
|
|
29
|
-
if (length === 0) {
|
|
30
|
-
variants.push({ constraints: [], equalities: [[sourceKey, targetKey]] });
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const orientationCount = declaration.orientation === 'undirected' ? 2 ** length : 1;
|
|
34
|
-
for (let mask = 0; mask < orientationCount; mask++) {
|
|
35
|
-
const reversed = Array.from({ length }, (_, index) => declaration.orientation === 'undirected' && (mask & (1 << index)) !== 0);
|
|
36
|
-
let valid = true;
|
|
37
|
-
for (let index = 0; index + 1 < length; index++) {
|
|
38
|
-
const incoming = reversed[index] ? endpoints[0] : endpoints[1];
|
|
39
|
-
const outgoing = reversed[index + 1] ? endpoints[1] : endpoints[0];
|
|
40
|
-
if (!typing.endpointsOverlap(incoming.accepts, outgoing.accepts))
|
|
41
|
-
valid = false;
|
|
42
|
-
}
|
|
43
|
-
if (!valid)
|
|
44
|
-
continue;
|
|
45
|
-
const first = reversed[0] ? endpoints[1] : endpoints[0];
|
|
46
|
-
const last = reversed[length - 1] ? endpoints[0] : endpoints[1];
|
|
47
|
-
variants.push({
|
|
48
|
-
constraints: [
|
|
49
|
-
[sourceKey, first.accepts],
|
|
50
|
-
[targetKey, last.accepts],
|
|
51
|
-
],
|
|
52
|
-
equalities: [],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return uniqueCompiledEdgeVariants(variants);
|
|
57
|
-
}
|
|
58
|
-
function uniqueCompiledEdgeVariants(values) {
|
|
59
|
-
const result = new Map();
|
|
60
|
-
for (const value of values) {
|
|
61
|
-
const key = `${value.constraints.map(([term, accepts]) => `${term}:${accepts.map(Key.of).sort(compareUnicode).join(',')}`).join('|')}=${value.equalities.map(([left, right]) => `${left}:${right}`).join('|')}`;
|
|
62
|
-
result.set(key, value);
|
|
63
|
-
}
|
|
64
|
-
return [...result.values()];
|
|
65
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import { type Pattern, type RunPattern } from '../../model/schema.js';
|
|
3
|
-
/** The machine compiled from each admitted I-Regexp source, shared by its occurrences. */
|
|
4
|
-
export type Machines = Map<string, Pattern | RunPattern>;
|
|
5
|
-
/**
|
|
6
|
-
* Admit one received pattern as data and return the machine compiled from its source. A received
|
|
7
|
-
* machine never decides membership: it may come from another compiler, from a host with other
|
|
8
|
-
* Unicode data, or from a forger, and the artifact carries no compiler version that could tell a
|
|
9
|
-
* current machine from those, so it is ignored rather than compared. Its source decides, through
|
|
10
|
-
* the same bounded `isIRegexp` and `compilePattern` that source resolution uses.
|
|
11
|
-
*/
|
|
12
|
-
export declare function pattern(input: JsonValue, patternIndex: number, path: string, machines: Machines): Pattern | RunPattern;
|