@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
|
@@ -1,116 +1,63 @@
|
|
|
1
|
-
import type { Value as PortableValue } from '@astrale-os/kernel-dsl/value';
|
|
1
|
+
import type { Array as PortableArray, Object as PortableObject, Value as PortableValue } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { ClassRef } from '../../addressing/index.js';
|
|
4
|
-
import type { MethodRecord } from '../../language/callable/model/callable.js';
|
|
5
|
-
import type { ResolvedMethod } from '../../language/callable/resolved.js';
|
|
6
|
-
import type { MediaType } from '../../language/class/model/data.js';
|
|
7
|
-
import type { EdgeCount } from '../../language/class/model/edge.js';
|
|
8
4
|
import type { ResolvedClass, ResolvedProperty } from '../../language/class/resolved.js';
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type { Method, PolicyCheckContext, ProjectionOfCallable } from '../callable/authoring.js';
|
|
13
|
-
import type { Policy } from '../policy/authoring.js';
|
|
14
|
-
import type { Lazy } from '../schema/lazy.js';
|
|
5
|
+
import type { StateTopologyOf } from '../../language/state/topology.js';
|
|
6
|
+
import type { BLOB_VALUE_KIND, BlobReceipt, BlobRef, BlobSchema } from '../../language/value/model/blob.js';
|
|
7
|
+
import type { Method, ProjectionOfCallable } from '../callable/authoring.js';
|
|
15
8
|
import type { ClassProjectionOfResolved } from '../schema/projection.js';
|
|
16
9
|
import type { TypedValueSchema } from '../value/schema.js';
|
|
10
|
+
import type { Class, DirectedEdgeClass, EdgeClass, NodeClass, UndirectedEdgeClass } from './handle.js';
|
|
11
|
+
import type { DirectedEdgeInput, DirectedSourceInput, DirectedTargetInput, IncidentEndpointInput, NodeClassInput, UndirectedEdgeInput } from './input.js';
|
|
12
|
+
import type { AuthoredMethodProjection, AuthoredPropertyProjection, BindMethodOwners, BindPropertyOwners, ClassOwnerProjectionOf, ClassReferenceProjectionOf } from './projection.js';
|
|
17
13
|
import type { AutoProperty, Property, PropertyOptions, PropertyStateMachineOf, ValueSchemaInput } from './property.js';
|
|
18
|
-
import type { PropertyRecordInput } from './property.js';
|
|
19
|
-
import { type AUTHORING } from '../schema/handle.js';
|
|
20
|
-
declare const CLASS_TYPE: unique symbol;
|
|
21
|
-
export type ClassReferenceInput = Lazy<Class | ClassRef | ResolvedClass<'node'> | ResolvedClass<'edge'>>;
|
|
22
|
-
export type NodeClassReferenceInput = Lazy<NodeClass | ClassRef | ResolvedClass<'node'>>;
|
|
23
|
-
export type EdgeClassReferenceInput = Lazy<EdgeClass | ClassRef | ResolvedClass<'edge'>>;
|
|
24
|
-
export interface DirectedSourceInput {
|
|
25
|
-
readonly as: string;
|
|
26
|
-
readonly accepts: readonly NodeClassReferenceInput[];
|
|
27
|
-
readonly outgoing: EdgeCount;
|
|
28
|
-
}
|
|
29
|
-
export interface DirectedTargetInput {
|
|
30
|
-
readonly as: string;
|
|
31
|
-
readonly accepts: readonly NodeClassReferenceInput[];
|
|
32
|
-
readonly incoming: EdgeCount;
|
|
33
|
-
}
|
|
34
|
-
export interface IncidentEndpointInput {
|
|
35
|
-
readonly as: string;
|
|
36
|
-
readonly accepts: readonly NodeClassReferenceInput[];
|
|
37
|
-
readonly incident: EdgeCount;
|
|
38
|
-
}
|
|
39
14
|
type ExactEndpointInput<Input, Shape> = Input & Record<Exclude<keyof Input, keyof Shape>, never>;
|
|
40
|
-
/** One observation slot: a local Policy, or its constant value. Absent means `true`. */
|
|
41
|
-
export type ClassPolicyInput = Lazy<Policy> | boolean;
|
|
42
|
-
export interface ClassPoliciesInput {
|
|
43
|
-
readonly read?: ClassPolicyInput;
|
|
44
|
-
readonly traverse?: ClassPolicyInput;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Policy checks deciding one Node Class observation. `self` is the observed Node; `ref` names one
|
|
48
|
-
* exact member, the same Node for every observed candidate.
|
|
49
|
-
*/
|
|
50
|
-
export interface ClassRuleContext extends PolicyCheckContext<ClassRuleObject> {
|
|
51
|
-
}
|
|
52
|
-
export type ClassRuleBuilder = (context: ClassRuleContext) => ClassRuleChecks;
|
|
53
|
-
/** One Node Class observation slot: a local Policy, a constant value, or Policy checks. */
|
|
54
|
-
export type NodeClassPolicyInput = ClassPolicyInput | ClassRuleBuilder;
|
|
55
|
-
export interface NodeClassPoliciesInput {
|
|
56
|
-
readonly read?: NodeClassPolicyInput;
|
|
57
|
-
readonly traverse?: NodeClassPolicyInput;
|
|
58
|
-
}
|
|
59
|
-
export interface NodeClassInput {
|
|
60
|
-
readonly abstract?: boolean;
|
|
61
|
-
readonly description?: string;
|
|
62
|
-
readonly extends?: readonly NodeClassReferenceInput[];
|
|
63
|
-
readonly properties?: PropertyRecordInput;
|
|
64
|
-
readonly data?: MediaType;
|
|
65
|
-
readonly methods?: Readonly<Record<string, Method>>;
|
|
66
|
-
readonly icon?: string;
|
|
67
|
-
/** Local observation Policies; inherited by no descendant and forbidden on abstract Classes. */
|
|
68
|
-
readonly policies?: NodeClassPoliciesInput;
|
|
69
|
-
}
|
|
70
|
-
export interface EdgeClassOptions {
|
|
71
|
-
readonly abstract?: boolean;
|
|
72
|
-
readonly description?: string;
|
|
73
|
-
readonly extends?: readonly EdgeClassReferenceInput[];
|
|
74
|
-
readonly properties?: PropertyRecordInput;
|
|
75
|
-
/** Local observation Policies; inherited by no descendant and forbidden on abstract Classes. */
|
|
76
|
-
readonly policies?: ClassPoliciesInput;
|
|
77
|
-
readonly constraints?: {
|
|
78
|
-
readonly noSelf?: true;
|
|
79
|
-
readonly acyclic?: true;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
export interface DirectedEdgeInput extends EdgeClassOptions {
|
|
83
|
-
readonly orientation: 'directed';
|
|
84
|
-
readonly source: DirectedSourceInput;
|
|
85
|
-
readonly target: DirectedTargetInput;
|
|
86
|
-
}
|
|
87
|
-
export interface UndirectedEdgeInput extends Omit<EdgeClassOptions, 'constraints'> {
|
|
88
|
-
readonly orientation: 'undirected';
|
|
89
|
-
readonly endpoints: readonly [IncidentEndpointInput, IncidentEndpointInput];
|
|
90
|
-
readonly constraints?: {
|
|
91
|
-
readonly noSelf?: true;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export type EdgeClassCommon = EdgeClassOptions;
|
|
95
|
-
export type EdgeClassInput = DirectedEdgeInput | UndirectedEdgeInput;
|
|
96
|
-
export type Class = NodeClass | EdgeClass;
|
|
97
|
-
export interface AuthoredPropertyProjection<out Input = unknown, out Output = unknown, out Required extends boolean = boolean, out Name extends string = string, out Owner = 'self', out State extends StateTopology | undefined = StateTopology | undefined> {
|
|
98
|
-
readonly input: Input;
|
|
99
|
-
readonly output: Output;
|
|
100
|
-
readonly required: Required;
|
|
101
|
-
readonly name: Name;
|
|
102
|
-
readonly owner: Owner;
|
|
103
|
-
readonly state?: State;
|
|
104
|
-
}
|
|
105
|
-
export interface AuthoredMethodProjection<out Value extends Method = Method, out Name extends string = string, out Owner = 'self'> {
|
|
106
|
-
readonly value: Value;
|
|
107
|
-
readonly name: Name;
|
|
108
|
-
readonly owner: Owner;
|
|
109
|
-
}
|
|
110
15
|
type PropertySchemaOf<Field> = Field extends AutoProperty<infer Value> ? PropertySchemaOf<Value> : Field extends Property<infer Schema, PropertyOptions, unknown> ? Schema : Field;
|
|
111
16
|
type PropertyOptionsOf<Field> = Field extends AutoProperty<infer Value> ? PropertyOptionsOf<Value> : Field extends Property<ValueSchemaInput, infer Options, unknown> ? Options : Record<never, never>;
|
|
112
|
-
type
|
|
113
|
-
|
|
17
|
+
type JsonSchemaValueOf<Schema> = 0 extends 1 & Schema ? PortableValue : Schema extends {
|
|
18
|
+
readonly const: infer Value;
|
|
19
|
+
} ? JsonKnownOf<Value> : Schema extends {
|
|
20
|
+
readonly enum: readonly (infer Value)[];
|
|
21
|
+
} ? JsonKnownOf<Value> : Schema extends {
|
|
22
|
+
readonly anyOf: readonly (infer Branch)[];
|
|
23
|
+
} ? JsonSchemaValueOf<Branch> : Schema extends {
|
|
24
|
+
readonly oneOf: readonly (infer Branch)[];
|
|
25
|
+
} ? JsonSchemaValueOf<Branch> : Schema extends {
|
|
26
|
+
readonly type: infer Type;
|
|
27
|
+
} ? JsonTypeValueOf<Type, Schema> : PortableValue;
|
|
28
|
+
type JsonKnownOf<Value> = 0 extends 1 & Value ? PortableValue : Value;
|
|
29
|
+
type JsonTypeValueOf<Type, Schema> = Type extends readonly (infer Each)[] ? JsonTypeValueOf<Each, Schema> : Type extends 'string' ? string : Type extends 'number' | 'integer' ? number : Type extends 'boolean' ? boolean : Type extends 'null' ? null : Type extends 'array' ? JsonArrayValueOf<Schema> : Type extends 'object' ? JsonObjectValueOf<Schema> : PortableValue;
|
|
30
|
+
type JsonArrayValueOf<Schema> = 'prefixItems' extends keyof Schema ? PortableArray : Schema extends {
|
|
31
|
+
readonly items: infer Items;
|
|
32
|
+
} ? readonly JsonSchemaValueOf<Items>[] : PortableArray;
|
|
33
|
+
type JsonObjectValueOf<Schema> = 'patternProperties' extends keyof Schema ? PortableObject : Schema extends {
|
|
34
|
+
readonly properties: infer Properties extends Readonly<Record<string, unknown>>;
|
|
35
|
+
readonly additionalProperties: false;
|
|
36
|
+
} ? JsonClosedObjectOf<Properties, Schema extends {
|
|
37
|
+
readonly required: infer Names;
|
|
38
|
+
} ? Names : readonly []> : Schema extends {
|
|
39
|
+
readonly additionalProperties: infer Additional extends object;
|
|
40
|
+
} ? JsonListsNoName<Schema> extends true ? Readonly<Record<string, JsonSchemaValueOf<Additional>>> : PortableObject : PortableObject;
|
|
41
|
+
type JsonListsNoName<Schema> = 'properties' extends keyof Schema ? Schema extends {
|
|
42
|
+
readonly properties: infer Properties;
|
|
43
|
+
} ? [Properties] extends [never] ? false : JsonNoAlternativeNames<Properties> : false : true;
|
|
44
|
+
type JsonNoAlternativeNames<Properties> = Properties extends unknown ? [keyof Properties] extends [never] ? true : false : never;
|
|
45
|
+
type JsonListsName<Names, Name> = [Names] extends [never] ? false : Names extends readonly unknown[] ? number extends Names['length'] ? false : true extends {
|
|
46
|
+
[At in keyof Names]: JsonNamesExactly<Names[At], Name>;
|
|
47
|
+
}[number] ? true : false : false;
|
|
48
|
+
type JsonNamesExactly<Element, Name> = [Element] extends [never] ? false : 0 extends 1 & Element ? false : [Element] extends [Name] ? true : false;
|
|
49
|
+
type JsonClosedObjectOf<Properties, Names> = [keyof Properties] extends [never] ? Readonly<Record<string, never>> : {
|
|
50
|
+
readonly [Name in keyof Properties as JsonListsName<Names, Name> extends true ? Name : never]: JsonSchemaValueOf<Properties[Name]>;
|
|
51
|
+
} & {
|
|
52
|
+
readonly [Name in keyof Properties as JsonListsName<Names, Name> extends true ? never : Name]?: JsonSchemaValueOf<Properties[Name]>;
|
|
53
|
+
} extends infer Value ? {
|
|
54
|
+
[Name in keyof Value]: Value[Name];
|
|
55
|
+
} : never;
|
|
56
|
+
type BlobMarkedSchema = BlobSchema | {
|
|
57
|
+
readonly 'x-astrale-value-kind': typeof BLOB_VALUE_KIND;
|
|
58
|
+
};
|
|
59
|
+
type ValueInputOf<Schema> = Schema extends BlobMarkedSchema ? BlobReceipt : Schema extends TypedValueSchema<infer Value> ? Value : Schema extends z.ZodType ? z.input<Schema> : JsonSchemaValueOf<Schema>;
|
|
60
|
+
type ValueOutputOf<Schema> = Schema extends BlobMarkedSchema ? BlobRef : Schema extends TypedValueSchema<infer Value> ? Value : Schema extends z.ZodType ? z.output<Schema> : JsonSchemaValueOf<Schema>;
|
|
114
61
|
type PropertyRequiredOf<Field> = PropertyOptionsOf<Field> extends {
|
|
115
62
|
readonly required: infer Required extends boolean;
|
|
116
63
|
} ? Required : undefined extends ValueInputOf<PropertySchemaOf<Field>> ? false : true;
|
|
@@ -131,7 +78,6 @@ type ParentPropertyProjectionsOf<Input> = Input extends {
|
|
|
131
78
|
type EffectivePropertyProjectionsOf<Input> = PropertyProjectionEntriesOf<'properties' extends keyof Input ? Input extends {
|
|
132
79
|
readonly properties?: infer Value;
|
|
133
80
|
} ? NonNullable<Value> : never : never> | ParentPropertyProjectionsOf<Input>;
|
|
134
|
-
type BindPropertyOwners<Entries, Owner> = Entries extends AuthoredPropertyProjection<infer Input, infer Output, infer Required, infer Name, infer ExistingOwner, infer State> ? AuthoredPropertyProjection<Input, Output, Required, Name, ExistingOwner extends 'self' ? Owner : ExistingOwner, State> : Entries;
|
|
135
81
|
type MethodFieldsOf<Input> = 'methods' extends keyof Input ? Input extends {
|
|
136
82
|
readonly methods?: infer Methods extends Readonly<Record<string, Method>>;
|
|
137
83
|
} ? NonNullable<Methods> : Readonly<Record<never, never>> : Readonly<Record<never, never>>;
|
|
@@ -141,7 +87,6 @@ type MethodIsStatic<Value extends Method> = ProjectionOfCallable<Value> extends
|
|
|
141
87
|
type OwnMethodProjectionsOf<Input, Static extends boolean> = {
|
|
142
88
|
[Name in keyof MethodFieldsOf<Input>]: MethodFieldsOf<Input>[Name] extends infer Value extends Method ? MethodIsStatic<Value> extends Static ? AuthoredMethodProjection<Value, Extract<Name, string>> : never : never;
|
|
143
89
|
}[keyof MethodFieldsOf<Input>];
|
|
144
|
-
type BindMethodOwners<Entries, Owner> = Entries extends AuthoredMethodProjection<infer Value, infer Name, infer ExistingOwner> ? AuthoredMethodProjection<Value, Name, ExistingOwner extends 'self' ? Owner : ExistingOwner> : Entries;
|
|
145
90
|
type AbstractMethodEntries<Entry> = Entry extends AuthoredMethodProjection<infer Value> ? ProjectionOfCallable<Value> extends {
|
|
146
91
|
readonly abstract: true;
|
|
147
92
|
} ? Entry : never : Entry extends {
|
|
@@ -178,106 +123,46 @@ type Increment<Depth extends number> = number extends Depth ? number : [...Tuple
|
|
|
178
123
|
type ClassDepthOfInput<Input> = Input extends {
|
|
179
124
|
readonly extends?: infer Parents extends readonly unknown[];
|
|
180
125
|
} ? Parents extends readonly [] ? 0 : Increment<ClassDepthOf<Parents[number]>> : 0;
|
|
181
|
-
export interface ClassIdentityProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown> {
|
|
182
|
-
readonly kind: Kind;
|
|
183
|
-
readonly identity: Identity;
|
|
184
|
-
}
|
|
185
|
-
export interface ClassOwnerProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown, out Properties = unknown, out InstanceMethods = unknown, out StaticMethods = unknown> extends ClassIdentityProjection<Kind, Identity> {
|
|
186
|
-
readonly properties: Properties;
|
|
187
|
-
readonly instanceMethods: InstanceMethods;
|
|
188
|
-
readonly staticMethods: StaticMethods;
|
|
189
|
-
}
|
|
190
|
-
export interface ClassReferenceProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown, out EffectiveProperties = AuthoredPropertyProjection, out EffectiveInstanceMethods = unknown, out EffectiveStaticMethods = unknown> extends ClassIdentityProjection<Kind, Identity> {
|
|
191
|
-
readonly effectiveProperties: EffectiveProperties;
|
|
192
|
-
readonly effectiveInstanceMethods: EffectiveInstanceMethods;
|
|
193
|
-
readonly effectiveStaticMethods: EffectiveStaticMethods;
|
|
194
|
-
}
|
|
195
|
-
type NodeClassIdentity<Config> = Config extends {
|
|
196
|
-
readonly abstract: infer Abstract;
|
|
197
|
-
readonly depth: infer Depth;
|
|
198
|
-
readonly properties: infer Properties;
|
|
199
|
-
readonly methods: infer Methods;
|
|
200
|
-
} ? {
|
|
201
|
-
readonly abstract: Abstract;
|
|
202
|
-
readonly depth: Depth;
|
|
203
|
-
readonly properties: Properties;
|
|
204
|
-
readonly methods: Methods;
|
|
205
|
-
} : never;
|
|
206
|
-
type DirectedEdgeClassIdentity<Config> = Config extends {
|
|
207
|
-
readonly abstract: infer Abstract;
|
|
208
|
-
readonly depth: infer Depth;
|
|
209
|
-
readonly properties: infer Properties;
|
|
210
|
-
readonly source: infer Source;
|
|
211
|
-
readonly target: infer Target;
|
|
212
|
-
readonly constraints: infer Constraints;
|
|
213
|
-
} ? {
|
|
214
|
-
readonly abstract: Abstract;
|
|
215
|
-
readonly depth: Depth;
|
|
216
|
-
readonly properties: Properties;
|
|
217
|
-
readonly source: Source;
|
|
218
|
-
readonly target: Target;
|
|
219
|
-
readonly constraints: Constraints;
|
|
220
|
-
} : never;
|
|
221
|
-
type UndirectedEdgeClassIdentity<Config> = Config extends {
|
|
222
|
-
readonly abstract: infer Abstract;
|
|
223
|
-
readonly depth: infer Depth;
|
|
224
|
-
readonly properties: infer Properties;
|
|
225
|
-
readonly endpoints: infer Endpoints;
|
|
226
|
-
readonly constraints: infer Constraints;
|
|
227
|
-
} ? {
|
|
228
|
-
readonly abstract: Abstract;
|
|
229
|
-
readonly depth: Depth;
|
|
230
|
-
readonly properties: Properties;
|
|
231
|
-
readonly endpoints: Endpoints;
|
|
232
|
-
readonly constraints: Constraints;
|
|
233
|
-
} : never;
|
|
234
|
-
type OwnerErasedPropertyProjection<Entry> = Entry extends AuthoredPropertyProjection<infer Input, infer Output, infer Required, infer Name, unknown, infer State> ? AuthoredPropertyProjection<Input, Output, Required, Name, unknown, State> : Entry extends ResolvedProperty<infer Value, infer Required, infer State, infer Input> & {
|
|
235
|
-
readonly name: infer Name;
|
|
236
|
-
readonly key: infer Key;
|
|
237
|
-
} ? {
|
|
238
|
-
readonly value: Value;
|
|
239
|
-
readonly input: Input;
|
|
240
|
-
readonly required: Required;
|
|
241
|
-
readonly name: Name;
|
|
242
|
-
readonly key: Key;
|
|
243
|
-
readonly state?: State;
|
|
244
|
-
} : never;
|
|
245
|
-
type OwnerErasedMethodProjection<Entry> = Entry extends AuthoredMethodProjection<infer Value, infer Name, unknown> ? AuthoredMethodProjection<Value, Name, unknown> : Entry extends ResolvedMethod<infer Input, infer Output, infer Static, infer Abstract, infer Auth, infer _Policy, infer Key> & {
|
|
246
|
-
readonly name: infer Name;
|
|
247
|
-
} ? {
|
|
248
|
-
readonly input: Input;
|
|
249
|
-
readonly output: Output;
|
|
250
|
-
readonly static: Static;
|
|
251
|
-
readonly abstract: Abstract;
|
|
252
|
-
readonly auth: Auth;
|
|
253
|
-
readonly name: Name;
|
|
254
|
-
readonly key: Key;
|
|
255
|
-
} : never;
|
|
256
|
-
export type ClassIdentityProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassIdentityProjection<'node', NodeClassIdentity<Config>> : Value extends DirectedEdgeClass<infer Config> ? ClassIdentityProjection<'edge', DirectedEdgeClassIdentity<Config>> : Value extends UndirectedEdgeClass<infer Config> ? ClassIdentityProjection<'edge', UndirectedEdgeClassIdentity<Config>> : never;
|
|
257
|
-
export type ClassOwnerProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassOwnerProjection<'node', NodeClassIdentity<Config>, Config extends {
|
|
258
|
-
readonly effectiveProperties: infer Properties;
|
|
259
|
-
} ? OwnerErasedPropertyProjection<Properties> : never, Config extends {
|
|
260
|
-
readonly effectiveInstanceMethods: infer Methods;
|
|
261
|
-
} ? OwnerErasedMethodProjection<Methods> : never, Config extends {
|
|
262
|
-
readonly effectiveStaticMethods: infer Methods;
|
|
263
|
-
} ? OwnerErasedMethodProjection<Methods> : never> : Value extends DirectedEdgeClass<infer Config> ? ClassOwnerProjection<'edge', DirectedEdgeClassIdentity<Config>, Config extends {
|
|
264
|
-
readonly effectiveProperties: infer Properties;
|
|
265
|
-
} ? OwnerErasedPropertyProjection<Properties> : never, never, never> : Value extends UndirectedEdgeClass<infer Config> ? ClassOwnerProjection<'edge', UndirectedEdgeClassIdentity<Config>, Config extends {
|
|
266
|
-
readonly effectiveProperties: infer Properties;
|
|
267
|
-
} ? OwnerErasedPropertyProjection<Properties> : never, never, never> : never;
|
|
268
|
-
export type ClassReferenceProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassReferenceProjection<'node', NodeClassIdentity<Config>, Config extends {
|
|
269
|
-
readonly effectiveProperties: infer Properties;
|
|
270
|
-
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<NodeClass<Config>>> : never, Config extends {
|
|
271
|
-
readonly effectiveInstanceMethods: infer Methods;
|
|
272
|
-
} ? BindMethodOwners<Methods, ClassOwnerProjectionOf<NodeClass<Config>>> : never, Config extends {
|
|
273
|
-
readonly effectiveStaticMethods: infer Methods;
|
|
274
|
-
} ? BindMethodOwners<Methods, ClassOwnerProjectionOf<NodeClass<Config>>> : never> : Value extends DirectedEdgeClass<infer Config> ? ClassReferenceProjection<'edge', DirectedEdgeClassIdentity<Config>, Config extends {
|
|
275
|
-
readonly effectiveProperties: infer Properties;
|
|
276
|
-
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<DirectedEdgeClass<Config>>> : never, never, never> : Value extends UndirectedEdgeClass<infer Config> ? ClassReferenceProjection<'edge', UndirectedEdgeClassIdentity<Config>, Config extends {
|
|
277
|
-
readonly effectiveProperties: infer Properties;
|
|
278
|
-
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<UndirectedEdgeClass<Config>>> : never, never, never> : never;
|
|
279
126
|
type CompactReference<Value> = Value extends () => infer Resolved ? () => CompactReference<Resolved> : Value extends ResolvedClass ? ClassProjectionOfResolved<Value> : Value extends Class ? ClassReferenceProjectionOf<Value> : Value;
|
|
280
127
|
type CompactReferences<Values extends readonly unknown[]> = Values extends readonly [] ? readonly [] : Values extends readonly [infer Value, ...infer Rest] ? readonly [CompactReference<Value>, ...CompactReferences<Rest>] : readonly CompactReference<Values[number]>[];
|
|
128
|
+
/**
|
|
129
|
+
* A Class an endpoint accepts, as its projection keeps it: the exact ref of a resolved Class, the
|
|
130
|
+
* mark of an authored one, which the Schema names, or the ref as given. A lazy reference stays lazy.
|
|
131
|
+
*/
|
|
132
|
+
type CompactAccepted<Value> = Value extends () => infer Resolved ? () => CompactAccepted<Resolved> : Value extends ResolvedClass ? ExactClassRefOf<Value> : Value extends NodeClass<infer Config> ? AcceptedClassMark<Config> : Value;
|
|
133
|
+
/**
|
|
134
|
+
* What tells an authored Node Class from the other Classes of its Schema in an endpoint's type:
|
|
135
|
+
* its abstractness, its depth and the names of its effective members. Names alone keep the Edge
|
|
136
|
+
* handle small enough to print in a declaration file; Classes alike in all of these are the same
|
|
137
|
+
* accepted Class to the types, never to the Schema. `schema/projection/class.ts` names the Classes
|
|
138
|
+
* of a Schema and of its direct dependencies that bear the mark, since either may own the handle.
|
|
139
|
+
*/
|
|
140
|
+
type AcceptedClassMark<Config> = {
|
|
141
|
+
readonly kind: 'node';
|
|
142
|
+
readonly abstract: Config extends {
|
|
143
|
+
readonly abstract: infer Abstract;
|
|
144
|
+
} ? Abstract : never;
|
|
145
|
+
readonly depth: Config extends {
|
|
146
|
+
readonly depth: infer Depth;
|
|
147
|
+
} ? Depth : never;
|
|
148
|
+
readonly properties: Config extends {
|
|
149
|
+
readonly effectiveProperties: infer Properties;
|
|
150
|
+
} ? Properties extends {
|
|
151
|
+
readonly name: infer Name;
|
|
152
|
+
} ? Name : never : never;
|
|
153
|
+
readonly methods: Config extends {
|
|
154
|
+
readonly effectiveInstanceMethods: infer Instance;
|
|
155
|
+
readonly effectiveStaticMethods: infer Static;
|
|
156
|
+
} ? Instance | Static extends infer Method ? Method extends {
|
|
157
|
+
readonly name: infer Name;
|
|
158
|
+
} ? Name : never : never : never;
|
|
159
|
+
};
|
|
160
|
+
/** The ref of a resolved Class, exact while its key is. */
|
|
161
|
+
type ExactClassRefOf<Value extends ResolvedClass> = Value['key'] extends `${infer Origin}:class.${infer Name}` ? string extends Origin ? ClassRef : string extends Name ? ClassRef : ClassRef<Name> & {
|
|
162
|
+
readonly origin: Origin;
|
|
163
|
+
} : ClassRef;
|
|
164
|
+
/** The Classes one endpoint accepts, in any order: the runtime list is canonically sorted. */
|
|
165
|
+
type CompactAccepts<Values> = Values extends readonly (infer Value)[] ? readonly CompactAccepted<Value>[] : readonly never[];
|
|
281
166
|
type CompactParentsOf<Input> = Input extends {
|
|
282
167
|
readonly extends?: infer Values extends readonly unknown[];
|
|
283
168
|
} ? 'extends' extends keyof Input ? CompactReferences<Values> : readonly [] : readonly [];
|
|
@@ -310,10 +195,12 @@ type CompactDirectedInput<Input extends Omit<DirectedEdgeInput, 'orientation'>>
|
|
|
310
195
|
} ? NonNullable<Value> : never : never>;
|
|
311
196
|
readonly source: {
|
|
312
197
|
readonly as: Input['source']['as'];
|
|
198
|
+
readonly accepts: CompactAccepts<Input['source']['accepts']>;
|
|
313
199
|
readonly outgoing: Input['source']['outgoing'];
|
|
314
200
|
};
|
|
315
201
|
readonly target: {
|
|
316
202
|
readonly as: Input['target']['as'];
|
|
203
|
+
readonly accepts: CompactAccepts<Input['target']['accepts']>;
|
|
317
204
|
readonly incoming: Input['target']['incoming'];
|
|
318
205
|
};
|
|
319
206
|
readonly constraints: Input extends {
|
|
@@ -333,10 +220,12 @@ type CompactUndirectedInput<Input extends Omit<UndirectedEdgeInput, 'orientation
|
|
|
333
220
|
readonly endpoints: readonly [
|
|
334
221
|
{
|
|
335
222
|
readonly as: Input['endpoints'][0]['as'];
|
|
223
|
+
readonly accepts: CompactAccepts<Input['endpoints'][0]['accepts']>;
|
|
336
224
|
readonly incident: Input['endpoints'][0]['incident'];
|
|
337
225
|
},
|
|
338
226
|
{
|
|
339
227
|
readonly as: Input['endpoints'][1]['as'];
|
|
228
|
+
readonly accepts: CompactAccepts<Input['endpoints'][1]['accepts']>;
|
|
340
229
|
readonly incident: Input['endpoints'][1]['incident'];
|
|
341
230
|
}
|
|
342
231
|
];
|
|
@@ -345,24 +234,6 @@ type CompactUndirectedInput<Input extends Omit<UndirectedEdgeInput, 'orientation
|
|
|
345
234
|
} ? NonNullable<Value> : Record<never, never>;
|
|
346
235
|
readonly effectiveProperties: EffectivePropertyProjectionsOf<Input>;
|
|
347
236
|
};
|
|
348
|
-
export interface NodeClass<out Config = unknown> {
|
|
349
|
-
readonly [AUTHORING]: 'definition';
|
|
350
|
-
readonly kind: 'node';
|
|
351
|
-
readonly [CLASS_TYPE]: () => Config;
|
|
352
|
-
}
|
|
353
|
-
export interface DirectedEdgeClass<out Input = unknown> {
|
|
354
|
-
readonly [AUTHORING]: 'definition';
|
|
355
|
-
readonly kind: 'edge';
|
|
356
|
-
readonly orientation: 'directed';
|
|
357
|
-
readonly [CLASS_TYPE]: () => Input;
|
|
358
|
-
}
|
|
359
|
-
export interface UndirectedEdgeClass<out Input = unknown> {
|
|
360
|
-
readonly [AUTHORING]: 'definition';
|
|
361
|
-
readonly kind: 'edge';
|
|
362
|
-
readonly orientation: 'undirected';
|
|
363
|
-
readonly [CLASS_TYPE]: () => Input;
|
|
364
|
-
}
|
|
365
|
-
export type EdgeClass = DirectedEdgeClass | UndirectedEdgeClass;
|
|
366
237
|
export declare function defineClass(config: {
|
|
367
238
|
readonly kind: 'node';
|
|
368
239
|
readonly abstract: boolean;
|
|
@@ -395,9 +266,8 @@ type WithoutStateProperties<Input> = Input extends {
|
|
|
395
266
|
readonly [Name in keyof Properties]: Properties[Name] extends Property ? [PropertyStateMachineOf<Properties[Name]>] extends [never] ? Properties[Name] : never : Properties[Name];
|
|
396
267
|
};
|
|
397
268
|
} : unknown;
|
|
398
|
-
export type ProjectionOfClass<Value extends Class> = Value extends NodeClass<infer Config> ? Config : Value extends DirectedEdgeClass<infer Input> ? Input : Value extends UndirectedEdgeClass<infer Input> ? Input : never;
|
|
399
269
|
export declare function classConfiguration(value: NodeClass): NodeClassInput;
|
|
400
270
|
export declare function classConfiguration(value: DirectedEdgeClass): Omit<DirectedEdgeInput, 'orientation'>;
|
|
401
271
|
export declare function classConfiguration(value: UndirectedEdgeClass): Omit<UndirectedEdgeInput, 'orientation'>;
|
|
402
272
|
export declare function classConfiguration(value: EdgeClass): Omit<DirectedEdgeInput, 'orientation'> | Omit<UndirectedEdgeInput, 'orientation'>;
|
|
403
|
-
export
|
|
273
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CLASS_OPERATIONS } from '../../language/policy/model/policy.js';
|
|
1
2
|
import { assertKnownKeys } from '../schema/diagnostic.js';
|
|
2
3
|
import { authoringValue } from '../schema/handle.js';
|
|
3
4
|
const classInputs = new WeakMap();
|
|
@@ -17,6 +18,7 @@ export function nodeClass(config) {
|
|
|
17
18
|
const admitted = config ?? {};
|
|
18
19
|
assertKnownKeys(admitted, [
|
|
19
20
|
'abstract',
|
|
21
|
+
'inheritance',
|
|
20
22
|
'description',
|
|
21
23
|
'extends',
|
|
22
24
|
'properties',
|
|
@@ -24,13 +26,21 @@ export function nodeClass(config) {
|
|
|
24
26
|
'methods',
|
|
25
27
|
'icon',
|
|
26
28
|
'policies',
|
|
29
|
+
'unique',
|
|
27
30
|
]);
|
|
28
31
|
if (admitted.policies !== undefined)
|
|
29
|
-
assertKnownKeys(admitted.policies,
|
|
32
|
+
assertKnownKeys(admitted.policies, CLASS_OPERATIONS);
|
|
30
33
|
const value = authoringValue('definition', {
|
|
31
34
|
kind: 'node',
|
|
32
35
|
});
|
|
33
|
-
classInputs.set(value, {
|
|
36
|
+
classInputs.set(value, {
|
|
37
|
+
...admitted,
|
|
38
|
+
// Copied, so the declaration does not follow later changes to the author's arrays.
|
|
39
|
+
...(admitted.unique === undefined
|
|
40
|
+
? {}
|
|
41
|
+
: { unique: admitted.unique.map((tuple) => [...tuple]) }),
|
|
42
|
+
abstract: admitted.abstract ?? false,
|
|
43
|
+
});
|
|
34
44
|
return value;
|
|
35
45
|
}
|
|
36
46
|
export const edgeClass = Object.freeze({
|
|
@@ -39,16 +49,18 @@ export const edgeClass = Object.freeze({
|
|
|
39
49
|
'source',
|
|
40
50
|
'target',
|
|
41
51
|
'abstract',
|
|
52
|
+
'inheritance',
|
|
42
53
|
'description',
|
|
43
54
|
'extends',
|
|
44
55
|
'properties',
|
|
45
56
|
'policies',
|
|
46
57
|
'constraints',
|
|
58
|
+
'unique',
|
|
47
59
|
]);
|
|
48
60
|
validateDirectedSourceInput(input.source);
|
|
49
61
|
validateDirectedTargetInput(input.target);
|
|
50
|
-
const { source, target, ...options } = input;
|
|
51
|
-
validateEdgeClassOptions(options);
|
|
62
|
+
const { source, target, unique, ...options } = input;
|
|
63
|
+
validateEdgeClassOptions(options, ['noSelf', 'acyclic']);
|
|
52
64
|
const value = authoringValue('definition', {
|
|
53
65
|
kind: 'edge',
|
|
54
66
|
orientation: 'directed',
|
|
@@ -56,6 +68,12 @@ export const edgeClass = Object.freeze({
|
|
|
56
68
|
classInputs.set(value, {
|
|
57
69
|
source: { ...source },
|
|
58
70
|
target: { ...target },
|
|
71
|
+
// Copied, so the declaration does not follow later changes to the author's arrays.
|
|
72
|
+
...(unique === undefined
|
|
73
|
+
? {}
|
|
74
|
+
: {
|
|
75
|
+
unique: unique.map((tuple) => tuple.map((field) => typeof field === 'string' ? field : { property: field.property })),
|
|
76
|
+
}),
|
|
59
77
|
...options,
|
|
60
78
|
abstract: options.abstract ?? false,
|
|
61
79
|
});
|
|
@@ -65,6 +83,7 @@ export const edgeClass = Object.freeze({
|
|
|
65
83
|
assertKnownKeys(input, [
|
|
66
84
|
'endpoints',
|
|
67
85
|
'abstract',
|
|
86
|
+
'inheritance',
|
|
68
87
|
'description',
|
|
69
88
|
'extends',
|
|
70
89
|
'properties',
|
|
@@ -76,7 +95,7 @@ export const edgeClass = Object.freeze({
|
|
|
76
95
|
validateIncidentEndpointInput(input.endpoints[0]);
|
|
77
96
|
validateIncidentEndpointInput(input.endpoints[1]);
|
|
78
97
|
const { endpoints, ...options } = input;
|
|
79
|
-
|
|
98
|
+
validateEdgeClassOptions(options, ['noSelf']);
|
|
80
99
|
const value = authoringValue('definition', {
|
|
81
100
|
kind: 'edge',
|
|
82
101
|
orientation: 'undirected',
|
|
@@ -96,39 +115,18 @@ export function classConfiguration(value) {
|
|
|
96
115
|
return input;
|
|
97
116
|
}
|
|
98
117
|
function validateDirectedSourceInput(value) {
|
|
99
|
-
assertKnownKeys(value, ['as', 'accepts', 'outgoing']);
|
|
118
|
+
assertKnownKeys(value, ['as', 'accepts', 'outgoing', 'onDelete']);
|
|
100
119
|
}
|
|
101
120
|
function validateDirectedTargetInput(value) {
|
|
102
|
-
assertKnownKeys(value, ['as', 'accepts', 'incoming']);
|
|
121
|
+
assertKnownKeys(value, ['as', 'accepts', 'incoming', 'onDelete']);
|
|
103
122
|
}
|
|
104
123
|
function validateIncidentEndpointInput(value) {
|
|
105
|
-
assertKnownKeys(value, ['as', 'accepts', 'incident']);
|
|
106
|
-
}
|
|
107
|
-
function validateEdgeClassOptions(value) {
|
|
108
|
-
assertKnownKeys(value, [
|
|
109
|
-
'abstract',
|
|
110
|
-
'description',
|
|
111
|
-
'extends',
|
|
112
|
-
'properties',
|
|
113
|
-
'policies',
|
|
114
|
-
'constraints',
|
|
115
|
-
]);
|
|
116
|
-
if (value.policies !== undefined)
|
|
117
|
-
assertKnownKeys(value.policies, ['read', 'traverse']);
|
|
118
|
-
if (value.constraints !== undefined)
|
|
119
|
-
assertKnownKeys(value.constraints, ['noSelf', 'acyclic']);
|
|
124
|
+
assertKnownKeys(value, ['as', 'accepts', 'incident', 'onDelete']);
|
|
120
125
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
'abstract',
|
|
124
|
-
'description',
|
|
125
|
-
'extends',
|
|
126
|
-
'properties',
|
|
127
|
-
'policies',
|
|
128
|
-
'constraints',
|
|
129
|
-
]);
|
|
126
|
+
/** Check the nested Edge Class options; the caller has checked the option keys themselves. */
|
|
127
|
+
function validateEdgeClassOptions(value, constraints) {
|
|
130
128
|
if (value.policies !== undefined)
|
|
131
|
-
assertKnownKeys(value.policies,
|
|
129
|
+
assertKnownKeys(value.policies, CLASS_OPERATIONS);
|
|
132
130
|
if (value.constraints !== undefined)
|
|
133
|
-
assertKnownKeys(value.constraints,
|
|
131
|
+
assertKnownKeys(value.constraints, constraints);
|
|
134
132
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AUTHORING } from '../schema/handle.js';
|
|
2
|
+
declare const CLASS_TYPE: unique symbol;
|
|
3
|
+
/** Authored Node Class handle; its type carries the compact projection of its input. */
|
|
4
|
+
export interface NodeClass<out Config = unknown> {
|
|
5
|
+
readonly [AUTHORING]: 'definition';
|
|
6
|
+
readonly kind: 'node';
|
|
7
|
+
readonly [CLASS_TYPE]: () => Config;
|
|
8
|
+
}
|
|
9
|
+
/** Authored directed Edge Class handle; its type carries the compact projection of its input. */
|
|
10
|
+
export interface DirectedEdgeClass<out Input = unknown> {
|
|
11
|
+
readonly [AUTHORING]: 'definition';
|
|
12
|
+
readonly kind: 'edge';
|
|
13
|
+
readonly orientation: 'directed';
|
|
14
|
+
readonly [CLASS_TYPE]: () => Input;
|
|
15
|
+
}
|
|
16
|
+
/** Authored undirected Edge Class handle; its type carries the compact projection of its input. */
|
|
17
|
+
export interface UndirectedEdgeClass<out Input = unknown> {
|
|
18
|
+
readonly [AUTHORING]: 'definition';
|
|
19
|
+
readonly kind: 'edge';
|
|
20
|
+
readonly orientation: 'undirected';
|
|
21
|
+
readonly [CLASS_TYPE]: () => Input;
|
|
22
|
+
}
|
|
23
|
+
export type EdgeClass = DirectedEdgeClass | UndirectedEdgeClass;
|
|
24
|
+
export type Class = NodeClass | EdgeClass;
|
|
25
|
+
/** The compact projection a Class handle carries. */
|
|
26
|
+
export type ProjectionOfClass<Value extends Class> = Value extends NodeClass<infer Config> ? Config : Value extends DirectedEdgeClass<infer Input> ? Input : Value extends UndirectedEdgeClass<infer Input> ? Input : never;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from '../schema/handle.js';
|