@astrale-os/kernel-dsl 0.2.0-beta.46 → 0.2.0-beta.48
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/patterns.d.ts +0 -5
- package/dist/v1/addressing/patterns.js +5 -5
- package/dist/v1/builder/callable/authoring.d.ts +1 -1
- package/dist/v1/builder/class/authoring.d.ts +0 -12
- package/dist/v1/builder/class/property.d.ts +4 -2
- package/dist/v1/builder/class/property.js +9 -1
- package/dist/v1/builder/index.d.ts +1 -1
- package/dist/v1/builder/lowering/callable.d.ts +2 -1
- package/dist/v1/builder/lowering/core.d.ts +3 -2
- package/dist/v1/builder/lowering/schema/compile.js +15 -2
- package/dist/v1/builder/lowering/value/compile.js +3 -0
- package/dist/v1/builder/lowering/value/zod.d.ts +3 -2
- package/dist/v1/builder/lowering/view.d.ts +4 -3
- package/dist/v1/builder/lowering/view.js +2 -14
- package/dist/v1/builder/schema/define.d.ts +4 -2
- 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 +8 -0
- 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 -375
- package/dist/v1/builder/view/authoring.d.ts +3 -7
- package/dist/v1/builder/view/authoring.js +5 -2
- 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 +7 -1001
- 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 +2 -0
- 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 +57 -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 +126 -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 -1214
- 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 +117 -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 +5 -0
- package/dist/v1/compiled/admission/wire/policy.js +168 -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 +3 -0
- package/dist/v1/compiled/model/schema.d.ts +5 -1
- package/dist/v1/domain/create.js +0 -19
- package/dist/v1/domain/model/domain.d.ts +0 -1
- package/dist/v1/domain/projection/classes.js +2 -9
- package/dist/v1/index.d.ts +1 -1
- package/dist/v1/language/class/inheritance.d.ts +12 -0
- package/dist/v1/language/class/inheritance.js +25 -0
- package/dist/v1/language/class/model/property.d.ts +3 -0
- package/dist/v1/language/class/resolved.d.ts +5 -1
- package/dist/v1/language/definition/metadata.d.ts +8 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/value/model/blob.d.ts +0 -2
- package/dist/v1/language/value/model/blob.js +2 -2
- 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/reference/registry.d.ts +2 -1
- package/dist/v1/language/value/regexp/syntax.d.ts +2 -1
- 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 +4 -2
- package/dist/v1/schema/analysis/class.js +1 -0
- package/dist/v1/schema/canonical/revision.d.ts +2 -1
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +2 -1
- package/dist/v1/schema/compatibility/context.d.ts +6 -2
- package/dist/v1/schema/compatibility/context.js +12 -6
- package/dist/v1/schema/compatibility/coordinate.d.ts +2 -1
- package/dist/v1/schema/compatibility/fields.d.ts +2 -0
- package/dist/v1/schema/compatibility/fields.js +1 -0
- package/dist/v1/schema/compatibility/references.js +1 -10
- package/dist/v1/schema/compatibility/report.d.ts +2 -1
- package/dist/v1/schema/compatibility/scope.d.ts +0 -4
- package/dist/v1/schema/compatibility/scope.js +1 -1
- package/dist/v1/schema/diagnostic.d.ts +1 -1
- package/dist/v1/schema/model/schema.d.ts +5 -1
- package/dist/v1/schema/normalization/domain.js +12 -6
- 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 +6 -7
- package/dist/v1/schema/resolution/origins.d.ts +1 -1
- package/dist/v1/schema/resolution/origins.js +0 -5
- package/dist/v1/schema/validation/class.js +19 -50
- package/dist/v1/schema/validation/core.js +1 -27
- package/dist/v1/schema/validation/domain.d.ts +2 -1
- package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
- package/dist/v1/schema/validation/domain.structure.js +9 -8
- package/dist/v1/schema/validation/policy/context.js +5 -16
- package/dist/v1/schema/validation/view.js +14 -9
- package/dist/value/accept.d.ts +1 -1
- package/dist/value/accept.js +32 -6
- package/dist/value/canonical.js +10 -2
- package/dist/value/immutable.optimization.d.ts +4 -1
- package/dist/value/immutable.optimization.js +8 -2
- package/dist/value/limits.d.ts +1 -1
- package/dist/value/unicode.d.ts +3 -0
- package/dist/value/unicode.js +27 -0
- package/package.json +1 -1
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type AutoEvent = 'create' | 'update';
|
|
2
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';
|
|
3
5
|
export interface PropertyAuto {
|
|
4
6
|
readonly on: readonly AutoEvent[];
|
|
5
7
|
readonly set: AutoSet;
|
|
@@ -8,6 +10,7 @@ export interface PropertyDefinition {
|
|
|
8
10
|
readonly schema: import('../../value/model/schema.js').JsonSchema;
|
|
9
11
|
readonly required: boolean;
|
|
10
12
|
readonly auto?: PropertyAuto;
|
|
13
|
+
readonly immutable?: PropertyImmutability;
|
|
11
14
|
readonly description?: string;
|
|
12
15
|
readonly state?: import('../../state/index.js').StateTopology;
|
|
13
16
|
}
|
|
@@ -45,6 +45,7 @@ export interface ResolvedClass<Kind extends ClassKind = ClassKind, Properties ex
|
|
|
45
45
|
readonly kind: Kind;
|
|
46
46
|
readonly abstract: boolean;
|
|
47
47
|
readonly definition: Definition;
|
|
48
|
+
/** Explicitly authored parents; intrinsic graph roots do not alter schema bytes. */
|
|
48
49
|
readonly extends: Parents & readonly ResolvedClass<Kind>[];
|
|
49
50
|
/** Local observation Policies; Class inheritance never contributes an attachment. */
|
|
50
51
|
readonly policies: Definition['policies'];
|
|
@@ -62,14 +63,17 @@ export interface ResolvedClass<Kind extends ClassKind = ClassKind, Properties ex
|
|
|
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
79
|
export type PropertyValueOf<Property> = Property extends ResolvedProperty<infer Value, boolean, StateTopology | undefined, unknown> ? Value : never;
|
|
@@ -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
|
+
}
|
|
@@ -21,8 +21,6 @@ export interface BlobOptions {
|
|
|
21
21
|
readonly mediaTypes?: readonly string[];
|
|
22
22
|
}
|
|
23
23
|
export declare const BLOB_VALUE_KIND: 'blob';
|
|
24
|
-
export declare const BLOB_DIGEST_PATTERN = "sha256:[0-9a-f]{64}";
|
|
25
|
-
export declare const BLOB_MEDIA_TYPE_PATTERN = "[a-z0-9!#$%&'*+.^_`|~-]+/[a-z0-9!#$%&'*+.^_`|~-]+(;[a-z0-9!#$%&'*+.^_`|~-]+=[!#$%&'*+.^_`|~0-9A-Za-z-]+)*";
|
|
26
24
|
/** Build the one canonical V1 schema shape for a blob-valued Node property. */
|
|
27
25
|
export declare function blob(options: BlobOptions): BlobSchema;
|
|
28
26
|
/** Marker recognition on an already admitted V1 value schema. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const BLOB_VALUE_KIND = 'blob';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const BLOB_DIGEST_PATTERN = 'sha256:[0-9a-f]{64}';
|
|
3
|
+
const BLOB_MEDIA_TYPE_PATTERN = "[a-z0-9!#$%&'*+.^_`|~-]+/[a-z0-9!#$%&'*+.^_`|~-]+(;[a-z0-9!#$%&'*+.^_`|~-]+=[!#$%&'*+.^_`|~0-9A-Za-z-]+)*";
|
|
4
4
|
const TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
|
|
5
5
|
const DIGEST = /^sha256:[0-9a-f]{64}$/u;
|
|
6
6
|
/** Build the one canonical V1 schema shape for a blob-valued Node property. */
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/** Exact portable UTC millisecond Instant used by the V1 value-schema dialect. */
|
|
2
|
-
/** Canonical value-language annotation for an Instant string. */
|
|
3
|
-
export declare const INSTANT_VALUE_KIND: 'instant';
|
|
4
2
|
export declare const instant: Readonly<{
|
|
5
3
|
readonly type: 'string';
|
|
6
4
|
readonly 'x-astrale-value-kind': 'instant';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Exact portable UTC millisecond Instant used by the V1 value-schema dialect. */
|
|
2
2
|
/** Canonical value-language annotation for an Instant string. */
|
|
3
|
-
|
|
3
|
+
const INSTANT_VALUE_KIND = 'instant';
|
|
4
4
|
export const instant = Object.freeze({
|
|
5
5
|
type: 'string',
|
|
6
6
|
'x-astrale-value-kind': INSTANT_VALUE_KIND,
|
|
@@ -21,5 +21,6 @@ export interface PathAnnotation {
|
|
|
21
21
|
readonly cardinality: 'one';
|
|
22
22
|
readonly accepts: readonly ClassRef[];
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
declare const VALUE_SCHEMA_CONTEXTS: readonly ['property-facet', 'callable-input', 'callable-output'];
|
|
25
25
|
export type ValueSchemaContext = (typeof VALUE_SCHEMA_CONTEXTS)[number];
|
|
26
|
+
export {};
|
|
@@ -4,8 +4,4 @@ export const JSON_SCHEMA_DIALECT = 'https://json-schema.org/draft/2020-12/schema
|
|
|
4
4
|
export const VALUE_SCHEMA_DIALECT = 'https://schemas.astrale.ai/dsl/v1/value-schema';
|
|
5
5
|
/** Required vocabulary carried by the V1 value-schema dialect. */
|
|
6
6
|
export const VALUE_SCHEMA_VOCABULARY = 'https://schemas.astrale.ai/dsl/v1/value-schema/vocabulary';
|
|
7
|
-
|
|
8
|
-
'property-facet',
|
|
9
|
-
'callable-input',
|
|
10
|
-
'callable-output',
|
|
11
|
-
];
|
|
7
|
+
const VALUE_SCHEMA_CONTEXTS = ['property-facet', 'callable-input', 'callable-output'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClassRef } from '../../../addressing/index.js';
|
|
2
2
|
import type { JsonSchema } from '../model/schema.js';
|
|
3
|
-
|
|
3
|
+
interface ValueSchemaDependency {
|
|
4
4
|
readonly origin: string;
|
|
5
5
|
readonly revision: `sha256:${string}`;
|
|
6
6
|
}
|
|
@@ -22,3 +22,4 @@ export interface ValueSchemaRegistry {
|
|
|
22
22
|
readonly transitiveDependencies: readonly ValueSchemaDomainRegistry[];
|
|
23
23
|
readonly graphNodePath: JsonSchema;
|
|
24
24
|
}
|
|
25
|
+
export {};
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* parser's bounds on length, nesting and counts; `states` when its machine would exceed the state
|
|
4
4
|
* budget.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
type IRegexpRefusal = 'syntax' | 'states';
|
|
7
7
|
/** The refusal of one source, through the same AST and state count as compilation. */
|
|
8
8
|
export declare function refuseIRegexp(source: string): IRegexpRefusal | undefined;
|
|
9
9
|
/** Complete RFC 9485 syntax admission, within the implementation limits RFC 9485 §8 allows. */
|
|
10
10
|
export declare function isIRegexp(source: string): boolean;
|
|
11
11
|
/** The authoring explanation of a `states` refusal of `subject` (`pattern`, `fullMatch`, ...). */
|
|
12
12
|
export declare function stateBudgetMessage(subject: string): string;
|
|
13
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DefinitionBase, ViewRef } from '../../../addressing/index.js';
|
|
2
|
+
/** Every View targets its owning Domain. */
|
|
2
3
|
export type ViewTarget = {
|
|
3
4
|
readonly kind: 'domain';
|
|
4
|
-
} | {
|
|
5
|
-
readonly kind: 'definition';
|
|
6
|
-
readonly definitions: readonly [ClassRef, ...ClassRef[]];
|
|
7
5
|
};
|
|
8
6
|
export interface ViewDefinition extends DefinitionBase<ViewRef> {
|
|
9
7
|
readonly description?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DefinitionKey, ViewRef } from '../../addressing/index.js';
|
|
2
|
-
import type { ViewDefinition
|
|
2
|
+
import type { ViewDefinition } from './model/view.js';
|
|
3
|
+
/** One resolved View of its owning Domain. A View has no Class or Node target. */
|
|
3
4
|
export interface ResolvedView {
|
|
4
5
|
readonly ref: ViewRef;
|
|
5
6
|
readonly key: DefinitionKey<string, 'view'>;
|
|
6
|
-
readonly target: ViewTarget;
|
|
7
7
|
readonly description?: ViewDefinition['description'];
|
|
8
8
|
readonly definition: ViewDefinition;
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@ import type { ClassRef } from '../../addressing/index.js';
|
|
|
2
2
|
import type { MethodDefinition } from '../../language/callable/model/callable.js';
|
|
3
3
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
4
4
|
import type { DataDefinition } from '../../language/class/model/data.js';
|
|
5
|
-
import type { PropertyAuto } from '../../language/class/model/property.js';
|
|
5
|
+
import type { PropertyAuto, PropertyImmutability } from '../../language/class/model/property.js';
|
|
6
6
|
import type { StateTopology } from '../../language/state/index.js';
|
|
7
7
|
import type { JsonSchema } from '../../language/value/model/schema.js';
|
|
8
8
|
import type { SchemaDiagnostic } from '../diagnostic.js';
|
|
@@ -16,6 +16,7 @@ export interface EffectiveField {
|
|
|
16
16
|
readonly schema: JsonSchema;
|
|
17
17
|
readonly required: boolean;
|
|
18
18
|
readonly auto?: PropertyAuto;
|
|
19
|
+
readonly immutable?: PropertyImmutability;
|
|
19
20
|
readonly state?: StateTopology;
|
|
20
21
|
}
|
|
21
22
|
export interface EffectiveMethod {
|
|
@@ -24,7 +25,7 @@ export interface EffectiveMethod {
|
|
|
24
25
|
readonly name: string;
|
|
25
26
|
readonly declaration: MethodDefinition;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
interface EffectiveData {
|
|
28
29
|
readonly identity: string;
|
|
29
30
|
readonly owner: ClassRef;
|
|
30
31
|
readonly declaration: DataDefinition;
|
|
@@ -67,3 +68,4 @@ export declare function methodSignature(value: MethodDefinition): {
|
|
|
67
68
|
durable: boolean;
|
|
68
69
|
} | undefined;
|
|
69
70
|
};
|
|
71
|
+
export {};
|
|
@@ -63,6 +63,7 @@ function ownFields(owner, declaration) {
|
|
|
63
63
|
schema: property.schema,
|
|
64
64
|
required: property.required,
|
|
65
65
|
...(property.auto === undefined ? {} : { auto: property.auto }),
|
|
66
|
+
...(property.immutable === undefined ? {} : { immutable: property.immutable }),
|
|
66
67
|
...(property.state === undefined ? {} : { state: property.state }),
|
|
67
68
|
});
|
|
68
69
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Revision } from '../../addressing/index.js';
|
|
2
2
|
import { type DomainSchema, type DomainSchemaIR } from '../model/schema.js';
|
|
3
|
-
|
|
3
|
+
interface CanonicalDomainSchema {
|
|
4
4
|
readonly schema: DomainSchema;
|
|
5
5
|
readonly bytes: Uint8Array;
|
|
6
6
|
readonly revision: Revision;
|
|
@@ -9,3 +9,4 @@ export declare function canonicalDomainSchema(value: DomainSchema): CanonicalDom
|
|
|
9
9
|
/** Internal acceptance seam. The caller must establish whole-Domain validity first. */
|
|
10
10
|
export declare function canonicalDomainSchemaAfterValidation(value: DomainSchemaIR): CanonicalDomainSchema;
|
|
11
11
|
export declare function revisionOfDomainSchema(schema: DomainSchema): Revision;
|
|
12
|
+
export {};
|
|
@@ -6,7 +6,7 @@ import type { ClassCoordinate } from '../coordinate.js';
|
|
|
6
6
|
import type { DependencyMeaningLevel } from '../fields.js';
|
|
7
7
|
import type { Report } from '../report.js';
|
|
8
8
|
import type { ComparisonContext, SubjectPair } from '../scope.js';
|
|
9
|
-
|
|
9
|
+
interface ClassRequirement {
|
|
10
10
|
readonly ancestors: readonly SemanticKey[];
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -44,3 +44,4 @@ export declare function compareAddedProperties({ context, pair, report, }: {
|
|
|
44
44
|
readonly pair: SubjectPair;
|
|
45
45
|
readonly report: Report;
|
|
46
46
|
}): void;
|
|
47
|
+
export {};
|
|
@@ -2,11 +2,15 @@ import type { ClassRef, DefinitionRef, Key as SemanticKey } from '../../addressi
|
|
|
2
2
|
import type { DefinitionAnalysis, EffectiveMethod } from '../analysis/class.js';
|
|
3
3
|
import type { DomainSchema } from '../model/schema.js';
|
|
4
4
|
import { SchemaError } from '../diagnostic.js';
|
|
5
|
-
/** One accepted root with its exact closure and a memoized
|
|
5
|
+
/** One accepted root with its exact closure and a memoized Definition analysis per owner. */
|
|
6
6
|
export interface Context {
|
|
7
7
|
readonly schemas: ReadonlyMap<string, DomainSchema>;
|
|
8
|
-
analysis(owner: DomainSchema): ReadonlyMap<string, DefinitionAnalysis
|
|
8
|
+
analysis(owner: DomainSchema): ReadonlyMap<string, DefinitionAnalysis>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Every owner passed acceptance against the closure it retains, which is the only way a schema
|
|
12
|
+
* gets one, so its analysis is derived without validating it again.
|
|
13
|
+
*/
|
|
10
14
|
export declare function contextOf(root: DomainSchema): Context;
|
|
11
15
|
export declare function effectiveDefinition(context: Context, owner: DomainSchema, ref: ClassRef): DefinitionAnalysis | undefined;
|
|
12
16
|
/** Effective Methods are keyed by name; a coordinate names one by its exact Method Key. */
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { MethodKey } from '../../addressing/index.js';
|
|
2
2
|
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
|
+
import { analyzeDefinitions } from '../analysis/class.js';
|
|
3
4
|
import { SchemaError, diagnostic } from '../diagnostic.js';
|
|
4
5
|
import { knownDomainClosure, lookupForDomainClosure } from '../resolution/closure.js';
|
|
5
|
-
import {
|
|
6
|
+
import { buildDomainResolutionContext } from '../resolution/context.js';
|
|
7
|
+
/**
|
|
8
|
+
* Every owner passed acceptance against the closure it retains, which is the only way a schema
|
|
9
|
+
* gets one, so its analysis is derived without validating it again.
|
|
10
|
+
*/
|
|
6
11
|
export function contextOf(root) {
|
|
7
12
|
const schemas = new Map([
|
|
8
13
|
[root.origin, root],
|
|
@@ -12,16 +17,17 @@ export function contextOf(root) {
|
|
|
12
17
|
return {
|
|
13
18
|
schemas,
|
|
14
19
|
analysis(owner) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
let definitions = analyses.get(owner);
|
|
21
|
+
if (definitions === undefined) {
|
|
22
|
+
definitions = analyzeDefinitions(buildDomainResolutionContext(owner, lookupForDomainClosure(owner))).definitions;
|
|
23
|
+
analyses.set(owner, definitions);
|
|
18
24
|
}
|
|
19
|
-
return
|
|
25
|
+
return definitions;
|
|
20
26
|
},
|
|
21
27
|
};
|
|
22
28
|
}
|
|
23
29
|
export function effectiveDefinition(context, owner, ref) {
|
|
24
|
-
return context.analysis(owner)
|
|
30
|
+
return context.analysis(owner).get(definitionRefIndex(ref));
|
|
25
31
|
}
|
|
26
32
|
/** Effective Methods are keyed by name; a coordinate names one by its exact Method Key. */
|
|
27
33
|
export function effectiveMethod(analysis, key) {
|
|
@@ -29,7 +29,7 @@ export declare function memberCoordinate(ref: MemberRef): MemberCoordinate;
|
|
|
29
29
|
export declare function propertyCoordinate(owner: ClassRef, name: string): PropertyCoordinate;
|
|
30
30
|
export declare function methodCoordinate(owner: ClassRef, name: string): MethodCoordinate;
|
|
31
31
|
export declare function keyForDefinitionRef(ref: DefinitionRef): SemanticKey;
|
|
32
|
-
|
|
32
|
+
interface ParsedKeyReference {
|
|
33
33
|
readonly kind: Definition.Kind;
|
|
34
34
|
readonly name: string;
|
|
35
35
|
readonly member?: 'property' | 'method';
|
|
@@ -37,3 +37,4 @@ export interface ParsedKeyReference {
|
|
|
37
37
|
}
|
|
38
38
|
/** Interpret one canonical V1 Key as a Definition or a Class member location. */
|
|
39
39
|
export declare function keyReference(key: SemanticKey): ParsedKeyReference;
|
|
40
|
+
export {};
|
|
@@ -43,6 +43,7 @@ export declare const PROPERTY_FIELDS: Readonly<{
|
|
|
43
43
|
schema: "always";
|
|
44
44
|
required: "always";
|
|
45
45
|
auto: "always";
|
|
46
|
+
immutable: "always";
|
|
46
47
|
state: "always";
|
|
47
48
|
description: Readonly<{
|
|
48
49
|
excluded: 'annotation';
|
|
@@ -132,6 +133,7 @@ export declare const FIELD_ROLES: Readonly<{
|
|
|
132
133
|
schema: "always";
|
|
133
134
|
required: "always";
|
|
134
135
|
auto: "always";
|
|
136
|
+
immutable: "always";
|
|
135
137
|
state: "always";
|
|
136
138
|
description: Readonly<{
|
|
137
139
|
excluded: 'annotation';
|
|
@@ -46,11 +46,6 @@ export function rootReferences(schema) {
|
|
|
46
46
|
collectCallableRefs(declaration, collector(schema, result, keyForDefinitionRef(declaration.ref)));
|
|
47
47
|
for (const declaration of Object.values(schema.policies))
|
|
48
48
|
collectPolicyDefinitionRefs(declaration, collector(schema, result, keyForDefinitionRef(declaration.ref)));
|
|
49
|
-
for (const declaration of Object.values(schema.views))
|
|
50
|
-
if (declaration.target.kind === 'definition') {
|
|
51
|
-
const add = collector(schema, result, keyForDefinitionRef(declaration.ref));
|
|
52
|
-
declaration.target.definitions.forEach((ref) => add(ref, 'view'));
|
|
53
|
-
}
|
|
54
49
|
collectCoreRefs(schema, collector(schema, result));
|
|
55
50
|
return result;
|
|
56
51
|
}
|
|
@@ -127,12 +122,8 @@ export function memberReferences(subject) {
|
|
|
127
122
|
case 'policy':
|
|
128
123
|
collectPolicyDefinitionRefs(schema.policies[ref.name], add);
|
|
129
124
|
break;
|
|
130
|
-
case 'view':
|
|
131
|
-
const view = schema.views[ref.name];
|
|
132
|
-
if (view.target.kind === 'definition')
|
|
133
|
-
view.target.definitions.forEach((ref) => add(ref, 'view'));
|
|
125
|
+
case 'view':
|
|
134
126
|
break;
|
|
135
|
-
}
|
|
136
127
|
case 'core': {
|
|
137
128
|
add(schema.core.nodes[ref.name].class, 'endpoint');
|
|
138
129
|
for (const edge of schema.core.edges) {
|
|
@@ -2,7 +2,7 @@ import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
|
2
2
|
import type { Assessment, ComparisonEntry, Facet } from './model.js';
|
|
3
3
|
import type { Reference } from './references.js';
|
|
4
4
|
import type { SubjectPair } from './scope.js';
|
|
5
|
-
|
|
5
|
+
interface ComparisonFact {
|
|
6
6
|
readonly pair: SubjectPair;
|
|
7
7
|
readonly facet: Facet;
|
|
8
8
|
readonly before?: Value;
|
|
@@ -24,3 +24,4 @@ export declare function createReport(): {
|
|
|
24
24
|
export type Report = ReturnType<typeof createReport>;
|
|
25
25
|
/** Full comparison merges facts; it never reclassifies the two analyses' conclusions. */
|
|
26
26
|
export declare function mergeEntries(...groups: readonly (readonly ComparisonEntry[])[]): readonly ComparisonEntry[];
|
|
27
|
+
export {};
|
|
@@ -34,7 +34,3 @@ export declare function prepare(request: ComparisonRequest): ComparisonContext;
|
|
|
34
34
|
* of a version that may declare none.
|
|
35
35
|
*/
|
|
36
36
|
export declare function selectMembers(source: DomainSchema, target: DomainSchema, keys: readonly Key[]): ComparisonContext;
|
|
37
|
-
export declare function retainedContext(dependent: DomainSchema, origin: Key.Origin, path: '/target/origin' | '/origin'): {
|
|
38
|
-
source: DomainSchema;
|
|
39
|
-
context: Context;
|
|
40
|
-
};
|
|
@@ -99,7 +99,7 @@ function comparisonContext({ kind, source, target, dependent, before, roots, cap
|
|
|
99
99
|
},
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
function retainedContext(dependent, origin, path) {
|
|
103
103
|
resolve(dependent);
|
|
104
104
|
const source = (knownDomainClosure(dependent) ?? []).find((entry) => entry.schema.origin === origin)?.schema;
|
|
105
105
|
if (source === undefined)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SchemaDiagnosticCode = 'DM_CAPABILITY_INVALID' | 'DM_MEMBER_ROOT_INVALID' | 'DM_DEPENDENCY_CONTEXT_INVALID' | 'DM_DEPENDENCY_NOT_RETAINED' | 'DM_MEANING_INCONSISTENT' | 'DM_MEMBER_ORIGIN_MISMATCH' | 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CALLABLE_POLICY_AUTH' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_CONSTRAINT' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNDIRECTED' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_COMPOSITION' | '
|
|
1
|
+
export type SchemaDiagnosticCode = 'DM_CAPABILITY_INVALID' | 'DM_MEMBER_ROOT_INVALID' | 'DM_DEPENDENCY_CONTEXT_INVALID' | 'DM_DEPENDENCY_NOT_RETAINED' | 'DM_MEANING_INCONSISTENT' | 'DM_MEMBER_ORIGIN_MISMATCH' | 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CALLABLE_POLICY_AUTH' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_CONSTRAINT' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNDIRECTED' | 'DV_ENTRYPOINT' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_COMPOSITION' | 'DV_PROPERTY_IMMUTABLE' | 'DV_PROPERTY_STATE' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_ABSTRACT_POLICY' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_INVALID' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_MULTIPLE' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
|
|
2
2
|
export interface SchemaDiagnostic<out Code extends SchemaDiagnosticCode = SchemaDiagnosticCode> {
|
|
3
3
|
readonly code: Code;
|
|
4
4
|
readonly pointer: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Key } from '../../addressing/index.js';
|
|
2
|
-
import type { DomainDependencyMap } from '../../addressing/index.js';
|
|
2
|
+
import type { DomainDependencyMap, ViewRef } from '../../addressing/index.js';
|
|
3
3
|
import type { Domain, DomainOfSource, DomainSource } from '../../domain/model/domain.js';
|
|
4
4
|
import type { FunctionDefinition } from '../../language/callable/model/callable.js';
|
|
5
5
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
@@ -10,6 +10,10 @@ export interface DomainSchemaIR {
|
|
|
10
10
|
readonly format: 'astrale.dsl';
|
|
11
11
|
readonly version: 'v1';
|
|
12
12
|
readonly origin: Key.Origin;
|
|
13
|
+
/** Human-facing display name of the Domain, projected as its Domain Node `name`. */
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** The one View this Domain opens by default, projected as its `entrypoint` Edge. */
|
|
16
|
+
readonly entrypoint?: ViewRef;
|
|
13
17
|
readonly dependencies: DomainDependencyMap;
|
|
14
18
|
readonly classes: Readonly<Record<string, ClassDefinition>>;
|
|
15
19
|
readonly functions: Readonly<Record<string, FunctionDefinition>>;
|
|
@@ -13,6 +13,16 @@ export function normalizeDomainSchema(schema) {
|
|
|
13
13
|
format: 'astrale.dsl',
|
|
14
14
|
version: 'v1',
|
|
15
15
|
origin: schema.origin,
|
|
16
|
+
name: schema.name,
|
|
17
|
+
...(schema.entrypoint === undefined
|
|
18
|
+
? {}
|
|
19
|
+
: {
|
|
20
|
+
entrypoint: {
|
|
21
|
+
origin: schema.entrypoint.origin,
|
|
22
|
+
kind: 'view',
|
|
23
|
+
name: schema.entrypoint.name,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
16
26
|
dependencies: mapRecord(schema.dependencies, (dependency) => ({ ...dependency })),
|
|
17
27
|
classes,
|
|
18
28
|
functions: mapRecord(schema.functions, canonicalizeFunction),
|
|
@@ -42,12 +52,7 @@ function canonicalizeView(value) {
|
|
|
42
52
|
return {
|
|
43
53
|
ref: value.ref,
|
|
44
54
|
...withDescription(value),
|
|
45
|
-
target:
|
|
46
|
-
? { kind: 'domain' }
|
|
47
|
-
: {
|
|
48
|
-
kind: 'definition',
|
|
49
|
-
definitions: [...value.target.definitions].sort(compareDefinitionRefs),
|
|
50
|
-
},
|
|
55
|
+
target: { kind: 'domain' },
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
58
|
function canonicalizeClass(value) {
|
|
@@ -142,6 +147,7 @@ function canonicalizeProperty(value) {
|
|
|
142
147
|
set: value.auto.set,
|
|
143
148
|
},
|
|
144
149
|
}),
|
|
150
|
+
...(value.immutable === undefined ? {} : { immutable: value.immutable }),
|
|
145
151
|
...(value.description === undefined ? {} : { description: value.description }),
|
|
146
152
|
...(value.state === undefined
|
|
147
153
|
? {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassRef
|
|
1
|
+
import type { ClassRef } from '../../addressing/index.js';
|
|
2
2
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
3
3
|
import type { DomainSchemaIR } from '../model/schema.js';
|
|
4
4
|
/** One exact Class declaration resolved within the retained Domain closure. */
|
|
@@ -18,4 +18,3 @@ export type IndexedClassDefinition = {
|
|
|
18
18
|
}>;
|
|
19
19
|
};
|
|
20
20
|
export declare function indexSchemaDefinitions(schema: DomainSchemaIR): ReadonlyMap<string, IndexedClassDefinition>;
|
|
21
|
-
export declare function resolveIndexedReference(indexes: ReadonlyMap<string, IndexedClassDefinition>, ref: DefinitionRef): IndexedClassDefinition | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { SourceDomain } from '../../domain/model/domain.js';
|
|
2
2
|
import type { DomainSchema } from '../model/schema.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Resolve one accepted Schema through its exact retained source closure. Acceptance validated it
|
|
5
|
+
* against that closure, which is the only way a Schema retains one, so it is not validated again.
|
|
6
|
+
*/
|
|
4
7
|
export declare function resolve<const S extends DomainSchema>(schema: S): SourceDomain<S>;
|
|
@@ -9,12 +9,14 @@ import { validateValueProgram } from '../../language/value/evaluate/program.js';
|
|
|
9
9
|
import { validateJsonInstance, validatePreparedInstance, } from '../../language/value/evaluate/validate.js';
|
|
10
10
|
import { classifyPreparedOrdering } from '../../language/value/ordering.js';
|
|
11
11
|
import { revisionOfDomainSchema } from '../canonical/revision.js';
|
|
12
|
-
import { SchemaError } from '../diagnostic.js';
|
|
13
|
-
import { validateDomainSchemaSemantics } from '../validation/domain.js';
|
|
14
12
|
import { lookupForDomainClosure } from './closure.js';
|
|
13
|
+
import { buildDomainResolutionContext } from './context.js';
|
|
15
14
|
import { createDomainValueSchemaRegistry } from './value.registry.js';
|
|
16
15
|
const resolvedSchemas = new WeakMap();
|
|
17
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Resolve one accepted Schema through its exact retained source closure. Acceptance validated it
|
|
18
|
+
* against that closure, which is the only way a Schema retains one, so it is not validated again.
|
|
19
|
+
*/
|
|
18
20
|
export function resolve(schema) {
|
|
19
21
|
const cached = resolvedSchemas.get(schema);
|
|
20
22
|
if (cached !== undefined)
|
|
@@ -24,10 +26,7 @@ export function resolve(schema) {
|
|
|
24
26
|
return resolved;
|
|
25
27
|
}
|
|
26
28
|
function resolveWithLookup(schema, lookup) {
|
|
27
|
-
const
|
|
28
|
-
if (validation.diagnostics.length > 0)
|
|
29
|
-
throw new SchemaError(validation.diagnostics);
|
|
30
|
-
const closure = [schema, ...validation.context.dependencies.values()];
|
|
29
|
+
const closure = [schema, ...buildDomainResolutionContext(schema, lookup).dependencies.values()];
|
|
31
30
|
const registries = new Map(closure.map((owner) => [owner.origin, createDomainValueSchemaRegistry(owner, lookup)]));
|
|
32
31
|
const input = {
|
|
33
32
|
root: Object.freeze({
|
|
@@ -10,7 +10,7 @@ import type { DomainSchemaIR } from '../model/schema.js';
|
|
|
10
10
|
* instantiates the Definition; every other site only refers to it. `pattern` is the Edge Class a
|
|
11
11
|
* Policy pattern matches, whose orientation and accepted endpoint Classes Policy typing reads.
|
|
12
12
|
*/
|
|
13
|
-
export type ReferenceSite = 'extends' | 'endpoint' | 'value' | 'policy' | 'pattern' | '
|
|
13
|
+
export type ReferenceSite = 'extends' | 'endpoint' | 'value' | 'policy' | 'pattern' | 'core';
|
|
14
14
|
/**
|
|
15
15
|
* What a site names: a Definition, or the Class-owned Method a Policy object term names. A Policy
|
|
16
16
|
* keeps the Method itself, since it resolves that Method's own executable declaration; a collector
|
|
@@ -25,11 +25,6 @@ export function collectDomainDefinitionRefs(schema) {
|
|
|
25
25
|
for (const declaration of Object.values(schema.policies)) {
|
|
26
26
|
collectPolicyDefinitionRefs(declaration, add);
|
|
27
27
|
}
|
|
28
|
-
for (const declaration of Object.values(schema.views)) {
|
|
29
|
-
if (declaration.target.kind === 'definition') {
|
|
30
|
-
declaration.target.definitions.forEach((ref) => add(ref, 'view'));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
28
|
collectCoreRefs(schema, add);
|
|
34
29
|
return Object.freeze([...result.values()].sort(compareDefinitionRefs));
|
|
35
30
|
}
|