@astrale-os/kernel-dsl 0.2.0-beta.9 → 1.0.0-beta.1
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 +138 -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 +19 -3
- package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
- package/dist/v1/schema/compatibility/meaning.js +0 -605
|
@@ -20,10 +20,11 @@ export function ClassKey(input) {
|
|
|
20
20
|
function is(input) {
|
|
21
21
|
if (typeof input !== 'string' || !Key.is(input))
|
|
22
22
|
return false;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
!
|
|
23
|
+
// Only the coordinate is tested: an origin label may itself be `property` or `method`.
|
|
24
|
+
const coordinate = input.slice(input.indexOf(':') + 1);
|
|
25
|
+
return (coordinate.startsWith('class.') &&
|
|
26
|
+
!coordinate.includes('.property.') &&
|
|
27
|
+
!coordinate.includes('.method.'));
|
|
27
28
|
}
|
|
28
29
|
ClassKey.is = is;
|
|
29
30
|
function ref(input) {
|
|
@@ -21,8 +21,9 @@ export function MethodKey(input) {
|
|
|
21
21
|
function is(input) {
|
|
22
22
|
if (typeof input !== 'string' || !Key.is(input))
|
|
23
23
|
return false;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// The member kind is the third segment: the owner Class may itself be named `method`.
|
|
25
|
+
const [kind, , member] = input.slice(input.indexOf(':') + 1).split('.');
|
|
26
|
+
return kind === 'class' && member === 'method';
|
|
26
27
|
}
|
|
27
28
|
MethodKey.is = is;
|
|
28
29
|
function address(input) {
|
|
@@ -5,11 +5,6 @@ export declare const MEMBER_NAME_PATTERN: RegExp;
|
|
|
5
5
|
export declare const DEPENDENCY_ALIAS_PATTERN: RegExp;
|
|
6
6
|
export declare const CORE_SLUG_PATTERN: RegExp;
|
|
7
7
|
export declare const DOMAIN_REVISION_PATTERN: RegExp;
|
|
8
|
-
export declare const DOMAIN_REVISION_FULL_MATCH = "sha256:[0-9a-f]{64}";
|
|
9
|
-
export declare const DOMAIN_ORIGIN_FULL_MATCH = "([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?";
|
|
10
|
-
export declare const MEMBER_NAME_FULL_MATCH = "[A-Za-z][A-Za-z0-9_]*";
|
|
11
|
-
export declare const DEPENDENCY_ALIAS_FULL_MATCH = "[a-z][A-Za-z0-9]*";
|
|
12
|
-
export declare const PROPERTY_KEY_FULL_MATCH = "([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?:class\\.[A-Za-z][A-Za-z0-9_]*\\.property\\.[A-Za-z][A-Za-z0-9_]*";
|
|
13
8
|
export declare const PROPERTY_KEY_PATTERN: RegExp;
|
|
14
9
|
export declare const patterns: Readonly<{
|
|
15
10
|
coreSlug: RegExp;
|
|
@@ -3,11 +3,11 @@ export const MEMBER_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/u;
|
|
|
3
3
|
export const DEPENDENCY_ALIAS_PATTERN = /^[a-z][A-Za-z0-9]*$/u;
|
|
4
4
|
export const CORE_SLUG_PATTERN = /^[a-z][a-z0-9-]{0,99}$/u;
|
|
5
5
|
export const DOMAIN_REVISION_PATTERN = /^sha256:[0-9a-f]{64}$/u;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const DOMAIN_REVISION_FULL_MATCH = 'sha256:[0-9a-f]{64}';
|
|
7
|
+
const DOMAIN_ORIGIN_FULL_MATCH = '([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?';
|
|
8
|
+
const MEMBER_NAME_FULL_MATCH = '[A-Za-z][A-Za-z0-9_]*';
|
|
9
|
+
const DEPENDENCY_ALIAS_FULL_MATCH = '[a-z][A-Za-z0-9]*';
|
|
10
|
+
const PROPERTY_KEY_FULL_MATCH = '([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?:class\\.[A-Za-z][A-Za-z0-9_]*\\.property\\.[A-Za-z][A-Za-z0-9_]*';
|
|
11
11
|
export const PROPERTY_KEY_PATTERN = new RegExp(`^(?:${PROPERTY_KEY_FULL_MATCH})$`, 'u');
|
|
12
12
|
export const patterns = Object.freeze({
|
|
13
13
|
coreSlug: CORE_SLUG_PATTERN,
|
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Value as PortableValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { PolicyRef } from '../../addressing/index.js';
|
|
4
|
+
import type { BinaryInputProjection, CallableExecution, FunctionAuth } from '../../language/callable/model/callable.js';
|
|
2
5
|
import type { PolicyCheckExpression, PolicyCheckObject, PolicyObjectRef } from '../../language/policy/model/policy.js';
|
|
3
6
|
import type { Class } from '../class/authoring.js';
|
|
4
7
|
import type { ValueSchemaInput } from '../class/property.js';
|
|
5
8
|
import type { CoreNode } from '../core/authoring.js';
|
|
6
9
|
import type { Policy, PolicyInput } from '../policy/authoring.js';
|
|
7
10
|
import type { Lazy } from '../schema/lazy.js';
|
|
11
|
+
import type { TypedValueSchema } from '../value/schema.js';
|
|
8
12
|
import type { View } from '../view/authoring.js';
|
|
9
13
|
import { type AUTHORING } from '../schema/handle.js';
|
|
10
14
|
declare const CALLABLE_OUTPUT: unique symbol;
|
|
11
15
|
declare const CALLABLE_INPUT: unique symbol;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
declare const CALLABLE_PROJECTION: unique symbol;
|
|
17
|
+
declare const CALLABLE_PROJECTION_VALUE: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* The check vocabulary of a rule site whose checks name `Object`s: an authorized callable's Policy
|
|
20
|
+
* and a Node Class rule write their checks with it.
|
|
21
|
+
*/
|
|
22
|
+
export interface PolicyCheckContext<Object extends PolicyCheckObject = PolicyCheckObject> {
|
|
23
|
+
readonly self: Extract<Object, {
|
|
17
24
|
readonly kind: 'self';
|
|
18
25
|
}>;
|
|
19
|
-
ref(member: PolicyObjectInput): Extract<
|
|
26
|
+
ref(member: PolicyObjectInput): Extract<Object, {
|
|
20
27
|
readonly kind: 'ref';
|
|
21
28
|
}>;
|
|
22
|
-
check(policy: PolicyInput, object:
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
check(policy: PolicyInput, object: Object): PolicyCheckExpression<PolicyRef, Object>;
|
|
30
|
+
sameNode(left: Object, right: Object): PolicyCheckExpression<PolicyRef, Object>;
|
|
31
|
+
allOf(first: PolicyCheckExpression<PolicyRef, Object>, ...rest: readonly PolicyCheckExpression<PolicyRef, Object>[]): PolicyCheckExpression<PolicyRef, Object>;
|
|
32
|
+
anyOf(first: PolicyCheckExpression<PolicyRef, Object>, ...rest: readonly PolicyCheckExpression<PolicyRef, Object>[]): PolicyCheckExpression<PolicyRef, Object>;
|
|
33
|
+
}
|
|
34
|
+
export interface CallablePolicyContext extends PolicyCheckContext {
|
|
35
|
+
readonly input: Readonly<Record<string, Extract<PolicyCheckObject, {
|
|
36
|
+
readonly kind: 'input';
|
|
37
|
+
}>>>;
|
|
25
38
|
}
|
|
26
39
|
export type CallablePolicyBuilder = (context: CallablePolicyContext) => PolicyCheckExpression;
|
|
40
|
+
/** The caller rule: Policy checks, or its constant value. Absent means `false`. */
|
|
41
|
+
export type CallablePolicyInput = CallablePolicyBuilder | boolean;
|
|
27
42
|
export interface StreamOutput<out Item extends ValueSchemaInput = ValueSchemaInput> {
|
|
28
43
|
readonly mode: 'stream';
|
|
29
44
|
readonly item: Item;
|
|
@@ -34,14 +49,21 @@ export interface BinaryOutput {
|
|
|
34
49
|
readonly [CALLABLE_OUTPUT]: true;
|
|
35
50
|
}
|
|
36
51
|
export type CallableOutputInput = ValueSchemaInput | StreamOutput | BinaryOutput;
|
|
37
|
-
export interface
|
|
52
|
+
export interface BinaryInputAuthoring<out Metadata extends ValueSchemaInput = ValueSchemaInput> {
|
|
53
|
+
readonly mode: 'binary';
|
|
54
|
+
readonly metadata: Metadata;
|
|
55
|
+
readonly maximumBytes: number;
|
|
56
|
+
readonly [CALLABLE_INPUT]: true;
|
|
57
|
+
}
|
|
58
|
+
export type FunctionInputSchema = ValueSchemaInput | BinaryInputAuthoring;
|
|
59
|
+
export interface CallableInputBase<Input extends FunctionInputSchema = ValueSchemaInput> {
|
|
38
60
|
readonly description?: string;
|
|
39
|
-
readonly input:
|
|
61
|
+
readonly input: Input;
|
|
40
62
|
readonly output: CallableOutputInput;
|
|
41
|
-
|
|
42
|
-
readonly
|
|
63
|
+
/** `{ durable: true }` makes an invocation return an Execution reference. */
|
|
64
|
+
readonly execution?: CallableExecution;
|
|
43
65
|
}
|
|
44
|
-
|
|
66
|
+
type ConcreteCallableInput<Input extends FunctionInputSchema = ValueSchemaInput> = CallableInputBase<Input> & ({
|
|
45
67
|
readonly auth: 'anonymous';
|
|
46
68
|
readonly policy?: never;
|
|
47
69
|
} | {
|
|
@@ -49,43 +71,61 @@ export type CallableInput = CallableInputBase & ({
|
|
|
49
71
|
readonly policy?: never;
|
|
50
72
|
} | {
|
|
51
73
|
readonly auth: 'authorized';
|
|
52
|
-
readonly policy?:
|
|
74
|
+
readonly policy?: CallablePolicyInput;
|
|
53
75
|
});
|
|
54
|
-
export type FunctionInput =
|
|
76
|
+
export type FunctionInput = ConcreteCallableInput<FunctionInputSchema> & {
|
|
55
77
|
readonly static?: never;
|
|
56
|
-
readonly
|
|
78
|
+
readonly abstract?: never;
|
|
57
79
|
};
|
|
58
|
-
export type MethodInput =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
readonly
|
|
80
|
+
export type MethodInput = ConcreteCallableInput & {
|
|
81
|
+
readonly static?: boolean;
|
|
82
|
+
/** Require every concrete descendant to declare this contract locally. */
|
|
83
|
+
readonly abstract?: boolean;
|
|
84
|
+
};
|
|
85
|
+
export type CallableInput = FunctionInput | MethodInput;
|
|
86
|
+
export interface CallableProjection<out Input = unknown, out Output = unknown, out Auth extends FunctionAuth = FunctionAuth, out Static extends boolean = boolean, out Abstract extends boolean = boolean, out Execution extends CallableExecution | undefined = CallableExecution | undefined> {
|
|
87
|
+
readonly [CALLABLE_PROJECTION_VALUE]: true;
|
|
62
88
|
readonly input: Input;
|
|
63
89
|
readonly output: Output;
|
|
64
90
|
readonly auth: Auth;
|
|
65
|
-
} & (Auth extends 'authorized' ? {
|
|
66
|
-
readonly policy?: CallablePolicyBuilder;
|
|
67
|
-
} : {
|
|
68
|
-
readonly policy?: never;
|
|
69
|
-
}) & ([Static] extends [never] ? {} : {
|
|
70
91
|
readonly static: Static;
|
|
71
|
-
|
|
72
|
-
readonly
|
|
73
|
-
}
|
|
74
|
-
|
|
92
|
+
readonly abstract: Abstract;
|
|
93
|
+
readonly execution: Execution;
|
|
94
|
+
}
|
|
95
|
+
type ValueInputOf<Schema> = Schema extends TypedValueSchema<infer Value> ? Value : Schema extends z.ZodType ? z.input<Schema> : PortableValue;
|
|
96
|
+
type FunctionInputOf<Schema> = Schema extends BinaryInputAuthoring<infer Metadata> ? BinaryInputProjection<ValueInputOf<Metadata>> : ValueInputOf<Schema>;
|
|
97
|
+
type ValueOutputOf<Schema> = Schema extends TypedValueSchema<infer Value> ? Value : Schema extends z.ZodType ? z.output<Schema> : PortableValue;
|
|
98
|
+
type ExecutionOfConfig<Config extends CallableInput> = Config extends {
|
|
99
|
+
readonly execution: infer Execution extends CallableExecution;
|
|
100
|
+
} ? Execution : undefined;
|
|
101
|
+
type CallableOutputOf<Input extends CallableOutputInput> = Input extends StreamOutput<infer Item> ? {
|
|
102
|
+
readonly mode: 'stream';
|
|
103
|
+
readonly item: ValueOutputOf<Item>;
|
|
104
|
+
} : Input extends BinaryOutput ? {
|
|
105
|
+
readonly mode: 'binary';
|
|
106
|
+
} : {
|
|
107
|
+
readonly mode: 'value';
|
|
108
|
+
readonly value: ValueOutputOf<Input>;
|
|
109
|
+
};
|
|
110
|
+
export interface Function<out Projection = unknown> {
|
|
75
111
|
readonly [AUTHORING]: 'function';
|
|
76
|
-
readonly [
|
|
112
|
+
readonly [CALLABLE_PROJECTION]?: () => Projection;
|
|
77
113
|
}
|
|
78
|
-
export interface Method<out
|
|
114
|
+
export interface Method<out Projection = unknown> {
|
|
79
115
|
readonly [AUTHORING]: 'method';
|
|
80
|
-
readonly [
|
|
116
|
+
readonly [CALLABLE_PROJECTION]?: () => Projection;
|
|
81
117
|
}
|
|
82
|
-
export type
|
|
118
|
+
export type ProjectionOfCallable<Value extends Function | Method> = Value extends Function<infer Projection> ? Projection : Value extends Method<infer Projection> ? Projection : never;
|
|
83
119
|
/** Internal lowering access; Callable authoring handles expose no public configuration object. */
|
|
84
|
-
export declare function
|
|
85
|
-
|
|
86
|
-
export type PolicyObjectInput = Lazy<PolicyObjectAuthoring>;
|
|
87
|
-
export declare function func<const Config extends FunctionInput
|
|
88
|
-
export declare function method<const Config extends MethodInput
|
|
120
|
+
export declare function callableConfiguration(value: Function | Method): CallableInput;
|
|
121
|
+
type PolicyObjectAuthoring = Class | Function | Method | Policy | View | CoreNode;
|
|
122
|
+
export type PolicyObjectInput = Lazy<PolicyObjectAuthoring | PolicyObjectRef>;
|
|
123
|
+
export declare function func<const Config extends FunctionInput, Input = FunctionInputOf<Config['input']>, Output = CallableOutputOf<Config['output']>, Auth extends FunctionAuth = Config['auth'], Execution extends CallableExecution | undefined = ExecutionOfConfig<Config>>(config: Config): Function<CallableProjection<Input, Output, Auth, false, false, Execution>>;
|
|
124
|
+
export declare function method<const Config extends MethodInput, Input = ValueInputOf<Config['input']>, Output = CallableOutputOf<Config['output']>, Auth extends FunctionAuth = Config['auth'], Static extends boolean = Config extends {
|
|
125
|
+
readonly static: true;
|
|
126
|
+
} ? true : false, Abstract extends boolean = Config extends {
|
|
127
|
+
readonly abstract: infer Value extends boolean;
|
|
128
|
+
} ? Value : false, Execution extends CallableExecution | undefined = ExecutionOfConfig<Config>>(config: Config): Method<CallableProjection<Input, Output, Auth, Static, Abstract, Execution>>;
|
|
89
129
|
export declare function callableInputField(name: string): Extract<PolicyCheckObject, {
|
|
90
130
|
readonly kind: 'input';
|
|
91
131
|
}>;
|
|
@@ -95,11 +135,17 @@ export declare function callableSelf(): Extract<PolicyCheckObject, {
|
|
|
95
135
|
export declare function callableRef(ref: PolicyObjectRef): Extract<PolicyCheckObject, {
|
|
96
136
|
readonly kind: 'ref';
|
|
97
137
|
}>;
|
|
98
|
-
export declare function callablePolicyObject(value: PolicyCheckObject): PolicyCheckObject;
|
|
99
138
|
/** Explicit non-value output contracts. Plain schemas remain value outputs. */
|
|
100
139
|
export declare const output: {
|
|
101
140
|
readonly stream: <const Item extends ValueSchemaInput>(item: Item) => StreamOutput<Item>;
|
|
102
141
|
readonly binary: () => BinaryOutput;
|
|
103
142
|
};
|
|
143
|
+
/** Explicit binary Function input. Plain schemas remain value inputs. */
|
|
144
|
+
export declare const input: {
|
|
145
|
+
readonly binary: <const Metadata extends ValueSchemaInput>(metadata: Metadata, options: {
|
|
146
|
+
readonly maximumBytes: number;
|
|
147
|
+
}) => BinaryInputAuthoring<Metadata>;
|
|
148
|
+
};
|
|
149
|
+
export declare function isBinaryInputAuthoring(value: FunctionInputSchema): value is BinaryInputAuthoring;
|
|
104
150
|
export declare function isCallableOutputAuthoring(value: CallableOutputInput): value is StreamOutput | BinaryOutput;
|
|
105
151
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { assertKnownKeys } from '../schema/diagnostic.js';
|
|
2
2
|
import { authoringValue, isAuthoringValue } from '../schema/handle.js';
|
|
3
|
-
const
|
|
3
|
+
const callableInputs = new WeakMap();
|
|
4
4
|
/** Internal lowering access; Callable authoring handles expose no public configuration object. */
|
|
5
|
-
export function
|
|
6
|
-
|
|
5
|
+
export function callableConfiguration(value) {
|
|
6
|
+
const input = callableInputs.get(value);
|
|
7
|
+
if (input === undefined)
|
|
8
|
+
throw new TypeError('Unknown Callable authoring handle.');
|
|
9
|
+
return input;
|
|
7
10
|
}
|
|
8
11
|
export function func(config) {
|
|
9
12
|
assertKnownKeys(config, [
|
|
@@ -13,11 +16,12 @@ export function func(config) {
|
|
|
13
16
|
'auth',
|
|
14
17
|
'policy',
|
|
15
18
|
'static',
|
|
16
|
-
'
|
|
19
|
+
'abstract',
|
|
20
|
+
'execution',
|
|
17
21
|
]);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const value = authoringValue('function', {});
|
|
23
|
+
callableInputs.set(value, { ...config });
|
|
24
|
+
return value;
|
|
21
25
|
}
|
|
22
26
|
export function method(config) {
|
|
23
27
|
assertKnownKeys(config, [
|
|
@@ -27,11 +31,12 @@ export function method(config) {
|
|
|
27
31
|
'auth',
|
|
28
32
|
'policy',
|
|
29
33
|
'static',
|
|
30
|
-
'
|
|
34
|
+
'abstract',
|
|
35
|
+
'execution',
|
|
31
36
|
]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const value = authoringValue('method', {});
|
|
38
|
+
callableInputs.set(value, { ...config });
|
|
39
|
+
return value;
|
|
35
40
|
}
|
|
36
41
|
export function callableInputField(name) {
|
|
37
42
|
return Object.freeze({ kind: 'input', field: name });
|
|
@@ -42,9 +47,6 @@ export function callableSelf() {
|
|
|
42
47
|
export function callableRef(ref) {
|
|
43
48
|
return Object.freeze({ kind: 'ref', ref: Object.freeze({ ...ref }) });
|
|
44
49
|
}
|
|
45
|
-
export function callablePolicyObject(value) {
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
50
|
/** Explicit non-value output contracts. Plain schemas remain value outputs. */
|
|
49
51
|
export const output = Object.freeze({
|
|
50
52
|
stream(item) {
|
|
@@ -59,6 +61,19 @@ export const output = Object.freeze({
|
|
|
59
61
|
});
|
|
60
62
|
},
|
|
61
63
|
});
|
|
64
|
+
/** Explicit binary Function input. Plain schemas remain value inputs. */
|
|
65
|
+
export const input = Object.freeze({
|
|
66
|
+
binary(metadata, options) {
|
|
67
|
+
return authoringValue('callable-input', {
|
|
68
|
+
mode: 'binary',
|
|
69
|
+
metadata,
|
|
70
|
+
maximumBytes: options.maximumBytes,
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export function isBinaryInputAuthoring(value) {
|
|
75
|
+
return isAuthoringValue(value, 'callable-input');
|
|
76
|
+
}
|
|
62
77
|
export function isCallableOutputAuthoring(value) {
|
|
63
78
|
return isAuthoringValue(value, 'callable-output');
|
|
64
79
|
}
|