@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,135 @@
|
|
|
1
|
+
import { isValueObject as isJsonObject } from '../model/object.js';
|
|
2
|
+
import { collectResourceClosure, locationKey, } from '../reference/closure.js';
|
|
3
|
+
import { indexRegistry } from '../reference/registry.index.js';
|
|
4
|
+
import { compilePattern } from '../regexp/compile.js';
|
|
5
|
+
import { loadPattern } from '../regexp/matcher.js';
|
|
6
|
+
import { appendPointer } from '../syntax/pointer.js';
|
|
7
|
+
import { walkSchema } from '../syntax/walk.js';
|
|
8
|
+
/** Prepare reference and linear-regexp state without generating executable source. */
|
|
9
|
+
export function prepareValueSchema(schema, registry, pointer) {
|
|
10
|
+
const indexed = indexRegistry(registry, pointer);
|
|
11
|
+
if (indexed.diagnostics.length > 0)
|
|
12
|
+
return failed(indexed.diagnostics);
|
|
13
|
+
const closure = collectResourceClosure(schema, 'callable-input', indexed.index, pointer);
|
|
14
|
+
if (closure.diagnostics.length > 0)
|
|
15
|
+
return failed(closure.diagnostics);
|
|
16
|
+
const locations = new Map();
|
|
17
|
+
const matchers = new Map();
|
|
18
|
+
for (const resource of closure.resources.values()) {
|
|
19
|
+
walkSchema(resource.schema, (location) => {
|
|
20
|
+
const key = locationKey(resource.key, location.pointer);
|
|
21
|
+
locations.set(key, {
|
|
22
|
+
key,
|
|
23
|
+
pointer: location.pointer,
|
|
24
|
+
resource,
|
|
25
|
+
schema: location.schema,
|
|
26
|
+
});
|
|
27
|
+
if (!isJsonObject(location.schema))
|
|
28
|
+
return;
|
|
29
|
+
rememberMatcher(matchers, location.schema.pattern);
|
|
30
|
+
rememberMatcher(matchers, location.schema.fullMatch);
|
|
31
|
+
if (isJsonObject(location.schema.patternProperties)) {
|
|
32
|
+
for (const pattern of Object.keys(location.schema.patternProperties)) {
|
|
33
|
+
rememberMatcher(matchers, pattern);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const initial = closure.resources.values().next().value;
|
|
39
|
+
const root = initial === undefined ? undefined : locations.get(locationKey(initial.key, ''));
|
|
40
|
+
if (root === undefined) {
|
|
41
|
+
return { compiled: false, message: 'The root value schema is absent from its closure.' };
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
compiled: true,
|
|
45
|
+
value: {
|
|
46
|
+
root,
|
|
47
|
+
locations,
|
|
48
|
+
resolutions: closure.resolutions,
|
|
49
|
+
program: () => portableProgram(root, locations, closure.resolutions),
|
|
50
|
+
child(location, keyword, member) {
|
|
51
|
+
const keywordPointer = appendPointer(location.pointer, keyword);
|
|
52
|
+
const pointer = member === undefined ? keywordPointer : appendPointer(keywordPointer, member);
|
|
53
|
+
const child = locations.get(locationKey(location.resource.key, pointer));
|
|
54
|
+
if (child === undefined) {
|
|
55
|
+
throw new TypeError(`Admitted value schema child ${pointer} is absent from its closure.`);
|
|
56
|
+
}
|
|
57
|
+
return child;
|
|
58
|
+
},
|
|
59
|
+
reference(location) {
|
|
60
|
+
const resolved = closure.resolutions.get(location.key);
|
|
61
|
+
return resolved === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: locations.get(locationKey(resolved.resource.key, resolved.pointer));
|
|
64
|
+
},
|
|
65
|
+
matcher(source) {
|
|
66
|
+
const matcher = matchers.get(source);
|
|
67
|
+
if (matcher === undefined) {
|
|
68
|
+
throw new TypeError('Value schema uses an unprepared I-Regexp source.');
|
|
69
|
+
}
|
|
70
|
+
return matcher;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function portableProgram(root, locations, resolutions) {
|
|
76
|
+
const ordered = [...locations.values()];
|
|
77
|
+
const indices = new Map(ordered.map((location, index) => [location.key, index]));
|
|
78
|
+
const patterns = new Map();
|
|
79
|
+
const nodes = ordered.map((location) => {
|
|
80
|
+
const children = {};
|
|
81
|
+
walkSchema(location.schema, (child) => {
|
|
82
|
+
if (child.depth !== 1)
|
|
83
|
+
return;
|
|
84
|
+
const target = indices.get(locationKey(location.resource.key, `${location.pointer}${child.pointer}`));
|
|
85
|
+
if (target !== undefined)
|
|
86
|
+
children[childKey(child.pointer)] = target;
|
|
87
|
+
});
|
|
88
|
+
rememberPattern(patterns, location.schema);
|
|
89
|
+
const resolved = resolutions.get(location.key);
|
|
90
|
+
const reference = resolved === undefined
|
|
91
|
+
? undefined
|
|
92
|
+
: indices.get(locationKey(resolved.resource.key, resolved.pointer));
|
|
93
|
+
if (resolved !== undefined && reference === undefined) {
|
|
94
|
+
throw new TypeError('Prepared value schema reference target is absent.');
|
|
95
|
+
}
|
|
96
|
+
return Object.freeze({
|
|
97
|
+
schema: location.schema,
|
|
98
|
+
children: Object.freeze(children),
|
|
99
|
+
...(reference === undefined ? {} : { reference }),
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
return Object.freeze({
|
|
103
|
+
root: indices.get(root.key),
|
|
104
|
+
nodes: Object.freeze(nodes),
|
|
105
|
+
patterns: Object.freeze([...patterns.values()]),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function rememberPattern(patterns, schema) {
|
|
109
|
+
if (!isJsonObject(schema))
|
|
110
|
+
return;
|
|
111
|
+
for (const source of [schema.pattern, schema.fullMatch]) {
|
|
112
|
+
if (typeof source === 'string' && !patterns.has(source))
|
|
113
|
+
patterns.set(source, compilePattern(source));
|
|
114
|
+
}
|
|
115
|
+
if (isJsonObject(schema.patternProperties)) {
|
|
116
|
+
for (const source of Object.keys(schema.patternProperties)) {
|
|
117
|
+
if (!patterns.has(source))
|
|
118
|
+
patterns.set(source, compilePattern(source));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export function childKey(pointer) {
|
|
123
|
+
return pointer.slice(1);
|
|
124
|
+
}
|
|
125
|
+
function rememberMatcher(matchers, input) {
|
|
126
|
+
if (typeof input === 'string' && !matchers.has(input)) {
|
|
127
|
+
matchers.set(input, loadPattern(compilePattern(input)));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function failed(diagnostics) {
|
|
131
|
+
return {
|
|
132
|
+
compiled: false,
|
|
133
|
+
message: diagnostics.map(({ code, message }) => `${code}: ${message}`).join('; '),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { loadValueProgram } from '../compile/load.js';
|
|
2
|
+
import { validateCanonicalJsonDomain } from '../profile/json.validate.js';
|
|
3
|
+
import { evaluateInstance } from './evaluator.js';
|
|
4
|
+
export function validateValueProgram(program, input, roots = [program.root]) {
|
|
5
|
+
const canonical = validateCanonicalJsonDomain(input, '');
|
|
6
|
+
if (canonical.length > 0)
|
|
7
|
+
return canonical;
|
|
8
|
+
return roots.flatMap((root) => {
|
|
9
|
+
const result = evaluateInstance(loadValueProgram({ ...program, root }), input);
|
|
10
|
+
return result.failures.map((failure) => ({
|
|
11
|
+
code: 'VALUE_SCHEMA_INSTANCE_INVALID',
|
|
12
|
+
pointer: failure.instancePointer,
|
|
13
|
+
message: `Value does not satisfy its complete V1 schema at ${failure.keyword}: ${failure.message}`,
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { ValueProgram } from '../compile/model.js';
|
|
3
|
+
import type { JsonSchema } from '../model/schema.js';
|
|
4
|
+
import type { ResolvedAddressReference, SchemaResource } from '../reference/references.js';
|
|
5
|
+
import type { IRegexpMatcher } from '../regexp/matcher.js';
|
|
6
|
+
export interface InstanceFailure {
|
|
7
|
+
readonly instancePointer: string;
|
|
8
|
+
readonly keyword: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SchemaLocation {
|
|
12
|
+
readonly key: string;
|
|
13
|
+
readonly pointer: string;
|
|
14
|
+
readonly resource: SchemaResource;
|
|
15
|
+
readonly schema: JsonSchema;
|
|
16
|
+
}
|
|
17
|
+
export interface CompiledInstanceSchema {
|
|
18
|
+
readonly root: SchemaLocation;
|
|
19
|
+
readonly locations: ReadonlyMap<string, SchemaLocation>;
|
|
20
|
+
readonly resolutions: ReadonlyMap<string, ResolvedAddressReference>;
|
|
21
|
+
program(): ValueProgram;
|
|
22
|
+
child(location: SchemaLocation, keyword: string, member?: string | number): SchemaLocation;
|
|
23
|
+
reference(location: SchemaLocation): SchemaLocation | undefined;
|
|
24
|
+
matcher(source: string): IRegexpMatcher;
|
|
25
|
+
}
|
|
26
|
+
export interface Evaluation {
|
|
27
|
+
readonly valid: boolean;
|
|
28
|
+
readonly failures: readonly InstanceFailure[];
|
|
29
|
+
/** Properties evaluated at this exact instance location. */
|
|
30
|
+
readonly properties: ReadonlySet<string>;
|
|
31
|
+
/** Items evaluated at this exact instance location. */
|
|
32
|
+
readonly items: ReadonlySet<number>;
|
|
33
|
+
}
|
|
34
|
+
export type Instance = JsonValue;
|
|
35
|
+
export declare function evaluation(failures?: readonly InstanceFailure[], properties?: ReadonlySet<string>, items?: ReadonlySet<number>): Evaluation;
|
|
36
|
+
export declare function mergeAnnotations(targetProperties: Set<string>, targetItems: Set<number>, source: Pick<Evaluation, 'properties' | 'items'>): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function evaluation(failures = [], properties = new Set(), items = new Set()) {
|
|
2
|
+
return { valid: failures.length === 0, failures, properties, items };
|
|
3
|
+
}
|
|
4
|
+
export function mergeAnnotations(targetProperties, targetItems, source) {
|
|
5
|
+
for (const property of source.properties)
|
|
6
|
+
targetProperties.add(property);
|
|
7
|
+
for (const item of source.items)
|
|
8
|
+
targetItems.add(item);
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { Diagnostic } from '../../validation/diagnostic.js';
|
|
3
|
+
import type { JsonSchema } from '../model/schema.js';
|
|
4
|
+
import type { ValueSchemaRegistry } from '../reference/registry.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validate one complete portable value with the admitted V1 Draft 2020-12 profile.
|
|
7
|
+
*
|
|
8
|
+
* Evaluation is an interpreter over the exact local resource closure. It never performs network
|
|
9
|
+
* resolution or dynamic source generation, and every admitted I-Regexp executes through RE2JS.
|
|
10
|
+
* `format` remains annotation-only; the graph NodePath codec performs its separate locator check.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateJsonInstance(schema: JsonSchema, value: JsonValue, registry: ValueSchemaRegistry, pointer?: string): Diagnostic[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { diagnostic } from '../../validation/diagnostic.js';
|
|
2
|
+
import { validateCanonicalJsonDomain } from '../profile/json.validate.js';
|
|
3
|
+
import { evaluateInstance } from './evaluator.js';
|
|
4
|
+
import { prepareValueSchema } from './preparation.js';
|
|
5
|
+
const validatorCache = new WeakMap();
|
|
6
|
+
/**
|
|
7
|
+
* Validate one complete portable value with the admitted V1 Draft 2020-12 profile.
|
|
8
|
+
*
|
|
9
|
+
* Evaluation is an interpreter over the exact local resource closure. It never performs network
|
|
10
|
+
* resolution or dynamic source generation, and every admitted I-Regexp executes through RE2JS.
|
|
11
|
+
* `format` remains annotation-only; the graph NodePath codec performs its separate locator check.
|
|
12
|
+
*/
|
|
13
|
+
export function validateJsonInstance(schema, value, registry, pointer = '') {
|
|
14
|
+
const diagnostics = [...validateCanonicalJsonDomain(value, pointer)];
|
|
15
|
+
if (diagnostics.length > 0)
|
|
16
|
+
return diagnostics;
|
|
17
|
+
const prepared = preparedInstanceValidator(schema, registry, pointer);
|
|
18
|
+
if (prepared.kind === 'error') {
|
|
19
|
+
return [
|
|
20
|
+
diagnostic('VS_REFERENCE_RESOLUTION', pointer, `Value validation failed closed while preparing exact schema resources: ${prepared.message}.`),
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
const result = evaluateInstance(prepared.compiled, value);
|
|
24
|
+
if (result.valid)
|
|
25
|
+
return [];
|
|
26
|
+
return result.failures.map((failure) => diagnostic('VALUE_SCHEMA_INSTANCE_INVALID', `${pointer}${failure.instancePointer}`, `Value does not satisfy its complete V1 schema at ${failure.keyword}: ${failure.message}`));
|
|
27
|
+
}
|
|
28
|
+
function preparedInstanceValidator(schema, registry, pointer) {
|
|
29
|
+
let bySchema = validatorCache.get(registry);
|
|
30
|
+
if (bySchema === undefined) {
|
|
31
|
+
bySchema = new Map();
|
|
32
|
+
validatorCache.set(registry, bySchema);
|
|
33
|
+
}
|
|
34
|
+
const cached = bySchema.get(schema);
|
|
35
|
+
if (cached !== undefined)
|
|
36
|
+
return cached;
|
|
37
|
+
const compilation = prepareValueSchema(schema, registry, pointer);
|
|
38
|
+
const prepared = compilation.compiled
|
|
39
|
+
? { kind: 'validator', compiled: compilation.value }
|
|
40
|
+
: { kind: 'error', message: compilation.message };
|
|
41
|
+
bySchema.set(schema, prepared);
|
|
42
|
+
return prepared;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Complete V1 inline value language. Named Type Definitions do not exist. */
|
|
2
|
+
export type { JsonSchema as ValueSchema, JsonSchemaObject as ValueSchemaObject, PathAnnotation, PropertyObjectSchema, ValueSchemaContext, } from './model/schema.js';
|
|
3
|
+
export { JSON_SCHEMA_DIALECT, VALUE_SCHEMA_DIALECT, VALUE_SCHEMA_VOCABULARY, } from './model/schema.js';
|
|
4
|
+
export { instant, isInstantValue } from './model/instant.js';
|
|
5
|
+
export { classifyOrdering, type OrderingKind } from './ordering.js';
|
|
6
|
+
export { canonicalizeValueSchema } from './profile/canonicalize.js';
|
|
7
|
+
export { validateValueSchema } from './profile/validate.js';
|
|
8
|
+
export { validateJsonInstance } from './evaluate/validate.js';
|
|
9
|
+
export { prepareValueSchema, type InstanceSchemaCompilation } from './evaluate/preparation.js';
|
|
10
|
+
export type { ValueProgram } from './compile/model.js';
|
|
11
|
+
export type { ValueSchemaRegistry, ValueSchemaDomainRegistry } from './reference/registry.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Complete V1 inline value language. Named Type Definitions do not exist. */
|
|
2
|
+
export { JSON_SCHEMA_DIALECT, VALUE_SCHEMA_DIALECT, VALUE_SCHEMA_VOCABULARY, } from './model/schema.js';
|
|
3
|
+
export { instant, isInstantValue } from './model/instant.js';
|
|
4
|
+
export { classifyOrdering } from './ordering.js';
|
|
5
|
+
export { canonicalizeValueSchema } from './profile/canonicalize.js';
|
|
6
|
+
export { validateValueSchema } from './profile/validate.js';
|
|
7
|
+
export { validateJsonInstance } from './evaluate/validate.js';
|
|
8
|
+
export { prepareValueSchema } from './evaluate/preparation.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Exact portable UTC millisecond Instant used by the V1 value-schema dialect. */
|
|
2
|
+
/** Canonical value-language annotation for an Instant string. */
|
|
3
|
+
export declare const INSTANT_VALUE_KIND: 'instant';
|
|
4
|
+
export declare const instant: Readonly<{
|
|
5
|
+
readonly type: 'string';
|
|
6
|
+
readonly 'x-astrale-value-kind': 'instant';
|
|
7
|
+
}>;
|
|
8
|
+
/** Test the exact proleptic-Gregorian V1 Instant lexical and calendar domain. */
|
|
9
|
+
export declare function isInstantValue(input: unknown): input is string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Exact portable UTC millisecond Instant used by the V1 value-schema dialect. */
|
|
2
|
+
/** Canonical value-language annotation for an Instant string. */
|
|
3
|
+
export const INSTANT_VALUE_KIND = 'instant';
|
|
4
|
+
export const instant = Object.freeze({
|
|
5
|
+
type: 'string',
|
|
6
|
+
'x-astrale-value-kind': INSTANT_VALUE_KIND,
|
|
7
|
+
});
|
|
8
|
+
const INSTANT_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z$/u;
|
|
9
|
+
/** Test the exact proleptic-Gregorian V1 Instant lexical and calendar domain. */
|
|
10
|
+
export function isInstantValue(input) {
|
|
11
|
+
if (typeof input !== 'string')
|
|
12
|
+
return false;
|
|
13
|
+
const match = INSTANT_PATTERN.exec(input);
|
|
14
|
+
if (match === null)
|
|
15
|
+
return false;
|
|
16
|
+
const year = Number(match[1]);
|
|
17
|
+
const month = Number(match[2]);
|
|
18
|
+
const day = Number(match[3]);
|
|
19
|
+
const hour = Number(match[4]);
|
|
20
|
+
const minute = Number(match[5]);
|
|
21
|
+
const second = Number(match[6]);
|
|
22
|
+
return (month >= 1 &&
|
|
23
|
+
month <= 12 &&
|
|
24
|
+
day >= 1 &&
|
|
25
|
+
day <= daysInMonth(year, month) &&
|
|
26
|
+
hour <= 23 &&
|
|
27
|
+
minute <= 59 &&
|
|
28
|
+
second <= 59);
|
|
29
|
+
}
|
|
30
|
+
function daysInMonth(year, month) {
|
|
31
|
+
if (month === 2)
|
|
32
|
+
return isLeapYear(year) ? 29 : 28;
|
|
33
|
+
return month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;
|
|
34
|
+
}
|
|
35
|
+
function isLeapYear(year) {
|
|
36
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
37
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Object as ValueObject, Value } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
/** Internal shape refinement for values that have already crossed portable-value admission. */
|
|
3
|
+
/** Return whether an unknown value is a portable JSON object. */
|
|
4
|
+
export declare function isValueObject(value: unknown): value is ValueObject;
|
|
5
|
+
export declare function isValueObject(value: Value): value is ValueObject;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Object as JsonObject, Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { ClassRef } from '../../../addressing/index.js';
|
|
3
|
+
/** Standard dialect on which the Astrale value-schema dialect is based. */
|
|
4
|
+
export declare const JSON_SCHEMA_DIALECT: 'https://json-schema.org/draft/2020-12/schema';
|
|
5
|
+
/** Required V1 dialect for every embedded Astrale value schema. */
|
|
6
|
+
export declare const VALUE_SCHEMA_DIALECT: 'https://schemas.astrale.ai/dsl/v1/value-schema';
|
|
7
|
+
/** Required vocabulary carried by the V1 value-schema dialect. */
|
|
8
|
+
export declare const VALUE_SCHEMA_VOCABULARY: 'https://schemas.astrale.ai/dsl/v1/value-schema/vocabulary';
|
|
9
|
+
export type JsonSchema = boolean | JsonSchemaObject;
|
|
10
|
+
export type JsonSchemaObject = JsonObject & {
|
|
11
|
+
readonly [keyword: string]: JsonValue;
|
|
12
|
+
};
|
|
13
|
+
export interface PropertyObjectSchema extends JsonSchemaObject {
|
|
14
|
+
readonly type: 'object';
|
|
15
|
+
readonly properties: Readonly<Record<string, JsonSchema>>;
|
|
16
|
+
readonly required: readonly string[];
|
|
17
|
+
readonly additionalProperties: false;
|
|
18
|
+
}
|
|
19
|
+
export interface PathAnnotation {
|
|
20
|
+
readonly target: 'node';
|
|
21
|
+
readonly cardinality: 'one';
|
|
22
|
+
readonly accepts: readonly ClassRef[];
|
|
23
|
+
}
|
|
24
|
+
export declare const VALUE_SCHEMA_CONTEXTS: readonly ['property-facet', 'callable-input', 'callable-output'];
|
|
25
|
+
export type ValueSchemaContext = (typeof VALUE_SCHEMA_CONTEXTS)[number];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Standard dialect on which the Astrale value-schema dialect is based. */
|
|
2
|
+
export const JSON_SCHEMA_DIALECT = 'https://json-schema.org/draft/2020-12/schema';
|
|
3
|
+
/** Required V1 dialect for every embedded Astrale value schema. */
|
|
4
|
+
export const VALUE_SCHEMA_DIALECT = 'https://schemas.astrale.ai/dsl/v1/value-schema';
|
|
5
|
+
/** Required vocabulary carried by the V1 value-schema dialect. */
|
|
6
|
+
export const VALUE_SCHEMA_VOCABULARY = 'https://schemas.astrale.ai/dsl/v1/value-schema/vocabulary';
|
|
7
|
+
export const VALUE_SCHEMA_CONTEXTS = [
|
|
8
|
+
'property-facet',
|
|
9
|
+
'callable-input',
|
|
10
|
+
'callable-output',
|
|
11
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ValueProgram } from './compile/model.js';
|
|
2
|
+
import type { JsonSchema } from './model/schema.js';
|
|
3
|
+
import type { ValueSchemaRegistry } from './reference/registry.js';
|
|
4
|
+
export type OrderingKind = 'boolean' | 'number' | 'string' | 'instant';
|
|
5
|
+
/**
|
|
6
|
+
* Classify a schema only when every value it can admit belongs to one sortable scalar domain.
|
|
7
|
+
*
|
|
8
|
+
* The analysis is intentionally conservative: unsupported or ambiguous schemas return undefined
|
|
9
|
+
* instead of guessing from annotations, examples, formats, or current data.
|
|
10
|
+
*/
|
|
11
|
+
export declare function classifyOrdering(contract: JsonSchema, registry: ValueSchemaRegistry): OrderingKind | undefined;
|
|
12
|
+
/** Recompute the scalar ordering classification from one admitted portable value program. */
|
|
13
|
+
export declare function classifyValueProgramOrdering(program: ValueProgram): OrderingKind | undefined;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { loadValueProgram } from './compile/load.js';
|
|
2
|
+
import { prepareValueSchema } from './evaluate/preparation.js';
|
|
3
|
+
const ALL_JSON_KINDS = new Set([
|
|
4
|
+
'null',
|
|
5
|
+
'boolean',
|
|
6
|
+
'number',
|
|
7
|
+
'string',
|
|
8
|
+
'array',
|
|
9
|
+
'object',
|
|
10
|
+
]);
|
|
11
|
+
/**
|
|
12
|
+
* Classify a schema only when every value it can admit belongs to one sortable scalar domain.
|
|
13
|
+
*
|
|
14
|
+
* The analysis is intentionally conservative: unsupported or ambiguous schemas return undefined
|
|
15
|
+
* instead of guessing from annotations, examples, formats, or current data.
|
|
16
|
+
*/
|
|
17
|
+
export function classifyOrdering(contract, registry) {
|
|
18
|
+
const prepared = prepareValueSchema(contract, registry, '');
|
|
19
|
+
if (!prepared.compiled)
|
|
20
|
+
return undefined;
|
|
21
|
+
const candidates = new OrderingClassifier(prepared.value).classify(prepared.value.root);
|
|
22
|
+
if (candidates.size !== 1)
|
|
23
|
+
return undefined;
|
|
24
|
+
const [kind] = candidates;
|
|
25
|
+
return kind === 'boolean' || kind === 'number' || kind === 'string' || kind === 'instant'
|
|
26
|
+
? kind
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
/** Recompute the scalar ordering classification from one admitted portable value program. */
|
|
30
|
+
export function classifyValueProgramOrdering(program) {
|
|
31
|
+
const compiled = loadValueProgram(program);
|
|
32
|
+
const candidates = new OrderingClassifier(compiled).classify(compiled.root);
|
|
33
|
+
if (candidates.size !== 1)
|
|
34
|
+
return undefined;
|
|
35
|
+
const [kind] = candidates;
|
|
36
|
+
return kind === 'boolean' || kind === 'number' || kind === 'string' || kind === 'instant'
|
|
37
|
+
? kind
|
|
38
|
+
: undefined;
|
|
39
|
+
}
|
|
40
|
+
class OrderingClassifier {
|
|
41
|
+
compiled;
|
|
42
|
+
active = new Set();
|
|
43
|
+
cache = new Map();
|
|
44
|
+
constructor(compiled) {
|
|
45
|
+
this.compiled = compiled;
|
|
46
|
+
}
|
|
47
|
+
classify(location) {
|
|
48
|
+
const cached = this.cache.get(location.key);
|
|
49
|
+
if (cached !== undefined)
|
|
50
|
+
return cached;
|
|
51
|
+
if (this.active.has(location.key))
|
|
52
|
+
return ALL_JSON_KINDS;
|
|
53
|
+
this.active.add(location.key);
|
|
54
|
+
try {
|
|
55
|
+
const result = this.classifySchema(location);
|
|
56
|
+
this.cache.set(location.key, result);
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
this.active.delete(location.key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
classifySchema(location) {
|
|
64
|
+
if (location.schema === false)
|
|
65
|
+
return new Set();
|
|
66
|
+
if (location.schema === true)
|
|
67
|
+
return ALL_JSON_KINDS;
|
|
68
|
+
const schema = location.schema;
|
|
69
|
+
let candidates = ALL_JSON_KINDS;
|
|
70
|
+
if (Object.hasOwn(schema, 'x-astrale-value-kind')) {
|
|
71
|
+
if (schema['x-astrale-value-kind'] !== 'instant' || schema.type !== 'string') {
|
|
72
|
+
return new Set();
|
|
73
|
+
}
|
|
74
|
+
candidates = intersect(candidates, new Set(['instant']));
|
|
75
|
+
}
|
|
76
|
+
const declaredTypes = typesOf(schema.type);
|
|
77
|
+
if (declaredTypes !== undefined)
|
|
78
|
+
candidates = intersect(candidates, declaredTypes);
|
|
79
|
+
if (Object.hasOwn(schema, 'const')) {
|
|
80
|
+
candidates = intersect(candidates, new Set([kindOfValue(schema.const)]));
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(schema.enum)) {
|
|
83
|
+
candidates = intersect(candidates, normalize(new Set(schema.enum.map(kindOfValue))));
|
|
84
|
+
}
|
|
85
|
+
if (Object.hasOwn(schema, '$ref')) {
|
|
86
|
+
const target = this.compiled.reference(location);
|
|
87
|
+
if (target === undefined)
|
|
88
|
+
return new Set();
|
|
89
|
+
candidates = intersect(candidates, this.classify(target));
|
|
90
|
+
}
|
|
91
|
+
const allOf = schemaList(schema.allOf);
|
|
92
|
+
if (allOf !== undefined) {
|
|
93
|
+
for (let index = 0; index < allOf.length; index += 1) {
|
|
94
|
+
candidates = intersect(candidates, this.classify(this.child(location, 'allOf', index)));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const keyword of ['anyOf', 'oneOf']) {
|
|
98
|
+
const branches = schemaList(schema[keyword]);
|
|
99
|
+
if (branches === undefined)
|
|
100
|
+
continue;
|
|
101
|
+
let admitted = new Set();
|
|
102
|
+
for (let index = 0; index < branches.length; index += 1) {
|
|
103
|
+
admitted = union(admitted, this.classify(this.child(location, keyword, index)));
|
|
104
|
+
}
|
|
105
|
+
candidates = intersect(candidates, admitted);
|
|
106
|
+
}
|
|
107
|
+
return candidates;
|
|
108
|
+
}
|
|
109
|
+
child(location, keyword, index) {
|
|
110
|
+
return this.compiled.child(location, keyword, index);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function typesOf(input) {
|
|
114
|
+
if (typeof input === 'string')
|
|
115
|
+
return typeSet([input]);
|
|
116
|
+
if (Array.isArray(input)) {
|
|
117
|
+
const types = input.filter((value) => typeof value === 'string');
|
|
118
|
+
return typeSet(types);
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
function typeSet(types) {
|
|
123
|
+
const result = new Set();
|
|
124
|
+
for (const type of types) {
|
|
125
|
+
if (type === 'integer' || type === 'number')
|
|
126
|
+
result.add('number');
|
|
127
|
+
else if (type === 'null' ||
|
|
128
|
+
type === 'boolean' ||
|
|
129
|
+
type === 'string' ||
|
|
130
|
+
type === 'array' ||
|
|
131
|
+
type === 'object') {
|
|
132
|
+
result.add(type);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
function kindOfValue(value) {
|
|
138
|
+
if (value === null)
|
|
139
|
+
return 'null';
|
|
140
|
+
if (Array.isArray(value))
|
|
141
|
+
return 'array';
|
|
142
|
+
if (typeof value === 'object')
|
|
143
|
+
return 'object';
|
|
144
|
+
if (typeof value === 'boolean')
|
|
145
|
+
return 'boolean';
|
|
146
|
+
if (typeof value === 'number')
|
|
147
|
+
return 'number';
|
|
148
|
+
return 'string';
|
|
149
|
+
}
|
|
150
|
+
function intersect(left, right) {
|
|
151
|
+
const result = new Set();
|
|
152
|
+
for (const leftKind of left) {
|
|
153
|
+
for (const rightKind of right) {
|
|
154
|
+
if (leftKind === rightKind)
|
|
155
|
+
result.add(leftKind);
|
|
156
|
+
else if ((leftKind === 'string' && rightKind === 'instant') ||
|
|
157
|
+
(leftKind === 'instant' && rightKind === 'string')) {
|
|
158
|
+
result.add('instant');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return normalize(result);
|
|
163
|
+
}
|
|
164
|
+
function union(left, right) {
|
|
165
|
+
return normalize(new Set([...left, ...right]));
|
|
166
|
+
}
|
|
167
|
+
function normalize(input) {
|
|
168
|
+
if (input.has('string'))
|
|
169
|
+
input.delete('instant');
|
|
170
|
+
return input;
|
|
171
|
+
}
|
|
172
|
+
function schemaList(input) {
|
|
173
|
+
return Array.isArray(input) ? input : undefined;
|
|
174
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { JsonSchema, ValueSchemaContext } from '../model/schema.js';
|
|
2
|
+
import type { ValueSchemaRegistry } from '../reference/registry.js';
|
|
3
|
+
/** Canonicalizes syntax without rewriting the schema's algebra. Validate first. */
|
|
4
|
+
export declare function canonicalizeValueSchema(schema: JsonSchema, context?: ValueSchemaContext, registry?: ValueSchemaRegistry): JsonSchema;
|