@astrale-os/kernel-dsl 0.2.0-beta.8 → 0.2.0
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 +5 -4
- package/dist/v1/addressing/method-key.js +3 -2
- package/dist/v1/addressing/patterns.d.ts +0 -5
- package/dist/v1/addressing/patterns.js +5 -5
- package/dist/v1/builder/callable/authoring.d.ts +87 -41
- package/dist/v1/builder/callable/authoring.js +29 -14
- package/dist/v1/builder/class/authoring.d.ts +311 -36
- package/dist/v1/builder/class/authoring.js +3 -4
- package/dist/v1/builder/class/property.d.ts +16 -8
- package/dist/v1/builder/class/property.js +21 -5
- package/dist/v1/builder/core/authoring.d.ts +28 -13
- package/dist/v1/builder/core/authoring.js +22 -2
- package/dist/v1/builder/index.d.ts +9 -8
- package/dist/v1/builder/index.js +2 -2
- package/dist/v1/builder/lowering/callable.d.ts +3 -1
- package/dist/v1/builder/lowering/callable.js +43 -51
- package/dist/v1/builder/lowering/class.d.ts +7 -0
- package/dist/v1/builder/lowering/class.js +79 -29
- package/dist/v1/builder/lowering/core.d.ts +3 -2
- package/dist/v1/builder/lowering/core.js +9 -6
- package/dist/v1/builder/lowering/policy.d.ts +8 -1
- package/dist/v1/builder/lowering/policy.js +35 -0
- package/dist/v1/builder/lowering/schema/capture.js +9 -4
- package/dist/v1/builder/lowering/schema/compile.d.ts +2 -2
- package/dist/v1/builder/lowering/schema/compile.js +15 -2
- package/dist/v1/builder/lowering/schema/context.d.ts +11 -8
- package/dist/v1/builder/lowering/schema/context.js +59 -29
- package/dist/v1/builder/lowering/schema/ownership.d.ts +3 -3
- package/dist/v1/builder/lowering/schema/ownership.js +2 -1
- package/dist/v1/builder/lowering/value/compile.js +14 -4
- package/dist/v1/builder/lowering/value/zod.d.ts +7 -6
- package/dist/v1/builder/lowering/value/zod.js +16 -7
- package/dist/v1/builder/lowering/view.d.ts +4 -3
- package/dist/v1/builder/lowering/view.js +2 -14
- package/dist/v1/builder/policy/authoring.d.ts +23 -6
- package/dist/v1/builder/policy/authoring.js +35 -8
- package/dist/v1/builder/schema/define.d.ts +8 -5
- package/dist/v1/builder/schema/diagnostic.d.ts +1 -1
- package/dist/v1/builder/schema/handle.d.ts +2 -1
- package/dist/v1/builder/schema/input.d.ts +9 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
- package/dist/v1/builder/schema/projection/callable.js +1 -0
- package/dist/v1/builder/schema/projection/class.d.ts +89 -0
- package/dist/v1/builder/schema/projection/class.js +1 -0
- package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
- package/dist/v1/builder/schema/projection/core-input.js +1 -0
- package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
- package/dist/v1/builder/schema/projection/domain.js +1 -0
- package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
- package/dist/v1/builder/schema/projection/identity.js +1 -0
- package/dist/v1/builder/schema/projection/model.d.ts +59 -0
- package/dist/v1/builder/schema/projection/model.js +1 -0
- package/dist/v1/builder/schema/projection/property.d.ts +32 -0
- package/dist/v1/builder/schema/projection/property.js +1 -0
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
- package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
- package/dist/v1/builder/schema/projection.d.ts +4 -258
- package/dist/v1/builder/value/full-match.js +6 -3
- package/dist/v1/builder/value/path.d.ts +2 -2
- package/dist/v1/builder/value/path.js +2 -2
- package/dist/v1/builder/view/authoring.d.ts +6 -14
- package/dist/v1/builder/view/authoring.js +13 -5
- package/dist/v1/bundle/structure.d.ts +2 -1
- package/dist/v1/compiled/admission/accept.d.ts +1 -1
- package/dist/v1/compiled/admission/accept.js +11 -814
- package/dist/v1/compiled/admission/closure.d.ts +3 -0
- package/dist/v1/compiled/admission/closure.js +173 -0
- package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
- package/dist/v1/compiled/admission/diagnostic.js +13 -0
- package/dist/v1/compiled/admission/revision.js +9 -1
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
- package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/class.js +125 -0
- package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
- package/dist/v1/compiled/admission/semantics/context.js +81 -0
- package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
- package/dist/v1/compiled/admission/semantics/core.js +123 -0
- package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/edge.js +89 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.js +63 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.js +139 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
- package/dist/v1/compiled/admission/semantics.d.ts +1 -1
- package/dist/v1/compiled/admission/semantics.js +8 -1078
- package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
- package/dist/v1/compiled/admission/wire/callable.js +90 -0
- package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/class.js +133 -0
- package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/core.js +32 -0
- package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
- package/dist/v1/compiled/admission/wire/dependency.js +43 -0
- package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/entry.js +100 -0
- package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
- package/dist/v1/compiled/admission/wire/pattern.js +111 -0
- package/dist/v1/compiled/admission/wire/policy.d.ts +10 -0
- package/dist/v1/compiled/admission/wire/policy.js +189 -0
- package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/program.js +52 -0
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/property.js +74 -0
- package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
- package/dist/v1/compiled/admission/wire/reference.js +33 -0
- package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
- package/dist/v1/compiled/admission/wire/value.js +98 -0
- package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
- package/dist/v1/compiled/admission/wire/view.js +17 -0
- package/dist/v1/compiled/compiler/compile.js +43 -11
- package/dist/v1/compiled/generated.d.ts +10 -0
- package/dist/v1/compiled/generated.js +15 -0
- package/dist/v1/compiled/loader/load.d.ts +5 -0
- package/dist/v1/compiled/loader/load.js +18 -4
- package/dist/v1/compiled/model/schema.d.ts +16 -7
- package/dist/v1/domain/create.js +18 -28
- package/dist/v1/domain/model/domain.d.ts +0 -1
- package/dist/v1/domain/model/input.d.ts +3 -0
- package/dist/v1/domain/projection/classes.js +13 -41
- package/dist/v1/domain/validation/create.d.ts +2 -0
- package/dist/v1/domain/validation/create.js +12 -0
- package/dist/v1/index.d.ts +5 -2
- package/dist/v1/index.js +3 -1
- package/dist/v1/language/callable/composition.d.ts +27 -0
- package/dist/v1/language/callable/composition.js +52 -0
- package/dist/v1/language/callable/executable.d.ts +6 -0
- package/dist/v1/language/callable/executable.js +4 -0
- package/dist/v1/language/callable/model/callable.d.ts +34 -9
- package/dist/v1/language/callable/model/callable.js +3 -1
- package/dist/v1/language/callable/resolved.d.ts +23 -8
- package/dist/v1/language/class/facets.d.ts +5 -2
- package/dist/v1/language/class/inheritance.d.ts +12 -0
- package/dist/v1/language/class/inheritance.js +25 -0
- package/dist/v1/language/class/lifetime.d.ts +17 -0
- package/dist/v1/language/class/lifetime.js +26 -0
- package/dist/v1/language/class/model/class.d.ts +8 -4
- package/dist/v1/language/class/model/property.d.ts +4 -2
- package/dist/v1/language/class/property-values.js +5 -2
- package/dist/v1/language/class/resolved.d.ts +25 -15
- package/dist/v1/language/core/model/core.d.ts +7 -1
- package/dist/v1/language/core/resolved.d.ts +6 -2
- package/dist/v1/language/definition/metadata.d.ts +8 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/index.d.ts +9 -0
- package/dist/v1/language/index.js +6 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +4 -3
- package/dist/v1/language/policy/analysis/branches.js +54 -12
- package/dist/v1/language/policy/analysis/budgets.js +1 -1
- package/dist/v1/language/policy/analysis/checks.d.ts +28 -0
- package/dist/v1/language/policy/analysis/checks.js +80 -0
- package/dist/v1/language/policy/index.d.ts +1 -0
- package/dist/v1/language/policy/index.js +1 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -5
- package/dist/v1/language/policy/model/policy.js +52 -1
- package/dist/v1/language/policy/normalization/normalize.d.ts +12 -1
- package/dist/v1/language/policy/normalization/normalize.js +178 -44
- package/dist/v1/language/state/index.d.ts +3 -0
- package/dist/v1/language/state/index.js +1 -0
- package/dist/v1/language/state/machine.d.ts +28 -0
- package/dist/v1/language/state/machine.js +40 -0
- package/dist/v1/language/state/topology.d.ts +14 -0
- package/dist/v1/language/state/topology.js +69 -0
- package/dist/v1/language/value/compile/fields.d.ts +1 -1
- package/dist/v1/language/value/compile/load.d.ts +4 -2
- package/dist/v1/language/value/compile/load.js +22 -1
- package/dist/v1/language/value/compile/model.d.ts +16 -1
- package/dist/v1/language/value/evaluate/assertions.d.ts +2 -0
- package/dist/v1/language/value/evaluate/assertions.js +13 -0
- package/dist/v1/language/value/evaluate/evaluator.js +111 -28
- package/dist/v1/language/value/evaluate/preparation.d.ts +10 -1
- package/dist/v1/language/value/evaluate/preparation.js +17 -26
- package/dist/v1/language/value/evaluate/program.js +1 -1
- package/dist/v1/language/value/evaluate/validate.d.ts +6 -2
- package/dist/v1/language/value/evaluate/validate.js +18 -11
- package/dist/v1/language/value/inclusion/includes.d.ts +9 -0
- package/dist/v1/language/value/inclusion/includes.js +777 -0
- package/dist/v1/language/value/model/blob.d.ts +31 -0
- package/dist/v1/language/value/model/blob.js +90 -0
- package/dist/v1/language/value/model/instant.d.ts +0 -2
- package/dist/v1/language/value/model/instant.js +1 -1
- package/dist/v1/language/value/model/schema.d.ts +2 -1
- package/dist/v1/language/value/model/schema.js +1 -5
- package/dist/v1/language/value/ordering.d.ts +2 -0
- package/dist/v1/language/value/ordering.js +4 -8
- package/dist/v1/language/value/profile/json.validate.js +1 -1
- package/dist/v1/language/value/profile/rules.js +48 -12
- package/dist/v1/language/value/reference/registry.d.ts +2 -1
- package/dist/v1/language/value/regexp/ast.js +3 -64
- package/dist/v1/language/value/regexp/compile.d.ts +32 -3
- package/dist/v1/language/value/regexp/compile.js +117 -21
- package/dist/v1/language/value/regexp/matcher.d.ts +6 -3
- package/dist/v1/language/value/regexp/matcher.js +185 -28
- package/dist/v1/language/value/regexp/syntax.d.ts +12 -1
- package/dist/v1/language/value/regexp/syntax.js +14 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +32 -0
- package/dist/v1/language/value/regexp/unicode.js +139 -0
- package/dist/v1/language/value/syntax/full-match.js +8 -5
- package/dist/v1/language/value/syntax/node-path/validate.js +4 -6
- package/dist/v1/language/view/model/view.d.ts +2 -4
- package/dist/v1/language/view/resolved.d.ts +2 -2
- package/dist/v1/schema/analysis/class.d.ts +36 -6
- package/dist/v1/schema/analysis/class.js +31 -66
- package/dist/v1/schema/canonical/revision.d.ts +2 -1
- package/dist/v1/schema/canonical/revision.js +4 -1
- package/dist/v1/schema/compatibility/api.d.ts +3 -0
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.d.ts +39 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +101 -0
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +47 -0
- package/dist/v1/schema/compatibility/comparators/classes.js +160 -0
- package/dist/v1/schema/compatibility/comparators/index.d.ts +12 -0
- package/dist/v1/schema/compatibility/comparators/index.js +53 -0
- package/dist/v1/schema/compatibility/comparators/members.d.ts +4 -0
- package/dist/v1/schema/compatibility/comparators/members.js +49 -0
- package/dist/v1/schema/compatibility/comparators/values.d.ts +5 -0
- package/dist/v1/schema/compatibility/comparators/values.js +37 -0
- package/dist/v1/schema/compatibility/compare.d.ts +5 -0
- package/dist/v1/schema/compatibility/compare.js +23 -0
- package/dist/v1/schema/compatibility/context.d.ts +19 -0
- package/dist/v1/schema/compatibility/context.js +49 -0
- package/dist/v1/schema/compatibility/coordinate.d.ts +40 -0
- package/dist/v1/schema/compatibility/coordinate.js +38 -0
- package/dist/v1/schema/compatibility/diff.d.ts +12 -0
- package/dist/v1/schema/compatibility/diff.js +39 -0
- package/dist/v1/schema/compatibility/evidence.d.ts +16 -0
- package/dist/v1/schema/compatibility/evidence.js +62 -0
- package/dist/v1/schema/compatibility/fields.d.ts +194 -0
- package/dist/v1/schema/compatibility/fields.js +94 -0
- package/dist/v1/schema/compatibility/index.d.ts +6 -0
- package/dist/v1/schema/compatibility/index.js +3 -0
- package/dist/v1/schema/compatibility/meaning/footprint.d.ts +7 -0
- package/dist/v1/schema/compatibility/meaning/footprint.js +59 -0
- package/dist/v1/schema/compatibility/meaning/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/meaning/index.js +16 -0
- package/dist/v1/schema/compatibility/model.d.ts +131 -0
- package/dist/v1/schema/compatibility/model.js +1 -0
- package/dist/v1/schema/compatibility/references.d.ts +38 -0
- package/dist/v1/schema/compatibility/references.js +149 -0
- package/dist/v1/schema/compatibility/report.d.ts +27 -0
- package/dist/v1/schema/compatibility/report.js +100 -0
- package/dist/v1/schema/compatibility/scope.d.ts +36 -0
- package/dist/v1/schema/compatibility/scope.js +110 -0
- package/dist/v1/schema/compatibility/structure/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/structure/index.js +40 -0
- package/dist/v1/schema/compatibility/structure/inheritance.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/inheritance.js +68 -0
- package/dist/v1/schema/compatibility/structure/requirements.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/requirements.js +97 -0
- package/dist/v1/schema/compatibility/subjects.d.ts +39 -0
- package/dist/v1/schema/compatibility/subjects.js +143 -0
- package/dist/v1/schema/compatibility/versioning/index.d.ts +8 -0
- package/dist/v1/schema/compatibility/versioning/index.js +50 -0
- package/dist/v1/schema/compatibility/versioning/members.d.ts +12 -0
- package/dist/v1/schema/compatibility/versioning/members.js +47 -0
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +11 -0
- package/dist/v1/schema/compatibility/versioning/surface.js +61 -0
- package/dist/v1/schema/diagnostic.d.ts +1 -1
- package/dist/v1/schema/fingerprint.d.ts +2 -0
- package/dist/v1/schema/fingerprint.js +1 -0
- package/dist/v1/schema/index.d.ts +4 -3
- package/dist/v1/schema/index.js +2 -1
- package/dist/v1/schema/model/schema.d.ts +8 -11
- package/dist/v1/schema/normalization/domain.js +57 -13
- package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
- package/dist/v1/schema/resolution/definition.index.js +0 -3
- package/dist/v1/schema/resolution/domain.d.ts +4 -1
- package/dist/v1/schema/resolution/domain.js +26 -18
- package/dist/v1/schema/resolution/origins.d.ts +28 -5
- package/dist/v1/schema/resolution/origins.js +68 -31
- package/dist/v1/schema/validation/callable.d.ts +4 -0
- package/dist/v1/schema/validation/callable.js +39 -0
- package/dist/v1/schema/validation/class.d.ts +10 -0
- package/dist/v1/schema/validation/class.js +79 -60
- package/dist/v1/schema/validation/core.js +83 -55
- package/dist/v1/schema/validation/domain.d.ts +2 -1
- package/dist/v1/schema/validation/domain.js +2 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
- package/dist/v1/schema/validation/domain.structure.js +214 -171
- package/dist/v1/schema/validation/policy/budgets.js +36 -6
- package/dist/v1/schema/validation/policy/context.js +5 -16
- package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
- package/dist/v1/schema/validation/policy/objects.js +71 -0
- package/dist/v1/schema/validation/policy/references.js +16 -4
- package/dist/v1/schema/validation/policy/typing.d.ts +2 -0
- package/dist/v1/schema/validation/policy/typing.js +55 -7
- package/dist/v1/schema/validation/policy/uses.js +73 -99
- package/dist/v1/schema/validation/value-api.d.ts +2 -0
- package/dist/v1/schema/validation/value-api.js +1 -0
- package/dist/v1/schema/validation/value.js +7 -1
- package/dist/v1/schema/validation/view.js +14 -9
- package/dist/value/accept.d.ts +9 -0
- package/dist/value/accept.js +106 -7
- package/dist/value/canonical.d.ts +3 -0
- package/dist/value/canonical.js +22 -6
- package/dist/value/immutable.optimization.d.ts +15 -0
- package/dist/value/immutable.optimization.js +34 -0
- package/dist/value/index.d.ts +1 -1
- package/dist/value/index.js +1 -1
- package/dist/value/json.d.ts +1 -1
- package/dist/value/json.js +1 -1
- package/dist/value/limits.d.ts +1 -1
- package/dist/value/unicode.d.ts +4 -1
- package/dist/value/unicode.js +28 -0
- package/package.json +20 -5
- package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
- package/dist/v1/schema/compatibility/meaning.js +0 -605
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { DefinitionKey, FunctionRef, Key, MethodKey } from '../../addressing/index.js';
|
|
2
2
|
import type { ResolvedClass } from '../class/resolved.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CallablePolicy } from '../policy/model/policy.js';
|
|
4
4
|
import type { Diagnostic } from '../validation/diagnostic.js';
|
|
5
|
-
import type { FunctionDefinition, MethodDefinition } from './model/callable.js';
|
|
5
|
+
import type { BinaryInputProjection, CallableExecution, FunctionDefinition, MethodDefinition } from './model/callable.js';
|
|
6
6
|
import type { FunctionAuth } from './model/callable.js';
|
|
7
|
-
type CallableDefinitionOf<Definition extends FunctionDefinition | MethodDefinition, Auth extends FunctionAuth, Policy extends
|
|
7
|
+
type CallableDefinitionOf<Definition extends FunctionDefinition | MethodDefinition, Auth extends FunctionAuth, Policy extends CallablePolicy> = Omit<Definition, 'auth' | 'policy'> & (Auth extends FunctionAuth ? {
|
|
8
8
|
readonly auth: Auth;
|
|
9
9
|
} & (Auth extends 'authorized' ? {
|
|
10
10
|
readonly policy?: Policy;
|
|
11
11
|
} : {
|
|
12
12
|
readonly policy?: never;
|
|
13
13
|
}) : never);
|
|
14
|
-
export interface ResolvedMethod<out Input = unknown, out Output = unknown, out Static extends boolean = boolean, out
|
|
14
|
+
export interface ResolvedMethod<out Input = unknown, out Output = unknown, out Static extends boolean = boolean, out Abstract extends MethodDefinition['abstract'] = MethodDefinition['abstract'], out Auth extends FunctionAuth = FunctionAuth, out Policy extends CallablePolicy = CallablePolicy, out ExactKey extends MethodKey = MethodKey> {
|
|
15
15
|
readonly owner: ResolvedClass<'node'> & {
|
|
16
16
|
readonly key: MethodOwnerKeyOfKey<ExactKey>;
|
|
17
17
|
};
|
|
@@ -20,15 +20,19 @@ export interface ResolvedMethod<out Input = unknown, out Output = unknown, out S
|
|
|
20
20
|
readonly description?: MethodDefinition['description'];
|
|
21
21
|
readonly input: MethodDefinition['input'];
|
|
22
22
|
readonly output: MethodDefinition['output'];
|
|
23
|
+
/** Present only for a durable Method. */
|
|
24
|
+
readonly execution?: CallableExecution;
|
|
23
25
|
readonly auth: Auth;
|
|
24
26
|
readonly policy?: Auth extends 'authorized' ? Policy : never;
|
|
25
27
|
readonly static: Static;
|
|
26
|
-
readonly
|
|
28
|
+
readonly abstract: Abstract;
|
|
29
|
+
/** Whether this exact local declaration requires an implementation. */
|
|
30
|
+
readonly executable: Abstract extends false ? true : boolean;
|
|
27
31
|
/** Present only when the callable input is a safely enumerable closed object. */
|
|
28
32
|
readonly inputFields?: readonly string[];
|
|
29
33
|
readonly definition: CallableDefinitionOf<MethodDefinition, Auth, Policy> & {
|
|
30
34
|
readonly static: Static;
|
|
31
|
-
readonly
|
|
35
|
+
readonly abstract: Abstract;
|
|
32
36
|
};
|
|
33
37
|
validateInput(input: unknown): readonly Diagnostic[];
|
|
34
38
|
validateInputField(field: string, input: unknown): readonly Diagnostic[];
|
|
@@ -41,12 +45,14 @@ export type ResolvedMethodCollection<ByKey extends Readonly<Record<MethodKey, Re
|
|
|
41
45
|
get<Key extends keyof ByKey>(key: Key): ByKey[Key];
|
|
42
46
|
get(key: MethodKey): ResolvedMethod | undefined;
|
|
43
47
|
};
|
|
44
|
-
export interface ResolvedFunction<out Input = unknown, out Output = unknown, out Auth extends FunctionAuth = FunctionAuth, out Policy extends
|
|
48
|
+
export interface ResolvedFunction<out Input = unknown, out Output = unknown, out Auth extends FunctionAuth = FunctionAuth, out Policy extends CallablePolicy = CallablePolicy> {
|
|
45
49
|
readonly ref: FunctionRef;
|
|
46
50
|
readonly key: DefinitionKey<string, 'function'>;
|
|
47
51
|
readonly description?: FunctionDefinition['description'];
|
|
48
52
|
readonly input: FunctionDefinition['input'];
|
|
49
53
|
readonly output: FunctionDefinition['output'];
|
|
54
|
+
/** Present only for a durable Function. */
|
|
55
|
+
readonly execution?: CallableExecution;
|
|
50
56
|
readonly auth: Auth;
|
|
51
57
|
readonly policy?: Auth extends 'authorized' ? Policy : never;
|
|
52
58
|
/** Present only when the callable input is a safely enumerable closed object. */
|
|
@@ -63,6 +69,15 @@ export type MethodOwnerKeyOf<Method> = Method extends {
|
|
|
63
69
|
readonly key: infer ExactKey extends MethodKey;
|
|
64
70
|
} ? MethodOwnerKeyOfKey<ExactKey> : never;
|
|
65
71
|
type MethodOwnerKeyOfKey<ExactKey extends MethodKey> = ExactKey extends `${infer Origin}:class.${infer Owner}.method.${string}` ? DefinitionKey<Extract<Origin, Key.Origin>, 'class', Owner> : never;
|
|
66
|
-
|
|
72
|
+
type ProjectedCallableInputOf<Callable> = Callable extends ResolvedMethod<infer Input, unknown, boolean> ? Input : Callable extends ResolvedFunction<infer Input, unknown> ? Input : never;
|
|
73
|
+
type InputValue<Input> = Input extends BinaryInputProjection<infer Metadata> ? Metadata : Input;
|
|
74
|
+
/** Portable metadata for a binary Function, or the Value for an ordinary callable. */
|
|
75
|
+
export type CallableInputOf<Callable> = InputValue<ProjectedCallableInputOf<Callable>>;
|
|
76
|
+
type InputMode<Input> = Input extends BinaryInputProjection ? 'binary' : 'value';
|
|
77
|
+
export type CallableInputModeOf<Callable> = InputMode<ProjectedCallableInputOf<Callable>>;
|
|
67
78
|
export type CallableOutputOf<Callable> = Callable extends ResolvedMethod<unknown, infer Output, boolean> ? Output : Callable extends ResolvedFunction<unknown, infer Output> ? Output : never;
|
|
79
|
+
/** An exact local Method whose Schema requires an implementation. */
|
|
80
|
+
export type ExecutableMethod<Input = unknown, Output = unknown, Static extends boolean = boolean> = ResolvedMethod<Input, Output, Static> & {
|
|
81
|
+
readonly executable: true;
|
|
82
|
+
};
|
|
68
83
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CallableInputOf, CallableOutputOf, ResolvedMethod, ResolvedMethodCollection } from '../callable/resolved.js';
|
|
2
|
+
import type { StateTopology } from '../state/index.js';
|
|
2
3
|
import type { ResolvedProperty, ResolvedPropertyCollection } from './resolved.js';
|
|
3
4
|
type MemberName = string | number | symbol;
|
|
4
5
|
type ValueAt<Collection, Key> = Key extends keyof Collection ? Collection[Key] : never;
|
|
@@ -17,7 +18,7 @@ type MethodByKeyOf<Class> = MethodCollectionOf<Class> extends {
|
|
|
17
18
|
readonly byKey: infer ByKey extends Readonly<Record<string, ResolvedMethod>>;
|
|
18
19
|
} ? ByKey : Readonly<Record<never, never>>;
|
|
19
20
|
type MethodByNameOf<Class> = Pick<MethodCollectionOf<Class>, Exclude<keyof MethodCollectionOf<Class>, keyof ResolvedMethodCollection>>;
|
|
20
|
-
export type PropertyOutputOf<Property> = Property extends ResolvedProperty<infer Value, infer Required> ? Required extends true ? Value : Value | undefined : never;
|
|
21
|
+
export type PropertyOutputOf<Property> = Property extends ResolvedProperty<infer Value, infer Required, StateTopology | undefined, unknown> ? Required extends true ? Value : Value | undefined : never;
|
|
21
22
|
/** Collision-safe direct Property values. Client supplies graph/wrapper reserved names. */
|
|
22
23
|
export type PropertyShortcutsOf<Class, Reserved extends MemberName = never> = Readonly<{
|
|
23
24
|
[Name in Exclude<keyof PropertyByNameOf<Class>, keyof MethodByNameOf<Class> | Reserved>]: PropertyOutputOf<ValueAt<PropertyByNameOf<Class>, Name>>;
|
|
@@ -40,7 +41,9 @@ export type CallableResultOf<Callable, Binary = unknown> = CallableOutputOf<Call
|
|
|
40
41
|
} ? AsyncIterable<Item> : Output extends {
|
|
41
42
|
readonly mode: 'binary';
|
|
42
43
|
} ? Binary : never : never;
|
|
43
|
-
type ExecutableMethod<Method> = Method extends ResolvedMethod<unknown, unknown, false
|
|
44
|
+
type ExecutableMethod<Method> = Method extends ResolvedMethod<unknown, unknown, false> & {
|
|
45
|
+
readonly executable: true;
|
|
46
|
+
} ? Method : never;
|
|
44
47
|
export type BoundMethodOf<Method, Binary = unknown> = ExecutableMethod<Method> extends infer Callable ? [Callable] extends [never] ? never : (input: CallableInputOf<Callable>) => Promise<CallableResultOf<Callable, Binary>> : never;
|
|
45
48
|
/** Collision-safe direct bound Methods. Client supplies graph/wrapper reserved names. */
|
|
46
49
|
export type BoundMethodShortcutsOf<Class, Binary = unknown, Reserved extends MemberName = never> = Readonly<{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ClassRef } from '../../addressing/index.js';
|
|
2
|
+
import type { ClassKind } from './model/class.js';
|
|
3
|
+
/** The representation shared by source, compiled and resolved Class admission. */
|
|
4
|
+
export interface ClassInheritance {
|
|
5
|
+
readonly ref: ClassRef;
|
|
6
|
+
readonly kind: ClassKind;
|
|
7
|
+
readonly extends: readonly ClassRef[];
|
|
8
|
+
}
|
|
9
|
+
/** Kernel graph roots are intrinsic supertypes, not authored structural Edge contracts. */
|
|
10
|
+
export declare function isGraphRoot(value: Pick<ClassInheritance, 'ref' | 'kind'>): boolean;
|
|
11
|
+
/** Same-kind satisfaction includes the intrinsic root and the declared parent closure. */
|
|
12
|
+
export declare function classSatisfies(candidate: ClassInheritance, required: ClassInheritance, resolve: (ref: ClassRef) => ClassInheritance | undefined): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Kernel graph roots are intrinsic supertypes, not authored structural Edge contracts. */
|
|
2
|
+
export function isGraphRoot(value) {
|
|
3
|
+
return (value.ref.origin === 'kernel.astrale.ai' &&
|
|
4
|
+
value.ref.name === (value.kind === 'node' ? 'Node' : 'Edge'));
|
|
5
|
+
}
|
|
6
|
+
/** Same-kind satisfaction includes the intrinsic root and the declared parent closure. */
|
|
7
|
+
export function classSatisfies(candidate, required, resolve) {
|
|
8
|
+
if (candidate.kind !== required.kind)
|
|
9
|
+
return false;
|
|
10
|
+
if (isGraphRoot(required))
|
|
11
|
+
return true;
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
const visit = (value) => {
|
|
14
|
+
if (value.ref.origin === required.ref.origin && value.ref.name === required.ref.name)
|
|
15
|
+
return true;
|
|
16
|
+
if (seen.has(value))
|
|
17
|
+
return false;
|
|
18
|
+
seen.add(value);
|
|
19
|
+
return value.extends.some((ref) => {
|
|
20
|
+
const parent = resolve(ref);
|
|
21
|
+
return parent !== undefined && parent.kind === required.kind && visit(parent);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return visit(candidate);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ClassRef } from '../../addressing/index.js';
|
|
2
|
+
import type { EdgeContract } from './model/edge.js';
|
|
3
|
+
/**
|
|
4
|
+
* What deleting the Node at one endpoint does to an Edge: `restrict` requires the transition to
|
|
5
|
+
* delete the Edge explicitly; `detach` deletes the Edge with the Node.
|
|
6
|
+
*/
|
|
7
|
+
export type EdgeLifetime = 'restrict' | 'detach';
|
|
8
|
+
/**
|
|
9
|
+
* The lifetime of each endpoint of an Edge Class, in endpoint order (source then target, or the two
|
|
10
|
+
* incident endpoints), derived from the contract its Domain `origin` declares.
|
|
11
|
+
*
|
|
12
|
+
* An Edge Class binds only the Nodes of its own Domain and of the Domains that depend on it. An
|
|
13
|
+
* endpoint that accepts a Class `origin` does not own can therefore reach a Node it does not bind,
|
|
14
|
+
* and such a foreign endpoint detaches, unless an endpoint declares a minimum count that
|
|
15
|
+
* detaching would break. Every other endpoint restricts.
|
|
16
|
+
*/
|
|
17
|
+
export declare function edgeLifetimes(origin: ClassRef['origin'], contract: EdgeContract): readonly [EdgeLifetime, EdgeLifetime];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lifetime of each endpoint of an Edge Class, in endpoint order (source then target, or the two
|
|
3
|
+
* incident endpoints), derived from the contract its Domain `origin` declares.
|
|
4
|
+
*
|
|
5
|
+
* An Edge Class binds only the Nodes of its own Domain and of the Domains that depend on it. An
|
|
6
|
+
* endpoint that accepts a Class `origin` does not own can therefore reach a Node it does not bind,
|
|
7
|
+
* and such a foreign endpoint detaches, unless an endpoint declares a minimum count that
|
|
8
|
+
* detaching would break. Every other endpoint restricts.
|
|
9
|
+
*/
|
|
10
|
+
export function edgeLifetimes(origin, contract) {
|
|
11
|
+
const endpoints = contract.orientation === 'directed'
|
|
12
|
+
? [
|
|
13
|
+
[contract.endpoints.source.accepts, contract.endpoints.source.outgoing],
|
|
14
|
+
[contract.endpoints.target.accepts, contract.endpoints.target.incoming],
|
|
15
|
+
]
|
|
16
|
+
: [
|
|
17
|
+
[contract.endpoints[0].accepts, contract.endpoints[0].incident],
|
|
18
|
+
[contract.endpoints[1].accepts, contract.endpoints[1].incident],
|
|
19
|
+
];
|
|
20
|
+
const required = endpoints.some(([, count]) => minimum(count) > 0);
|
|
21
|
+
const lifetime = ([accepts]) => !required && accepts.some((ref) => ref.origin !== origin) ? 'detach' : 'restrict';
|
|
22
|
+
return Object.freeze([lifetime(endpoints[0]), lifetime(endpoints[1])]);
|
|
23
|
+
}
|
|
24
|
+
function minimum(count) {
|
|
25
|
+
return count === '1' || count === '1..*' ? 1 : 0;
|
|
26
|
+
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import type { ClassRef, DefinitionBase
|
|
1
|
+
import type { ClassRef, DefinitionBase } from '../../../addressing/index.js';
|
|
2
2
|
import type { MethodRecord } from '../../callable/model/callable.js';
|
|
3
|
+
import type { ClassPolicy, NodeClassPolicy } from '../../policy/model/policy.js';
|
|
3
4
|
import type { DataFacet } from './data.js';
|
|
4
5
|
import type { EdgeContract } from './edge.js';
|
|
5
6
|
import type { PropertyFacet } from './property.js';
|
|
6
7
|
export type ClassKind = 'node' | 'edge';
|
|
8
|
+
/** An absent observation rule admits every caller; a delegation is still scoped by its ceiling. */
|
|
7
9
|
export interface NodeClassPolicies {
|
|
8
|
-
readonly read?:
|
|
9
|
-
readonly traverse?:
|
|
10
|
+
readonly read?: NodeClassPolicy;
|
|
11
|
+
readonly traverse?: NodeClassPolicy;
|
|
10
12
|
}
|
|
13
|
+
/** An absent observation rule admits every caller; a delegation is still scoped by its ceiling. */
|
|
11
14
|
export interface EdgeClassPolicies {
|
|
12
|
-
readonly
|
|
15
|
+
readonly read?: ClassPolicy;
|
|
16
|
+
readonly traverse?: ClassPolicy;
|
|
13
17
|
}
|
|
14
18
|
export interface NodeClassDefinition extends DefinitionBase<ClassRef>, PropertyFacet, DataFacet {
|
|
15
19
|
readonly kind: 'node';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export type PropertyVisibility = 'public' | 'private';
|
|
2
1
|
export type AutoEvent = 'create' | 'update';
|
|
3
2
|
export type AutoSet = 'instant';
|
|
3
|
+
/** `create`: written only by node or edge creation. `once`: written while absent, never unset. */
|
|
4
|
+
export type PropertyImmutability = 'create' | 'once';
|
|
4
5
|
export interface PropertyAuto {
|
|
5
6
|
readonly on: readonly AutoEvent[];
|
|
6
7
|
readonly set: AutoSet;
|
|
@@ -8,9 +9,10 @@ export interface PropertyAuto {
|
|
|
8
9
|
export interface PropertyDefinition {
|
|
9
10
|
readonly schema: import('../../value/model/schema.js').JsonSchema;
|
|
10
11
|
readonly required: boolean;
|
|
11
|
-
readonly visibility: PropertyVisibility;
|
|
12
12
|
readonly auto?: PropertyAuto;
|
|
13
|
+
readonly immutable?: PropertyImmutability;
|
|
13
14
|
readonly description?: string;
|
|
15
|
+
readonly state?: import('../../state/index.js').StateTopology;
|
|
14
16
|
}
|
|
15
17
|
export type PropertyRecord = Readonly<Record<string, PropertyDefinition>>;
|
|
16
18
|
export interface PropertyFacet {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { acceptPropertyRoot } from '../../../value/accept.js';
|
|
2
|
+
import { isImmutableSnapshot } from '../../../value/immutable.optimization.js';
|
|
2
3
|
import { PropertyKey as admitPropertyKey } from '../../addressing/index.js';
|
|
3
4
|
export function acceptPropertyValues(input, pointer = '') {
|
|
4
|
-
const admitted =
|
|
5
|
+
const admitted = acceptPropertyRoot(input);
|
|
5
6
|
if (admitted === null || typeof admitted !== 'object' || Array.isArray(admitted)) {
|
|
6
7
|
throw new TypeError(`Expected PropertyValues object at ${pointer || '/'}.`);
|
|
7
8
|
}
|
|
@@ -21,6 +22,8 @@ export const PropertyValues = Object.freeze({
|
|
|
21
22
|
function freeze(value) {
|
|
22
23
|
if (value === null || typeof value !== 'object')
|
|
23
24
|
return value;
|
|
25
|
+
if (isImmutableSnapshot(value))
|
|
26
|
+
return value;
|
|
24
27
|
for (const member of Object.values(value))
|
|
25
28
|
freeze(member);
|
|
26
29
|
return Object.freeze(value);
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import type { Value as PortableValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import type { ClassRef, DefinitionKey, Key,
|
|
2
|
+
import type { ClassRef, DefinitionKey, Key, PropertyKey } from '../../addressing/index.js';
|
|
3
3
|
import type { ResolvedMethodCollection } from '../callable/resolved.js';
|
|
4
|
+
import type { StateTopology } from '../state/index.js';
|
|
4
5
|
import type { Diagnostic } from '../validation/diagnostic.js';
|
|
6
|
+
import type { ValueProgram } from '../value/compile/model.js';
|
|
5
7
|
import type { OrderingKind } from '../value/ordering.js';
|
|
6
8
|
import type { ClassDefinition, ClassKind } from './model/class.js';
|
|
7
9
|
import type { DataDefinition } from './model/data.js';
|
|
8
10
|
import type { PropertyDefinition } from './model/property.js';
|
|
9
11
|
import type { PropertyValues } from './property-values.js';
|
|
10
|
-
export interface ResolvedProperty<out Value = PortableValue, out Required extends boolean = boolean> {
|
|
12
|
+
export interface ResolvedProperty<out Value = PortableValue, out Required extends boolean = boolean, out State extends StateTopology | undefined = StateTopology | undefined, out Input = Value> {
|
|
11
13
|
readonly owner: AnyResolvedClass;
|
|
12
14
|
readonly name: string;
|
|
13
15
|
readonly key: PropertyKey;
|
|
14
|
-
readonly definition: PropertyDefinition & {
|
|
16
|
+
readonly definition: Omit<PropertyDefinition, 'required' | 'state'> & {
|
|
15
17
|
readonly required: Required;
|
|
18
|
+
readonly state?: State;
|
|
16
19
|
};
|
|
17
20
|
/** The one portable scalar ordering domain, when the Property is orderable. */
|
|
18
21
|
readonly ordering?: OrderingKind;
|
|
19
22
|
validate(input: unknown): readonly Diagnostic[];
|
|
23
|
+
/** The admitted program `validate` evaluates. */
|
|
24
|
+
program(): ValueProgram;
|
|
20
25
|
readonly __value?: Value;
|
|
26
|
+
readonly __input?: Input;
|
|
21
27
|
}
|
|
22
28
|
export interface ResolvedData {
|
|
23
29
|
readonly owner: ResolvedClass<'node'>;
|
|
24
30
|
readonly definition: DataDefinition;
|
|
25
31
|
}
|
|
26
|
-
export interface ResolvedClassPolicies<Kind extends ClassKind = ClassKind> {
|
|
27
|
-
readonly read: Kind extends 'node' ? readonly PolicyRef[] : readonly [];
|
|
28
|
-
readonly traverse: readonly PolicyRef[];
|
|
29
|
-
}
|
|
30
32
|
export type ResolvedPropertyCollection<ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<unknown>>> = Readonly<Record<PropertyKey, ResolvedProperty<unknown>>>, ByName extends Readonly<Record<string, ResolvedProperty<unknown>>> = Readonly<Record<never, never>>> = Readonly<ByName> & Iterable<ByKey[keyof ByKey]> & {
|
|
31
33
|
readonly byKey: ByKey;
|
|
32
34
|
get<Key extends keyof ByKey>(key: Key): ByKey[Key];
|
|
@@ -43,9 +45,10 @@ export interface ResolvedClass<Kind extends ClassKind = ClassKind, Properties ex
|
|
|
43
45
|
readonly kind: Kind;
|
|
44
46
|
readonly abstract: boolean;
|
|
45
47
|
readonly definition: Definition;
|
|
48
|
+
/** Explicitly authored parents; intrinsic graph roots do not alter schema bytes. */
|
|
46
49
|
readonly extends: Parents & readonly ResolvedClass<Kind>[];
|
|
47
|
-
/**
|
|
48
|
-
readonly policies:
|
|
50
|
+
/** Local observation Policies; Class inheritance never contributes an attachment. */
|
|
51
|
+
readonly policies: Definition['policies'];
|
|
49
52
|
readonly data: Kind extends 'node' ? ResolvedData | undefined : undefined;
|
|
50
53
|
readonly properties: Properties;
|
|
51
54
|
readonly methods: Kind extends 'node' ? InstanceMethods : ResolvedMethodCollection<Record<never, never>>;
|
|
@@ -55,31 +58,32 @@ export interface ResolvedClass<Kind extends ClassKind = ClassKind, Properties ex
|
|
|
55
58
|
readonly self: {
|
|
56
59
|
readonly data: Kind extends 'node' ? ResolvedData | undefined : undefined;
|
|
57
60
|
readonly properties: SelfProperties;
|
|
58
|
-
/** Policies declared by this exact Class only. */
|
|
59
|
-
readonly policies: Definition['policies'];
|
|
60
61
|
readonly methods: Kind extends 'node' ? SelfInstanceMethods : ResolvedMethodCollection<Record<never, never>>;
|
|
61
62
|
readonly static: {
|
|
62
63
|
readonly methods: Kind extends 'node' ? SelfStaticMethods : ResolvedMethodCollection<Record<never, never>>;
|
|
63
64
|
};
|
|
64
65
|
};
|
|
66
|
+
/** Same-kind nominal inheritance, including the universal Kernel Node or Edge root. */
|
|
65
67
|
satisfies(selected: ResolvedClass<Kind>): boolean;
|
|
66
68
|
validateProperties(input: unknown): readonly Diagnostic[];
|
|
67
69
|
}
|
|
68
70
|
/** One resolved Class with an exact graph kind, used at heterogeneous Domain boundaries. */
|
|
69
71
|
export type AnyResolvedClass = ResolvedClass<'node'> | ResolvedClass<'edge'>;
|
|
70
|
-
/**
|
|
72
|
+
/** Class keys satisfied by one resolved Class, including its graph root and transitive parents. */
|
|
71
73
|
export type ClassSatisfactionKeysOf<Class> = ClassSatisfactionKeys<Class, never>;
|
|
72
74
|
type ClassSatisfactionKeys<Class, Seen> = Class extends Seen ? never : (Class extends {
|
|
75
|
+
readonly kind: infer Kind extends ClassKind;
|
|
76
|
+
} ? DefinitionKey<'kernel.astrale.ai', 'class', Kind extends 'node' ? 'Node' : 'Edge'> : never) | (Class extends {
|
|
73
77
|
readonly key: infer ExactKey extends DefinitionKey<Key.Origin, 'class'>;
|
|
74
78
|
} ? ExactKey : never) | (Class extends ResolvedClass<ClassKind, ResolvedPropertyCollection, ResolvedMethodCollection, ResolvedMethodCollection, ResolvedPropertyCollection, ResolvedMethodCollection, ResolvedMethodCollection, ClassDefinition, infer Parents> ? ClassSatisfactionKeys<Extract<Parents[number], ResolvedClass>, Seen | Class> : never);
|
|
75
|
-
export type PropertyValueOf<Property> = Property extends ResolvedProperty<infer Value> ? Value : never;
|
|
79
|
+
export type PropertyValueOf<Property> = Property extends ResolvedProperty<infer Value, boolean, StateTopology | undefined, unknown> ? Value : never;
|
|
76
80
|
export type PropertiesOf<Class> = Class extends {
|
|
77
81
|
readonly properties: infer Properties extends ResolvedPropertyCollection;
|
|
78
82
|
} ? Properties : ResolvedPropertyCollection<Record<never, never>>;
|
|
79
83
|
export type PropertyValuesOf<Class> = PropertyValues & Readonly<{
|
|
80
84
|
[Key in keyof PropertyByKeyOf<Class>]?: PropertyValueOf<PropertyByKeyOf<Class>[Key]>;
|
|
81
85
|
}>;
|
|
82
|
-
export type PropertyInputOf<Class> =
|
|
86
|
+
export type PropertyInputOf<Class> = PropertyWriteInput<PropertyByKeyOf<Class>, PropertyByNameOf<Class>>;
|
|
83
87
|
export type MethodsOf<Class> = Class extends {
|
|
84
88
|
readonly kind: 'node';
|
|
85
89
|
readonly methods: infer Methods extends ResolvedMethodCollection;
|
|
@@ -114,10 +118,16 @@ type PropertyInput<ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<u
|
|
|
114
118
|
} & {
|
|
115
119
|
[Name in keyof ByName]?: PropertyValueOf<ByName[Name]>;
|
|
116
120
|
}>;
|
|
121
|
+
type PropertyWriteInput<ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<unknown>>>, ByName extends Readonly<Record<string, ResolvedProperty<unknown>>>> = Readonly<{
|
|
122
|
+
[Key in keyof ByKey]?: PropertyWriteValueOf<ByKey[Key]>;
|
|
123
|
+
} & {
|
|
124
|
+
[Name in keyof ByName]?: PropertyWriteValueOf<ByName[Name]>;
|
|
125
|
+
}>;
|
|
126
|
+
type PropertyWriteValueOf<Property> = Property extends ResolvedProperty<unknown, boolean, StateTopology | undefined, infer Input> ? Input : never;
|
|
117
127
|
type PropertyByKeyOf<Class> = PropertiesOf<Class> extends {
|
|
118
128
|
readonly byKey: infer ByKey extends Readonly<Record<PropertyKey, ResolvedProperty<unknown>>>;
|
|
119
129
|
} ? ByKey : Readonly<Record<never, never>>;
|
|
120
130
|
type PropertyByNameOf<Class> = Readonly<{
|
|
121
|
-
[Name in Exclude<keyof PropertiesOf<Class>, keyof ResolvedPropertyCollection>]: Extract<PropertiesOf<Class>[Name], ResolvedProperty
|
|
131
|
+
[Name in Exclude<keyof PropertiesOf<Class>, keyof ResolvedPropertyCollection>]: Extract<PropertiesOf<Class>[Name], ResolvedProperty<unknown, boolean, StateTopology | undefined, unknown>>;
|
|
122
132
|
}>;
|
|
123
133
|
export {};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { ClassRef, CoreRef, DefinitionBase } from '../../../addressing/index.js';
|
|
2
2
|
import type { PropertyValues } from '../../class/property-values.js';
|
|
3
|
+
import type { PolicyObjectRef } from '../../policy/model/policy.js';
|
|
3
4
|
export interface DomainEndpointRef {
|
|
4
5
|
readonly kind: 'domain';
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* One Core Edge endpoint: the owning Domain itself, or any local Definition whose installed
|
|
9
|
+
* projection resolves through an exact member Path. That is the same projected-member vocabulary
|
|
10
|
+
* a Policy object names, so both languages address one identity the same way.
|
|
11
|
+
*/
|
|
12
|
+
export type CoreEndpointRef = PolicyObjectRef | DomainEndpointRef;
|
|
7
13
|
export interface CoreDefinition extends DefinitionBase<CoreRef> {
|
|
8
14
|
readonly class: ClassRef;
|
|
9
15
|
readonly properties: PropertyValues;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { DefinitionKey } from '../../addressing/index.js';
|
|
2
|
+
import type { ResolvedMethod } from '../callable/resolved.js';
|
|
2
3
|
import type { PropertyValues } from '../class/property-values.js';
|
|
3
4
|
import type { ResolvedClass } from '../class/resolved.js';
|
|
5
|
+
import type { ResolvedDefinition } from '../resolved.js';
|
|
4
6
|
import type { CoreDefinition } from './model/core.js';
|
|
5
7
|
export interface ResolvedCoreDefinition {
|
|
6
8
|
readonly ref: CoreDefinition['ref'];
|
|
@@ -13,9 +15,11 @@ export interface ResolvedDomainEndpoint {
|
|
|
13
15
|
readonly kind: 'domain';
|
|
14
16
|
readonly origin: string;
|
|
15
17
|
}
|
|
18
|
+
/** The owning Domain, one local Definition, or one local Class-owned Method. */
|
|
19
|
+
export type ResolvedCoreEndpoint = ResolvedDefinition | ResolvedMethod | ResolvedDomainEndpoint;
|
|
16
20
|
export interface ResolvedCoreEdge {
|
|
17
21
|
readonly class: ResolvedClass<'edge'>;
|
|
18
|
-
readonly source:
|
|
19
|
-
readonly target:
|
|
22
|
+
readonly source: ResolvedCoreEndpoint;
|
|
23
|
+
readonly target: ResolvedCoreEndpoint;
|
|
20
24
|
readonly properties: PropertyValues;
|
|
21
25
|
}
|
|
@@ -10,3 +10,11 @@ export declare const icon: Readonly<{
|
|
|
10
10
|
readonly minLength: 1;
|
|
11
11
|
readonly maxLength: 8000;
|
|
12
12
|
}>;
|
|
13
|
+
/** Exact V1 bound for the required human-facing display name a new Domain revision declares. */
|
|
14
|
+
export declare const name: Readonly<{
|
|
15
|
+
readonly type: 'string';
|
|
16
|
+
readonly minLength: 1;
|
|
17
|
+
readonly maxLength: 100;
|
|
18
|
+
}>;
|
|
19
|
+
/** The common source and compiled grammar for a name displayed exactly as authored. */
|
|
20
|
+
export declare function isDomainNameText(value: string): boolean;
|
|
@@ -10,3 +10,15 @@ export const icon = Object.freeze({
|
|
|
10
10
|
minLength: 1,
|
|
11
11
|
maxLength: 8000,
|
|
12
12
|
});
|
|
13
|
+
/** Exact V1 bound for the required human-facing display name a new Domain revision declares. */
|
|
14
|
+
export const name = Object.freeze({
|
|
15
|
+
type: 'string',
|
|
16
|
+
minLength: 1,
|
|
17
|
+
maxLength: 100,
|
|
18
|
+
});
|
|
19
|
+
// oxlint-disable-next-line no-control-regex
|
|
20
|
+
const DOMAIN_NAME_CONTROL = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/u;
|
|
21
|
+
/** The common source and compiled grammar for a name displayed exactly as authored. */
|
|
22
|
+
export function isDomainNameText(value) {
|
|
23
|
+
return value.trim() === value && !DOMAIN_NAME_CONTROL.test(value);
|
|
24
|
+
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
export { isMethodExecutable } from './callable/executable.js';
|
|
2
|
+
export { isBinaryInput } from './callable/model/callable.js';
|
|
1
3
|
export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodKey, PolicyRef, PropertyKey, ViewRef, } from '../addressing/index.js';
|
|
2
4
|
export type { Value as PropertyValue } from '@astrale-os/kernel-dsl/value';
|
|
3
5
|
export type { JsonSchema as ValueSchema, JsonSchemaObject as ValueSchemaObject, } from './value/model/schema.js';
|
|
4
6
|
export type { OrderingKind } from './value/ordering.js';
|
|
7
|
+
export type { ValueProgram } from './value/compile/model.js';
|
|
8
|
+
export { valueProgramIncludes } from './value/inclusion/includes.js';
|
|
9
|
+
export { stateMachine } from './state/index.js';
|
|
10
|
+
export type { EventOf, StateMachine, StateOf, StateTopology } from './state/index.js';
|
|
5
11
|
export type * from './callable/model/callable.js';
|
|
6
12
|
export type * from './callable/resolved.js';
|
|
7
13
|
export type * from './class/model/class.js';
|
|
8
14
|
export type { DataDefinition, DataFacet, MediaType } from './class/model/data.js';
|
|
9
15
|
export type * from './class/model/edge.js';
|
|
16
|
+
export { edgeLifetimes } from './class/lifetime.js';
|
|
17
|
+
export type { EdgeLifetime } from './class/lifetime.js';
|
|
10
18
|
export type * from './class/model/property.js';
|
|
11
19
|
export type * from './class/resolved.js';
|
|
12
20
|
export type * from './class/facets.js';
|
|
@@ -18,6 +26,7 @@ export type { Definition } from './definition.js';
|
|
|
18
26
|
export type { ResolvedDefinition, ResolvedDefinitionOf } from './resolved.js';
|
|
19
27
|
export type { Diagnostic, DiagnosticCode } from './validation/diagnostic.js';
|
|
20
28
|
export type * from './policy/model/policy.js';
|
|
29
|
+
export { isClassRuleChecks, policyVariableClass, policyVariableSelector, policyObjectKey, policyObjectOrigin, projectedMemberClass, } from './policy/model/policy.js';
|
|
21
30
|
export type * from './policy/resolved.js';
|
|
22
31
|
export type * from './view/model/view.js';
|
|
23
32
|
export type * from './view/resolved.js';
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
export { isMethodExecutable } from './callable/executable.js';
|
|
2
|
+
export { isBinaryInput } from './callable/model/callable.js';
|
|
3
|
+
export { valueProgramIncludes } from './value/inclusion/includes.js';
|
|
4
|
+
export { stateMachine } from './state/index.js';
|
|
5
|
+
export { edgeLifetimes } from './class/lifetime.js';
|
|
1
6
|
export { PropertyValues } from './class/property-values.js';
|
|
7
|
+
export { isClassRuleChecks, policyVariableClass, policyVariableSelector, policyObjectKey, policyObjectOrigin, projectedMemberClass, } from './policy/model/policy.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PolicyEdgePattern, PolicyPatternExpression, PolicyPatternTerm } from '../model/policy.js';
|
|
1
|
+
import type { PolicyEdgePattern, PolicyPatternExpression, PolicyPatternTerm, PolicyVariableSelector } from '../model/policy.js';
|
|
3
2
|
export interface PatternBranch {
|
|
3
|
+
readonly terms: ReadonlyMap<string, PolicyPatternTerm>;
|
|
4
|
+
readonly equalities: readonly (readonly [string, string])[];
|
|
4
5
|
readonly edges: readonly PatternEdgeUse[];
|
|
5
|
-
readonly variables: ReadonlyMap<string,
|
|
6
|
+
readonly variables: ReadonlyMap<string, PolicyVariableSelector>;
|
|
6
7
|
readonly requiredVariables: ReadonlySet<string>;
|
|
7
8
|
readonly namespace: string;
|
|
8
9
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { definitionRefIndex } from '../../../addressing/ordering.js';
|
|
2
|
+
import { policyObjectKey, policyVariableSelector } from '../model/policy.js';
|
|
1
3
|
import { BRANCH_OVERFLOW } from './budgets.js';
|
|
2
4
|
export function branchesOf(pattern, namespace) {
|
|
3
5
|
const variables = collectVariableClasses(pattern, namespace);
|
|
@@ -25,7 +27,7 @@ export function isConnected(branch) {
|
|
|
25
27
|
const mode = targetMode(branch);
|
|
26
28
|
if (mode === undefined)
|
|
27
29
|
return false;
|
|
28
|
-
const vertices = new Set(
|
|
30
|
+
const vertices = new Set(['subject', ...branch.terms.keys()]);
|
|
29
31
|
for (const variable of branch.requiredVariables)
|
|
30
32
|
vertices.add(variable);
|
|
31
33
|
const union = new UnionFind(vertices);
|
|
@@ -36,6 +38,8 @@ export function isConnected(branch) {
|
|
|
36
38
|
union.add(target);
|
|
37
39
|
union.join(source, target);
|
|
38
40
|
}
|
|
41
|
+
for (const [left, right] of branch.equalities)
|
|
42
|
+
union.join(left, right);
|
|
39
43
|
const root = union.find('subject');
|
|
40
44
|
return [...vertices].every((vertex) => union.find(vertex) === root);
|
|
41
45
|
}
|
|
@@ -43,25 +47,54 @@ export function targetMode(branch) {
|
|
|
43
47
|
let object = false;
|
|
44
48
|
let source = false;
|
|
45
49
|
let target = false;
|
|
46
|
-
for (const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
target ||= term.kind === 'target';
|
|
51
|
-
}
|
|
50
|
+
for (const term of branch.terms.values()) {
|
|
51
|
+
object ||= term.kind === 'object';
|
|
52
|
+
source ||= term.kind === 'source';
|
|
53
|
+
target ||= term.kind === 'target';
|
|
52
54
|
}
|
|
53
55
|
if (object && !source && !target)
|
|
54
56
|
return 'object';
|
|
55
|
-
if (!object && source
|
|
57
|
+
if (!object && (source || target))
|
|
56
58
|
return 'edge';
|
|
57
59
|
return undefined;
|
|
58
60
|
}
|
|
59
61
|
export function termKey(term, namespace) {
|
|
60
|
-
return term.kind === 'variable'
|
|
62
|
+
return term.kind === 'variable'
|
|
63
|
+
? variableKey(namespace, term.id)
|
|
64
|
+
: term.kind === 'ref'
|
|
65
|
+
? `ref:${term.ref.kind === 'method' ? policyObjectKey(term.ref) : definitionRefIndex(term.ref)}`
|
|
66
|
+
: term.kind;
|
|
61
67
|
}
|
|
62
68
|
function branchesForNode(pattern, namespace, variables) {
|
|
63
69
|
if ('source' in pattern) {
|
|
64
|
-
return [
|
|
70
|
+
return [
|
|
71
|
+
{
|
|
72
|
+
terms: new Map([pattern.source, pattern.target].map((term) => [termKey(term, namespace), term])),
|
|
73
|
+
equalities: [],
|
|
74
|
+
edges: [{ pattern, namespace }],
|
|
75
|
+
variables,
|
|
76
|
+
requiredVariables: new Set(),
|
|
77
|
+
namespace,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
if ('sameNode' in pattern) {
|
|
82
|
+
const terms = new Map([pattern.sameNode.left, pattern.sameNode.right].map((term) => [
|
|
83
|
+
termKey(term, namespace),
|
|
84
|
+
term,
|
|
85
|
+
]));
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
terms,
|
|
89
|
+
equalities: [
|
|
90
|
+
[termKey(pattern.sameNode.left, namespace), termKey(pattern.sameNode.right, namespace)],
|
|
91
|
+
],
|
|
92
|
+
edges: [],
|
|
93
|
+
variables,
|
|
94
|
+
requiredVariables: new Set(),
|
|
95
|
+
namespace,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
65
98
|
}
|
|
66
99
|
if ('exists' in pattern) {
|
|
67
100
|
const direct = new Set(pattern.exists.nodes.map((node) => variableKey(namespace, node.variable.id)));
|
|
@@ -74,10 +107,19 @@ function branchesForNode(pattern, namespace, variables) {
|
|
|
74
107
|
return 'allOf' in pattern ? branchProduct(children) : capBranches(children.flat());
|
|
75
108
|
}
|
|
76
109
|
function emptyBranch() {
|
|
77
|
-
return {
|
|
110
|
+
return {
|
|
111
|
+
terms: new Map(),
|
|
112
|
+
equalities: [],
|
|
113
|
+
edges: [],
|
|
114
|
+
variables: new Map(),
|
|
115
|
+
requiredVariables: new Set(),
|
|
116
|
+
namespace: '$',
|
|
117
|
+
};
|
|
78
118
|
}
|
|
79
119
|
function mergeBranches(left, right) {
|
|
80
120
|
return {
|
|
121
|
+
terms: new Map([...left.terms, ...right.terms]),
|
|
122
|
+
equalities: [...left.equalities, ...right.equalities],
|
|
81
123
|
edges: [...left.edges, ...right.edges],
|
|
82
124
|
variables: new Map([...left.variables, ...right.variables]),
|
|
83
125
|
requiredVariables: new Set([...left.requiredVariables, ...right.requiredVariables]),
|
|
@@ -89,7 +131,7 @@ function collectVariableClasses(pattern, namespace) {
|
|
|
89
131
|
const visit = (node) => {
|
|
90
132
|
if ('exists' in node) {
|
|
91
133
|
for (const variable of node.exists.nodes) {
|
|
92
|
-
result.set(variableKey(namespace, variable.variable.id), variable
|
|
134
|
+
result.set(variableKey(namespace, variable.variable.id), policyVariableSelector(variable));
|
|
93
135
|
}
|
|
94
136
|
visit(node.exists.where);
|
|
95
137
|
}
|
|
@@ -8,7 +8,7 @@ export const MAX_CHECK_DEPTH = 4;
|
|
|
8
8
|
export const MAX_CHECK_LEAVES = 8;
|
|
9
9
|
export const BRANCH_OVERFLOW = MAX_BRANCHES + 1;
|
|
10
10
|
export function measureChecks(expression) {
|
|
11
|
-
if ('check' in expression)
|
|
11
|
+
if ('check' in expression || 'sameNode' in expression)
|
|
12
12
|
return { depth: 1, branches: 1, leaves: 1 };
|
|
13
13
|
const children = ('allOf' in expression ? expression.allOf : expression.anyOf).map(measureChecks);
|
|
14
14
|
const branches = 'allOf' in expression
|