@astrale-os/kernel-dsl 1.0.0-beta.3 → 1.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v1/addressing/class-key.js +3 -3
- package/dist/v1/addressing/definition-ref.js +21 -37
- package/dist/v1/addressing/domain-dependency.d.ts +0 -6
- package/dist/v1/addressing/domain-dependency.js +1 -6
- package/dist/v1/addressing/key.d.ts +4 -1
- package/dist/v1/addressing/key.js +23 -3
- package/dist/v1/addressing/ordering.d.ts +2 -0
- package/dist/v1/addressing/ordering.js +2 -0
- package/dist/v1/addressing/patterns.d.ts +1 -1
- package/dist/v1/addressing/patterns.js +2 -6
- package/dist/v1/builder/callable/authoring.d.ts +11 -5
- package/dist/v1/builder/callable/authoring.js +2 -0
- package/dist/v1/builder/class/authoring.d.ts +94 -224
- package/dist/v1/builder/class/authoring.js +30 -35
- package/dist/v1/builder/class/handle.d.ts +27 -0
- package/dist/v1/builder/class/handle.js +1 -0
- package/dist/v1/builder/class/input.d.ts +159 -0
- package/dist/v1/builder/class/projection.d.ts +129 -0
- package/dist/v1/builder/class/projection.js +1 -0
- package/dist/v1/builder/class/property.d.ts +3 -9
- package/dist/v1/builder/class/property.js +1 -0
- package/dist/v1/builder/core/authoring.d.ts +1 -1
- package/dist/v1/builder/index.d.ts +10 -2
- package/dist/v1/builder/index.js +2 -0
- package/dist/v1/builder/lowering/callable.js +1 -0
- package/dist/v1/builder/lowering/class.d.ts +9 -1
- package/dist/v1/builder/lowering/class.js +62 -17
- package/dist/v1/builder/lowering/policy.js +6 -24
- package/dist/v1/builder/lowering/property-keys.d.ts +27 -0
- package/dist/v1/builder/lowering/property-keys.js +108 -0
- package/dist/v1/builder/lowering/schema/compile.js +13 -6
- package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
- package/dist/v1/builder/lowering/schema/context.js +36 -7
- package/dist/v1/builder/lowering/schema/lifetime.d.ts +11 -0
- package/dist/v1/builder/lowering/schema/lifetime.js +55 -0
- package/dist/v1/builder/lowering/value/compile.js +29 -22
- package/dist/v1/builder/lowering/value/file.d.ts +7 -0
- package/dist/v1/builder/lowering/value/file.js +14 -0
- package/dist/v1/builder/lowering/value/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +41 -7
- package/dist/v1/builder/policy/authoring.d.ts +80 -9
- package/dist/v1/builder/policy/authoring.js +99 -68
- package/dist/v1/builder/policy/legacy/edge.d.ts +28 -0
- package/dist/v1/builder/policy/legacy/edge.js +16 -0
- package/dist/v1/builder/schema/define.d.ts +0 -1
- package/dist/v1/builder/schema/diagnostic.d.ts +3 -2
- package/dist/v1/builder/schema/diagnostic.js +5 -10
- package/dist/v1/builder/schema/input.d.ts +4 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
- package/dist/v1/builder/schema/projection/class.d.ts +78 -16
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/domain.d.ts +13 -2
- package/dist/v1/builder/schema/projection/identity.d.ts +74 -9
- package/dist/v1/builder/schema/projection/model.d.ts +4 -2
- package/dist/v1/builder/schema/projection/property.d.ts +38 -4
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +5 -4
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- package/dist/v1/builder/schema/rule.d.ts +316 -0
- package/dist/v1/builder/schema/rule.js +192 -0
- package/dist/v1/builder/value/file.d.ts +34 -0
- package/dist/v1/builder/value/file.js +77 -0
- package/dist/v1/builder/value/full-match.d.ts +0 -1
- package/dist/v1/builder/value/full-match.js +0 -1
- package/dist/v1/builder/value/path-metadata.d.ts +1 -1
- package/dist/v1/builder/value/path.d.ts +1 -1
- package/dist/v1/bundle/codec.js +55 -74
- package/dist/v1/bundle/diagnostic.d.ts +3 -1
- package/dist/v1/bundle/diagnostic.js +9 -7
- package/dist/v1/bundle/index.d.ts +2 -0
- package/dist/v1/bundle/index.js +1 -0
- package/dist/v1/bundle/model.js +1 -1
- package/dist/v1/bundle/rule.d.ts +14 -0
- package/dist/v1/bundle/rule.js +41 -0
- package/dist/v1/bundle/structure.js +6 -8
- package/dist/v1/compiled/admission/accept.js +9 -15
- package/dist/v1/compiled/admission/closure.js +17 -34
- package/dist/v1/compiled/admission/diagnostic.d.ts +23 -1
- package/dist/v1/compiled/admission/diagnostic.js +40 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +7 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +48 -19
- package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
- package/dist/v1/compiled/admission/semantics/core.js +56 -24
- package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
- package/dist/v1/compiled/admission/semantics/edge.js +6 -65
- package/dist/v1/compiled/admission/semantics/policy/admit.js +4 -19
- package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -5
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
- package/dist/v1/compiled/admission/semantics/policy/parity.js +44 -53
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +7 -21
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
- package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
- package/dist/v1/compiled/admission/wire/callable.d.ts +5 -2
- package/dist/v1/compiled/admission/wire/callable.js +24 -20
- package/dist/v1/compiled/admission/wire/class.js +79 -30
- package/dist/v1/compiled/admission/wire/entry.d.ts +1 -1
- package/dist/v1/compiled/admission/wire/entry.js +36 -13
- package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
- package/dist/v1/compiled/admission/wire/policy.js +27 -20
- package/dist/v1/compiled/admission/wire/program.d.ts +13 -3
- package/dist/v1/compiled/admission/wire/program.js +39 -44
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -1
- package/dist/v1/compiled/admission/wire/property.js +8 -5
- package/dist/v1/compiled/admission/wire/value.d.ts +0 -2
- package/dist/v1/compiled/admission/wire/value.js +0 -7
- package/dist/v1/compiled/codec/json.js +4 -3
- package/dist/v1/compiled/compiler/compile.js +15 -33
- package/dist/v1/compiled/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/index.d.ts +2 -0
- package/dist/v1/compiled/index.js +1 -0
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +13 -52
- package/dist/v1/compiled/model/schema.d.ts +3 -0
- package/dist/v1/compiled/rule.d.ts +49 -0
- package/dist/v1/compiled/rule.js +169 -0
- package/dist/v1/domain/create.js +9 -10
- package/dist/v1/domain/model/domain.d.ts +2 -7
- package/dist/v1/domain/model/input.d.ts +19 -10
- package/dist/v1/domain/namespace/member-collection.js +8 -7
- package/dist/v1/domain/projection/classes.js +11 -8
- package/dist/v1/domain/validation/create.d.ts +7 -16
- package/dist/v1/domain/validation/create.js +35 -81
- package/dist/v1/index.d.ts +5 -3
- package/dist/v1/index.js +1 -1
- package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
- package/dist/v1/language/.spec/schemas/value-schema.schema.json +23 -0
- package/dist/v1/language/callable/admission.d.ts +15 -0
- package/dist/v1/language/callable/admission.js +44 -0
- package/dist/v1/language/callable/model/callable.d.ts +10 -0
- package/dist/v1/language/callable/resolved.d.ts +26 -5
- package/dist/v1/language/chain.d.ts +7 -0
- package/dist/v1/language/chain.js +24 -0
- package/dist/v1/language/class/inheritance.d.ts +36 -5
- package/dist/v1/language/class/inheritance.js +85 -1
- package/dist/v1/language/class/lifetime.d.ts +50 -11
- package/dist/v1/language/class/lifetime.js +89 -20
- package/dist/v1/language/class/model/class.d.ts +45 -9
- package/dist/v1/language/class/model/edge.d.ts +31 -2
- package/dist/v1/language/class/model/property.d.ts +16 -7
- package/dist/v1/language/class/property-values.js +2 -4
- package/dist/v1/language/class/resolved.d.ts +9 -4
- package/dist/v1/language/class/unique.d.ts +143 -0
- package/dist/v1/language/class/unique.js +264 -0
- package/dist/v1/language/core/facts.d.ts +85 -0
- package/dist/v1/language/core/facts.js +116 -0
- package/dist/v1/language/cycle.d.ts +10 -0
- package/dist/v1/language/cycle.js +30 -0
- package/dist/v1/language/definition/metadata.d.ts +38 -0
- package/dist/v1/language/definition/metadata.js +51 -0
- package/dist/v1/language/freeze.d.ts +5 -0
- package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
- package/dist/v1/language/index.d.ts +7 -2
- package/dist/v1/language/index.js +5 -1
- package/dist/v1/language/limits.d.ts +83 -0
- package/dist/v1/language/limits.js +77 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +8 -8
- package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
- package/dist/v1/language/policy/analysis/budgets.js +140 -20
- package/dist/v1/language/policy/analysis/checks.js +8 -6
- package/dist/v1/language/policy/analysis/composition.d.ts +4 -0
- package/dist/v1/language/policy/analysis/composition.js +11 -0
- package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
- package/dist/v1/language/policy/analysis/typing.js +456 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -9
- package/dist/v1/language/policy/model/policy.js +42 -4
- package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
- package/dist/v1/language/policy/normalization/normalize.js +46 -68
- package/dist/v1/language/suspended.d.ts +7 -0
- package/dist/v1/language/suspended.js +23 -0
- package/dist/v1/language/validation/diagnostic.d.ts +15 -1
- package/dist/v1/language/validation/diagnostic.js +21 -0
- package/dist/v1/language/validation/rule.d.ts +45 -0
- package/dist/v1/language/validation/rule.js +109 -0
- package/dist/v1/language/value/compile/fields.js +16 -16
- package/dist/v1/language/value/compile/load.d.ts +5 -0
- package/dist/v1/language/value/compile/load.js +13 -0
- package/dist/v1/language/value/evaluate/assertions.d.ts +5 -1
- package/dist/v1/language/value/evaluate/assertions.js +19 -8
- package/dist/v1/language/value/evaluate/evaluator.js +117 -120
- package/dist/v1/language/value/evaluate/preparation.d.ts +16 -0
- package/dist/v1/language/value/evaluate/preparation.js +100 -47
- package/dist/v1/language/value/evaluate/program.d.ts +2 -1
- package/dist/v1/language/value/evaluate/program.js +6 -6
- package/dist/v1/language/value/evaluate/validate.d.ts +3 -3
- package/dist/v1/language/value/evaluate/validate.js +15 -11
- package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
- package/dist/v1/language/value/evaluate/validity.optimization.js +338 -0
- package/dist/v1/language/value/files.d.ts +44 -0
- package/dist/v1/language/value/files.js +151 -0
- package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
- package/dist/v1/language/value/inclusion/arrays.js +85 -0
- package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
- package/dist/v1/language/value/inclusion/assertions.js +28 -0
- package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
- package/dist/v1/language/value/inclusion/combinators.js +67 -0
- package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
- package/dist/v1/language/value/inclusion/equivalence.js +76 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +140 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +29 -3
- package/dist/v1/language/value/inclusion/includes.js +58 -723
- package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
- package/dist/v1/language/value/inclusion/keywords.js +31 -0
- package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
- package/dist/v1/language/value/inclusion/kinds.js +57 -0
- package/dist/v1/language/value/inclusion/location.d.ts +24 -0
- package/dist/v1/language/value/inclusion/location.js +66 -0
- package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
- package/dist/v1/language/value/inclusion/numbers.js +41 -0
- package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
- package/dist/v1/language/value/inclusion/objects.js +190 -0
- package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
- package/dist/v1/language/value/inclusion/strings.js +29 -0
- package/dist/v1/language/value/inclusion/types.d.ts +3 -0
- package/dist/v1/language/value/inclusion/types.js +34 -0
- package/dist/v1/language/value/model/blob.d.ts +6 -0
- package/dist/v1/language/value/model/blob.js +8 -0
- package/dist/v1/language/value/model/file.d.ts +41 -0
- package/dist/v1/language/value/model/file.js +122 -0
- package/dist/v1/language/value/ordering.d.ts +14 -0
- package/dist/v1/language/value/ordering.js +144 -77
- package/dist/v1/language/value/profile/canonicalize.d.ts +6 -1
- package/dist/v1/language/value/profile/canonicalize.js +67 -87
- package/dist/v1/language/value/profile/json.validate.d.ts +12 -0
- package/dist/v1/language/value/profile/json.validate.js +18 -5
- package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +1 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.js +21 -5
- package/dist/v1/language/value/profile/rules.js +27 -44
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/profile/vocabulary.d.ts +36 -2
- package/dist/v1/language/value/profile/vocabulary.js +58 -5
- package/dist/v1/language/value/reference/closure.js +6 -6
- package/dist/v1/language/value/reference/recursion.js +9 -48
- package/dist/v1/language/value/reference/references.d.ts +3 -1
- package/dist/v1/language/value/reference/references.js +7 -7
- package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
- package/dist/v1/language/value/reference/registry.index.js +33 -16
- package/dist/v1/language/value/regexp/ast.js +6 -7
- package/dist/v1/language/value/regexp/compile.d.ts +5 -11
- package/dist/v1/language/value/regexp/compile.js +14 -12
- package/dist/v1/language/value/regexp/syntax.js +3 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +1 -1
- package/dist/v1/language/value/regexp/unicode.js +1 -1
- package/dist/v1/language/value/syntax/keywords.d.ts +3 -3
- package/dist/v1/language/value/syntax/keywords.js +4 -20
- package/dist/v1/language/value/syntax/node-path/validate.js +2 -3
- package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
- package/dist/v1/language/value/syntax/pointer.js +5 -2
- package/dist/v1/language/value/syntax/walk.d.ts +9 -0
- package/dist/v1/language/value/syntax/walk.js +37 -20
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2596 -0
- package/dist/v1/schema/admission/accept.d.ts +3 -1
- package/dist/v1/schema/admission/accept.js +6 -14
- package/dist/v1/schema/admission/callable.d.ts +21 -0
- package/dist/v1/schema/admission/callable.js +96 -0
- package/dist/v1/schema/analysis/class.d.ts +4 -0
- package/dist/v1/schema/analysis/class.js +57 -17
- package/dist/v1/schema/canonical/revision.d.ts +4 -1
- package/dist/v1/schema/canonical/revision.js +8 -5
- package/dist/v1/schema/compatibility/api.d.ts +4 -1
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +9 -4
- package/dist/v1/schema/compatibility/comparators/classes.js +50 -29
- package/dist/v1/schema/compatibility/comparators/index.d.ts +1 -1
- package/dist/v1/schema/compatibility/comparators/members.js +1 -1
- package/dist/v1/schema/compatibility/comparators/values.js +2 -2
- package/dist/v1/schema/compatibility/context.d.ts +5 -2
- package/dist/v1/schema/compatibility/context.js +8 -6
- package/dist/v1/schema/compatibility/coordinate.js +3 -3
- package/dist/v1/schema/compatibility/diff.js +2 -4
- package/dist/v1/schema/compatibility/extension.d.ts +11 -0
- package/dist/v1/schema/compatibility/extension.js +22 -0
- package/dist/v1/schema/compatibility/fields.d.ts +20 -4
- package/dist/v1/schema/compatibility/fields.js +13 -3
- package/dist/v1/schema/compatibility/meaning/footprint.js +16 -51
- package/dist/v1/schema/compatibility/model.d.ts +17 -5
- package/dist/v1/schema/compatibility/references.d.ts +0 -3
- package/dist/v1/schema/compatibility/references.js +1 -9
- package/dist/v1/schema/compatibility/report.js +1 -1
- package/dist/v1/schema/compatibility/rule.d.ts +13 -0
- package/dist/v1/schema/compatibility/rule.js +23 -0
- package/dist/v1/schema/compatibility/scope.d.ts +2 -0
- package/dist/v1/schema/compatibility/scope.js +4 -1
- package/dist/v1/schema/compatibility/structure/index.js +6 -4
- package/dist/v1/schema/compatibility/structure/requirements.js +58 -61
- package/dist/v1/schema/compatibility/versioning/index.js +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +1 -1
- package/dist/v1/schema/compatibility/versioning/surface.js +30 -2
- package/dist/v1/schema/compatibility/walk.d.ts +17 -0
- package/dist/v1/schema/compatibility/walk.js +41 -0
- package/dist/v1/schema/diagnostic.d.ts +17 -3
- package/dist/v1/schema/diagnostic.js +14 -11
- package/dist/v1/schema/enforcement/changes.d.ts +590 -0
- package/dist/v1/schema/enforcement/changes.js +566 -0
- package/dist/v1/schema/enforcement/derived.d.ts +236 -0
- package/dist/v1/schema/enforcement/derived.js +243 -0
- package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
- package/dist/v1/schema/enforcement/dispose.js +275 -0
- package/dist/v1/schema/enforcement/facts.d.ts +89 -0
- package/dist/v1/schema/enforcement/facts.js +70 -0
- package/dist/v1/schema/enforcement/fields.d.ts +65 -0
- package/dist/v1/schema/enforcement/fields.js +36 -0
- package/dist/v1/schema/enforcement/index.d.ts +39 -0
- package/dist/v1/schema/enforcement/index.js +10 -0
- package/dist/v1/schema/enforcement/install.d.ts +1634 -0
- package/dist/v1/schema/enforcement/install.js +1223 -0
- package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
- package/dist/v1/schema/enforcement/lifecycle.js +91 -0
- package/dist/v1/schema/enforcement/model.d.ts +253 -0
- package/dist/v1/schema/enforcement/model.js +1 -0
- package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
- package/dist/v1/schema/enforcement/obligations.js +240 -0
- package/dist/v1/schema/enforcement/write.d.ts +1314 -0
- package/dist/v1/schema/enforcement/write.js +1017 -0
- package/dist/v1/schema/index.d.ts +11 -1
- package/dist/v1/schema/index.js +5 -0
- package/dist/v1/schema/model/schema.d.ts +23 -1
- package/dist/v1/schema/model/schema.js +1 -1
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +50 -13
- package/dist/v1/schema/resolution/closure.js +2 -1
- package/dist/v1/schema/resolution/context.js +17 -18
- package/dist/v1/schema/resolution/domain.d.ts +5 -0
- package/dist/v1/schema/resolution/domain.js +6 -12
- package/dist/v1/schema/resolution/origins.js +6 -8
- package/dist/v1/schema/rule.d.ts +25 -0
- package/dist/v1/schema/rule.js +459 -0
- package/dist/v1/schema/validation/callable.d.ts +35 -2
- package/dist/v1/schema/validation/callable.js +65 -9
- package/dist/v1/schema/validation/class.d.ts +6 -2
- package/dist/v1/schema/validation/class.js +128 -105
- package/dist/v1/schema/validation/core.js +103 -173
- package/dist/v1/schema/validation/domain.js +25 -15
- package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
- package/dist/v1/schema/validation/domain.json-schema.js +222 -0
- package/dist/v1/schema/validation/domain.route.d.ts +6 -1
- package/dist/v1/schema/validation/domain.route.js +18 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +7797 -0
- package/dist/v1/schema/validation/domain.structure.js +516 -160
- package/dist/v1/schema/validation/icon.d.ts +4 -0
- package/dist/v1/schema/validation/icon.js +29 -0
- package/dist/v1/schema/validation/json.json-schema.d.ts +40 -0
- package/dist/v1/schema/validation/json.json-schema.js +46 -0
- package/dist/v1/schema/validation/policy/budgets.d.ts +37 -2
- package/dist/v1/schema/validation/policy/budgets.js +94 -121
- package/dist/v1/schema/validation/policy/context.d.ts +6 -5
- package/dist/v1/schema/validation/policy/context.js +7 -10
- package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
- package/dist/v1/schema/validation/policy/objects.js +6 -14
- package/dist/v1/schema/validation/policy/references.js +20 -62
- package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
- package/dist/v1/schema/validation/policy/typing.js +22 -356
- package/dist/v1/schema/validation/policy/uses.d.ts +40 -3
- package/dist/v1/schema/validation/policy/uses.js +63 -91
- package/dist/v1/schema/validation/policy/validate.js +5 -5
- package/dist/v1/schema/validation/value-api.d.ts +27 -1
- package/dist/v1/schema/validation/value-api.js +37 -2
- package/dist/v1/schema/validation/value.d.ts +3 -0
- package/dist/v1/schema/validation/value.js +9 -17
- package/dist/v1/schema/validation/value.json-schema.d.ts +54 -0
- package/dist/v1/schema/validation/value.json-schema.js +163 -0
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/accept.d.ts +9 -3
- package/dist/value/accept.js +25 -1
- package/dist/value/canonical.d.ts +22 -1
- package/dist/value/canonical.js +114 -21
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/equal.d.ts +9 -1
- package/dist/value/equal.js +37 -3
- package/dist/value/immutable.optimization.d.ts +2 -0
- package/dist/value/immutable.optimization.js +4 -0
- package/dist/value/index.d.ts +5 -3
- package/dist/value/index.js +2 -1
- package/dist/value/json.d.ts +2 -2
- package/dist/value/json.js +2 -2
- package/dist/value/limits.d.ts +11 -0
- package/dist/value/rule.d.ts +12 -0
- package/dist/value/rule.js +50 -0
- package/dist/value/types.d.ts +6 -0
- package/dist/value/unicode.d.ts +2 -1
- package/dist/value/unicode.js +2 -0
- package/package.json +15 -4
- package/dist/v1/builder/lowering/core-properties.d.ts +0 -10
- package/dist/v1/builder/lowering/core-properties.js +0 -76
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
- package/dist/v1/compiled/admission/semantics/cardinality.js +0 -113
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
- package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
- package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
- package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
- package/dist/v1/compiled/admission/wire/pattern.d.ts +0 -12
- package/dist/v1/compiled/admission/wire/pattern.js +0 -111
- package/dist/v1/language/class/index.d.ts +0 -8
- package/dist/v1/language/class/index.js +0 -1
- package/dist/v1/language/core/index.d.ts +0 -2
- package/dist/v1/language/value/index.d.ts +0 -11
- package/dist/v1/language/value/index.js +0 -8
- package/dist/v1/schema/canonical/domain.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
- package/dist/v1/schema/canonical/domain.digest.js +0 -5
- package/dist/v1/schema/canonical/domain.js +0 -5
- package/dist/v1/schema/canonical/freeze.d.ts +0 -1
- /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
import type { ClassRef } from '../../addressing/index.js';
|
|
2
|
-
import type { ClassKind } from './model/class.js';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { ClassKind, Inheritance } from './model/class.js';
|
|
3
|
+
import type { EdgeContract, EdgeCount } from './model/edge.js';
|
|
4
|
+
/** A Class as satisfaction reads it, shared by source, compiled and resolved Class admission. */
|
|
5
|
+
export interface ClassAncestry {
|
|
5
6
|
readonly ref: ClassRef;
|
|
6
7
|
readonly kind: ClassKind;
|
|
7
8
|
readonly extends: readonly ClassRef[];
|
|
8
9
|
}
|
|
10
|
+
/** The origin of the Kernel, whose Schema every Domain depends on. */
|
|
11
|
+
export declare const KERNEL_ORIGIN = "kernel.astrale.ai";
|
|
9
12
|
/** Kernel graph roots are intrinsic supertypes, not authored structural Edge contracts. */
|
|
10
|
-
export declare function isGraphRoot(value: Pick<
|
|
13
|
+
export declare function isGraphRoot(value: Pick<ClassAncestry, 'ref' | 'kind'>): boolean;
|
|
11
14
|
/** Same-kind satisfaction includes the intrinsic root and the declared parent closure. */
|
|
12
|
-
export declare function classSatisfies(candidate:
|
|
15
|
+
export declare function classSatisfies(candidate: ClassAncestry, required: ClassAncestry, resolve: (ref: ClassRef) => ClassAncestry | undefined): boolean;
|
|
16
|
+
/** The inheritance a Class declares, `'internal'` when it declares none. */
|
|
17
|
+
export declare function inheritanceOf(declaration: {
|
|
18
|
+
readonly inheritance?: Inheritance;
|
|
19
|
+
}): Inheritance;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a Class of another Domain may extend this Class: only an `'open'` one admits it. Its own
|
|
22
|
+
* Domain may extend any Class that is not `'final'`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function admitsForeignSubclass(declaration: {
|
|
25
|
+
readonly inheritance?: Inheritance;
|
|
26
|
+
}): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether `child` safely refines its parent Edge contract `parent`: same orientation, at least the
|
|
29
|
+
* parent's constraints, and endpoints whose accepted Classes `satisfies` one the paired parent
|
|
30
|
+
* endpoint accepts, within its count. Undirected endpoints may pair in either order.
|
|
31
|
+
*/
|
|
32
|
+
export declare function edgeContractRefines(child: EdgeContract, parent: EdgeContract & Pick<ClassAncestry, 'ref' | 'kind'>, satisfies: (candidate: ClassRef, accepts: readonly ClassRef[]) => boolean): boolean;
|
|
33
|
+
/** Interpret an Edge count as inclusive degree bounds. */
|
|
34
|
+
export declare function countBounds(value: EdgeCount): readonly [number, number];
|
|
35
|
+
/** Whether Edges of one Class, read from source to target, close a cycle (`acyclic` forbids it). */
|
|
36
|
+
export declare function hasDirectedCycle(edges: readonly {
|
|
37
|
+
readonly source: {
|
|
38
|
+
readonly key: string;
|
|
39
|
+
};
|
|
40
|
+
readonly target: {
|
|
41
|
+
readonly key: string;
|
|
42
|
+
};
|
|
43
|
+
}[]): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/** The origin of the Kernel, whose Schema every Domain depends on. */
|
|
2
|
+
export const KERNEL_ORIGIN = 'kernel.astrale.ai';
|
|
1
3
|
/** Kernel graph roots are intrinsic supertypes, not authored structural Edge contracts. */
|
|
2
4
|
export function isGraphRoot(value) {
|
|
3
|
-
return (value.ref.origin ===
|
|
5
|
+
return (value.ref.origin === KERNEL_ORIGIN &&
|
|
4
6
|
value.ref.name === (value.kind === 'node' ? 'Node' : 'Edge'));
|
|
5
7
|
}
|
|
6
8
|
/** Same-kind satisfaction includes the intrinsic root and the declared parent closure. */
|
|
@@ -23,3 +25,85 @@ export function classSatisfies(candidate, required, resolve) {
|
|
|
23
25
|
};
|
|
24
26
|
return visit(candidate);
|
|
25
27
|
}
|
|
28
|
+
/** The inheritance a Class declares, `'internal'` when it declares none. */
|
|
29
|
+
export function inheritanceOf(declaration) {
|
|
30
|
+
return declaration.inheritance ?? 'internal';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether a Class of another Domain may extend this Class: only an `'open'` one admits it. Its own
|
|
34
|
+
* Domain may extend any Class that is not `'final'`.
|
|
35
|
+
*/
|
|
36
|
+
export function admitsForeignSubclass(declaration) {
|
|
37
|
+
return inheritanceOf(declaration) === 'open';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether `child` safely refines its parent Edge contract `parent`: same orientation, at least the
|
|
41
|
+
* parent's constraints, and endpoints whose accepted Classes `satisfies` one the paired parent
|
|
42
|
+
* endpoint accepts, within its count. Undirected endpoints may pair in either order.
|
|
43
|
+
*/
|
|
44
|
+
export function edgeContractRefines(child, parent, satisfies) {
|
|
45
|
+
if (isGraphRoot(parent))
|
|
46
|
+
return true;
|
|
47
|
+
if (parent.constraints.noSelf === true && child.constraints.noSelf !== true)
|
|
48
|
+
return false;
|
|
49
|
+
if (parent.constraints.acyclic === true && child.constraints.acyclic !== true)
|
|
50
|
+
return false;
|
|
51
|
+
const endpointRefines = (childEndpoint, parentEndpoint) => childEndpoint.accepts.every((accepted) => satisfies(accepted, parentEndpoint.accepts));
|
|
52
|
+
if (child.orientation === 'directed' && parent.orientation === 'directed') {
|
|
53
|
+
return (endpointRefines(child.endpoints.source, parent.endpoints.source) &&
|
|
54
|
+
countRefines(child.endpoints.source.outgoing, parent.endpoints.source.outgoing) &&
|
|
55
|
+
endpointRefines(child.endpoints.target, parent.endpoints.target) &&
|
|
56
|
+
countRefines(child.endpoints.target.incoming, parent.endpoints.target.incoming));
|
|
57
|
+
}
|
|
58
|
+
if (child.orientation !== 'undirected' || parent.orientation !== 'undirected')
|
|
59
|
+
return false;
|
|
60
|
+
const refines = (childIndex, parentIndex) => endpointRefines(child.endpoints[childIndex], parent.endpoints[parentIndex]) &&
|
|
61
|
+
countRefines(child.endpoints[childIndex].incident, parent.endpoints[parentIndex].incident);
|
|
62
|
+
const direct = refines(0, 0) && refines(1, 1);
|
|
63
|
+
if (direct)
|
|
64
|
+
return true;
|
|
65
|
+
return refines(0, 1) && refines(1, 0);
|
|
66
|
+
}
|
|
67
|
+
function countRefines(child, parent) {
|
|
68
|
+
const [childMinimum, childMaximum] = countBounds(child);
|
|
69
|
+
const [parentMinimum, parentMaximum] = countBounds(parent);
|
|
70
|
+
return childMinimum >= parentMinimum && childMaximum <= parentMaximum;
|
|
71
|
+
}
|
|
72
|
+
/** Interpret an Edge count as inclusive degree bounds. */
|
|
73
|
+
export function countBounds(value) {
|
|
74
|
+
switch (value) {
|
|
75
|
+
case '0..*':
|
|
76
|
+
return [0, Number.POSITIVE_INFINITY];
|
|
77
|
+
case '1..*':
|
|
78
|
+
return [1, Number.POSITIVE_INFINITY];
|
|
79
|
+
case '0..1':
|
|
80
|
+
return [0, 1];
|
|
81
|
+
case '1':
|
|
82
|
+
return [1, 1];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Whether Edges of one Class, read from source to target, close a cycle (`acyclic` forbids it). */
|
|
86
|
+
export function hasDirectedCycle(edges) {
|
|
87
|
+
const outgoing = new Map();
|
|
88
|
+
for (const edge of edges) {
|
|
89
|
+
const targets = outgoing.get(edge.source.key) ?? [];
|
|
90
|
+
targets.push(edge.target.key);
|
|
91
|
+
outgoing.set(edge.source.key, targets);
|
|
92
|
+
}
|
|
93
|
+
const visiting = new Set();
|
|
94
|
+
const visited = new Set();
|
|
95
|
+
const visit = (key) => {
|
|
96
|
+
if (visiting.has(key))
|
|
97
|
+
return true;
|
|
98
|
+
if (visited.has(key))
|
|
99
|
+
return false;
|
|
100
|
+
visiting.add(key);
|
|
101
|
+
for (const target of outgoing.get(key) ?? [])
|
|
102
|
+
if (visit(target))
|
|
103
|
+
return true;
|
|
104
|
+
visiting.delete(key);
|
|
105
|
+
visited.add(key);
|
|
106
|
+
return false;
|
|
107
|
+
};
|
|
108
|
+
return [...outgoing.keys()].some(visit);
|
|
109
|
+
}
|
|
@@ -1,17 +1,56 @@
|
|
|
1
1
|
import type { ClassRef } from '../../addressing/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ClassDefinition, EdgeClassDefinition } from './model/class.js';
|
|
3
|
+
import type { EdgeContract, EdgeCount, EdgeEndpointBase, EdgeLifetime } from './model/edge.js';
|
|
4
|
+
export type { EdgeLifetime } from './model/edge.js';
|
|
5
|
+
/** The Classes lifetimes read: those of an Edge Class's Domain and of its dependency closure. */
|
|
6
|
+
export interface LifetimeScope {
|
|
7
|
+
/**
|
|
8
|
+
* Whether a Node of another Domain may be of the Class: it is `'open'`, or a Class of its own
|
|
9
|
+
* Domain that extends it is.
|
|
10
|
+
*/
|
|
11
|
+
readonly extendable: (ref: ClassRef) => boolean;
|
|
12
|
+
}
|
|
13
|
+
/** The lifetime scope of `classes`. */
|
|
14
|
+
export declare function lifetimeScope(classes: Iterable<ClassDefinition>): LifetimeScope;
|
|
15
|
+
/** One endpoint of an Edge contract and how many Edges of the Class each Node in it has. */
|
|
16
|
+
export interface ContractEndpoint {
|
|
17
|
+
readonly endpoint: EdgeEndpointBase;
|
|
18
|
+
readonly count: EdgeCount;
|
|
19
|
+
}
|
|
20
|
+
/** The endpoints of an Edge contract in order: source then target, or the two incident ones. */
|
|
21
|
+
export declare function contractEndpoints(contract: EdgeContract): readonly [ContractEndpoint, ContractEndpoint];
|
|
3
22
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
23
|
+
* Whether an endpoint of an Edge Class of `origin` can hold a Node of another Domain: it accepts a
|
|
24
|
+
* Class `origin` does not own, or one another Domain may extend. The Kernel's own relations are the
|
|
25
|
+
* exception: every Domain depends on the Kernel and extends its roots, so its relations bind every
|
|
26
|
+
* Node and keep the lifetimes they have as closed Classes, however open the Kernel's Classes are.
|
|
6
27
|
*/
|
|
7
|
-
export
|
|
28
|
+
export declare function reachesAnotherDomain(origin: ClassRef['origin'], endpoint: EdgeEndpointBase, scope: LifetimeScope): boolean;
|
|
8
29
|
/**
|
|
9
|
-
* The lifetime of each endpoint of
|
|
10
|
-
*
|
|
30
|
+
* The lifetime of each endpoint of `edge`, in endpoint order: the one it declares, else the derived
|
|
31
|
+
* one.
|
|
11
32
|
*
|
|
12
|
-
* An Edge Class binds only the Nodes of its own Domain and of the Domains that depend on it
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* detaching
|
|
33
|
+
* An Edge Class binds only the Nodes of its own Domain and of the Domains that depend on it, and a
|
|
34
|
+
* Domain blocks only the deletion of its own Nodes. An endpoint that can hold a Node of another
|
|
35
|
+
* Domain therefore detaches, unless an endpoint of the Class declares a minimum count that
|
|
36
|
+
* detaching could break (`requiredEndpoint`). Every other endpoint restricts.
|
|
16
37
|
*/
|
|
17
|
-
export declare function edgeLifetimes(
|
|
38
|
+
export declare function edgeLifetimes(edge: EdgeClassDefinition, scope: LifetimeScope): readonly [EdgeLifetime, EdgeLifetime];
|
|
39
|
+
/** One breach of the lifetime laws at one endpoint of an Edge Class: its index and why. */
|
|
40
|
+
export interface LifetimeBreach {
|
|
41
|
+
readonly index: 0 | 1;
|
|
42
|
+
readonly reason: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The breaches of the lifetime laws (LANGUAGE-EDGE-LIFETIME) by the lifetimes `edge` declares: an
|
|
46
|
+
* endpoint that can hold a Node of another Domain never restricts, and none detaches in a Class
|
|
47
|
+
* with an endpoint that requires an Edge (`requiredEndpoint`). A derived lifetime breaks neither.
|
|
48
|
+
*/
|
|
49
|
+
export declare function lifetimeBreaches(edge: EdgeClassDefinition, scope: LifetimeScope): readonly LifetimeBreach[];
|
|
50
|
+
/**
|
|
51
|
+
* The first endpoint of an Edge Class that requires an Edge, if one does, with its index. Detaching
|
|
52
|
+
* there could leave a Node below its count, so an endpoint of such a Class never detaches.
|
|
53
|
+
*/
|
|
54
|
+
export declare function requiredEndpoint(edge: EdgeContract): (ContractEndpoint & {
|
|
55
|
+
readonly index: 0 | 1;
|
|
56
|
+
}) | undefined;
|
|
@@ -1,26 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
2
|
+
import { KERNEL_ORIGIN } from './inheritance.js';
|
|
3
|
+
/** The lifetime scope of `classes`. */
|
|
4
|
+
export function lifetimeScope(classes) {
|
|
5
|
+
const declarations = new Map();
|
|
6
|
+
for (const declaration of classes)
|
|
7
|
+
declarations.set(definitionRefIndex(declaration.ref), declaration);
|
|
8
|
+
const extendable = new Set();
|
|
9
|
+
const open = (ref) => {
|
|
10
|
+
const key = definitionRefIndex(ref);
|
|
11
|
+
if (extendable.has(key))
|
|
12
|
+
return;
|
|
13
|
+
extendable.add(key);
|
|
14
|
+
for (const parent of declarations.get(key)?.extends ?? [])
|
|
15
|
+
if (parent.origin === ref.origin)
|
|
16
|
+
open(parent);
|
|
17
|
+
};
|
|
18
|
+
for (const declaration of declarations.values())
|
|
19
|
+
if (declaration.kind === 'node' && declaration.inheritance === 'open')
|
|
20
|
+
open(declaration.ref);
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
extendable: (ref) => extendable.has(definitionRefIndex(ref)),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** The endpoints of an Edge contract in order: source then target, or the two incident ones. */
|
|
26
|
+
export function contractEndpoints(contract) {
|
|
27
|
+
return contract.orientation === 'directed'
|
|
12
28
|
? [
|
|
13
|
-
|
|
14
|
-
|
|
29
|
+
{ endpoint: contract.endpoints.source, count: contract.endpoints.source.outgoing },
|
|
30
|
+
{ endpoint: contract.endpoints.target, count: contract.endpoints.target.incoming },
|
|
15
31
|
]
|
|
16
32
|
: [
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
{ endpoint: contract.endpoints[0], count: contract.endpoints[0].incident },
|
|
34
|
+
{ endpoint: contract.endpoints[1], count: contract.endpoints[1].incident },
|
|
19
35
|
];
|
|
20
|
-
const required = endpoints.some(([, count]) => minimum(count) > 0);
|
|
21
|
-
const lifetime = ([accepts]) => !required && accepts.some((ref) => ref.origin !== origin) ? 'detach' : 'restrict';
|
|
22
|
-
return Object.freeze([lifetime(endpoints[0]), lifetime(endpoints[1])]);
|
|
23
36
|
}
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Whether an endpoint of an Edge Class of `origin` can hold a Node of another Domain: it accepts a
|
|
39
|
+
* Class `origin` does not own, or one another Domain may extend. The Kernel's own relations are the
|
|
40
|
+
* exception: every Domain depends on the Kernel and extends its roots, so its relations bind every
|
|
41
|
+
* Node and keep the lifetimes they have as closed Classes, however open the Kernel's Classes are.
|
|
42
|
+
*/
|
|
43
|
+
export function reachesAnotherDomain(origin, endpoint, scope) {
|
|
44
|
+
return endpoint.accepts.some((ref) => ref.origin !== origin || (origin !== KERNEL_ORIGIN && scope.extendable(ref)));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The lifetime of each endpoint of `edge`, in endpoint order: the one it declares, else the derived
|
|
48
|
+
* one.
|
|
49
|
+
*
|
|
50
|
+
* An Edge Class binds only the Nodes of its own Domain and of the Domains that depend on it, and a
|
|
51
|
+
* Domain blocks only the deletion of its own Nodes. An endpoint that can hold a Node of another
|
|
52
|
+
* Domain therefore detaches, unless an endpoint of the Class declares a minimum count that
|
|
53
|
+
* detaching could break (`requiredEndpoint`). Every other endpoint restricts.
|
|
54
|
+
*/
|
|
55
|
+
export function edgeLifetimes(edge, scope) {
|
|
56
|
+
const required = requiredEndpoint(edge) !== undefined;
|
|
57
|
+
const [head, tail] = contractEndpoints(edge).map(({ endpoint }) => endpoint.onDelete ??
|
|
58
|
+
(!required && reachesAnotherDomain(edge.ref.origin, endpoint, scope) ? 'detach' : 'restrict'));
|
|
59
|
+
return Object.freeze([head, tail]);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The breaches of the lifetime laws (LANGUAGE-EDGE-LIFETIME) by the lifetimes `edge` declares: an
|
|
63
|
+
* endpoint that can hold a Node of another Domain never restricts, and none detaches in a Class
|
|
64
|
+
* with an endpoint that requires an Edge (`requiredEndpoint`). A derived lifetime breaks neither.
|
|
65
|
+
*/
|
|
66
|
+
export function lifetimeBreaches(edge, scope) {
|
|
67
|
+
const required = requiredEndpoint(edge)?.count;
|
|
68
|
+
return Object.freeze(contractEndpoints(edge).flatMap(({ endpoint }, index) => {
|
|
69
|
+
const at = index;
|
|
70
|
+
if (endpoint.onDelete === 'restrict' &&
|
|
71
|
+
reachesAnotherDomain(edge.ref.origin, endpoint, scope))
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
index: at,
|
|
75
|
+
reason: 'can hold Nodes of another Domain and cannot restrict their deletion.',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
if (endpoint.onDelete === 'detach' && required !== undefined)
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
index: at,
|
|
82
|
+
reason: `cannot detach: an endpoint of the Class requires ${required} Edges.`,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
return [];
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The first endpoint of an Edge Class that requires an Edge, if one does, with its index. Detaching
|
|
90
|
+
* there could leave a Node below its count, so an endpoint of such a Class never detaches.
|
|
91
|
+
*/
|
|
92
|
+
export function requiredEndpoint(edge) {
|
|
93
|
+
const index = contractEndpoints(edge).findIndex(({ count }) => count === '1' || count === '1..*');
|
|
94
|
+
return index === -1 ? undefined : { ...contractEndpoints(edge)[index], index: index };
|
|
26
95
|
}
|
|
@@ -1,32 +1,68 @@
|
|
|
1
|
-
import type { ClassRef, DefinitionBase } from '../../../addressing/index.js';
|
|
1
|
+
import type { ClassRef, DefinitionBase, PropertyKey } from '../../../addressing/index.js';
|
|
2
2
|
import type { MethodRecord } from '../../callable/model/callable.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EdgeClassPolicy, EdgeClassWritePolicy, NodeClassCreatePolicy, NodeClassPolicy, NodeClassWritePolicy } from '../../policy/model/policy.js';
|
|
4
4
|
import type { DataFacet } from './data.js';
|
|
5
5
|
import type { EdgeContract } from './edge.js';
|
|
6
|
-
import type { PropertyFacet } from './property.js';
|
|
6
|
+
import type { EdgePropertyDefinition, NodePropertyDefinition, PropertyFacet } from './property.js';
|
|
7
7
|
export type ClassKind = 'node' | 'edge';
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Which Classes may extend a Class: `'open'`, those of its Domain and of every Domain that depends
|
|
10
|
+
* on that Domain; `'internal'`, those of its Domain only; `'final'`, none.
|
|
11
|
+
*/
|
|
12
|
+
export type Inheritance = 'open' | 'internal' | 'final';
|
|
13
|
+
/**
|
|
14
|
+
* An absent observation rule admits every caller; a delegation is still scoped by its ceiling. An
|
|
15
|
+
* absent write rule admits only the Domain that declares the Class.
|
|
16
|
+
*/
|
|
9
17
|
export interface NodeClassPolicies {
|
|
10
18
|
readonly read?: NodeClassPolicy;
|
|
11
19
|
readonly traverse?: NodeClassPolicy;
|
|
20
|
+
readonly create?: NodeClassCreatePolicy;
|
|
21
|
+
readonly update?: NodeClassWritePolicy;
|
|
22
|
+
readonly delete?: NodeClassWritePolicy;
|
|
12
23
|
}
|
|
13
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* An absent observation rule admits every caller; a delegation is still scoped by its ceiling. An
|
|
26
|
+
* absent write rule admits only the Domain that declares the Class.
|
|
27
|
+
*/
|
|
14
28
|
export interface EdgeClassPolicies {
|
|
15
|
-
readonly read?:
|
|
16
|
-
readonly traverse?:
|
|
29
|
+
readonly read?: EdgeClassPolicy;
|
|
30
|
+
readonly traverse?: EdgeClassPolicy;
|
|
31
|
+
readonly create?: EdgeClassWritePolicy;
|
|
32
|
+
readonly update?: EdgeClassWritePolicy;
|
|
33
|
+
readonly delete?: EdgeClassWritePolicy;
|
|
17
34
|
}
|
|
18
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The Properties one key of a Node Class names, own or inherited, which no two Nodes of the Classes
|
|
37
|
+
* it covers share while each of them is present: distinct, by key in code-point order.
|
|
38
|
+
*/
|
|
39
|
+
export type NodeUniqueTuple = readonly [PropertyKey, ...PropertyKey[]];
|
|
40
|
+
/**
|
|
41
|
+
* The form of a Node key tuple: its fields are Properties, whatever their keys and number. A
|
|
42
|
+
* backend announces it to enforce Node keys, so a tuple is never ignored where it is not.
|
|
43
|
+
*/
|
|
44
|
+
export type NodeUniqueForm = readonly ['property'];
|
|
45
|
+
export interface NodeClassDefinition extends DefinitionBase<ClassRef>, PropertyFacet<NodePropertyDefinition>, DataFacet {
|
|
19
46
|
readonly kind: 'node';
|
|
20
47
|
readonly abstract: boolean;
|
|
48
|
+
/** Absent when `'internal'`, the default, so a Class that keeps the default keeps its revision. */
|
|
49
|
+
readonly inheritance?: Exclude<Inheritance, 'internal'>;
|
|
21
50
|
readonly description?: string;
|
|
22
51
|
readonly extends: readonly ClassRef[];
|
|
23
52
|
readonly methods: MethodRecord;
|
|
24
53
|
readonly icon?: string;
|
|
25
54
|
readonly policies: NodeClassPolicies;
|
|
55
|
+
/**
|
|
56
|
+
* The tuples no two Nodes of this Class and of its active concrete descendants share while every
|
|
57
|
+
* Property is present; absent, none. A descendant is covered without declaring them again.
|
|
58
|
+
*/
|
|
59
|
+
readonly unique?: readonly [NodeUniqueTuple, ...NodeUniqueTuple[]];
|
|
26
60
|
}
|
|
27
|
-
export type EdgeClassDefinition = DefinitionBase<ClassRef> & PropertyFacet & EdgeContract & {
|
|
61
|
+
export type EdgeClassDefinition = DefinitionBase<ClassRef> & PropertyFacet<EdgePropertyDefinition> & EdgeContract & {
|
|
28
62
|
readonly kind: 'edge';
|
|
29
63
|
readonly abstract: boolean;
|
|
64
|
+
/** Absent when `'internal'`, the default, so a Class that keeps the default keeps its revision. */
|
|
65
|
+
readonly inheritance?: Exclude<Inheritance, 'internal'>;
|
|
30
66
|
readonly description?: string;
|
|
31
67
|
readonly extends: readonly ClassRef[];
|
|
32
68
|
readonly policies: EdgeClassPolicies;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type { ClassRef } from '../../../addressing/index.js';
|
|
1
|
+
import type { ClassRef, PropertyKey } from '../../../addressing/index.js';
|
|
2
2
|
export type EdgeCount = '0..*' | '1..*' | '0..1' | '1';
|
|
3
3
|
export type EdgeOrientation = 'directed' | 'undirected';
|
|
4
|
+
/**
|
|
5
|
+
* What deleting the Node at one endpoint does to an Edge: `restrict` requires the transition to
|
|
6
|
+
* delete the Edge explicitly; `detach` deletes the Edge with the Node.
|
|
7
|
+
*/
|
|
8
|
+
export type EdgeLifetime = 'restrict' | 'detach';
|
|
4
9
|
export interface EdgeEndpointBase {
|
|
5
10
|
readonly role: string;
|
|
6
|
-
readonly accepts: readonly ClassRef[];
|
|
11
|
+
readonly accepts: readonly [ClassRef, ...ClassRef[]];
|
|
12
|
+
/** Declared only when authored; otherwise derived (`edgeLifetimes`). */
|
|
13
|
+
readonly onDelete?: EdgeLifetime;
|
|
7
14
|
}
|
|
8
15
|
export interface DirectedSourceEndpoint extends EdgeEndpointBase {
|
|
9
16
|
readonly outgoing: EdgeCount;
|
|
@@ -22,6 +29,22 @@ export interface UndirectedEdgeConstraints {
|
|
|
22
29
|
readonly noSelf?: true;
|
|
23
30
|
readonly acyclic?: never;
|
|
24
31
|
}
|
|
32
|
+
/** A field a key tuple names: an endpoint of the Edge, its slug, or one of its Properties. */
|
|
33
|
+
export type EdgeUniqueField = 'source' | 'target' | 'slug' | {
|
|
34
|
+
readonly property: PropertyKey;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The fields one key of a directed Edge Class names, which no two Edges of the Classes it covers
|
|
38
|
+
* share while each of them is present: distinct, in canonical order (`compareEdgeUniqueFields`).
|
|
39
|
+
*/
|
|
40
|
+
export type EdgeUniqueTuple = readonly [EdgeUniqueField, ...EdgeUniqueField[]];
|
|
41
|
+
/** The kind of a key field: an endpoint, the slug, or a Property whatever its key. */
|
|
42
|
+
export type EdgeUniqueFieldKind = 'source' | 'target' | 'slug' | 'property';
|
|
43
|
+
/**
|
|
44
|
+
* The form of a key tuple: the kinds of its fields, each once, in canonical order. A backend
|
|
45
|
+
* announces the forms it enforces, so a tuple of a form it does not announce is never ignored.
|
|
46
|
+
*/
|
|
47
|
+
export type EdgeUniqueForm = readonly [EdgeUniqueFieldKind, ...EdgeUniqueFieldKind[]];
|
|
25
48
|
export interface DirectedEdgeContract {
|
|
26
49
|
readonly orientation: 'directed';
|
|
27
50
|
readonly endpoints: {
|
|
@@ -29,10 +52,16 @@ export interface DirectedEdgeContract {
|
|
|
29
52
|
readonly target: DirectedTargetEndpoint;
|
|
30
53
|
};
|
|
31
54
|
readonly constraints: DirectedEdgeConstraints;
|
|
55
|
+
/**
|
|
56
|
+
* The tuples no two Edges of this Class and of its active concrete descendants share. Absent
|
|
57
|
+
* when the Class declares none, so a Class without one keeps its revision; never empty.
|
|
58
|
+
*/
|
|
59
|
+
readonly unique?: readonly [EdgeUniqueTuple, ...EdgeUniqueTuple[]];
|
|
32
60
|
}
|
|
33
61
|
export interface UndirectedEdgeContract {
|
|
34
62
|
readonly orientation: 'undirected';
|
|
35
63
|
readonly endpoints: readonly [IncidentEndpoint, IncidentEndpoint];
|
|
36
64
|
readonly constraints: UndirectedEdgeConstraints;
|
|
65
|
+
readonly unique?: never;
|
|
37
66
|
}
|
|
38
67
|
export type EdgeContract = DirectedEdgeContract | UndirectedEdgeContract;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import type { StateTopology } from '../../state/index.js';
|
|
2
|
+
import type { JsonSchema } from '../../value/model/schema.js';
|
|
1
3
|
export type AutoEvent = 'create' | 'update';
|
|
2
4
|
export type AutoSet = 'instant';
|
|
3
5
|
/** `create`: written only by node or edge creation. `once`: written while absent, never unset. */
|
|
4
6
|
export type PropertyImmutability = 'create' | 'once';
|
|
5
7
|
export interface PropertyAuto {
|
|
6
|
-
readonly on: readonly AutoEvent[];
|
|
8
|
+
readonly on: readonly [AutoEvent, ...AutoEvent[]];
|
|
7
9
|
readonly set: AutoSet;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
/** A Property of a Node Class, which may be a State Property. */
|
|
12
|
+
export interface NodePropertyDefinition {
|
|
13
|
+
readonly schema: JsonSchema;
|
|
11
14
|
readonly required: boolean;
|
|
12
15
|
readonly auto?: PropertyAuto;
|
|
13
16
|
readonly immutable?: PropertyImmutability;
|
|
14
17
|
readonly description?: string;
|
|
15
|
-
readonly state?:
|
|
18
|
+
readonly state?: StateTopology;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
export interface
|
|
19
|
-
readonly
|
|
20
|
+
/** A Property of an Edge Class: an Edge has no State Property. */
|
|
21
|
+
export interface EdgePropertyDefinition extends Omit<NodePropertyDefinition, 'state'> {
|
|
22
|
+
readonly state?: never;
|
|
23
|
+
}
|
|
24
|
+
/** A Property of a Class of either kind. */
|
|
25
|
+
export type PropertyDefinition = NodePropertyDefinition | EdgePropertyDefinition;
|
|
26
|
+
export type PropertyRecord<Definition extends PropertyDefinition = PropertyDefinition> = Readonly<Record<string, Definition>>;
|
|
27
|
+
export interface PropertyFacet<Definition extends PropertyDefinition = PropertyDefinition> {
|
|
28
|
+
readonly properties: PropertyRecord<Definition>;
|
|
20
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { acceptPropertyRoot } from '../../../value/accept.js';
|
|
2
2
|
import { isImmutableSnapshot } from '../../../value/immutable.optimization.js';
|
|
3
3
|
import { PropertyKey as admitPropertyKey } from '../../addressing/index.js';
|
|
4
|
+
import { compareCodeUnits } from '../../addressing/ordering.js';
|
|
4
5
|
export function acceptPropertyValues(input, pointer = '') {
|
|
5
6
|
const admitted = acceptPropertyRoot(input);
|
|
6
7
|
if (admitted === null || typeof admitted !== 'object' || Array.isArray(admitted)) {
|
|
@@ -10,7 +11,7 @@ export function acceptPropertyValues(input, pointer = '') {
|
|
|
10
11
|
}
|
|
11
12
|
export function createPropertyValues(entries) {
|
|
12
13
|
const output = Object.create(null);
|
|
13
|
-
for (const [key, value] of [...entries].sort(([left], [right]) =>
|
|
14
|
+
for (const [key, value] of [...entries].sort(([left], [right]) => compareCodeUnits(left, right))) {
|
|
14
15
|
Object.defineProperty(output, key, { enumerable: true, value: freeze(value) });
|
|
15
16
|
}
|
|
16
17
|
return Object.freeze(output);
|
|
@@ -28,6 +29,3 @@ function freeze(value) {
|
|
|
28
29
|
freeze(member);
|
|
29
30
|
return Object.freeze(value);
|
|
30
31
|
}
|
|
31
|
-
function compare(left, right) {
|
|
32
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
33
|
-
}
|
|
@@ -19,6 +19,7 @@ export interface ResolvedProperty<out Value = PortableValue, out Required extend
|
|
|
19
19
|
};
|
|
20
20
|
/** The one portable scalar ordering domain, when the Property is orderable. */
|
|
21
21
|
readonly ordering?: OrderingKind;
|
|
22
|
+
/** Check a value the Property holds, which a read returns: a `Ref` for a blob. */
|
|
22
23
|
validate(input: unknown): readonly Diagnostic[];
|
|
23
24
|
/** The admitted program `validate` evaluates. */
|
|
24
25
|
program(): ValueProgram;
|
|
@@ -33,7 +34,11 @@ export type ResolvedPropertyCollection<ByKey extends Readonly<Record<PropertyKey
|
|
|
33
34
|
readonly byKey: ByKey;
|
|
34
35
|
get<Key extends keyof ByKey>(key: Key): ByKey[Key];
|
|
35
36
|
get(key: PropertyKey): ResolvedProperty | undefined;
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A set of values by name or key, each checked by `validate`. A blob also takes the text of an
|
|
39
|
+
* upload receipt, which a write exchanges for its Ref and only the issuing Kernel can judge.
|
|
40
|
+
*/
|
|
41
|
+
from(input: PropertyValuesInput<ByKey, ByName>): PropertyValues;
|
|
37
42
|
};
|
|
38
43
|
export interface ResolvedClass<Kind extends ClassKind = ClassKind, Properties extends ResolvedPropertyCollection = ResolvedPropertyCollection, InstanceMethods extends ResolvedMethodCollection = ResolvedMethodCollection, StaticMethods extends ResolvedMethodCollection = ResolvedMethodCollection, SelfProperties extends ResolvedPropertyCollection = ResolvedPropertyCollection, SelfInstanceMethods extends ResolvedMethodCollection = ResolvedMethodCollection, SelfStaticMethods extends ResolvedMethodCollection = ResolvedMethodCollection, Definition extends Extract<ClassDefinition, {
|
|
39
44
|
readonly kind: Kind;
|
|
@@ -113,10 +118,10 @@ export type SelfStaticMethodsOf<Class> = Class extends {
|
|
|
113
118
|
};
|
|
114
119
|
};
|
|
115
120
|
} ? Methods : ResolvedMethodCollection<Record<never, never>>;
|
|
116
|
-
type
|
|
117
|
-
[Key in keyof ByKey]?: PropertyValueOf<ByKey[Key]>;
|
|
121
|
+
type PropertyValuesInput<ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<unknown>>>, ByName extends Readonly<Record<string, ResolvedProperty<unknown>>>> = Readonly<{
|
|
122
|
+
[Key in keyof ByKey]?: PropertyValueOf<ByKey[Key]> | PropertyWriteValueOf<ByKey[Key]>;
|
|
118
123
|
} & {
|
|
119
|
-
[Name in keyof ByName]?: PropertyValueOf<ByName[Name]>;
|
|
124
|
+
[Name in keyof ByName]?: PropertyValueOf<ByName[Name]> | PropertyWriteValueOf<ByName[Name]>;
|
|
120
125
|
}>;
|
|
121
126
|
type PropertyWriteInput<ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<unknown>>>, ByName extends Readonly<Record<string, ResolvedProperty<unknown>>>> = Readonly<{
|
|
122
127
|
[Key in keyof ByKey]?: PropertyWriteValueOf<ByKey[Key]>;
|