@astrale-os/kernel-dsl 0.1.5 → 0.2.0-beta.10
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/index.d.ts +1 -57
- package/dist/index.js +1 -31
- package/dist/upgrade/contract.d.ts +31 -0
- package/dist/upgrade/contract.js +1 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade/index.js +1 -0
- package/dist/v1/addressing/class-key.d.ts +12 -0
- package/dist/v1/addressing/class-key.js +39 -0
- package/dist/v1/addressing/definition-ref.d.ts +28 -0
- package/dist/v1/addressing/definition-ref.js +63 -0
- package/dist/v1/addressing/domain-dependency.d.ts +18 -0
- package/dist/v1/addressing/domain-dependency.js +6 -0
- package/dist/v1/addressing/index.d.ts +12 -0
- package/dist/v1/addressing/index.js +7 -0
- package/dist/v1/addressing/key.d.ts +19 -0
- package/dist/v1/addressing/key.js +39 -0
- package/dist/v1/addressing/method-address.d.ts +9 -0
- package/dist/v1/addressing/method-address.js +1 -0
- package/dist/v1/addressing/method-key.d.ts +15 -0
- package/dist/v1/addressing/method-key.js +60 -0
- package/dist/v1/addressing/ordering.d.ts +6 -0
- package/dist/v1/addressing/ordering.js +20 -0
- package/dist/v1/addressing/patterns.d.ts +27 -0
- package/dist/v1/addressing/patterns.js +29 -0
- package/dist/v1/addressing/property-key.d.ts +13 -0
- package/dist/v1/addressing/property-key.js +39 -0
- package/dist/v1/addressing/revision.d.ts +8 -0
- package/dist/v1/addressing/revision.js +8 -0
- package/dist/v1/builder/callable/authoring.d.ts +117 -0
- package/dist/v1/builder/callable/authoring.js +67 -0
- package/dist/v1/builder/class/authoring.d.ts +367 -0
- package/dist/v1/builder/class/authoring.js +134 -0
- package/dist/v1/builder/class/property.d.ts +52 -0
- package/dist/v1/builder/class/property.js +49 -0
- package/dist/v1/builder/core/authoring.d.ts +42 -0
- package/dist/v1/builder/core/authoring.js +39 -0
- package/dist/v1/builder/index.d.ts +26 -0
- package/dist/v1/builder/index.js +11 -0
- package/dist/v1/builder/lowering/callable.d.ts +24 -0
- package/dist/v1/builder/lowering/callable.js +135 -0
- package/dist/v1/builder/lowering/class.d.ts +22 -0
- package/dist/v1/builder/lowering/class.js +129 -0
- package/dist/v1/builder/lowering/core-properties.d.ts +10 -0
- package/dist/v1/builder/lowering/core-properties.js +76 -0
- package/dist/v1/builder/lowering/core.d.ts +22 -0
- package/dist/v1/builder/lowering/core.js +50 -0
- package/dist/v1/builder/lowering/policy.d.ts +16 -0
- package/dist/v1/builder/lowering/policy.js +59 -0
- package/dist/v1/builder/lowering/schema/capture.d.ts +4 -0
- package/dist/v1/builder/lowering/schema/capture.js +70 -0
- package/dist/v1/builder/lowering/schema/compile.d.ts +10 -0
- package/dist/v1/builder/lowering/schema/compile.js +80 -0
- package/dist/v1/builder/lowering/schema/context.d.ts +44 -0
- package/dist/v1/builder/lowering/schema/context.js +247 -0
- package/dist/v1/builder/lowering/schema/ownership.d.ts +8 -0
- package/dist/v1/builder/lowering/schema/ownership.js +29 -0
- package/dist/v1/builder/lowering/value/compile.d.ts +15 -0
- package/dist/v1/builder/lowering/value/compile.js +136 -0
- package/dist/v1/builder/lowering/value/path.d.ts +3 -0
- package/dist/v1/builder/lowering/value/path.js +20 -0
- package/dist/v1/builder/lowering/value/zod.d.ts +32 -0
- package/dist/v1/builder/lowering/value/zod.js +342 -0
- package/dist/v1/builder/lowering/view.d.ts +11 -0
- package/dist/v1/builder/lowering/view.js +27 -0
- package/dist/v1/builder/policy/authoring.d.ts +52 -0
- package/dist/v1/builder/policy/authoring.js +90 -0
- package/dist/v1/builder/schema/define.d.ts +11 -0
- package/dist/v1/builder/schema/define.js +5 -0
- package/dist/v1/builder/schema/diagnostic.d.ts +16 -0
- package/dist/v1/builder/schema/diagnostic.js +31 -0
- package/dist/v1/builder/schema/handle.d.ts +7 -0
- package/dist/v1/builder/schema/handle.js +14 -0
- package/dist/v1/builder/schema/input.d.ts +15 -0
- package/dist/v1/builder/schema/input.js +1 -0
- package/dist/v1/builder/schema/lazy.d.ts +2 -0
- package/dist/v1/builder/schema/lazy.js +13 -0
- package/dist/v1/builder/schema/projection.d.ts +364 -0
- package/dist/v1/builder/schema/projection.js +1 -0
- package/dist/v1/builder/value/full-match.d.ts +4 -0
- package/dist/v1/builder/value/full-match.js +11 -0
- package/dist/v1/builder/value/path-metadata.d.ts +4 -0
- package/dist/v1/builder/value/path-metadata.js +7 -0
- package/dist/v1/builder/value/path.d.ts +8 -0
- package/dist/v1/builder/value/path.js +11 -0
- package/dist/v1/builder/value/schema.d.ts +16 -0
- package/dist/v1/builder/value/schema.js +10 -0
- package/dist/v1/builder/view/authoring.d.ts +17 -0
- package/dist/v1/builder/view/authoring.js +16 -0
- package/dist/v1/bundle/codec.d.ts +5 -0
- package/dist/v1/bundle/codec.js +168 -0
- package/dist/v1/bundle/create.d.ts +3 -0
- package/dist/v1/bundle/create.js +5 -0
- package/dist/v1/bundle/diagnostic.d.ts +10 -0
- package/dist/v1/bundle/diagnostic.js +17 -0
- package/dist/v1/bundle/index.d.ts +18 -0
- package/dist/v1/bundle/index.js +20 -0
- package/dist/v1/bundle/model.d.ts +16 -0
- package/dist/v1/bundle/model.js +11 -0
- package/dist/v1/bundle/structure.d.ts +7 -0
- package/dist/v1/bundle/structure.js +71 -0
- package/dist/v1/bundle/transport.d.ts +8 -0
- package/dist/v1/bundle/transport.js +7 -0
- package/dist/v1/compiled/admission/accept.d.ts +3 -0
- package/dist/v1/compiled/admission/accept.js +881 -0
- package/dist/v1/compiled/admission/revision.d.ts +4 -0
- package/dist/v1/compiled/admission/revision.js +73 -0
- package/dist/v1/compiled/admission/semantics.d.ts +7 -0
- package/dist/v1/compiled/admission/semantics.js +1091 -0
- package/dist/v1/compiled/codec/json.d.ts +3 -0
- package/dist/v1/compiled/codec/json.js +9 -0
- package/dist/v1/compiled/compiler/compile.d.ts +4 -0
- package/dist/v1/compiled/compiler/compile.js +113 -0
- package/dist/v1/compiled/diagnostic.d.ts +11 -0
- package/dist/v1/compiled/diagnostic.js +13 -0
- package/dist/v1/compiled/index.d.ts +7 -0
- package/dist/v1/compiled/index.js +5 -0
- package/dist/v1/compiled/loader/index.d.ts +1 -0
- package/dist/v1/compiled/loader/index.js +1 -0
- package/dist/v1/compiled/loader/load.d.ts +4 -0
- package/dist/v1/compiled/loader/load.js +141 -0
- package/dist/v1/compiled/model/schema.d.ts +73 -0
- package/dist/v1/compiled/model/schema.js +1 -0
- package/dist/v1/domain/create.d.ts +8 -0
- package/dist/v1/domain/create.js +264 -0
- package/dist/v1/domain/index.d.ts +2 -0
- package/dist/v1/domain/index.js +1 -0
- package/dist/v1/domain/model/domain.d.ts +59 -0
- package/dist/v1/domain/model/domain.js +1 -0
- package/dist/v1/domain/model/input.d.ts +31 -0
- package/dist/v1/domain/model/input.js +1 -0
- package/dist/v1/domain/namespace/member-collection.d.ts +5 -0
- package/dist/v1/domain/namespace/member-collection.js +81 -0
- package/dist/v1/domain/projection/classes.d.ts +4 -0
- package/dist/v1/domain/projection/classes.js +200 -0
- package/dist/v1/domain/validation/create.d.ts +18 -0
- package/dist/v1/domain/validation/create.js +75 -0
- package/dist/v1/index.d.ts +16 -0
- package/dist/v1/index.js +8 -0
- package/dist/v1/language/callable/index.d.ts +2 -0
- package/dist/v1/language/callable/index.js +1 -0
- package/dist/v1/language/callable/model/callable.d.ts +33 -0
- package/dist/v1/language/callable/model/callable.js +1 -0
- package/dist/v1/language/callable/resolved.d.ts +68 -0
- package/dist/v1/language/callable/resolved.js +1 -0
- package/dist/v1/language/class/facets.d.ts +58 -0
- package/dist/v1/language/class/facets.js +1 -0
- package/dist/v1/language/class/index.d.ts +8 -0
- package/dist/v1/language/class/index.js +1 -0
- package/dist/v1/language/class/model/class.d.ts +36 -0
- package/dist/v1/language/class/model/class.js +1 -0
- package/dist/v1/language/class/model/data.d.ts +11 -0
- package/dist/v1/language/class/model/data.js +2 -0
- package/dist/v1/language/class/model/edge.d.ts +38 -0
- package/dist/v1/language/class/model/edge.js +1 -0
- package/dist/v1/language/class/model/property.d.ts +18 -0
- package/dist/v1/language/class/model/property.js +1 -0
- package/dist/v1/language/class/property-values.d.ts +15 -0
- package/dist/v1/language/class/property-values.js +30 -0
- package/dist/v1/language/class/resolved.d.ts +123 -0
- package/dist/v1/language/class/resolved.js +1 -0
- package/dist/v1/language/core/index.d.ts +2 -0
- package/dist/v1/language/core/index.js +1 -0
- package/dist/v1/language/core/model/core.d.ts +20 -0
- package/dist/v1/language/core/model/core.js +1 -0
- package/dist/v1/language/core/resolved.d.ts +21 -0
- package/dist/v1/language/core/resolved.js +1 -0
- package/dist/v1/language/definition/metadata.d.ts +12 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/definition.d.ts +7 -0
- package/dist/v1/language/definition.js +1 -0
- package/dist/v1/language/index.d.ts +23 -0
- package/dist/v1/language/index.js +1 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +19 -0
- package/dist/v1/language/policy/analysis/branches.js +132 -0
- package/dist/v1/language/policy/analysis/budgets.d.ts +16 -0
- package/dist/v1/language/policy/analysis/budgets.js +25 -0
- package/dist/v1/language/policy/index.d.ts +3 -0
- package/dist/v1/language/policy/index.js +1 -0
- package/dist/v1/language/policy/model/policy.d.ts +77 -0
- package/dist/v1/language/policy/model/policy.js +1 -0
- package/dist/v1/language/policy/normalization/normalize.d.ts +4 -0
- package/dist/v1/language/policy/normalization/normalize.js +226 -0
- package/dist/v1/language/policy/resolved.d.ts +9 -0
- package/dist/v1/language/policy/resolved.js +1 -0
- package/dist/v1/language/resolved.d.ts +10 -0
- package/dist/v1/language/resolved.js +1 -0
- package/dist/v1/language/validation/diagnostic.d.ts +8 -0
- package/dist/v1/language/validation/diagnostic.js +3 -0
- package/dist/v1/language/value/compile/fields.d.ts +3 -0
- package/dist/v1/language/value/compile/fields.js +60 -0
- package/dist/v1/language/value/compile/load.d.ts +4 -0
- package/dist/v1/language/value/compile/load.js +41 -0
- package/dist/v1/language/value/compile/model.d.ts +27 -0
- package/dist/v1/language/value/compile/model.js +1 -0
- package/dist/v1/language/value/evaluate/assertions.d.ts +6 -0
- package/dist/v1/language/value/evaluate/assertions.js +58 -0
- package/dist/v1/language/value/evaluate/evaluator.d.ts +4 -0
- package/dist/v1/language/value/evaluate/evaluator.js +361 -0
- package/dist/v1/language/value/evaluate/preparation.d.ts +13 -0
- package/dist/v1/language/value/evaluate/preparation.js +135 -0
- package/dist/v1/language/value/evaluate/program.d.ts +3 -0
- package/dist/v1/language/value/evaluate/program.js +16 -0
- package/dist/v1/language/value/evaluate/types.d.ts +36 -0
- package/dist/v1/language/value/evaluate/types.js +9 -0
- package/dist/v1/language/value/evaluate/validate.d.ts +12 -0
- package/dist/v1/language/value/evaluate/validate.js +43 -0
- package/dist/v1/language/value/index.d.ts +11 -0
- package/dist/v1/language/value/index.js +8 -0
- package/dist/v1/language/value/model/instant.d.ts +9 -0
- package/dist/v1/language/value/model/instant.js +37 -0
- package/dist/v1/language/value/model/object.d.ts +5 -0
- package/dist/v1/language/value/model/object.js +3 -0
- package/dist/v1/language/value/model/schema.d.ts +25 -0
- package/dist/v1/language/value/model/schema.js +11 -0
- package/dist/v1/language/value/ordering.d.ts +13 -0
- package/dist/v1/language/value/ordering.js +174 -0
- package/dist/v1/language/value/profile/canonicalize.d.ts +4 -0
- package/dist/v1/language/value/profile/canonicalize.js +130 -0
- package/dist/v1/language/value/profile/json.validate.d.ts +2 -0
- package/dist/v1/language/value/profile/json.validate.js +14 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +78 -0
- package/dist/v1/language/value/profile/meta-schema.compiled.js +2079 -0
- package/dist/v1/language/value/profile/meta-schema.d.ts +4 -0
- package/dist/v1/language/value/profile/meta-schema.js +19 -0
- package/dist/v1/language/value/profile/rules.d.ts +3 -0
- package/dist/v1/language/value/profile/rules.js +109 -0
- package/dist/v1/language/value/profile/validate.d.ts +4 -0
- package/dist/v1/language/value/profile/validate.js +39 -0
- package/dist/v1/language/value/profile/vocabulary.d.ts +2 -0
- package/dist/v1/language/value/profile/vocabulary.js +68 -0
- package/dist/v1/language/value/reference/closure.d.ts +11 -0
- package/dist/v1/language/value/reference/closure.js +51 -0
- package/dist/v1/language/value/reference/recursion.d.ts +5 -0
- package/dist/v1/language/value/reference/recursion.js +95 -0
- package/dist/v1/language/value/reference/references.d.ts +17 -0
- package/dist/v1/language/value/reference/references.js +45 -0
- package/dist/v1/language/value/reference/registry.d.ts +24 -0
- package/dist/v1/language/value/reference/registry.index.d.ts +14 -0
- package/dist/v1/language/value/reference/registry.index.js +76 -0
- package/dist/v1/language/value/reference/registry.js +1 -0
- package/dist/v1/language/value/regexp/ast.d.ts +21 -0
- package/dist/v1/language/value/regexp/ast.js +326 -0
- package/dist/v1/language/value/regexp/compile.d.ts +3 -0
- package/dist/v1/language/value/regexp/compile.js +96 -0
- package/dist/v1/language/value/regexp/lower.d.ts +3 -0
- package/dist/v1/language/value/regexp/lower.js +26 -0
- package/dist/v1/language/value/regexp/matcher.d.ts +7 -0
- package/dist/v1/language/value/regexp/matcher.js +50 -0
- package/dist/v1/language/value/regexp/pattern.d.ts +2 -0
- package/dist/v1/language/value/regexp/pattern.js +38 -0
- package/dist/v1/language/value/regexp/syntax.d.ts +2 -0
- package/dist/v1/language/value/regexp/syntax.js +5 -0
- package/dist/v1/language/value/syntax/full-match.d.ts +6 -0
- package/dist/v1/language/value/syntax/full-match.js +20 -0
- package/dist/v1/language/value/syntax/keywords.d.ts +3 -0
- package/dist/v1/language/value/syntax/keywords.js +20 -0
- package/dist/v1/language/value/syntax/node-path/schema.d.ts +5 -0
- package/dist/v1/language/value/syntax/node-path/schema.js +18 -0
- package/dist/v1/language/value/syntax/node-path/validate.d.ts +4 -0
- package/dist/v1/language/value/syntax/node-path/validate.js +80 -0
- package/dist/v1/language/value/syntax/pointer.d.ts +4 -0
- package/dist/v1/language/value/syntax/pointer.js +49 -0
- package/dist/v1/language/value/syntax/walk.d.ts +10 -0
- package/dist/v1/language/value/syntax/walk.js +53 -0
- package/dist/v1/language/view/index.d.ts +2 -0
- package/dist/v1/language/view/index.js +1 -0
- package/dist/v1/language/view/model/view.d.ts +11 -0
- package/dist/v1/language/view/model/view.js +1 -0
- package/dist/v1/language/view/resolved.d.ts +9 -0
- package/dist/v1/language/view/resolved.js +1 -0
- package/dist/v1/schema/admission/accept.d.ts +3 -0
- package/dist/v1/schema/admission/accept.js +26 -0
- package/dist/v1/schema/analysis/class.d.ts +41 -0
- package/dist/v1/schema/analysis/class.js +181 -0
- package/dist/v1/schema/canonical/domain.d.ts +3 -0
- package/dist/v1/schema/canonical/domain.digest.d.ts +3 -0
- package/dist/v1/schema/canonical/domain.digest.js +5 -0
- package/dist/v1/schema/canonical/domain.js +5 -0
- package/dist/v1/schema/canonical/freeze.d.ts +1 -0
- package/dist/v1/schema/canonical/freeze.js +9 -0
- package/dist/v1/schema/canonical/revision.d.ts +11 -0
- package/dist/v1/schema/canonical/revision.js +17 -0
- package/dist/v1/schema/codec/header.d.ts +17 -0
- package/dist/v1/schema/codec/header.js +26 -0
- package/dist/v1/schema/codec/schema.d.ts +5 -0
- package/dist/v1/schema/codec/schema.js +21 -0
- package/dist/v1/schema/compatibility/meaning.d.ts +29 -0
- package/dist/v1/schema/compatibility/meaning.js +605 -0
- package/dist/v1/schema/dependency/lookup.d.ts +18 -0
- package/dist/v1/schema/dependency/lookup.js +31 -0
- package/dist/v1/schema/diagnostic.d.ts +12 -0
- package/dist/v1/schema/diagnostic.js +21 -0
- package/dist/v1/schema/index.d.ts +26 -0
- package/dist/v1/schema/index.js +13 -0
- package/dist/v1/schema/model/format.d.ts +2 -0
- package/dist/v1/schema/model/format.js +2 -0
- package/dist/v1/schema/model/schema.d.ts +30 -0
- package/dist/v1/schema/model/schema.js +4 -0
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +207 -0
- package/dist/v1/schema/resolution/closure.d.ts +9 -0
- package/dist/v1/schema/resolution/closure.js +49 -0
- package/dist/v1/schema/resolution/context.d.ts +17 -0
- package/dist/v1/schema/resolution/context.js +158 -0
- package/dist/v1/schema/resolution/definition.index.d.ts +21 -0
- package/dist/v1/schema/resolution/definition.index.js +17 -0
- package/dist/v1/schema/resolution/domain.d.ts +4 -0
- package/dist/v1/schema/resolution/domain.js +112 -0
- package/dist/v1/schema/resolution/origins.d.ts +14 -0
- package/dist/v1/schema/resolution/origins.js +121 -0
- package/dist/v1/schema/resolution/value.registry.d.ts +7 -0
- package/dist/v1/schema/resolution/value.registry.js +39 -0
- package/dist/v1/schema/revision.d.ts +1 -0
- package/dist/v1/schema/revision.js +1 -0
- package/dist/v1/schema/validation/class.d.ts +5 -0
- package/dist/v1/schema/validation/class.js +208 -0
- package/dist/v1/schema/validation/core.d.ts +5 -0
- package/dist/v1/schema/validation/core.js +264 -0
- package/dist/v1/schema/validation/domain.d.ts +11 -0
- package/dist/v1/schema/validation/domain.js +36 -0
- package/dist/v1/schema/validation/domain.route.d.ts +4 -0
- package/dist/v1/schema/validation/domain.route.js +32 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +4 -0
- package/dist/v1/schema/validation/domain.structure.js +427 -0
- package/dist/v1/schema/validation/policy/budgets.d.ts +4 -0
- package/dist/v1/schema/validation/policy/budgets.js +102 -0
- package/dist/v1/schema/validation/policy/context.d.ts +28 -0
- package/dist/v1/schema/validation/policy/context.js +89 -0
- package/dist/v1/schema/validation/policy/references.d.ts +2 -0
- package/dist/v1/schema/validation/policy/references.js +143 -0
- package/dist/v1/schema/validation/policy/typing.d.ts +19 -0
- package/dist/v1/schema/validation/policy/typing.js +318 -0
- package/dist/v1/schema/validation/policy/uses.d.ts +5 -0
- package/dist/v1/schema/validation/policy/uses.js +258 -0
- package/dist/v1/schema/validation/policy/validate.d.ts +11 -0
- package/dist/v1/schema/validation/policy/validate.js +23 -0
- package/dist/v1/schema/validation/value-api.d.ts +13 -0
- package/dist/v1/schema/validation/value-api.js +23 -0
- package/dist/v1/schema/validation/value.d.ts +4 -0
- package/dist/v1/schema/validation/value.js +39 -0
- package/dist/v1/schema/validation/view.d.ts +3 -0
- package/dist/v1/schema/validation/view.js +29 -0
- package/dist/v1/value/full-match.d.ts +2 -0
- package/dist/v1/value/full-match.js +2 -0
- package/dist/v1.d.ts +2 -0
- package/dist/v1.js +2 -0
- package/dist/value/accept.d.ts +8 -0
- package/dist/value/accept.js +132 -0
- package/dist/value/canonical.d.ts +4 -0
- package/dist/value/canonical.js +41 -0
- package/dist/value/decode.d.ts +4 -0
- package/dist/value/decode.js +108 -0
- package/dist/value/equal.d.ts +3 -0
- package/dist/value/equal.js +5 -0
- package/dist/value/error.d.ts +12 -0
- package/dist/value/error.js +21 -0
- package/dist/value/index.d.ts +9 -0
- package/dist/value/index.js +6 -0
- package/dist/value/json.d.ts +3 -0
- package/dist/value/json.js +3 -0
- package/dist/value/limits.d.ts +21 -0
- package/dist/value/limits.js +15 -0
- package/dist/value/types.d.ts +6 -0
- package/dist/value/types.js +1 -0
- package/dist/value/unicode.d.ts +4 -0
- package/dist/value/unicode.js +64 -0
- package/dist/version/dispatch.d.ts +24 -0
- package/dist/version/dispatch.js +47 -0
- package/dist/version/index.d.ts +2 -0
- package/dist/version/index.js +1 -0
- package/package.json +75 -15
- package/dist/builders/bitmask.d.ts +0 -5
- package/dist/builders/bitmask.d.ts.map +0 -1
- package/dist/builders/bitmask.js +0 -12
- package/dist/builders/bitmask.js.map +0 -1
- package/dist/builders/data.d.ts +0 -7
- package/dist/builders/data.d.ts.map +0 -1
- package/dist/builders/data.js +0 -18
- package/dist/builders/data.js.map +0 -1
- package/dist/builders/definition/base.d.ts +0 -13
- package/dist/builders/definition/base.d.ts.map +0 -1
- package/dist/builders/definition/base.js +0 -24
- package/dist/builders/definition/base.js.map +0 -1
- package/dist/builders/definition/edge-class.d.ts +0 -8
- package/dist/builders/definition/edge-class.d.ts.map +0 -1
- package/dist/builders/definition/edge-class.js +0 -9
- package/dist/builders/definition/edge-class.js.map +0 -1
- package/dist/builders/definition/edge-interface.d.ts +0 -8
- package/dist/builders/definition/edge-interface.d.ts.map +0 -1
- package/dist/builders/definition/edge-interface.js +0 -9
- package/dist/builders/definition/edge-interface.js.map +0 -1
- package/dist/builders/definition/node-class.d.ts +0 -7
- package/dist/builders/definition/node-class.d.ts.map +0 -1
- package/dist/builders/definition/node-class.js +0 -9
- package/dist/builders/definition/node-class.js.map +0 -1
- package/dist/builders/definition/node-interface.d.ts +0 -7
- package/dist/builders/definition/node-interface.d.ts.map +0 -1
- package/dist/builders/definition/node-interface.js +0 -9
- package/dist/builders/definition/node-interface.js.map +0 -1
- package/dist/builders/function.d.ts +0 -34
- package/dist/builders/function.d.ts.map +0 -1
- package/dist/builders/function.js +0 -8
- package/dist/builders/function.js.map +0 -1
- package/dist/builders/policy.d.ts +0 -10
- package/dist/builders/policy.d.ts.map +0 -1
- package/dist/builders/policy.js +0 -28
- package/dist/builders/policy.js.map +0 -1
- package/dist/builders/prop.d.ts +0 -7
- package/dist/builders/prop.d.ts.map +0 -1
- package/dist/builders/prop.js +0 -9
- package/dist/builders/prop.js.map +0 -1
- package/dist/builders/ref.d.ts +0 -12
- package/dist/builders/ref.d.ts.map +0 -1
- package/dist/builders/ref.js +0 -27
- package/dist/builders/ref.js.map +0 -1
- package/dist/grammar/definition/base.d.ts +0 -13
- package/dist/grammar/definition/base.d.ts.map +0 -1
- package/dist/grammar/definition/base.js +0 -2
- package/dist/grammar/definition/base.js.map +0 -1
- package/dist/grammar/definition/discriminants.d.ts +0 -31
- package/dist/grammar/definition/discriminants.d.ts.map +0 -1
- package/dist/grammar/definition/discriminants.js +0 -33
- package/dist/grammar/definition/discriminants.js.map +0 -1
- package/dist/grammar/definition/edge-class.d.ts +0 -19
- package/dist/grammar/definition/edge-class.d.ts.map +0 -1
- package/dist/grammar/definition/edge-class.js +0 -2
- package/dist/grammar/definition/edge-class.js.map +0 -1
- package/dist/grammar/definition/edge-interface.d.ts +0 -18
- package/dist/grammar/definition/edge-interface.d.ts.map +0 -1
- package/dist/grammar/definition/edge-interface.js +0 -2
- package/dist/grammar/definition/edge-interface.js.map +0 -1
- package/dist/grammar/definition/node-class.d.ts +0 -26
- package/dist/grammar/definition/node-class.d.ts.map +0 -1
- package/dist/grammar/definition/node-class.js +0 -2
- package/dist/grammar/definition/node-class.js.map +0 -1
- package/dist/grammar/definition/node-interface.d.ts +0 -14
- package/dist/grammar/definition/node-interface.d.ts.map +0 -1
- package/dist/grammar/definition/node-interface.js +0 -2
- package/dist/grammar/definition/node-interface.js.map +0 -1
- package/dist/grammar/facets/constraints.d.ts +0 -8
- package/dist/grammar/facets/constraints.d.ts.map +0 -1
- package/dist/grammar/facets/constraints.js +0 -2
- package/dist/grammar/facets/constraints.js.map +0 -1
- package/dist/grammar/facets/content.d.ts +0 -4
- package/dist/grammar/facets/content.d.ts.map +0 -1
- package/dist/grammar/facets/content.js +0 -2
- package/dist/grammar/facets/content.js.map +0 -1
- package/dist/grammar/facets/endpoints.d.ts +0 -14
- package/dist/grammar/facets/endpoints.d.ts.map +0 -1
- package/dist/grammar/facets/endpoints.js +0 -3
- package/dist/grammar/facets/endpoints.js.map +0 -1
- package/dist/grammar/facets/indexes.d.ts +0 -12
- package/dist/grammar/facets/indexes.d.ts.map +0 -1
- package/dist/grammar/facets/indexes.js +0 -9
- package/dist/grammar/facets/indexes.js.map +0 -1
- package/dist/grammar/facets/properties.d.ts +0 -26
- package/dist/grammar/facets/properties.d.ts.map +0 -1
- package/dist/grammar/facets/properties.js +0 -45
- package/dist/grammar/facets/properties.js.map +0 -1
- package/dist/grammar/function/config.d.ts +0 -16
- package/dist/grammar/function/config.d.ts.map +0 -1
- package/dist/grammar/function/config.js +0 -2
- package/dist/grammar/function/config.js.map +0 -1
- package/dist/grammar/function/def.d.ts +0 -58
- package/dist/grammar/function/def.d.ts.map +0 -1
- package/dist/grammar/function/def.js +0 -2
- package/dist/grammar/function/def.js.map +0 -1
- package/dist/grammar/function/inheritance.d.ts +0 -3
- package/dist/grammar/function/inheritance.d.ts.map +0 -1
- package/dist/grammar/function/inheritance.js +0 -2
- package/dist/grammar/function/inheritance.js.map +0 -1
- package/dist/grammar/function/output.d.ts +0 -3
- package/dist/grammar/function/output.d.ts.map +0 -1
- package/dist/grammar/function/output.js +0 -2
- package/dist/grammar/function/output.js.map +0 -1
- package/dist/grammar/policy/callable.d.ts +0 -40
- package/dist/grammar/policy/callable.d.ts.map +0 -1
- package/dist/grammar/policy/callable.js +0 -2
- package/dist/grammar/policy/callable.js.map +0 -1
- package/dist/grammar/policy/def.d.ts +0 -27
- package/dist/grammar/policy/def.d.ts.map +0 -1
- package/dist/grammar/policy/def.js +0 -2
- package/dist/grammar/policy/def.js.map +0 -1
- package/dist/grammar/policy/pattern.d.ts +0 -34
- package/dist/grammar/policy/pattern.d.ts.map +0 -1
- package/dist/grammar/policy/pattern.js +0 -2
- package/dist/grammar/policy/pattern.js.map +0 -1
- package/dist/grammar/values/bitmask.d.ts +0 -7
- package/dist/grammar/values/bitmask.d.ts.map +0 -1
- package/dist/grammar/values/bitmask.js +0 -2
- package/dist/grammar/values/bitmask.js.map +0 -1
- package/dist/grammar/values/data.d.ts +0 -30
- package/dist/grammar/values/data.d.ts.map +0 -1
- package/dist/grammar/values/data.js +0 -2
- package/dist/grammar/values/data.js.map +0 -1
- package/dist/grammar/values/ref.d.ts +0 -26
- package/dist/grammar/values/ref.d.ts.map +0 -1
- package/dist/grammar/values/ref.js +0 -2
- package/dist/grammar/values/ref.js.map +0 -1
- package/dist/grammar/values/self.d.ts +0 -12
- package/dist/grammar/values/self.d.ts.map +0 -1
- package/dist/grammar/values/self.js +0 -6
- package/dist/grammar/values/self.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inference/content.d.ts +0 -27
- package/dist/inference/content.d.ts.map +0 -1
- package/dist/inference/content.js +0 -2
- package/dist/inference/content.js.map +0 -1
- package/dist/inference/index.d.ts +0 -7
- package/dist/inference/index.d.ts.map +0 -1
- package/dist/inference/index.js +0 -2
- package/dist/inference/index.js.map +0 -1
- package/dist/inference/inheritance.d.ts +0 -48
- package/dist/inference/inheritance.d.ts.map +0 -1
- package/dist/inference/inheritance.js +0 -2
- package/dist/inference/inheritance.js.map +0 -1
- package/dist/inference/input.d.ts +0 -30
- package/dist/inference/input.d.ts.map +0 -1
- package/dist/inference/input.js +0 -2
- package/dist/inference/input.js.map +0 -1
- package/dist/inference/methods.d.ts +0 -69
- package/dist/inference/methods.d.ts.map +0 -1
- package/dist/inference/methods.js +0 -2
- package/dist/inference/methods.js.map +0 -1
- package/dist/inference/properties.d.ts +0 -37
- package/dist/inference/properties.d.ts.map +0 -1
- package/dist/inference/properties.js +0 -2
- package/dist/inference/properties.js.map +0 -1
- package/dist/inference/schema.d.ts +0 -37
- package/dist/inference/schema.d.ts.map +0 -1
- package/dist/inference/schema.js +0 -2
- package/dist/inference/schema.js.map +0 -1
- package/dist/instance/core/define.d.ts +0 -13
- package/dist/instance/core/define.d.ts.map +0 -1
- package/dist/instance/core/define.js +0 -63
- package/dist/instance/core/define.js.map +0 -1
- package/dist/instance/core/edge.d.ts +0 -9
- package/dist/instance/core/edge.d.ts.map +0 -1
- package/dist/instance/core/edge.js +0 -11
- package/dist/instance/core/edge.js.map +0 -1
- package/dist/instance/core/endpoint.d.ts +0 -11
- package/dist/instance/core/endpoint.d.ts.map +0 -1
- package/dist/instance/core/endpoint.js +0 -19
- package/dist/instance/core/endpoint.js.map +0 -1
- package/dist/instance/core/node.d.ts +0 -7
- package/dist/instance/core/node.d.ts.map +0 -1
- package/dist/instance/core/node.js +0 -9
- package/dist/instance/core/node.js.map +0 -1
- package/dist/instance/core/path.d.ts +0 -21
- package/dist/instance/core/path.d.ts.map +0 -1
- package/dist/instance/core/path.js +0 -21
- package/dist/instance/core/path.js.map +0 -1
- package/dist/instance/core/self.d.ts +0 -15
- package/dist/instance/core/self.d.ts.map +0 -1
- package/dist/instance/core/self.js +0 -8
- package/dist/instance/core/self.js.map +0 -1
- package/dist/instance/core/types.d.ts +0 -45
- package/dist/instance/core/types.d.ts.map +0 -1
- package/dist/instance/core/types.js +0 -2
- package/dist/instance/core/types.js.map +0 -1
- package/dist/instance/seed/define.d.ts +0 -12
- package/dist/instance/seed/define.d.ts.map +0 -1
- package/dist/instance/seed/define.js +0 -34
- package/dist/instance/seed/define.js.map +0 -1
- package/dist/instance/seed/types.d.ts +0 -12
- package/dist/instance/seed/types.d.ts.map +0 -1
- package/dist/instance/seed/types.js +0 -2
- package/dist/instance/seed/types.js.map +0 -1
- package/dist/ir/classes.d.ts +0 -78
- package/dist/ir/classes.d.ts.map +0 -1
- package/dist/ir/classes.js +0 -2
- package/dist/ir/classes.js.map +0 -1
- package/dist/ir/domain.d.ts +0 -13
- package/dist/ir/domain.d.ts.map +0 -1
- package/dist/ir/domain.js +0 -2
- package/dist/ir/domain.js.map +0 -1
- package/dist/ir/endpoints.d.ts +0 -27
- package/dist/ir/endpoints.d.ts.map +0 -1
- package/dist/ir/endpoints.js +0 -2
- package/dist/ir/endpoints.js.map +0 -1
- package/dist/ir/functions.d.ts +0 -34
- package/dist/ir/functions.d.ts.map +0 -1
- package/dist/ir/functions.js +0 -2
- package/dist/ir/functions.js.map +0 -1
- package/dist/ir/index.d.ts +0 -9
- package/dist/ir/index.d.ts.map +0 -1
- package/dist/ir/index.js +0 -2
- package/dist/ir/index.js.map +0 -1
- package/dist/ir/ir.d.ts +0 -75
- package/dist/ir/ir.d.ts.map +0 -1
- package/dist/ir/ir.js +0 -5
- package/dist/ir/ir.js.map +0 -1
- package/dist/ir/json-schema.d.ts +0 -20
- package/dist/ir/json-schema.d.ts.map +0 -1
- package/dist/ir/json-schema.js +0 -2
- package/dist/ir/json-schema.js.map +0 -1
- package/dist/ir/policies.d.ts +0 -74
- package/dist/ir/policies.d.ts.map +0 -1
- package/dist/ir/policies.js +0 -2
- package/dist/ir/policies.js.map +0 -1
- package/dist/schema/classify.d.ts +0 -8
- package/dist/schema/classify.d.ts.map +0 -1
- package/dist/schema/classify.js +0 -20
- package/dist/schema/classify.js.map +0 -1
- package/dist/schema/define.d.ts +0 -23
- package/dist/schema/define.d.ts.map +0 -1
- package/dist/schema/define.js +0 -58
- package/dist/schema/define.js.map +0 -1
- package/dist/schema/error.d.ts +0 -8
- package/dist/schema/error.d.ts.map +0 -1
- package/dist/schema/error.js +0 -14
- package/dist/schema/error.js.map +0 -1
- package/dist/schema/refs.d.ts +0 -77
- package/dist/schema/refs.d.ts.map +0 -1
- package/dist/schema/refs.js +0 -100
- package/dist/schema/refs.js.map +0 -1
- package/dist/schema/resolve/index.d.ts +0 -5
- package/dist/schema/resolve/index.d.ts.map +0 -1
- package/dist/schema/resolve/index.js +0 -5
- package/dist/schema/resolve/index.js.map +0 -1
- package/dist/schema/resolve/methods.d.ts +0 -8
- package/dist/schema/resolve/methods.d.ts.map +0 -1
- package/dist/schema/resolve/methods.js +0 -18
- package/dist/schema/resolve/methods.js.map +0 -1
- package/dist/schema/resolve/properties.d.ts +0 -13
- package/dist/schema/resolve/properties.d.ts.map +0 -1
- package/dist/schema/resolve/properties.js +0 -37
- package/dist/schema/resolve/properties.js.map +0 -1
- package/dist/schema/resolve/self.d.ts +0 -7
- package/dist/schema/resolve/self.d.ts.map +0 -1
- package/dist/schema/resolve/self.js +0 -33
- package/dist/schema/resolve/self.js.map +0 -1
- package/dist/schema/resolve/thunks.d.ts +0 -12
- package/dist/schema/resolve/thunks.d.ts.map +0 -1
- package/dist/schema/resolve/thunks.js +0 -37
- package/dist/schema/resolve/thunks.js.map +0 -1
- package/dist/schema/schema.d.ts +0 -25
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js +0 -2
- package/dist/schema/schema.js.map +0 -1
- package/dist/schema/validators/context.d.ts +0 -17
- package/dist/schema/validators/context.d.ts.map +0 -1
- package/dist/schema/validators/context.js +0 -2
- package/dist/schema/validators/context.js.map +0 -1
- package/dist/schema/validators/endpoints.d.ts +0 -4
- package/dist/schema/validators/endpoints.d.ts.map +0 -1
- package/dist/schema/validators/endpoints.js +0 -27
- package/dist/schema/validators/endpoints.js.map +0 -1
- package/dist/schema/validators/index.d.ts +0 -12
- package/dist/schema/validators/index.d.ts.map +0 -1
- package/dist/schema/validators/index.js +0 -25
- package/dist/schema/validators/index.js.map +0 -1
- package/dist/schema/validators/indexes.d.ts +0 -4
- package/dist/schema/validators/indexes.d.ts.map +0 -1
- package/dist/schema/validators/indexes.js +0 -19
- package/dist/schema/validators/indexes.js.map +0 -1
- package/dist/schema/validators/inheritance.d.ts +0 -4
- package/dist/schema/validators/inheritance.d.ts.map +0 -1
- package/dist/schema/validators/inheritance.js +0 -27
- package/dist/schema/validators/inheritance.js.map +0 -1
- package/dist/schema/validators/methods.d.ts +0 -9
- package/dist/schema/validators/methods.d.ts.map +0 -1
- package/dist/schema/validators/methods.js +0 -44
- package/dist/schema/validators/methods.js.map +0 -1
- package/dist/schema/validators/names.d.ts +0 -4
- package/dist/schema/validators/names.d.ts.map +0 -1
- package/dist/schema/validators/names.js +0 -19
- package/dist/schema/validators/names.js.map +0 -1
- package/dist/schema/validators/policies.d.ts +0 -4
- package/dist/schema/validators/policies.d.ts.map +0 -1
- package/dist/schema/validators/policies.js +0 -61
- package/dist/schema/validators/policies.js.map +0 -1
- package/dist/schema/validators/ref-targets.d.ts +0 -4
- package/dist/schema/validators/ref-targets.d.ts.map +0 -1
- package/dist/schema/validators/ref-targets.js +0 -54
- package/dist/schema/validators/ref-targets.js.map +0 -1
- package/dist/serializer/context.d.ts +0 -35
- package/dist/serializer/context.d.ts.map +0 -1
- package/dist/serializer/context.js +0 -359
- package/dist/serializer/context.js.map +0 -1
- package/dist/serializer/helpers.d.ts +0 -34
- package/dist/serializer/helpers.d.ts.map +0 -1
- package/dist/serializer/helpers.js +0 -116
- package/dist/serializer/helpers.js.map +0 -1
- package/dist/serializer/index.d.ts +0 -2
- package/dist/serializer/index.d.ts.map +0 -1
- package/dist/serializer/index.js +0 -2
- package/dist/serializer/index.js.map +0 -1
- package/dist/serializer/policies.d.ts +0 -34
- package/dist/serializer/policies.d.ts.map +0 -1
- package/dist/serializer/policies.js +0 -837
- package/dist/serializer/policies.js.map +0 -1
- package/dist/serializer/policy-typing.d.ts +0 -56
- package/dist/serializer/policy-typing.d.ts.map +0 -1
- package/dist/serializer/policy-typing.js +0 -490
- package/dist/serializer/policy-typing.js.map +0 -1
- package/dist/serializer/serialize.d.ts +0 -12
- package/dist/serializer/serialize.d.ts.map +0 -1
- package/dist/serializer/serialize.js +0 -6
- package/dist/serializer/serialize.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ClassRef, CoreRef, DefinitionBase } from '../../../addressing/index.js';
|
|
2
|
+
import type { PropertyValues } from '../../class/property-values.js';
|
|
3
|
+
export interface DomainEndpointRef {
|
|
4
|
+
readonly kind: 'domain';
|
|
5
|
+
}
|
|
6
|
+
export type CoreEndpointRef = CoreRef | DomainEndpointRef;
|
|
7
|
+
export interface CoreDefinition extends DefinitionBase<CoreRef> {
|
|
8
|
+
readonly class: ClassRef;
|
|
9
|
+
readonly properties: PropertyValues;
|
|
10
|
+
}
|
|
11
|
+
export interface CoreEdge {
|
|
12
|
+
readonly class: ClassRef;
|
|
13
|
+
readonly source: CoreEndpointRef;
|
|
14
|
+
readonly target: CoreEndpointRef;
|
|
15
|
+
readonly properties: PropertyValues;
|
|
16
|
+
}
|
|
17
|
+
export interface CoreContent {
|
|
18
|
+
readonly nodes: Readonly<Record<string, CoreDefinition>>;
|
|
19
|
+
readonly edges: readonly CoreEdge[];
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DefinitionKey } from '../../addressing/index.js';
|
|
2
|
+
import type { PropertyValues } from '../class/property-values.js';
|
|
3
|
+
import type { ResolvedClass } from '../class/resolved.js';
|
|
4
|
+
import type { CoreDefinition } from './model/core.js';
|
|
5
|
+
export interface ResolvedCoreDefinition {
|
|
6
|
+
readonly ref: CoreDefinition['ref'];
|
|
7
|
+
readonly key: DefinitionKey<string, 'core'>;
|
|
8
|
+
readonly class: ResolvedClass<'node'>;
|
|
9
|
+
readonly properties: PropertyValues;
|
|
10
|
+
readonly definition: CoreDefinition;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedDomainEndpoint {
|
|
13
|
+
readonly kind: 'domain';
|
|
14
|
+
readonly origin: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedCoreEdge {
|
|
17
|
+
readonly class: ResolvedClass<'edge'>;
|
|
18
|
+
readonly source: ResolvedCoreDefinition | ResolvedDomainEndpoint;
|
|
19
|
+
readonly target: ResolvedCoreDefinition | ResolvedDomainEndpoint;
|
|
20
|
+
readonly properties: PropertyValues;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Exact V1 bound for optional human-facing declaration descriptions. */
|
|
2
|
+
export declare const description: Readonly<{
|
|
3
|
+
readonly type: 'string';
|
|
4
|
+
readonly minLength: 1;
|
|
5
|
+
readonly maxLength: 1000;
|
|
6
|
+
}>;
|
|
7
|
+
/** Exact V1 bound for optional Node Class presentation icons. */
|
|
8
|
+
export declare const icon: Readonly<{
|
|
9
|
+
readonly type: 'string';
|
|
10
|
+
readonly minLength: 1;
|
|
11
|
+
readonly maxLength: 8000;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Exact V1 bound for optional human-facing declaration descriptions. */
|
|
2
|
+
export const description = Object.freeze({
|
|
3
|
+
type: 'string',
|
|
4
|
+
minLength: 1,
|
|
5
|
+
maxLength: 1000,
|
|
6
|
+
});
|
|
7
|
+
/** Exact V1 bound for optional Node Class presentation icons. */
|
|
8
|
+
export const icon = Object.freeze({
|
|
9
|
+
type: 'string',
|
|
10
|
+
minLength: 1,
|
|
11
|
+
maxLength: 8000,
|
|
12
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FunctionDefinition } from './callable/model/callable.js';
|
|
2
|
+
import type { ClassDefinition } from './class/model/class.js';
|
|
3
|
+
import type { CoreDefinition } from './core/model/core.js';
|
|
4
|
+
import type { PolicyDefinition } from './policy/model/policy.js';
|
|
5
|
+
import type { ViewDefinition } from './view/model/view.js';
|
|
6
|
+
/** Every named V1 product Definition. Property and Method remain Class-owned members. */
|
|
7
|
+
export type Definition = ClassDefinition | FunctionDefinition | PolicyDefinition | ViewDefinition | CoreDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodKey, PolicyRef, PropertyKey, ViewRef, } from '../addressing/index.js';
|
|
2
|
+
export type { Value as PropertyValue } from '@astrale-os/kernel-dsl/value';
|
|
3
|
+
export type { JsonSchema as ValueSchema, JsonSchemaObject as ValueSchemaObject, } from './value/model/schema.js';
|
|
4
|
+
export type { OrderingKind } from './value/ordering.js';
|
|
5
|
+
export type * from './callable/model/callable.js';
|
|
6
|
+
export type * from './callable/resolved.js';
|
|
7
|
+
export type * from './class/model/class.js';
|
|
8
|
+
export type { DataDefinition, DataFacet, MediaType } from './class/model/data.js';
|
|
9
|
+
export type * from './class/model/edge.js';
|
|
10
|
+
export type * from './class/model/property.js';
|
|
11
|
+
export type * from './class/resolved.js';
|
|
12
|
+
export type * from './class/facets.js';
|
|
13
|
+
export { PropertyValues } from './class/property-values.js';
|
|
14
|
+
export type { PropertyValuesOperations } from './class/property-values.js';
|
|
15
|
+
export type * from './core/model/core.js';
|
|
16
|
+
export type * from './core/resolved.js';
|
|
17
|
+
export type { Definition } from './definition.js';
|
|
18
|
+
export type { ResolvedDefinition, ResolvedDefinitionOf } from './resolved.js';
|
|
19
|
+
export type { Diagnostic, DiagnosticCode } from './validation/diagnostic.js';
|
|
20
|
+
export type * from './policy/model/policy.js';
|
|
21
|
+
export type * from './policy/resolved.js';
|
|
22
|
+
export type * from './view/model/view.js';
|
|
23
|
+
export type * from './view/resolved.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PropertyValues } from './class/property-values.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ClassRef } from '../../../addressing/index.js';
|
|
2
|
+
import type { PolicyEdgePattern, PolicyPatternExpression, PolicyPatternTerm } from '../model/policy.js';
|
|
3
|
+
export interface PatternBranch {
|
|
4
|
+
readonly edges: readonly PatternEdgeUse[];
|
|
5
|
+
readonly variables: ReadonlyMap<string, ClassRef>;
|
|
6
|
+
readonly requiredVariables: ReadonlySet<string>;
|
|
7
|
+
readonly namespace: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PatternEdgeUse {
|
|
10
|
+
readonly pattern: PolicyEdgePattern;
|
|
11
|
+
readonly namespace: string;
|
|
12
|
+
}
|
|
13
|
+
export type PolicyTargetMode = 'object' | 'edge';
|
|
14
|
+
export declare function branchesOf(pattern: PolicyPatternExpression, namespace: string): readonly PatternBranch[];
|
|
15
|
+
export declare function branchProduct(children: readonly (readonly PatternBranch[])[]): readonly PatternBranch[];
|
|
16
|
+
export declare function capBranches(values: readonly PatternBranch[]): readonly PatternBranch[];
|
|
17
|
+
export declare function isConnected(branch: PatternBranch): boolean;
|
|
18
|
+
export declare function targetMode(branch: PatternBranch): PolicyTargetMode | undefined;
|
|
19
|
+
export declare function termKey(term: PolicyPatternTerm, namespace: string): string;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { BRANCH_OVERFLOW } from './budgets.js';
|
|
2
|
+
export function branchesOf(pattern, namespace) {
|
|
3
|
+
const variables = collectVariableClasses(pattern, namespace);
|
|
4
|
+
return branchesForNode(pattern, namespace, variables);
|
|
5
|
+
}
|
|
6
|
+
export function branchProduct(children) {
|
|
7
|
+
let result = [emptyBranch()];
|
|
8
|
+
for (const child of children) {
|
|
9
|
+
const next = [];
|
|
10
|
+
for (const left of result) {
|
|
11
|
+
for (const right of child) {
|
|
12
|
+
next.push(mergeBranches(left, right));
|
|
13
|
+
if (next.length >= BRANCH_OVERFLOW)
|
|
14
|
+
return next;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
result = next;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
export function capBranches(values) {
|
|
22
|
+
return values.length <= BRANCH_OVERFLOW ? values : values.slice(0, BRANCH_OVERFLOW);
|
|
23
|
+
}
|
|
24
|
+
export function isConnected(branch) {
|
|
25
|
+
const mode = targetMode(branch);
|
|
26
|
+
if (mode === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
const vertices = new Set(mode === 'object' ? ['subject', 'object'] : ['subject', 'source', 'target']);
|
|
29
|
+
for (const variable of branch.requiredVariables)
|
|
30
|
+
vertices.add(variable);
|
|
31
|
+
const union = new UnionFind(vertices);
|
|
32
|
+
for (const edge of branch.edges) {
|
|
33
|
+
const source = termKey(edge.pattern.source, edge.namespace);
|
|
34
|
+
const target = termKey(edge.pattern.target, edge.namespace);
|
|
35
|
+
union.add(source);
|
|
36
|
+
union.add(target);
|
|
37
|
+
union.join(source, target);
|
|
38
|
+
}
|
|
39
|
+
const root = union.find('subject');
|
|
40
|
+
return [...vertices].every((vertex) => union.find(vertex) === root);
|
|
41
|
+
}
|
|
42
|
+
export function targetMode(branch) {
|
|
43
|
+
let object = false;
|
|
44
|
+
let source = false;
|
|
45
|
+
let target = false;
|
|
46
|
+
for (const edge of branch.edges) {
|
|
47
|
+
for (const term of [edge.pattern.source, edge.pattern.target]) {
|
|
48
|
+
object ||= term.kind === 'object';
|
|
49
|
+
source ||= term.kind === 'source';
|
|
50
|
+
target ||= term.kind === 'target';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (object && !source && !target)
|
|
54
|
+
return 'object';
|
|
55
|
+
if (!object && source && target)
|
|
56
|
+
return 'edge';
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
export function termKey(term, namespace) {
|
|
60
|
+
return term.kind === 'variable' ? variableKey(namespace, term.id) : term.kind;
|
|
61
|
+
}
|
|
62
|
+
function branchesForNode(pattern, namespace, variables) {
|
|
63
|
+
if ('source' in pattern) {
|
|
64
|
+
return [{ edges: [{ pattern, namespace }], variables, requiredVariables: new Set(), namespace }];
|
|
65
|
+
}
|
|
66
|
+
if ('exists' in pattern) {
|
|
67
|
+
const direct = new Set(pattern.exists.nodes.map((node) => variableKey(namespace, node.variable.id)));
|
|
68
|
+
return branchesForNode(pattern.exists.where, namespace, variables).map((branch) => ({
|
|
69
|
+
...branch,
|
|
70
|
+
requiredVariables: new Set([...branch.requiredVariables, ...direct]),
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const children = ('allOf' in pattern ? pattern.allOf : pattern.anyOf).map((child) => branchesForNode(child, namespace, variables));
|
|
74
|
+
return 'allOf' in pattern ? branchProduct(children) : capBranches(children.flat());
|
|
75
|
+
}
|
|
76
|
+
function emptyBranch() {
|
|
77
|
+
return { edges: [], variables: new Map(), requiredVariables: new Set(), namespace: '$' };
|
|
78
|
+
}
|
|
79
|
+
function mergeBranches(left, right) {
|
|
80
|
+
return {
|
|
81
|
+
edges: [...left.edges, ...right.edges],
|
|
82
|
+
variables: new Map([...left.variables, ...right.variables]),
|
|
83
|
+
requiredVariables: new Set([...left.requiredVariables, ...right.requiredVariables]),
|
|
84
|
+
namespace: `${left.namespace}&${right.namespace}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function collectVariableClasses(pattern, namespace) {
|
|
88
|
+
const result = new Map();
|
|
89
|
+
const visit = (node) => {
|
|
90
|
+
if ('exists' in node) {
|
|
91
|
+
for (const variable of node.exists.nodes) {
|
|
92
|
+
result.set(variableKey(namespace, variable.variable.id), variable.class);
|
|
93
|
+
}
|
|
94
|
+
visit(node.exists.where);
|
|
95
|
+
}
|
|
96
|
+
else if ('allOf' in node)
|
|
97
|
+
node.allOf.forEach(visit);
|
|
98
|
+
else if ('anyOf' in node)
|
|
99
|
+
node.anyOf.forEach(visit);
|
|
100
|
+
};
|
|
101
|
+
visit(pattern);
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
function variableKey(namespace, id) {
|
|
105
|
+
return `variable:${namespace}:${id}`;
|
|
106
|
+
}
|
|
107
|
+
class UnionFind {
|
|
108
|
+
#parents = new Map();
|
|
109
|
+
constructor(values) {
|
|
110
|
+
for (const value of values)
|
|
111
|
+
this.add(value);
|
|
112
|
+
}
|
|
113
|
+
add(value) {
|
|
114
|
+
if (!this.#parents.has(value))
|
|
115
|
+
this.#parents.set(value, value);
|
|
116
|
+
}
|
|
117
|
+
find(value) {
|
|
118
|
+
this.add(value);
|
|
119
|
+
const parent = this.#parents.get(value);
|
|
120
|
+
if (parent === value)
|
|
121
|
+
return value;
|
|
122
|
+
const root = this.find(parent);
|
|
123
|
+
this.#parents.set(value, root);
|
|
124
|
+
return root;
|
|
125
|
+
}
|
|
126
|
+
join(left, right) {
|
|
127
|
+
const a = this.find(left);
|
|
128
|
+
const b = this.find(right);
|
|
129
|
+
if (a !== b)
|
|
130
|
+
this.#parents.set(b, a);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PolicyCheckExpression } from '../model/policy.js';
|
|
2
|
+
export declare const MAX_PATTERN_DEPTH = 4;
|
|
3
|
+
export declare const MAX_BRANCHES = 8;
|
|
4
|
+
export declare const MAX_VARIABLES = 4;
|
|
5
|
+
export declare const MAX_EDGES = 6;
|
|
6
|
+
export declare const MAX_REPEAT = 3;
|
|
7
|
+
export declare const MAX_DOMAINS = 4;
|
|
8
|
+
export declare const MAX_CHECK_DEPTH = 4;
|
|
9
|
+
export declare const MAX_CHECK_LEAVES = 8;
|
|
10
|
+
export declare const BRANCH_OVERFLOW: number;
|
|
11
|
+
export interface CheckMeasure {
|
|
12
|
+
readonly depth: number;
|
|
13
|
+
readonly branches: number;
|
|
14
|
+
readonly leaves: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function measureChecks(expression: PolicyCheckExpression): CheckMeasure;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const MAX_PATTERN_DEPTH = 4;
|
|
2
|
+
export const MAX_BRANCHES = 8;
|
|
3
|
+
export const MAX_VARIABLES = 4;
|
|
4
|
+
export const MAX_EDGES = 6;
|
|
5
|
+
export const MAX_REPEAT = 3;
|
|
6
|
+
export const MAX_DOMAINS = 4;
|
|
7
|
+
export const MAX_CHECK_DEPTH = 4;
|
|
8
|
+
export const MAX_CHECK_LEAVES = 8;
|
|
9
|
+
export const BRANCH_OVERFLOW = MAX_BRANCHES + 1;
|
|
10
|
+
export function measureChecks(expression) {
|
|
11
|
+
if ('check' in expression)
|
|
12
|
+
return { depth: 1, branches: 1, leaves: 1 };
|
|
13
|
+
const children = ('allOf' in expression ? expression.allOf : expression.anyOf).map(measureChecks);
|
|
14
|
+
const branches = 'allOf' in expression
|
|
15
|
+
? children.reduce((value, child) => saturatingProduct(value, child.branches), 1)
|
|
16
|
+
: children.reduce((value, child) => Math.min(BRANCH_OVERFLOW, value + child.branches), 0);
|
|
17
|
+
return {
|
|
18
|
+
depth: 1 + Math.max(0, ...children.map((child) => child.depth)),
|
|
19
|
+
branches,
|
|
20
|
+
leaves: children.reduce((value, child) => value + child.leaves, 0),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function saturatingProduct(left, right) {
|
|
24
|
+
return Math.min(BRANCH_OVERFLOW, left * right);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './normalization/normalize.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { CoreRef, ClassRef, FunctionRef, PolicyRef, ViewRef, DefinitionBase } from '../../../addressing/index.js';
|
|
2
|
+
export type PolicyPatternTerm = {
|
|
3
|
+
readonly kind: 'subject';
|
|
4
|
+
} | {
|
|
5
|
+
readonly kind: 'object';
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'source';
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'target';
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'variable';
|
|
12
|
+
readonly id: number;
|
|
13
|
+
};
|
|
14
|
+
export interface PolicyVariable {
|
|
15
|
+
readonly variable: {
|
|
16
|
+
readonly kind: 'variable';
|
|
17
|
+
readonly id: number;
|
|
18
|
+
};
|
|
19
|
+
readonly class: ClassRef;
|
|
20
|
+
}
|
|
21
|
+
export interface PolicyRepeat {
|
|
22
|
+
readonly min: number;
|
|
23
|
+
readonly max: number;
|
|
24
|
+
}
|
|
25
|
+
export interface PolicyEdgePattern {
|
|
26
|
+
readonly source: PolicyPatternTerm;
|
|
27
|
+
readonly class: ClassRef;
|
|
28
|
+
readonly target: PolicyPatternTerm;
|
|
29
|
+
readonly repeat?: PolicyRepeat;
|
|
30
|
+
}
|
|
31
|
+
export type PolicyPatternExpression = PolicyEdgePattern | {
|
|
32
|
+
readonly exists: {
|
|
33
|
+
readonly nodes: readonly PolicyVariable[];
|
|
34
|
+
readonly where: PolicyPatternExpression;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
readonly allOf: readonly PolicyPatternExpression[];
|
|
38
|
+
} | {
|
|
39
|
+
readonly anyOf: readonly PolicyPatternExpression[];
|
|
40
|
+
};
|
|
41
|
+
export type PolicyExpression = {
|
|
42
|
+
readonly match: PolicyPatternExpression;
|
|
43
|
+
} | {
|
|
44
|
+
readonly allOf: readonly PolicyRef[];
|
|
45
|
+
} | {
|
|
46
|
+
readonly anyOf: readonly PolicyRef[];
|
|
47
|
+
};
|
|
48
|
+
export interface PolicyDefinition extends DefinitionBase<PolicyRef> {
|
|
49
|
+
readonly expression: PolicyExpression;
|
|
50
|
+
readonly description?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Local Domain members whose installed projection resolves through one exact member Path. */
|
|
53
|
+
export type PolicyObjectRef = ClassRef | FunctionRef | PolicyRef | ViewRef | CoreRef;
|
|
54
|
+
export type PolicyCheckObject = {
|
|
55
|
+
readonly kind: 'self';
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: 'input';
|
|
58
|
+
readonly field: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: 'ref';
|
|
61
|
+
readonly ref: PolicyObjectRef;
|
|
62
|
+
};
|
|
63
|
+
/** Versioned Policy-check grammar specialized by each lifecycle boundary. */
|
|
64
|
+
export type PolicyCheckExpression<Policy = PolicyRef, Object = PolicyCheckObject> = {
|
|
65
|
+
readonly check: Policy;
|
|
66
|
+
readonly object: Object;
|
|
67
|
+
} | {
|
|
68
|
+
readonly allOf: readonly [
|
|
69
|
+
PolicyCheckExpression<Policy, Object>,
|
|
70
|
+
...PolicyCheckExpression<Policy, Object>[]
|
|
71
|
+
];
|
|
72
|
+
} | {
|
|
73
|
+
readonly anyOf: readonly [
|
|
74
|
+
PolicyCheckExpression<Policy, Object>,
|
|
75
|
+
...PolicyCheckExpression<Policy, Object>[]
|
|
76
|
+
];
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PolicyCheckExpression, PolicyExpression, PolicyPatternExpression } from '../model/policy.js';
|
|
2
|
+
export declare function normalizePolicyExpression(value: PolicyExpression): PolicyExpression;
|
|
3
|
+
export declare function normalizePolicyPattern(value: PolicyPatternExpression): PolicyPatternExpression;
|
|
4
|
+
export declare function normalizePolicyChecks(value: PolicyCheckExpression): PolicyCheckExpression;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import { definitionRefIndex, compareDefinitionRefs } from '../../../addressing/ordering.js';
|
|
3
|
+
const textEncoder = new TextEncoder();
|
|
4
|
+
export function normalizePolicyExpression(value) {
|
|
5
|
+
if ('match' in value) {
|
|
6
|
+
return { match: normalizePolicyPattern(value.match) };
|
|
7
|
+
}
|
|
8
|
+
if ('allOf' in value) {
|
|
9
|
+
return { allOf: uniqueRefs(value.allOf) };
|
|
10
|
+
}
|
|
11
|
+
return { anyOf: uniqueRefs(value.anyOf) };
|
|
12
|
+
}
|
|
13
|
+
export function normalizePolicyPattern(value) {
|
|
14
|
+
const rewritten = rewriteVariables(value, canonicalVariableIds(value));
|
|
15
|
+
return normalizePatternNode(rewritten);
|
|
16
|
+
}
|
|
17
|
+
export function normalizePolicyChecks(value) {
|
|
18
|
+
if ('check' in value)
|
|
19
|
+
return value;
|
|
20
|
+
if ('allOf' in value) {
|
|
21
|
+
const children = value.allOf.flatMap((child) => {
|
|
22
|
+
const normalized = normalizePolicyChecks(child);
|
|
23
|
+
return 'allOf' in normalized ? normalized.allOf : [normalized];
|
|
24
|
+
});
|
|
25
|
+
return { allOf: policyCheckComposition(uniqueJson(children)) };
|
|
26
|
+
}
|
|
27
|
+
const children = value.anyOf.flatMap((child) => {
|
|
28
|
+
const normalized = normalizePolicyChecks(child);
|
|
29
|
+
return 'anyOf' in normalized ? normalized.anyOf : [normalized];
|
|
30
|
+
});
|
|
31
|
+
return { anyOf: policyCheckComposition(uniqueJson(children)) };
|
|
32
|
+
}
|
|
33
|
+
function policyCheckComposition(values) {
|
|
34
|
+
// Structural routing may carry an invalid empty array into semantic validation;
|
|
35
|
+
// validateChecks reports it before the DomainSchema can be accepted.
|
|
36
|
+
return values;
|
|
37
|
+
}
|
|
38
|
+
function normalizePatternNode(value) {
|
|
39
|
+
if (isEdge(value)) {
|
|
40
|
+
const repeat = value.repeat;
|
|
41
|
+
if (repeat?.min === 1 && repeat.max === 1) {
|
|
42
|
+
const { repeat: _omitted, ...edge } = value;
|
|
43
|
+
return edge;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
if ('exists' in value) {
|
|
48
|
+
return {
|
|
49
|
+
exists: {
|
|
50
|
+
nodes: [...value.exists.nodes].sort((left, right) => left.variable.id - right.variable.id),
|
|
51
|
+
where: normalizePatternNode(value.exists.where),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if ('allOf' in value) {
|
|
56
|
+
const children = value.allOf.flatMap((child) => {
|
|
57
|
+
const normalized = normalizePatternNode(child);
|
|
58
|
+
return 'allOf' in normalized ? normalized.allOf : [normalized];
|
|
59
|
+
});
|
|
60
|
+
return { allOf: uniqueJson(children) };
|
|
61
|
+
}
|
|
62
|
+
const children = value.anyOf.flatMap((child) => {
|
|
63
|
+
const normalized = normalizePatternNode(child);
|
|
64
|
+
return 'anyOf' in normalized ? normalized.anyOf : [normalized];
|
|
65
|
+
});
|
|
66
|
+
return { anyOf: uniqueJson(children) };
|
|
67
|
+
}
|
|
68
|
+
function canonicalVariableIds(value) {
|
|
69
|
+
const declarations = new Map();
|
|
70
|
+
collectDeclarations(value, declarations);
|
|
71
|
+
const colors = new Map(declarations);
|
|
72
|
+
for (let iteration = 0; iteration < declarations.size + 1; iteration++) {
|
|
73
|
+
const next = new Map();
|
|
74
|
+
for (const id of declarations.keys()) {
|
|
75
|
+
const uses = [];
|
|
76
|
+
collectUses(value, id, colors, uses);
|
|
77
|
+
uses.sort(compareUtf8Bytes);
|
|
78
|
+
next.set(id, `${declarations.get(id) ?? ''}|${uses.join('|')}`);
|
|
79
|
+
}
|
|
80
|
+
if ([...next].every(([id, color]) => colors.get(id) === color))
|
|
81
|
+
break;
|
|
82
|
+
colors.clear();
|
|
83
|
+
for (const [id, color] of next)
|
|
84
|
+
colors.set(id, color);
|
|
85
|
+
}
|
|
86
|
+
const firstUse = new Map();
|
|
87
|
+
collectFirstUseKeys(value, colors, firstUse);
|
|
88
|
+
const ordered = [...declarations.keys()].sort((left, right) => {
|
|
89
|
+
const byColor = compareUtf8Bytes(colors.get(left) ?? '', colors.get(right) ?? '');
|
|
90
|
+
if (byColor !== 0)
|
|
91
|
+
return byColor;
|
|
92
|
+
const byUse = compareUtf8Bytes(firstUse.get(left) ?? '', firstUse.get(right) ?? '');
|
|
93
|
+
if (byUse !== 0)
|
|
94
|
+
return byUse;
|
|
95
|
+
// A remaining tie is an automorphic binder class: assigning either first
|
|
96
|
+
// yields the same recursively sorted canonical Pattern.
|
|
97
|
+
return left - right;
|
|
98
|
+
});
|
|
99
|
+
return new Map(ordered.map((id, index) => [id, index]));
|
|
100
|
+
}
|
|
101
|
+
function collectDeclarations(value, result) {
|
|
102
|
+
if ('exists' in value) {
|
|
103
|
+
for (const node of value.exists.nodes) {
|
|
104
|
+
result.set(node.variable.id, definitionRefIndex(node.class));
|
|
105
|
+
}
|
|
106
|
+
collectDeclarations(value.exists.where, result);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if ('allOf' in value)
|
|
110
|
+
for (const child of value.allOf)
|
|
111
|
+
collectDeclarations(child, result);
|
|
112
|
+
if ('anyOf' in value)
|
|
113
|
+
for (const child of value.anyOf)
|
|
114
|
+
collectDeclarations(child, result);
|
|
115
|
+
}
|
|
116
|
+
function collectUses(value, target, colors, result) {
|
|
117
|
+
if (isEdge(value)) {
|
|
118
|
+
if (value.source.kind === 'variable' && value.source.id === target) {
|
|
119
|
+
result.push(`s:${definitionRefIndex(value.class)}:${termColor(value.target, colors)}`);
|
|
120
|
+
}
|
|
121
|
+
if (value.target.kind === 'variable' && value.target.id === target) {
|
|
122
|
+
result.push(`t:${definitionRefIndex(value.class)}:${termColor(value.source, colors)}`);
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if ('exists' in value)
|
|
127
|
+
return collectUses(value.exists.where, target, colors, result);
|
|
128
|
+
const children = 'allOf' in value ? value.allOf : value.anyOf;
|
|
129
|
+
for (const child of children)
|
|
130
|
+
collectUses(child, target, colors, result);
|
|
131
|
+
}
|
|
132
|
+
function termColor(term, colors) {
|
|
133
|
+
if (term.kind === 'variable')
|
|
134
|
+
return `variable:${colors.get(term.id) ?? '?'}`;
|
|
135
|
+
return term.kind;
|
|
136
|
+
}
|
|
137
|
+
function collectFirstUseKeys(value, colors, result, prefix = '$') {
|
|
138
|
+
if (isEdge(value)) {
|
|
139
|
+
for (const [position, term] of [
|
|
140
|
+
['source', value.source],
|
|
141
|
+
['target', value.target],
|
|
142
|
+
]) {
|
|
143
|
+
if (term.kind === 'variable') {
|
|
144
|
+
const key = `${prefix}:${definitionRefIndex(value.class)}:${position}`;
|
|
145
|
+
const current = result.get(term.id);
|
|
146
|
+
if (current === undefined || key < current)
|
|
147
|
+
result.set(term.id, key);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if ('exists' in value) {
|
|
153
|
+
collectFirstUseKeys(value.exists.where, colors, result, `${prefix}:exists`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const key = 'allOf' in value ? 'allOf' : 'anyOf';
|
|
157
|
+
const operands = 'allOf' in value ? value.allOf : value.anyOf;
|
|
158
|
+
const children = [...operands].sort((left, right) => compareUtf8Bytes(patternSignature(left, colors), patternSignature(right, colors)));
|
|
159
|
+
children.forEach((child, index) => collectFirstUseKeys(child, colors, result, `${prefix}:${key}:${index}`));
|
|
160
|
+
}
|
|
161
|
+
function patternSignature(value, colors) {
|
|
162
|
+
if (isEdge(value)) {
|
|
163
|
+
return `edge:${definitionRefIndex(value.class)}:${termColor(value.source, colors)}:${termColor(value.target, colors)}:${value.repeat?.min ?? 1}:${value.repeat?.max ?? 1}`;
|
|
164
|
+
}
|
|
165
|
+
if ('exists' in value) {
|
|
166
|
+
return `exists:${value.exists.nodes
|
|
167
|
+
.map((node) => colors.get(node.variable.id) ?? '')
|
|
168
|
+
.sort(compareUtf8Bytes)
|
|
169
|
+
.join(',')}:${patternSignature(value.exists.where, colors)}`;
|
|
170
|
+
}
|
|
171
|
+
const key = 'allOf' in value ? 'allOf' : 'anyOf';
|
|
172
|
+
const operands = 'allOf' in value ? value.allOf : value.anyOf;
|
|
173
|
+
return `${key}:${operands
|
|
174
|
+
.map((child) => patternSignature(child, colors))
|
|
175
|
+
.sort(compareUtf8Bytes)
|
|
176
|
+
.join('|')}`;
|
|
177
|
+
}
|
|
178
|
+
function rewriteVariables(value, ids) {
|
|
179
|
+
if (isEdge(value)) {
|
|
180
|
+
return {
|
|
181
|
+
...value,
|
|
182
|
+
source: rewriteTerm(value.source, ids),
|
|
183
|
+
target: rewriteTerm(value.target, ids),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if ('exists' in value) {
|
|
187
|
+
return {
|
|
188
|
+
exists: {
|
|
189
|
+
nodes: value.exists.nodes.map((node) => ({
|
|
190
|
+
variable: { kind: 'variable', id: ids.get(node.variable.id) ?? node.variable.id },
|
|
191
|
+
class: node.class,
|
|
192
|
+
})),
|
|
193
|
+
where: rewriteVariables(value.exists.where, ids),
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if ('allOf' in value)
|
|
198
|
+
return { allOf: value.allOf.map((child) => rewriteVariables(child, ids)) };
|
|
199
|
+
return { anyOf: value.anyOf.map((child) => rewriteVariables(child, ids)) };
|
|
200
|
+
}
|
|
201
|
+
function rewriteTerm(value, ids) {
|
|
202
|
+
return value.kind === 'variable' ? { kind: 'variable', id: ids.get(value.id) ?? value.id } : value;
|
|
203
|
+
}
|
|
204
|
+
function uniqueRefs(values) {
|
|
205
|
+
const byKey = new Map(values.map((value) => [definitionRefIndex(value), value]));
|
|
206
|
+
return [...byKey.values()].sort(compareDefinitionRefs);
|
|
207
|
+
}
|
|
208
|
+
function uniqueJson(values) {
|
|
209
|
+
const byEncoding = new Map(values.map((value) => [json.serialize(value), value]));
|
|
210
|
+
return [...byEncoding.entries()]
|
|
211
|
+
.sort(([left], [right]) => compareUtf8Bytes(left, right))
|
|
212
|
+
.map(([, value]) => value);
|
|
213
|
+
}
|
|
214
|
+
function compareUtf8Bytes(left, right) {
|
|
215
|
+
const a = textEncoder.encode(left);
|
|
216
|
+
const b = textEncoder.encode(right);
|
|
217
|
+
const length = Math.min(a.length, b.length);
|
|
218
|
+
for (let index = 0; index < length; index++) {
|
|
219
|
+
if (a[index] !== b[index])
|
|
220
|
+
return (a[index] ?? 0) - (b[index] ?? 0);
|
|
221
|
+
}
|
|
222
|
+
return a.length - b.length;
|
|
223
|
+
}
|
|
224
|
+
function isEdge(value) {
|
|
225
|
+
return 'source' in value;
|
|
226
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DefinitionKey, PolicyRef } from '../../addressing/index.js';
|
|
2
|
+
import type { PolicyDefinition } from './model/policy.js';
|
|
3
|
+
export interface ResolvedPolicy {
|
|
4
|
+
readonly ref: PolicyRef;
|
|
5
|
+
readonly key: DefinitionKey<string, 'policy'>;
|
|
6
|
+
readonly expression: PolicyDefinition['expression'];
|
|
7
|
+
readonly description?: PolicyDefinition['description'];
|
|
8
|
+
readonly definition: PolicyDefinition;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DefinitionRef } from '../addressing/index.js';
|
|
2
|
+
import type { ResolvedFunction } from './callable/resolved.js';
|
|
3
|
+
import type { AnyResolvedClass } from './class/resolved.js';
|
|
4
|
+
import type { ResolvedCoreDefinition } from './core/resolved.js';
|
|
5
|
+
import type { ResolvedPolicy } from './policy/resolved.js';
|
|
6
|
+
import type { ResolvedView } from './view/resolved.js';
|
|
7
|
+
export type ResolvedDefinition = AnyResolvedClass | ResolvedFunction | ResolvedPolicy | ResolvedView | ResolvedCoreDefinition;
|
|
8
|
+
export type ResolvedDefinitionOf<Kind extends DefinitionRef['kind']> = Extract<ResolvedDefinition, {
|
|
9
|
+
readonly ref: DefinitionRef<Kind>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|