@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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"use strict";
|
|
5
5
|
export const validate = validate20;
|
|
6
6
|
export default validate20;
|
|
7
|
-
const schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://schemas.astrale.ai/dsl/v1/value-schema", "$vocabulary": {}, "allOf": [{ "$ref": "https://json-schema.org/draft/2020-12/schema" }], "properties": { "fullMatch": { "type": "string" }, "x-astrale-path": { "type": "object" } } };
|
|
7
|
+
const schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://schemas.astrale.ai/dsl/v1/value-schema", "$dynamicAnchor": "meta", "$vocabulary": { "https://json-schema.org/draft/2020-12/vocab/core": true, "https://json-schema.org/draft/2020-12/vocab/applicator": true, "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, "https://json-schema.org/draft/2020-12/vocab/validation": true, "https://json-schema.org/draft/2020-12/vocab/meta-data": true, "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, "https://json-schema.org/draft/2020-12/vocab/content": true, "https://schemas.astrale.ai/dsl/v1/value-schema/vocabulary": true }, "title": "Astrale V1 value schema", "$comment": "The meta-schema of the V1 value-schema dialect: Draft 2020-12 and the required Astrale vocabulary (fullMatch, x-astrale-file, x-astrale-path, x-astrale-value-kind). Its $dynamicAnchor extends Draft 2020-12 at every subschema, not only the root. The rules of the profile beyond it are published as schema.values.RULES.", "allOf": [{ "$ref": "https://json-schema.org/draft/2020-12/schema" }], "properties": { "fullMatch": { "type": "string" }, "x-astrale-file": { "type": "object" }, "x-astrale-path": { "type": "object" } } };
|
|
8
8
|
const schema0 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://json-schema.org/draft/2020-12/schema", "$vocabulary": { "https://json-schema.org/draft/2020-12/vocab/core": true, "https://json-schema.org/draft/2020-12/vocab/applicator": true, "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, "https://json-schema.org/draft/2020-12/vocab/validation": true, "https://json-schema.org/draft/2020-12/vocab/meta-data": true, "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, "https://json-schema.org/draft/2020-12/vocab/content": true }, "$dynamicAnchor": "meta", "title": "Core and Validation specifications meta-schema", "allOf": [{ "$ref": "meta/core" }, { "$ref": "meta/applicator" }, { "$ref": "meta/unevaluated" }, { "$ref": "meta/validation" }, { "$ref": "meta/meta-data" }, { "$ref": "meta/format-annotation" }, { "$ref": "meta/content" }], "type": ["object", "boolean"], "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", "properties": { "definitions": { "$comment": "\"definitions\" has been replaced by \"$defs\".", "type": "object", "additionalProperties": { "$dynamicRef": "#meta" }, "deprecated": true, "default": {} }, "dependencies": { "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", "type": "object", "additionalProperties": { "anyOf": [{ "$dynamicRef": "#meta" }, { "$ref": "meta/validation#/$defs/stringArray" }] }, "deprecated": true, "default": {} }, "$recursiveAnchor": { "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", "$ref": "meta/core#/$defs/anchorString", "deprecated": true }, "$recursiveRef": { "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", "$ref": "meta/core#/$defs/uriReferenceString", "deprecated": true } } };
|
|
9
9
|
const schema23 = { "type": "array", "items": { "type": "string" }, "uniqueItems": true, "default": [] };
|
|
10
10
|
const schema5 = { "type": "string", "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" };
|
|
@@ -2042,6 +2042,9 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2042
2042
|
if (evaluated0.dynamicItems) {
|
|
2043
2043
|
evaluated0.items = undefined;
|
|
2044
2044
|
}
|
|
2045
|
+
if (!dynamicAnchors.meta) {
|
|
2046
|
+
dynamicAnchors.meta = validate20;
|
|
2047
|
+
}
|
|
2045
2048
|
if (!(validate0(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
|
|
2046
2049
|
vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors);
|
|
2047
2050
|
errors = vErrors.length;
|
|
@@ -2059,10 +2062,10 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2059
2062
|
errors++;
|
|
2060
2063
|
}
|
|
2061
2064
|
}
|
|
2062
|
-
if (data["x-astrale-
|
|
2063
|
-
let data1 = data["x-astrale-
|
|
2065
|
+
if (data["x-astrale-file"] !== undefined) {
|
|
2066
|
+
let data1 = data["x-astrale-file"];
|
|
2064
2067
|
if (!(data1 && typeof data1 == "object" && !Array.isArray(data1))) {
|
|
2065
|
-
const err1 = { instancePath: instancePath + "/x-astrale-
|
|
2068
|
+
const err1 = { instancePath: instancePath + "/x-astrale-file", schemaPath: "#/properties/x-astrale-file/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2066
2069
|
if (vErrors === null) {
|
|
2067
2070
|
vErrors = [err1];
|
|
2068
2071
|
}
|
|
@@ -2072,8 +2075,21 @@ function validate20(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2072
2075
|
errors++;
|
|
2073
2076
|
}
|
|
2074
2077
|
}
|
|
2078
|
+
if (data["x-astrale-path"] !== undefined) {
|
|
2079
|
+
let data2 = data["x-astrale-path"];
|
|
2080
|
+
if (!(data2 && typeof data2 == "object" && !Array.isArray(data2))) {
|
|
2081
|
+
const err2 = { instancePath: instancePath + "/x-astrale-path", schemaPath: "#/properties/x-astrale-path/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2082
|
+
if (vErrors === null) {
|
|
2083
|
+
vErrors = [err2];
|
|
2084
|
+
}
|
|
2085
|
+
else {
|
|
2086
|
+
vErrors.push(err2);
|
|
2087
|
+
}
|
|
2088
|
+
errors++;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2075
2091
|
}
|
|
2076
2092
|
validate20.errors = vErrors;
|
|
2077
2093
|
return errors === 0;
|
|
2078
2094
|
}
|
|
2079
|
-
validate20.evaluated = { "props": { "fullMatch": true, "x-astrale-path": true, "definitions": true, "dependencies": true, "$recursiveAnchor": true, "$recursiveRef": true, "contentEncoding": true, "contentMediaType": true, "contentSchema": true, "format": true, "title": true, "description": true, "default": true, "deprecated": true, "readOnly": true, "writeOnly": true, "examples": true, "type": true, "const": true, "enum": true, "multipleOf": true, "maximum": true, "exclusiveMaximum": true, "minimum": true, "exclusiveMinimum": true, "maxLength": true, "minLength": true, "pattern": true, "maxItems": true, "minItems": true, "uniqueItems": true, "maxContains": true, "minContains": true, "maxProperties": true, "minProperties": true, "required": true, "dependentRequired": true, "unevaluatedItems": true, "unevaluatedProperties": true, "prefixItems": true, "items": true, "contains": true, "additionalProperties": true, "properties": true, "patternProperties": true, "dependentSchemas": true, "propertyNames": true, "if": true, "then": true, "else": true, "allOf": true, "anyOf": true, "oneOf": true, "not": true, "$id": true, "$schema": true, "$ref": true, "$anchor": true, "$dynamicRef": true, "$dynamicAnchor": true, "$vocabulary": true, "$comment": true, "$defs": true }, "dynamicProps": false, "dynamicItems": false };
|
|
2095
|
+
validate20.evaluated = { "props": { "fullMatch": true, "x-astrale-file": true, "x-astrale-path": true, "definitions": true, "dependencies": true, "$recursiveAnchor": true, "$recursiveRef": true, "contentEncoding": true, "contentMediaType": true, "contentSchema": true, "format": true, "title": true, "description": true, "default": true, "deprecated": true, "readOnly": true, "writeOnly": true, "examples": true, "type": true, "const": true, "enum": true, "multipleOf": true, "maximum": true, "exclusiveMaximum": true, "minimum": true, "exclusiveMinimum": true, "maxLength": true, "minLength": true, "pattern": true, "maxItems": true, "minItems": true, "uniqueItems": true, "maxContains": true, "minContains": true, "maxProperties": true, "minProperties": true, "required": true, "dependentRequired": true, "unevaluatedItems": true, "unevaluatedProperties": true, "prefixItems": true, "items": true, "contains": true, "additionalProperties": true, "properties": true, "patternProperties": true, "dependentSchemas": true, "propertyNames": true, "if": true, "then": true, "else": true, "allOf": true, "anyOf": true, "oneOf": true, "not": true, "$id": true, "$schema": true, "$ref": true, "$anchor": true, "$dynamicRef": true, "$dynamicAnchor": true, "$vocabulary": true, "$comment": true, "$defs": true }, "dynamicProps": false, "dynamicItems": false };
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { diagnostic } from '../../validation/diagnostic.js';
|
|
3
3
|
import { blob, BLOB_VALUE_KIND } from '../model/blob.js';
|
|
4
|
+
import { FILE_KEYWORD, FILE_VALUE_KIND, isCanonicalFileSchema } from '../model/file.js';
|
|
4
5
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
5
6
|
import { VALUE_SCHEMA_DIALECT } from '../model/schema.js';
|
|
6
7
|
import { refuseIRegexp, stateBudgetMessage } from '../regexp/syntax.js';
|
|
8
|
+
import { escapePointerToken } from '../syntax/pointer.js';
|
|
7
9
|
import { walkSchema } from '../syntax/walk.js';
|
|
8
|
-
import {
|
|
10
|
+
import { FORBIDDEN_KEYWORDS, VALUE_KEYWORDS } from './vocabulary.js';
|
|
11
|
+
const KEYWORDS = new Set(VALUE_KEYWORDS);
|
|
12
|
+
const FORBIDDEN = new Set(FORBIDDEN_KEYWORDS);
|
|
9
13
|
export function validateSchemaProfile(schema, context, pointer) {
|
|
10
14
|
const diagnostics = [];
|
|
11
15
|
walkSchema(schema, (location) => {
|
|
@@ -13,11 +17,11 @@ export function validateSchemaProfile(schema, context, pointer) {
|
|
|
13
17
|
return;
|
|
14
18
|
const currentPointer = `${pointer}${location.pointer}`;
|
|
15
19
|
for (const keyword of Object.keys(location.schema)) {
|
|
16
|
-
if (!
|
|
17
|
-
diagnostics.push(diagnostic('VS_KEYWORD_CLOSED', `${currentPointer}/${
|
|
20
|
+
if (!KEYWORDS.has(keyword)) {
|
|
21
|
+
diagnostics.push(diagnostic('VS_KEYWORD_CLOSED', `${currentPointer}/${escapePointerToken(keyword)}`, `Keyword ${keyword} is outside the closed V1 Draft 2020-12 vocabulary.`));
|
|
18
22
|
}
|
|
19
|
-
if (
|
|
20
|
-
diagnostics.push(diagnostic('VS_DYNAMIC_FORBIDDEN', `${currentPointer}/${
|
|
23
|
+
if (FORBIDDEN.has(keyword)) {
|
|
24
|
+
diagnostics.push(diagnostic('VS_DYNAMIC_FORBIDDEN', `${currentPointer}/${escapePointerToken(keyword)}`, `Keyword ${keyword} is forbidden by V1.`));
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
if (Object.hasOwn(location.schema, '$schema')) {
|
|
@@ -28,16 +32,28 @@ export function validateSchemaProfile(schema, context, pointer) {
|
|
|
28
32
|
if (Object.hasOwn(location.schema, '$id')) {
|
|
29
33
|
diagnostics.push(diagnostic('VS_RESOURCE_ID', `${currentPointer}/$id`, '$id is forbidden in an embedded V1 value schema.'));
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
// The dialect refuses a repeated type, required or dependentRequired entry; it lets an enum
|
|
36
|
+
// repeat a value.
|
|
37
|
+
if (Array.isArray(location.schema.enum)) {
|
|
38
|
+
rejectCanonicalDuplicates(location.schema.enum, `${currentPointer}/enum`, diagnostics);
|
|
39
|
+
}
|
|
32
40
|
validateValueKind(location.schema, context, location.depth, currentPointer, diagnostics);
|
|
33
41
|
validateRegexes(location.schema, currentPointer, diagnostics);
|
|
34
42
|
});
|
|
35
43
|
return diagnostics;
|
|
36
44
|
}
|
|
37
45
|
function validateValueKind(schema, context, depth, pointer, diagnostics) {
|
|
46
|
+
if (Object.hasOwn(schema, FILE_KEYWORD) && schema['x-astrale-value-kind'] !== FILE_VALUE_KIND) {
|
|
47
|
+
diagnostics.push(diagnostic('VS_VALUE_KIND', `${pointer}/${FILE_KEYWORD}`, 'x-astrale-file states the constraints of a file field only, beside x-astrale-value-kind file.'));
|
|
48
|
+
}
|
|
38
49
|
if (!Object.hasOwn(schema, 'x-astrale-value-kind'))
|
|
39
50
|
return;
|
|
40
|
-
if (schema['x-astrale-value-kind'] ===
|
|
51
|
+
if (schema['x-astrale-value-kind'] === FILE_VALUE_KIND) {
|
|
52
|
+
if (context !== 'callable-input' || !isCanonicalFileSchema(schema)) {
|
|
53
|
+
diagnostics.push(diagnostic('VS_VALUE_KIND', `${pointer}/x-astrale-value-kind`, 'file must be exactly a schema.values.file output, inside a callable input.'));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (schema['x-astrale-value-kind'] === BLOB_VALUE_KIND) {
|
|
41
57
|
if (context !== 'property-facet' || depth !== 0 || !isCanonicalBlobSchema(schema)) {
|
|
42
58
|
diagnostics.push(diagnostic('VS_VALUE_KIND', `${pointer}/x-astrale-value-kind`, 'blob must be the exact schema.values.blob output at the root of a Node property.'));
|
|
43
59
|
}
|
|
@@ -73,28 +89,8 @@ function isCanonicalBlobSchema(input) {
|
|
|
73
89
|
function isString(input) {
|
|
74
90
|
return typeof input === 'string';
|
|
75
91
|
}
|
|
76
|
-
|
|
77
|
-
if (Array.isArray(schema.type)) {
|
|
78
|
-
rejectPrimitiveDuplicates(schema.type, `${pointer}/type`, 'type', diagnostics);
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(schema.required)) {
|
|
81
|
-
rejectPrimitiveDuplicates(schema.required, `${pointer}/required`, 'required', diagnostics);
|
|
82
|
-
}
|
|
83
|
-
if (Array.isArray(schema.enum)) {
|
|
84
|
-
rejectCanonicalDuplicates(schema.enum, `${pointer}/enum`, 'enum', diagnostics);
|
|
85
|
-
}
|
|
86
|
-
if (isJsonObject(schema.dependentRequired)) {
|
|
87
|
-
for (const [name, dependencies] of Object.entries(schema.dependentRequired)) {
|
|
88
|
-
if (Array.isArray(dependencies)) {
|
|
89
|
-
rejectPrimitiveDuplicates(dependencies, `${pointer}/dependentRequired/${escapeToken(name)}`, 'dependentRequired', diagnostics);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
92
|
+
/** The dialect refuses a fullMatch that is not a string, at every location. */
|
|
94
93
|
function validateRegexes(schema, pointer, diagnostics) {
|
|
95
|
-
if (Object.hasOwn(schema, 'fullMatch') && typeof schema.fullMatch !== 'string') {
|
|
96
|
-
diagnostics.push(diagnostic('VS_META_SCHEMA', `${pointer}/fullMatch`, 'fullMatch must be an I-Regexp source string.'));
|
|
97
|
-
}
|
|
98
94
|
if (typeof schema.fullMatch === 'string') {
|
|
99
95
|
portableRegex(schema.fullMatch, `${pointer}/fullMatch`, 'fullMatch', 'fullMatch must satisfy the complete RFC 9485 I-Regexp syntax.', diagnostics);
|
|
100
96
|
}
|
|
@@ -103,7 +99,7 @@ function validateRegexes(schema, pointer, diagnostics) {
|
|
|
103
99
|
}
|
|
104
100
|
if (isJsonObject(schema.patternProperties)) {
|
|
105
101
|
for (const pattern of Object.keys(schema.patternProperties)) {
|
|
106
|
-
portableRegex(pattern, `${pointer}/patternProperties/${
|
|
102
|
+
portableRegex(pattern, `${pointer}/patternProperties/${escapePointerToken(pattern)}`, 'A patternProperties key', 'patternProperties keys must satisfy RFC 9485 I-Regexp syntax.', diagnostics);
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
105
|
}
|
|
@@ -113,17 +109,7 @@ function portableRegex(source, pointer, subject, syntax, diagnostics) {
|
|
|
113
109
|
return;
|
|
114
110
|
diagnostics.push(diagnostic('VS_REGEX_PORTABLE', pointer, refusal === 'syntax' ? syntax : stateBudgetMessage(subject)));
|
|
115
111
|
}
|
|
116
|
-
function
|
|
117
|
-
const seen = new Set();
|
|
118
|
-
for (const value of values) {
|
|
119
|
-
if (seen.has(value)) {
|
|
120
|
-
diagnostics.push(diagnostic('VS_META_SCHEMA', pointer, `${name} is a duplicate-free semantic set.`));
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
seen.add(value);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function rejectCanonicalDuplicates(values, pointer, name, diagnostics) {
|
|
112
|
+
function rejectCanonicalDuplicates(values, pointer, diagnostics) {
|
|
127
113
|
const seen = new Set();
|
|
128
114
|
for (const value of values) {
|
|
129
115
|
let key;
|
|
@@ -134,12 +120,9 @@ function rejectCanonicalDuplicates(values, pointer, name, diagnostics) {
|
|
|
134
120
|
continue;
|
|
135
121
|
}
|
|
136
122
|
if (seen.has(key)) {
|
|
137
|
-
diagnostics.push(diagnostic('VS_META_SCHEMA', pointer,
|
|
123
|
+
diagnostics.push(diagnostic('VS_META_SCHEMA', pointer, 'enum rejects canonically equal duplicates.'));
|
|
138
124
|
return;
|
|
139
125
|
}
|
|
140
126
|
seen.add(key);
|
|
141
127
|
}
|
|
142
128
|
}
|
|
143
|
-
function escapeToken(value) {
|
|
144
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
145
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { orderAndDeduplicate } from '../../validation/diagnostic.js';
|
|
2
2
|
import { collectResourceClosure } from '../reference/closure.js';
|
|
3
3
|
import { validateProductiveRecursion } from '../reference/recursion.js';
|
|
4
4
|
import { hasNodeDefinition, indexRegistry } from '../reference/registry.index.js';
|
|
@@ -28,12 +28,3 @@ export function validateValueSchema(schema, context, registry, pointer = '') {
|
|
|
28
28
|
diagnostics.push(...validateProductiveRecursion(closure.resources, closure.resolutions));
|
|
29
29
|
return orderAndDeduplicate(diagnostics);
|
|
30
30
|
}
|
|
31
|
-
function orderAndDeduplicate(diagnostics) {
|
|
32
|
-
const unique = new Map();
|
|
33
|
-
for (const value of diagnostics) {
|
|
34
|
-
unique.set(`${value.pointer}\u0000${value.code}\u0000${value.ref ?? ''}\u0000${value.message}`, value);
|
|
35
|
-
}
|
|
36
|
-
return [...unique.values()].sort((left, right) => compareUnicode(left.pointer, right.pointer) ||
|
|
37
|
-
compareUnicode(left.code, right.code) ||
|
|
38
|
-
compareUnicode(left.message, right.message));
|
|
39
|
-
}
|
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
declare const keywords: readonly ['$anchor', '$comment', '$defs', '$dynamicAnchor', '$dynamicRef', '$id', '$ref', '$schema', '$vocabulary', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'contentEncoding', 'contentMediaType', 'contentSchema', 'default', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'examples', 'exclusiveMaximum', 'exclusiveMinimum', 'format', 'fullMatch', 'if', 'items', 'maxContains', 'maxItems', 'maxLength', 'maxProperties', 'maximum', 'minContains', 'minItems', 'minLength', 'minProperties', 'minimum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'prefixItems', 'properties', 'propertyNames', 'readOnly', 'required', 'then', 'title', 'type', 'unevaluatedItems', 'unevaluatedProperties', 'uniqueItems', 'writeOnly', 'x-astrale-file', 'x-astrale-path', 'x-astrale-value-kind'];
|
|
2
|
+
export type ValueKeyword = (typeof keywords)[number];
|
|
3
|
+
/**
|
|
4
|
+
* The closed V1 vocabulary: every keyword a value schema may name, the Astrale profile's included
|
|
5
|
+
* (`fullMatch`, `x-astrale-file`, `x-astrale-path`, `x-astrale-value-kind`). Any other keyword is refused
|
|
6
|
+
* (`VS_KEYWORD_CLOSED`). Other rules restrict some of these: the forbidden keywords never appear,
|
|
7
|
+
* `$id` never, `$schema` only at the root. Frozen and Unicode-ordered.
|
|
8
|
+
*/
|
|
9
|
+
export declare const VALUE_KEYWORDS: readonly ValueKeyword[];
|
|
10
|
+
/** The keywords of the vocabulary refused wherever they appear (`VS_DYNAMIC_FORBIDDEN`). */
|
|
11
|
+
export declare const FORBIDDEN_KEYWORDS: readonly ValueKeyword[];
|
|
12
|
+
/**
|
|
13
|
+
* The keywords whose value holds subschemas, by its shape: one schema, an array of schemas, or an
|
|
14
|
+
* object of named schemas. A value schema's locations are its root and the subschemas these hold.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SUBSCHEMA_KEYWORDS: {
|
|
17
|
+
readonly single: readonly ValueKeyword[];
|
|
18
|
+
readonly array: readonly ValueKeyword[];
|
|
19
|
+
readonly map: readonly ValueKeyword[];
|
|
20
|
+
};
|
|
21
|
+
/** A value kind a schema declares with `x-astrale-value-kind`, because no JSON type gives it. */
|
|
22
|
+
export interface DeclaredValueKind {
|
|
23
|
+
/** The JSON type of its values, which the schema states beside the declaration. */
|
|
24
|
+
readonly type: 'string' | 'object';
|
|
25
|
+
/**
|
|
26
|
+
* Where a schema may declare it: at any location of any value schema, only as the whole schema
|
|
27
|
+
* of a Node Property that is neither automatic nor a State Property, or at any location of a
|
|
28
|
+
* callable input.
|
|
29
|
+
*/
|
|
30
|
+
readonly placement: 'any' | 'node-property' | 'callable-input';
|
|
31
|
+
/** The kind, in one plain sentence. */
|
|
32
|
+
readonly statement: string;
|
|
33
|
+
}
|
|
34
|
+
/** The value kinds `x-astrale-value-kind` declares; it admits no other value. */
|
|
35
|
+
export declare const DECLARED_VALUE_KINDS: Readonly<Record<'instant' | 'blob' | 'file', DeclaredValueKind>>;
|
|
36
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const keywords = [
|
|
2
2
|
'$anchor',
|
|
3
3
|
'$comment',
|
|
4
4
|
'$defs',
|
|
@@ -31,15 +31,15 @@ export const STANDARD_SCHEMA_KEYWORDS = new Set([
|
|
|
31
31
|
'if',
|
|
32
32
|
'items',
|
|
33
33
|
'maxContains',
|
|
34
|
-
'maximum',
|
|
35
34
|
'maxItems',
|
|
36
35
|
'maxLength',
|
|
37
36
|
'maxProperties',
|
|
37
|
+
'maximum',
|
|
38
38
|
'minContains',
|
|
39
|
-
'minimum',
|
|
40
39
|
'minItems',
|
|
41
40
|
'minLength',
|
|
42
41
|
'minProperties',
|
|
42
|
+
'minimum',
|
|
43
43
|
'multipleOf',
|
|
44
44
|
'not',
|
|
45
45
|
'oneOf',
|
|
@@ -57,12 +57,65 @@ export const STANDARD_SCHEMA_KEYWORDS = new Set([
|
|
|
57
57
|
'unevaluatedProperties',
|
|
58
58
|
'uniqueItems',
|
|
59
59
|
'writeOnly',
|
|
60
|
+
'x-astrale-file',
|
|
60
61
|
'x-astrale-path',
|
|
61
62
|
'x-astrale-value-kind',
|
|
62
|
-
]
|
|
63
|
-
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* The closed V1 vocabulary: every keyword a value schema may name, the Astrale profile's included
|
|
66
|
+
* (`fullMatch`, `x-astrale-file`, `x-astrale-path`, `x-astrale-value-kind`). Any other keyword is refused
|
|
67
|
+
* (`VS_KEYWORD_CLOSED`). Other rules restrict some of these: the forbidden keywords never appear,
|
|
68
|
+
* `$id` never, `$schema` only at the root. Frozen and Unicode-ordered.
|
|
69
|
+
*/
|
|
70
|
+
export const VALUE_KEYWORDS = Object.freeze(keywords);
|
|
71
|
+
/** The keywords of the vocabulary refused wherever they appear (`VS_DYNAMIC_FORBIDDEN`). */
|
|
72
|
+
export const FORBIDDEN_KEYWORDS = Object.freeze([
|
|
64
73
|
'$anchor',
|
|
65
74
|
'$dynamicAnchor',
|
|
66
75
|
'$dynamicRef',
|
|
67
76
|
'$vocabulary',
|
|
68
77
|
]);
|
|
78
|
+
/**
|
|
79
|
+
* The keywords whose value holds subschemas, by its shape: one schema, an array of schemas, or an
|
|
80
|
+
* object of named schemas. A value schema's locations are its root and the subschemas these hold.
|
|
81
|
+
*/
|
|
82
|
+
export const SUBSCHEMA_KEYWORDS = Object.freeze({
|
|
83
|
+
single: Object.freeze([
|
|
84
|
+
'additionalProperties',
|
|
85
|
+
'contains',
|
|
86
|
+
'contentSchema',
|
|
87
|
+
'else',
|
|
88
|
+
'if',
|
|
89
|
+
'items',
|
|
90
|
+
'not',
|
|
91
|
+
'propertyNames',
|
|
92
|
+
'then',
|
|
93
|
+
'unevaluatedItems',
|
|
94
|
+
'unevaluatedProperties',
|
|
95
|
+
]),
|
|
96
|
+
array: Object.freeze(['allOf', 'anyOf', 'oneOf', 'prefixItems']),
|
|
97
|
+
map: Object.freeze([
|
|
98
|
+
'$defs',
|
|
99
|
+
'dependentSchemas',
|
|
100
|
+
'patternProperties',
|
|
101
|
+
'properties',
|
|
102
|
+
]),
|
|
103
|
+
});
|
|
104
|
+
/** The value kinds `x-astrale-value-kind` declares; it admits no other value. */
|
|
105
|
+
export const DECLARED_VALUE_KINDS = Object.freeze({
|
|
106
|
+
instant: Object.freeze({
|
|
107
|
+
type: 'string',
|
|
108
|
+
placement: 'any',
|
|
109
|
+
statement: 'A UTC instant written YYYY-MM-DDTHH:mm:ss.sssZ, in the years 0000 to 9999, whose text order is its chronological order.',
|
|
110
|
+
}),
|
|
111
|
+
blob: Object.freeze({
|
|
112
|
+
type: 'object',
|
|
113
|
+
placement: 'node-property',
|
|
114
|
+
statement: 'The Ref of stored contents, its digest, media type and size: the schema is exactly a values.blob output, and the Property is written with an upload receipt.',
|
|
115
|
+
}),
|
|
116
|
+
file: Object.freeze({
|
|
117
|
+
type: 'string',
|
|
118
|
+
placement: 'callable-input',
|
|
119
|
+
statement: 'An upload receipt of the caller, naming one file the callable receives: the schema is exactly a values.file output, whose x-astrale-file states the maxBytes and mediaTypes a client checks before it uploads.',
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { diagnostic } from '../../validation/diagnostic.js';
|
|
2
2
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
3
3
|
import { hasNodePathAnnotation } from '../syntax/node-path/schema.js';
|
|
4
|
-
import { walkSchema } from '../syntax/walk.js';
|
|
4
|
+
import { collectSchemaPointers, walkSchema } from '../syntax/walk.js';
|
|
5
5
|
import { resolveAddressReference, } from './references.js';
|
|
6
6
|
export function collectResourceClosure(schema, context, index, pointer) {
|
|
7
7
|
const diagnostics = [];
|
|
@@ -19,6 +19,7 @@ export function collectResourceClosure(schema, context, index, pointer) {
|
|
|
19
19
|
const resource = queue.shift();
|
|
20
20
|
if (resource === undefined)
|
|
21
21
|
break;
|
|
22
|
+
const pointers = collectSchemaPointers(resource.schema);
|
|
22
23
|
walkSchema(resource.schema, (location) => {
|
|
23
24
|
if (!isJsonObject(location.schema) || !Object.hasOwn(location.schema, '$ref'))
|
|
24
25
|
return;
|
|
@@ -27,7 +28,7 @@ export function collectResourceClosure(schema, context, index, pointer) {
|
|
|
27
28
|
diagnostics.push(diagnostic('VS_REFERENCE_FORM', refPointer, '$ref must be a string URI-reference.'));
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
const result = resolveAddressReference(location.schema.$ref, resource, index, refPointer, hasNodePathAnnotation(location.schema));
|
|
31
|
+
const result = resolveAddressReference(location.schema.$ref, resource, pointers, index, refPointer, hasNodePathAnnotation(location.schema));
|
|
31
32
|
if (result.diagnostic !== undefined)
|
|
32
33
|
diagnostics.push(result.diagnostic);
|
|
33
34
|
if (result.resolved === undefined)
|
|
@@ -36,10 +37,9 @@ export function collectResourceClosure(schema, context, index, pointer) {
|
|
|
36
37
|
const target = result.resolved.resource;
|
|
37
38
|
if (resources.has(target.key))
|
|
38
39
|
return;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
40
|
+
// The graph NodePath resource is no part of the schema: what it holds is reported at the
|
|
41
|
+
// $ref that names it.
|
|
42
|
+
const registered = { ...target, diagnosticPointer: refPointer };
|
|
43
43
|
resources.set(target.key, registered);
|
|
44
44
|
queue.push(registered);
|
|
45
45
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { cycleEdges } from '../../cycle.js';
|
|
1
2
|
import { diagnostic } from '../../validation/diagnostic.js';
|
|
2
3
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
3
|
-
import { SCHEMA_ARRAY_KEYWORDS, SCHEMA_MAP_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, } from '../syntax/keywords.js';
|
|
4
4
|
import { appendPointer } from '../syntax/pointer.js';
|
|
5
|
-
import {
|
|
5
|
+
import { forEachSubschema, walkSchema } from '../syntax/walk.js';
|
|
6
6
|
import { locationKey } from './closure.js';
|
|
7
7
|
export const CONSUMING_SCHEMA_KEYWORDS = new Set([
|
|
8
8
|
'additionalProperties',
|
|
@@ -43,53 +43,14 @@ export function validateProductiveRecursion(resources, resolutions) {
|
|
|
43
43
|
for (const [keyword, value] of Object.entries(location.schema)) {
|
|
44
44
|
if (!NON_CONSUMING_SCHEMA_KEYWORDS.has(keyword))
|
|
45
45
|
continue;
|
|
46
|
-
|
|
47
|
-
if (SCHEMA_SINGLE_KEYWORDS.has(keyword) && isJsonSchema(value)) {
|
|
48
|
-
outgoing.add(locationKey(resource.key, keywordPointer));
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (SCHEMA_ARRAY_KEYWORDS.has(keyword) && Array.isArray(value)) {
|
|
52
|
-
value.forEach((entry, index) => {
|
|
53
|
-
if (isJsonSchema(entry)) {
|
|
54
|
-
outgoing.add(locationKey(resource.key, appendPointer(keywordPointer, index)));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (SCHEMA_MAP_KEYWORDS.has(keyword) && isJsonObject(value)) {
|
|
60
|
-
for (const [name, entry] of Object.entries(value)) {
|
|
61
|
-
if (isJsonSchema(entry)) {
|
|
62
|
-
outgoing.add(locationKey(resource.key, appendPointer(keywordPointer, name)));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
46
|
+
forEachSubschema(keyword, value, appendPointer(location.pointer, keyword), (_, at) => outgoing.add(locationKey(resource.key, at)));
|
|
66
47
|
}
|
|
67
48
|
});
|
|
68
49
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
diagnostic('VS_RECURSION_PRODUCTIVE', diagnosticPointers.get(cycleAt) ?? '', 'Every recursive cycle must cross an instance-consuming schema edge.'),
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
function findCycle(node, adjacency, visiting, visited) {
|
|
82
|
-
if (visiting.has(node))
|
|
83
|
-
return node;
|
|
84
|
-
if (visited.has(node))
|
|
85
|
-
return undefined;
|
|
86
|
-
visiting.add(node);
|
|
87
|
-
for (const target of adjacency.get(node) ?? []) {
|
|
88
|
-
const cycleAt = findCycle(target, adjacency, visiting, visited);
|
|
89
|
-
if (cycleAt !== undefined)
|
|
90
|
-
return cycleAt;
|
|
91
|
-
}
|
|
92
|
-
visiting.delete(node);
|
|
93
|
-
visited.add(node);
|
|
94
|
-
return undefined;
|
|
50
|
+
const [cycle] = cycleEdges(adjacency.keys(), (node) => adjacency.get(node) ?? []);
|
|
51
|
+
if (cycle === undefined)
|
|
52
|
+
return [];
|
|
53
|
+
return [
|
|
54
|
+
diagnostic('VS_RECURSION_PRODUCTIVE', diagnosticPointers.get(cycle.target) ?? '', 'Every recursive cycle must cross an instance-consuming schema edge.'),
|
|
55
|
+
];
|
|
95
56
|
}
|
|
@@ -11,7 +11,9 @@ export interface ResolvedAddressReference {
|
|
|
11
11
|
readonly resource: SchemaResource;
|
|
12
12
|
readonly pointer: string;
|
|
13
13
|
}
|
|
14
|
-
export declare function resolveAddressReference(ref: string, from: SchemaResource,
|
|
14
|
+
export declare function resolveAddressReference(ref: string, from: SchemaResource,
|
|
15
|
+
/** The schema locations of `from`, the only targets a local reference has. */
|
|
16
|
+
pointers: ReadonlySet<string>, index: RegistryIndex, pointer: string, nodePathPlacement: boolean): {
|
|
15
17
|
readonly resolved?: ResolvedAddressReference;
|
|
16
18
|
readonly diagnostic?: Diagnostic;
|
|
17
19
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { diagnostic } from '../../validation/diagnostic.js';
|
|
2
2
|
import { GRAPH_NODE_PATH_SCHEMA_ID } from '../syntax/node-path/schema.js';
|
|
3
|
-
import { parseJsonPointerFragment,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { parseJsonPointerFragment, tokensToPointer } from '../syntax/pointer.js';
|
|
4
|
+
export function resolveAddressReference(ref, from,
|
|
5
|
+
/** The schema locations of `from`, the only targets a local reference has. */
|
|
6
|
+
pointers, index, pointer, nodePathPlacement) {
|
|
6
7
|
if (ref === GRAPH_NODE_PATH_SCHEMA_ID) {
|
|
7
8
|
if (!nodePathPlacement) {
|
|
8
9
|
return {
|
|
@@ -27,16 +28,15 @@ export function resolveAddressReference(ref, from, index, pointer, nodePathPlace
|
|
|
27
28
|
diagnostic: diagnostic('VS_REFERENCE_FORM', pointer, 'A local $ref must be a JSON Pointer fragment; anchors are forbidden.', ref),
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
return resolveTarget(from, tokens, pointer, ref);
|
|
31
|
+
return resolveTarget(from, pointers, tokens, pointer, ref);
|
|
31
32
|
}
|
|
32
33
|
return {
|
|
33
34
|
diagnostic: diagnostic('VS_REFERENCE_FORM', pointer, 'A $ref must be a local JSON Pointer or the graph NodePath id at its extension site.', ref),
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function resolveTarget(resource, tokens, diagnosticPointer, ref) {
|
|
37
|
-
const target = resolvePointer(resource.schema, tokens);
|
|
37
|
+
function resolveTarget(resource, pointers, tokens, diagnosticPointer, ref) {
|
|
38
38
|
const pointer = tokensToPointer(tokens);
|
|
39
|
-
if (
|
|
39
|
+
if (!pointers.has(pointer)) {
|
|
40
40
|
return {
|
|
41
41
|
diagnostic: diagnostic('VS_REFERENCE_RESOLUTION', diagnosticPointer, 'The $ref does not resolve to an exact schema location in the registry.', ref),
|
|
42
42
|
};
|
|
@@ -5,6 +5,8 @@ export interface RegistryIndex {
|
|
|
5
5
|
readonly registry: ValueSchemaRegistry;
|
|
6
6
|
readonly domains: ReadonlyMap<string, ValueSchemaDomainRegistry>;
|
|
7
7
|
readonly dependenciesByOwner: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
8
|
+
/** The `definitionRefIndex` of each Node Definition its own Domain lists. */
|
|
9
|
+
readonly nodeDefinitions: ReadonlySet<string>;
|
|
8
10
|
}
|
|
9
11
|
export declare function indexRegistry(registry: ValueSchemaRegistry, pointer: string): {
|
|
10
12
|
readonly index: RegistryIndex;
|
|
@@ -4,11 +4,21 @@ import { diagnostic } from '../../validation/diagnostic.js';
|
|
|
4
4
|
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
5
5
|
import { JSON_SCHEMA_DIALECT } from '../model/schema.js';
|
|
6
6
|
import { GRAPH_NODE_PATH_SCHEMA_ID } from '../syntax/node-path/schema.js';
|
|
7
|
+
// A registry is an immutable value, and every value schema of a Domain is validated against the
|
|
8
|
+
// same one: an index that admitted it without a diagnostic is reused, so the closure is indexed
|
|
9
|
+
// once per registry rather than once per value schema.
|
|
10
|
+
const admittedIndexes = new WeakMap();
|
|
7
11
|
export function indexRegistry(registry, pointer) {
|
|
12
|
+
const admitted = admittedIndexes.get(registry);
|
|
13
|
+
if (admitted !== undefined)
|
|
14
|
+
return { index: admitted, diagnostics: [] };
|
|
8
15
|
const diagnostics = [];
|
|
9
16
|
const domains = new Map();
|
|
10
17
|
domains.set(registry.current.origin, registry.current);
|
|
11
|
-
|
|
18
|
+
// The registry is the closure the Kernel builds for the schema at `pointer`, not a document: a
|
|
19
|
+
// fault of one of its entries is a fault of the closure that schema is checked with, reported
|
|
20
|
+
// there, the entry named in the message.
|
|
21
|
+
validateDomainRegistry(registry.current, 'current', false, pointer, diagnostics);
|
|
12
22
|
const dependencies = [
|
|
13
23
|
...registry.directDependencies.map((domain) => ({ domain, lane: 'directDependencies' })),
|
|
14
24
|
...registry.transitiveDependencies.map((domain) => ({
|
|
@@ -17,10 +27,9 @@ export function indexRegistry(registry, pointer) {
|
|
|
17
27
|
})),
|
|
18
28
|
];
|
|
19
29
|
dependencies.forEach(({ domain, lane }, index) => {
|
|
20
|
-
|
|
21
|
-
validateDomainRegistry(domain, domainPointer, true, diagnostics);
|
|
30
|
+
validateDomainRegistry(domain, `${lane}/${index}`, true, pointer, diagnostics);
|
|
22
31
|
if (domain.origin === registry.current.origin || domains.has(domain.origin)) {
|
|
23
|
-
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION',
|
|
32
|
+
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION', pointer, `Registry origin ${domain.origin} is duplicated in the exact closure, at ${lane}/${index}.`));
|
|
24
33
|
return;
|
|
25
34
|
}
|
|
26
35
|
domains.set(domain.origin, domain);
|
|
@@ -31,36 +40,44 @@ export function indexRegistry(registry, pointer) {
|
|
|
31
40
|
dependenciesByOwner.set(domain.origin, pins);
|
|
32
41
|
for (const dependency of domain.dependencies) {
|
|
33
42
|
const target = domains.get(dependency.origin);
|
|
43
|
+
// The schema at `pointer` cannot be judged without the closure it may reference.
|
|
34
44
|
if (target === undefined || target.revision !== dependency.revision) {
|
|
35
|
-
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION',
|
|
45
|
+
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION', pointer, `Registry closure is missing exact ${dependency.origin}@${dependency.revision} required by ${domain.origin}.`));
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
const nodeDefinitions = new Set();
|
|
50
|
+
for (const domain of domains.values()) {
|
|
51
|
+
for (const ref of domain.nodeDefinitions) {
|
|
52
|
+
if (ref.origin === domain.origin)
|
|
53
|
+
nodeDefinitions.add(definitionRefIndex(ref));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
validateGraphNodePathResource(registry.graphNodePath, pointer, diagnostics);
|
|
57
|
+
const index = { registry, domains, dependenciesByOwner, nodeDefinitions };
|
|
58
|
+
if (diagnostics.length === 0)
|
|
59
|
+
admittedIndexes.set(registry, index);
|
|
60
|
+
return { index, diagnostics };
|
|
41
61
|
}
|
|
42
62
|
export function isOriginVisibleFrom(index, ownerOrigin, targetOrigin) {
|
|
43
63
|
return (ownerOrigin === targetOrigin ||
|
|
44
64
|
index.dependenciesByOwner.get(ownerOrigin)?.has(targetOrigin) === true);
|
|
45
65
|
}
|
|
46
66
|
export function hasNodeDefinition(index, ref, ownerOrigin) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return (index.domains
|
|
50
|
-
.get(ref.origin)
|
|
51
|
-
?.nodeDefinitions.some((candidate) => definitionRefIndex(candidate) === definitionRefIndex(ref)) === true);
|
|
67
|
+
return (isOriginVisibleFrom(index, ownerOrigin, ref.origin) &&
|
|
68
|
+
index.nodeDefinitions.has(definitionRefIndex(ref)));
|
|
52
69
|
}
|
|
53
|
-
function validateDomainRegistry(domain,
|
|
70
|
+
function validateDomainRegistry(domain, entry, revisionRequired, pointer, diagnostics) {
|
|
54
71
|
if (!DOMAIN_ORIGIN_PATTERN.test(domain.origin)) {
|
|
55
|
-
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION',
|
|
72
|
+
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION', pointer, `Registry origin is invalid, at ${entry}.`));
|
|
56
73
|
}
|
|
57
74
|
if ((revisionRequired && domain.revision === undefined) ||
|
|
58
75
|
(domain.revision !== undefined && !DOMAIN_REVISION_PATTERN.test(domain.revision))) {
|
|
59
|
-
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION',
|
|
76
|
+
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION', pointer, `A dependency-closure registry entry requires its exact sha256 revision, at ${entry}.`));
|
|
60
77
|
}
|
|
61
78
|
for (const ref of domain.nodeDefinitions) {
|
|
62
79
|
if (ref.origin !== domain.origin) {
|
|
63
|
-
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION',
|
|
80
|
+
diagnostics.push(diagnostic('VS_REFERENCE_RESOLUTION', pointer, `A registry domain can list only its own Node Definitions, at ${entry}.`));
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
83
|
}
|