@astrale-os/kernel-dsl 1.0.0-beta.2 → 1.0.0-beta.20
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 +4 -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 +31 -33
- 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 +5 -2
- 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 +2 -0
- 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 +11 -6
- package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
- package/dist/v1/builder/lowering/schema/context.js +36 -4
- 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/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +1 -3
- package/dist/v1/builder/policy/authoring.d.ts +85 -5
- package/dist/v1/builder/policy/authoring.js +107 -68
- 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 +1 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
- package/dist/v1/builder/schema/projection/class.d.ts +118 -15
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/identity.d.ts +2 -1
- package/dist/v1/builder/schema/projection/model.d.ts +4 -2
- package/dist/v1/builder/schema/projection/property.d.ts +1 -1
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +2 -1
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- 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 +11 -13
- package/dist/v1/bundle/diagnostic.d.ts +2 -0
- package/dist/v1/bundle/diagnostic.js +9 -7
- package/dist/v1/bundle/model.js +1 -1
- package/dist/v1/bundle/structure.js +4 -6
- package/dist/v1/compiled/admission/accept.js +4 -10
- package/dist/v1/compiled/admission/closure.js +2 -2
- package/dist/v1/compiled/admission/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/admission/diagnostic.js +1 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +6 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +37 -12
- 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/callable.js +0 -2
- 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 +40 -43
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +4 -16
- 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.js +11 -1
- package/dist/v1/compiled/admission/wire/class.js +73 -21
- package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
- package/dist/v1/compiled/admission/wire/policy.js +8 -7
- package/dist/v1/compiled/compiler/compile.js +8 -8
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +11 -45
- package/dist/v1/domain/create.js +5 -6
- package/dist/v1/domain/model/domain.d.ts +2 -7
- package/dist/v1/domain/model/input.d.ts +2 -1
- package/dist/v1/domain/namespace/member-collection.js +4 -6
- package/dist/v1/domain/projection/classes.js +4 -1
- package/dist/v1/domain/validation/create.d.ts +6 -3
- package/dist/v1/domain/validation/create.js +21 -69
- package/dist/v1/index.d.ts +2 -1
- package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
- package/dist/v1/language/.spec/schemas/value-schema.schema.json +22 -0
- package/dist/v1/language/callable/admission.d.ts +15 -0
- package/dist/v1/language/callable/admission.js +43 -0
- package/dist/v1/language/callable/model/callable.d.ts +10 -0
- package/dist/v1/language/callable/resolved.d.ts +16 -3
- package/dist/v1/language/class/inheritance.d.ts +36 -5
- package/dist/v1/language/class/inheritance.js +87 -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/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/definition/metadata.d.ts +5 -0
- package/dist/v1/language/definition/metadata.js +7 -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 +64 -0
- package/dist/v1/language/limits.js +60 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +2 -1
- package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
- package/dist/v1/language/policy/analysis/budgets.js +133 -19
- package/dist/v1/language/policy/analysis/checks.js +3 -2
- package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
- package/dist/v1/language/policy/analysis/typing.js +455 -0
- package/dist/v1/language/policy/model/policy.d.ts +49 -9
- package/dist/v1/language/policy/model/policy.js +14 -0
- package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
- package/dist/v1/language/policy/normalization/normalize.js +22 -21
- 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 +4 -8
- package/dist/v1/language/value/evaluate/program.d.ts +2 -1
- package/dist/v1/language/value/evaluate/program.js +2 -2
- package/dist/v1/language/value/evaluate/validate.d.ts +2 -2
- package/dist/v1/language/value/evaluate/validate.js +6 -2
- package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
- package/dist/v1/language/value/evaluate/validity.optimization.js +342 -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 +29 -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 +74 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +138 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +17 -0
- package/dist/v1/language/value/inclusion/includes.js +25 -719
- 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 +63 -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 +11 -0
- package/dist/v1/language/value/ordering.d.ts +14 -0
- package/dist/v1/language/value/ordering.js +86 -9
- package/dist/v1/language/value/profile/canonicalize.js +6 -5
- package/dist/v1/language/value/profile/json.validate.d.ts +3 -1
- package/dist/v1/language/value/profile/json.validate.js +3 -2
- package/dist/v1/language/value/profile/meta-schema.compiled.js +4 -1
- package/dist/v1/language/value/profile/rules.js +17 -43
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/profile/vocabulary.d.ts +35 -2
- package/dist/v1/language/value/profile/vocabulary.js +52 -5
- package/dist/v1/language/value/reference/closure.js +3 -4
- package/dist/v1/language/value/reference/recursion.js +2 -22
- 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/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 +2 -0
- package/dist/v1/language/value/syntax/walk.js +19 -20
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2519 -0
- package/dist/v1/schema/admission/accept.js +3 -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.js +33 -15
- package/dist/v1/schema/canonical/revision.js +4 -4
- package/dist/v1/schema/compatibility/api.d.ts +2 -1
- package/dist/v1/schema/compatibility/api.js +1 -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 +29 -8
- 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/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 -50
- package/dist/v1/schema/compatibility/model.d.ts +17 -5
- package/dist/v1/schema/compatibility/report.js +1 -1
- 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 +57 -58
- 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/index.d.ts +10 -1
- package/dist/v1/schema/index.js +4 -0
- package/dist/v1/schema/model/schema.d.ts +20 -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 +29 -9
- package/dist/v1/schema/resolution/closure.js +2 -1
- package/dist/v1/schema/resolution/context.js +13 -13
- package/dist/v1/schema/resolution/domain.d.ts +5 -0
- package/dist/v1/schema/resolution/domain.js +2 -2
- package/dist/v1/schema/resolution/origins.js +3 -2
- package/dist/v1/schema/rule.d.ts +26 -0
- package/dist/v1/schema/rule.js +440 -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 +127 -104
- package/dist/v1/schema/validation/core.js +90 -168
- package/dist/v1/schema/validation/domain.js +4 -13
- package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
- package/dist/v1/schema/validation/domain.json-schema.js +197 -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 +7780 -0
- package/dist/v1/schema/validation/domain.structure.js +398 -147
- 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 +33 -2
- package/dist/v1/schema/validation/policy/budgets.js +87 -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 +11 -27
- 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 +66 -89
- package/dist/v1/schema/validation/policy/validate.js +5 -5
- package/dist/v1/schema/validation/value-api.d.ts +22 -0
- package/dist/v1/schema/validation/value-api.js +34 -1
- 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 +49 -0
- package/dist/v1/schema/validation/value.json-schema.js +137 -0
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/canonical.d.ts +6 -0
- package/dist/value/canonical.js +36 -0
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/index.d.ts +1 -1
- package/dist/value/json.d.ts +2 -2
- package/dist/value/json.js +2 -2
- 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 +8 -1
- 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/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
package/dist/v1/schema/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { resolve as resolveDomainSchema } from './resolution/domain.js';
|
|
3
3
|
export const resolve = resolveDomainSchema;
|
|
4
4
|
export { acceptDomainSchema as accept } from './admission/accept.js';
|
|
5
|
+
export { acceptCallable } from './admission/callable.js';
|
|
5
6
|
export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
|
|
6
7
|
export { revisionOfDomainSchema as revision } from './canonical/revision.js';
|
|
7
8
|
export { ANNOTATION_KEYWORDS, FIELD_ROLES, callableFingerprint } from './compatibility/index.js';
|
|
@@ -10,5 +11,8 @@ export { header } from './codec/header.js';
|
|
|
10
11
|
export { DOMAIN_FORMAT as FORMAT, DOMAIN_VERSION as VERSION } from './model/format.js';
|
|
11
12
|
export { compile, load } from '../compiled/index.js';
|
|
12
13
|
export { SchemaError as Error } from './diagnostic.js';
|
|
14
|
+
export { RULES } from './rule.js';
|
|
15
|
+
export { limits } from '../language/limits.js';
|
|
16
|
+
export { measurePolicies } from './validation/policy/budgets.js';
|
|
13
17
|
/** The versioned value-schema grammar embedded in declarations. */
|
|
14
18
|
export * as values from './validation/value-api.js';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { Key, Revision } from '../../addressing/index.js';
|
|
2
3
|
import type { DomainDependencyMap, ViewRef } from '../../addressing/index.js';
|
|
3
4
|
import type { Domain, DomainOfSource, DomainSource } from '../../domain/model/domain.js';
|
|
4
5
|
import type { FunctionDefinition } from '../../language/callable/model/callable.js';
|
|
5
6
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
7
|
+
import type { PropertyValues } from '../../language/class/property-values.js';
|
|
6
8
|
import type { CoreContent } from '../../language/core/model/core.js';
|
|
7
9
|
import type { PolicyDefinition } from '../../language/policy/model/policy.js';
|
|
8
10
|
import type { ViewDefinition } from '../../language/view/model/view.js';
|
|
@@ -21,6 +23,23 @@ export interface DomainSchemaIR {
|
|
|
21
23
|
readonly views: Readonly<Record<string, ViewDefinition>>;
|
|
22
24
|
readonly core: CoreContent;
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The JSON document of a Domain schema, as tools write and exchange it: `DomainSchemaIR` without
|
|
28
|
+
* its in-process proofs. The structure the Kernel enforces has this type, which the build checks
|
|
29
|
+
* (`validation/domain.structure.typecheck.ts`), and the published JSON Schema describes it.
|
|
30
|
+
*/
|
|
31
|
+
export interface DomainSchemaDocument extends DocumentOf<DomainSchemaIR> {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The JSON document a model type describes. A `Revision` and `PropertyValues` are in-process
|
|
35
|
+
* proofs: the document carries them as plain text and plain values.
|
|
36
|
+
*/
|
|
37
|
+
export type DocumentOf<Model> = [JsonValue] extends [Model] ? Model : DocumentOfEach<Model>;
|
|
38
|
+
type DocumentOfEach<Model> = Model extends Revision ? string : Model extends PropertyValues ? {
|
|
39
|
+
readonly [Key in keyof Model as Key extends string ? Key : never]: DocumentOf<Model[Key]>;
|
|
40
|
+
} : Model extends string | number | boolean | null | undefined ? Model : {
|
|
41
|
+
readonly [Key in keyof Model]: DocumentOf<Model[Key]>;
|
|
42
|
+
};
|
|
24
43
|
declare const DOMAIN_SCHEMA_BRAND: unique symbol;
|
|
25
44
|
/**
|
|
26
45
|
* Accepted canonical schema carrying its exact resolved Domain projection.
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { CallableDefinition } from '../../language/callable/model/callable.js';
|
|
1
2
|
import type { DomainSchemaIR } from '../model/schema.js';
|
|
2
3
|
export declare function normalizeDomainSchema(schema: DomainSchemaIR): DomainSchemaIR;
|
|
4
|
+
export declare function canonicalizeCallable(value: CallableDefinition): CallableDefinition;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { compareDefinitionRefs, compareUnicode } from '../../addressing/ordering.js';
|
|
3
3
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
4
|
+
import { compareEdgeUniqueFields, compareEdgeUniqueTuples, compareNodeUniqueTuples, } from '../../language/class/unique.js';
|
|
5
|
+
import { CLASS_OPERATIONS } from '../../language/policy/model/policy.js';
|
|
4
6
|
import { normalizeClassRule, normalizePolicyChecks, normalizePolicyExpression, } from '../../language/policy/normalization/normalize.js';
|
|
5
7
|
import { admitStateTopology } from '../../language/state/topology.js';
|
|
6
8
|
import { canonicalizeValueSchema } from '../../language/value/profile/canonicalize.js';
|
|
@@ -61,6 +63,7 @@ function canonicalizeClass(value) {
|
|
|
61
63
|
ref: value.ref,
|
|
62
64
|
kind: value.kind,
|
|
63
65
|
abstract: value.abstract,
|
|
66
|
+
...(value.inheritance === undefined ? {} : { inheritance: value.inheritance }),
|
|
64
67
|
extends: [...value.extends].sort(compareDefinitionRefs),
|
|
65
68
|
properties: mapRecord(value.properties, canonicalizeProperty),
|
|
66
69
|
};
|
|
@@ -70,7 +73,8 @@ function canonicalizeClass(value) {
|
|
|
70
73
|
methods: mapRecord(value.methods, canonicalizeMethod),
|
|
71
74
|
...(value.data === undefined ? {} : { data: { mediaType: value.data.mediaType } }),
|
|
72
75
|
...(value.icon === undefined ? {} : { icon: value.icon }),
|
|
73
|
-
policies:
|
|
76
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
77
|
+
...(value.unique === undefined ? {} : { unique: canonicalizeNodeUnique(value.unique) }),
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
return value.orientation === 'directed'
|
|
@@ -78,23 +82,36 @@ function canonicalizeClass(value) {
|
|
|
78
82
|
...base,
|
|
79
83
|
orientation: 'directed',
|
|
80
84
|
endpoints: canonicalizeDirectedEndpoints(value.endpoints),
|
|
81
|
-
policies: value.policies,
|
|
85
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
82
86
|
constraints: value.constraints,
|
|
87
|
+
...(value.unique === undefined ? {} : { unique: canonicalizeUnique(value.unique) }),
|
|
83
88
|
}
|
|
84
89
|
: {
|
|
85
90
|
...base,
|
|
86
91
|
orientation: 'undirected',
|
|
87
92
|
endpoints: canonicalizeIncidentEndpoints(value.endpoints),
|
|
88
|
-
policies: value.policies,
|
|
93
|
+
policies: canonicalizeClassPolicies(value.policies),
|
|
89
94
|
constraints: value.constraints,
|
|
90
95
|
};
|
|
91
96
|
}
|
|
97
|
+
/** A set of Node key tuples, each a set of Property keys, both in their canonical order. */
|
|
98
|
+
function canonicalizeNodeUnique(tuples) {
|
|
99
|
+
return tuples
|
|
100
|
+
.map((tuple) => [...tuple].sort(compareUnicode))
|
|
101
|
+
.sort(compareNodeUniqueTuples);
|
|
102
|
+
}
|
|
103
|
+
/** A set of key tuples, each a set of fields: fields and tuples take their canonical order. */
|
|
104
|
+
function canonicalizeUnique(tuples) {
|
|
105
|
+
return tuples
|
|
106
|
+
.map((tuple) => [...tuple].sort(compareEdgeUniqueFields))
|
|
107
|
+
.sort(compareEdgeUniqueTuples);
|
|
108
|
+
}
|
|
92
109
|
/** A rule keeps one spelling: normalized checks, or the Policy a lone `self` check names. */
|
|
93
|
-
function
|
|
94
|
-
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
110
|
+
function canonicalizeClassPolicies(value) {
|
|
111
|
+
return Object.fromEntries(CLASS_OPERATIONS.flatMap((operation) => {
|
|
112
|
+
const policy = value[operation];
|
|
113
|
+
return policy === undefined ? [] : [[operation, normalizeClassRule(policy)]];
|
|
114
|
+
}));
|
|
98
115
|
}
|
|
99
116
|
function canonicalizeFunction(value) {
|
|
100
117
|
return {
|
|
@@ -102,7 +119,7 @@ function canonicalizeFunction(value) {
|
|
|
102
119
|
...canonicalizeCallable(value),
|
|
103
120
|
};
|
|
104
121
|
}
|
|
105
|
-
function canonicalizeCallable(value) {
|
|
122
|
+
export function canonicalizeCallable(value) {
|
|
106
123
|
const base = {
|
|
107
124
|
...withDescription(value),
|
|
108
125
|
input: isBinaryInput(value.input)
|
|
@@ -115,6 +132,8 @@ function canonicalizeCallable(value) {
|
|
|
115
132
|
output: canonicalizeCallableOutput(value.output),
|
|
116
133
|
// Ordinary execution has one canonical form, so existing revisions never move.
|
|
117
134
|
...(value.execution?.durable === true ? { execution: { durable: true } } : {}),
|
|
135
|
+
// Absence is the one spelling of a call admitted afresh; validation refuses any other.
|
|
136
|
+
...(value.admission === undefined ? {} : { admission: { maxAge: value.admission.maxAge } }),
|
|
118
137
|
};
|
|
119
138
|
return value.auth === 'authorized'
|
|
120
139
|
? {
|
|
@@ -154,6 +173,7 @@ function canonicalizeProperty(value) {
|
|
|
154
173
|
? {}
|
|
155
174
|
: {
|
|
156
175
|
auto: {
|
|
176
|
+
// The distinct events of a non-empty list are a non-empty list.
|
|
157
177
|
on: [...new Set(value.auto.on)].sort(compareUnicode),
|
|
158
178
|
set: value.auto.set,
|
|
159
179
|
},
|
|
@@ -20,8 +20,9 @@ export function requireDomainClosure(schema) {
|
|
|
20
20
|
const closure = knownDomainClosure(schema);
|
|
21
21
|
if (closure !== undefined)
|
|
22
22
|
return closure;
|
|
23
|
+
// What the value lacks is the exact closure of its dependencies, retained only by acceptance.
|
|
23
24
|
throw new SchemaError([
|
|
24
|
-
diagnostic('DV_ACCEPTANCE_CONTEXT', '', `DomainSchema ${schema.origin} has no retained acceptance context; accept it again against its exact lookup.`),
|
|
25
|
+
diagnostic('DV_ACCEPTANCE_CONTEXT', '/dependencies', `DomainSchema ${schema.origin} has no retained acceptance context; accept it again against its exact lookup.`),
|
|
25
26
|
]);
|
|
26
27
|
}
|
|
27
28
|
export function lookupForDomainClosure(schema) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { dependencyLimits } from '../../addressing/domain-dependency.js';
|
|
2
1
|
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
2
|
import { DOMAIN_REVISION_PATTERN } from '../../addressing/patterns.js';
|
|
3
|
+
import { limits } from '../../language/limits.js';
|
|
4
|
+
import { escapePointerToken } from '../../language/value/syntax/pointer.js';
|
|
4
5
|
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
5
6
|
import { diagnostic } from '../diagnostic.js';
|
|
6
7
|
import { indexSchemaDefinitions } from './definition.index.js';
|
|
@@ -10,11 +11,11 @@ export function buildDomainResolutionContext(candidate, lookup) {
|
|
|
10
11
|
const dependencies = new Map();
|
|
11
12
|
const definitions = new Map();
|
|
12
13
|
const directOrigins = new Set();
|
|
13
|
-
if (Object.keys(candidate.dependencies).length >
|
|
14
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A Domain may declare at most ${
|
|
14
|
+
if (Object.keys(candidate.dependencies).length > limits.dependency.direct) {
|
|
15
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A Domain may declare at most ${limits.dependency.direct} direct dependency aliases.`));
|
|
15
16
|
}
|
|
16
17
|
for (const [alias, dependency] of Object.entries(candidate.dependencies)) {
|
|
17
|
-
const pointer = `/dependencies/${
|
|
18
|
+
const pointer = `/dependencies/${escapePointerToken(alias)}`;
|
|
18
19
|
if (!DOMAIN_REVISION_PATTERN.test(dependency.revision))
|
|
19
20
|
continue;
|
|
20
21
|
if (dependency.origin === candidate.origin) {
|
|
@@ -94,7 +95,7 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
94
95
|
continue;
|
|
95
96
|
}
|
|
96
97
|
const [alias, dependency] = edge;
|
|
97
|
-
const pointer = frames.length === 1 ? `/dependencies/${
|
|
98
|
+
const pointer = frames.length === 1 ? `/dependencies/${escapePointerToken(alias)}` : '/dependencies';
|
|
98
99
|
if (activeOrigins.has(dependency.origin)) {
|
|
99
100
|
diagnostics.push(diagnostic('DV_DEPENDENCY_ACYCLIC', pointer, `Dependency cycle reaches ${dependency.origin}.`));
|
|
100
101
|
continue;
|
|
@@ -120,16 +121,16 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
120
121
|
continue;
|
|
121
122
|
}
|
|
122
123
|
dependencies.set(nested.origin, nested);
|
|
123
|
-
if (dependencies.size + 1 >
|
|
124
|
+
if (dependencies.size + 1 > limits.dependency.closure) {
|
|
124
125
|
if (!closureLimitReported) {
|
|
125
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A dependency closure may contain at most ${
|
|
126
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', '/dependencies', `A dependency closure may contain at most ${limits.dependency.closure} Domains.`));
|
|
126
127
|
closureLimitReported = true;
|
|
127
128
|
}
|
|
128
129
|
continue;
|
|
129
130
|
}
|
|
130
131
|
const depth = frame.depth + 1;
|
|
131
|
-
if (depth >
|
|
132
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', pointer, `Dependency depth ${depth} exceeds the maximum ${
|
|
132
|
+
if (depth > limits.dependency.depth) {
|
|
133
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_LIMITS', pointer, `Dependency depth ${depth} exceeds the maximum ${limits.dependency.depth}.`));
|
|
133
134
|
continue;
|
|
134
135
|
}
|
|
135
136
|
const key = `${dependency.origin}\u0000${dependency.revision}`;
|
|
@@ -146,13 +147,12 @@ function loadDependencyClosure(candidate, dependencies, lookup, diagnostics) {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
function validateDependencyUse(candidate, directOrigins, diagnostics) {
|
|
150
|
+
// Each reference that cannot resolve is reported where it is written; the dependency it lacks
|
|
151
|
+
// belongs in the dependency map.
|
|
149
152
|
const used = collectUsedForeignOrigins(candidate);
|
|
150
153
|
for (const origin of used) {
|
|
151
154
|
if (!directOrigins.has(origin)) {
|
|
152
|
-
diagnostics.push(diagnostic('DV_DEPENDENCY_DIRECT', '', `Foreign origin ${origin} is referenced without an exact direct dependency.`));
|
|
155
|
+
diagnostics.push(diagnostic('DV_DEPENDENCY_DIRECT', '/dependencies', `Foreign origin ${origin} is referenced without an exact direct dependency.`));
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
|
-
function escapeToken(value) {
|
|
157
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
158
|
-
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { SourceDomain } from '../../domain/model/domain.js';
|
|
2
|
+
import type { CallableValidation } from '../../domain/validation/create.js';
|
|
3
|
+
import type { JsonSchema } from '../../language/value/model/schema.js';
|
|
4
|
+
import type { ValueSchemaRegistry } from '../../language/value/reference/registry.js';
|
|
2
5
|
import type { DomainSchema } from '../model/schema.js';
|
|
6
|
+
import { type PatternPool } from '../../language/value/evaluate/preparation.js';
|
|
3
7
|
/**
|
|
4
8
|
* Resolve one accepted Schema through its exact retained source closure. Acceptance validated it
|
|
5
9
|
* against that closure, which is the only way a Schema retains one, so it is not validated again.
|
|
6
10
|
*/
|
|
7
11
|
export declare function resolve<const S extends DomainSchema>(schema: S): SourceDomain<S>;
|
|
12
|
+
export declare function callableValidation(input: JsonSchema, output: JsonSchema | undefined, registry: ValueSchemaRegistry, patterns: PatternPool): CallableValidation;
|
|
@@ -88,7 +88,7 @@ function sourceValidation(closure, registries) {
|
|
|
88
88
|
}
|
|
89
89
|
return createDomainValidation(properties, callables);
|
|
90
90
|
}
|
|
91
|
-
function callableValidation(input, output, registry, patterns) {
|
|
91
|
+
export function callableValidation(input, output, registry, patterns) {
|
|
92
92
|
const prepared = prepareValueSchema(input, registry, '', patterns);
|
|
93
93
|
if (!prepared.compiled) {
|
|
94
94
|
throw new TypeError(`Accepted callable input cannot be prepared: ${prepared.message}`);
|
|
@@ -97,7 +97,7 @@ function callableValidation(input, output, registry, patterns) {
|
|
|
97
97
|
const fields = inputFieldNodes(inputProgram);
|
|
98
98
|
return Object.freeze({
|
|
99
99
|
...(fields === undefined ? {} : { fields: Object.freeze(Object.keys(fields)) }),
|
|
100
|
-
validateInput: (value) => validatePreparedInstance(prepared.value, value),
|
|
100
|
+
validateInput: (value, options) => validatePreparedInstance(prepared.value, value, options),
|
|
101
101
|
validateInputField(field, value) {
|
|
102
102
|
const nodes = fields?.[field];
|
|
103
103
|
return nodes === undefined
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compareDefinitionRefs, definitionRefIndex } from '../../addressing/ordering.js';
|
|
2
2
|
import { isBinaryInput } from '../../language/callable/model/callable.js';
|
|
3
|
-
import { isClassRuleChecks, policyVariableClass } from '../../language/policy/model/policy.js';
|
|
3
|
+
import { CLASS_OPERATIONS, isClassRuleChecks, policyVariableClass, } from '../../language/policy/model/policy.js';
|
|
4
4
|
import { isValueObject as isJsonObject } from '../../language/value/model/object.js';
|
|
5
5
|
import { walkSchema } from '../../language/value/syntax/walk.js';
|
|
6
6
|
/** Collect only semantic refs, never strings or objects embedded as JSON data. */
|
|
@@ -58,7 +58,8 @@ export function collectClassRefs(declaration, add) {
|
|
|
58
58
|
Object.values(declaration.methods).forEach((method) => collectCallableRefs(method, add));
|
|
59
59
|
}
|
|
60
60
|
export function collectClassPolicyRefs(declaration, add) {
|
|
61
|
-
for (const
|
|
61
|
+
for (const operation of CLASS_OPERATIONS) {
|
|
62
|
+
const policy = declaration.policies[operation];
|
|
62
63
|
if (isClassRuleChecks(policy))
|
|
63
64
|
collectPolicyCheckRefs(policy, add);
|
|
64
65
|
else if (typeof policy === 'object')
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DiagnosticRule } from '../language/validation/rule.js';
|
|
2
|
+
import type { SchemaDiagnosticCode } from './diagnostic.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a rule reads to decide. `structure`: the shape of the document alone. `rule`: the whole
|
|
5
|
+
* document. `context`: the document and its environment, so one document can be accepted in one
|
|
6
|
+
* environment and refused in another. The environment is what the lookup serves for the pinned
|
|
7
|
+
* dependencies, their accepted Schemas or their absence, and, for a Schema already accepted, the
|
|
8
|
+
* closure its acceptance retained.
|
|
9
|
+
*/
|
|
10
|
+
export type SchemaRuleStage = 'structure' | 'rule' | 'context';
|
|
11
|
+
/**
|
|
12
|
+
* The rule one Schema diagnostic code reports. A final `{/path*}` of its positions stands for any
|
|
13
|
+
* further tokens; `{endpoint}` is `source`, `target`, `0` or `1`; `{count}` is `outgoing`,
|
|
14
|
+
* `incoming` or `incident`; `{operation}` is `read` or `traverse`; `{key}` is a Property key. A
|
|
15
|
+
* condition is a fragment such as `#/$defs/edge-class/if`.
|
|
16
|
+
*/
|
|
17
|
+
export interface SchemaRule extends DiagnosticRule {
|
|
18
|
+
readonly stage: SchemaRuleStage;
|
|
19
|
+
/** What the feature the rule guards enforces on data or on calls, where it enforces something. */
|
|
20
|
+
readonly enforces?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Every Schema diagnostic code with the rule it reports. A code added to the DSL does not compile
|
|
24
|
+
* until it is described here.
|
|
25
|
+
*/
|
|
26
|
+
export declare const RULES: Readonly<Record<SchemaDiagnosticCode, SchemaRule>>;
|