@astrale-os/kernel-dsl 1.0.0-beta.11 → 1.0.0-beta.13
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/definition-ref.js +21 -37
- package/dist/v1/addressing/ordering.d.ts +2 -0
- package/dist/v1/addressing/ordering.js +4 -0
- package/dist/v1/addressing/patterns.d.ts +0 -1
- package/dist/v1/addressing/patterns.js +0 -5
- package/dist/v1/builder/callable/authoring.d.ts +1 -1
- package/dist/v1/builder/class/authoring.d.ts +6 -256
- package/dist/v1/builder/class/authoring.js +5 -28
- package/dist/v1/builder/class/handle.d.ts +27 -0
- package/dist/v1/builder/class/handle.js +1 -0
- package/dist/v1/builder/class/input.d.ts +129 -0
- package/dist/v1/builder/class/projection.d.ts +129 -0
- package/dist/v1/builder/class/projection.js +1 -0
- package/dist/v1/builder/core/authoring.d.ts +1 -1
- package/dist/v1/builder/index.d.ts +3 -1
- package/dist/v1/builder/lowering/class.d.ts +1 -1
- package/dist/v1/builder/lowering/schema/context.d.ts +2 -1
- package/dist/v1/builder/lowering/schema/context.js +2 -4
- package/dist/v1/builder/lowering/value/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +1 -3
- package/dist/v1/builder/policy/authoring.d.ts +1 -1
- package/dist/v1/builder/schema/define.d.ts +0 -1
- package/dist/v1/builder/schema/diagnostic.d.ts +2 -1
- package/dist/v1/builder/schema/diagnostic.js +5 -10
- package/dist/v1/builder/schema/input.d.ts +1 -1
- package/dist/v1/builder/schema/projection/class.d.ts +2 -1
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/identity.d.ts +2 -1
- package/dist/v1/builder/schema/projection/property.d.ts +1 -1
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- package/dist/v1/builder/value/full-match.d.ts +0 -1
- package/dist/v1/builder/value/full-match.js +0 -1
- package/dist/v1/builder/value/path-metadata.d.ts +1 -1
- package/dist/v1/builder/value/path.d.ts +1 -1
- package/dist/v1/bundle/codec.js +2 -4
- package/dist/v1/bundle/diagnostic.js +3 -7
- package/dist/v1/bundle/structure.js +2 -4
- package/dist/v1/compiled/admission/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/admission/diagnostic.js +1 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +6 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +4 -8
- package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
- package/dist/v1/compiled/admission/semantics/core.js +54 -34
- package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
- package/dist/v1/compiled/admission/semantics/edge.js +6 -65
- package/dist/v1/compiled/admission/semantics/policy/callable.js +0 -2
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
- package/dist/v1/compiled/admission/semantics/policy/parity.js +13 -22
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +4 -16
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
- package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
- package/dist/v1/compiled/compiler/compile.js +6 -8
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +10 -44
- package/dist/v1/domain/create.js +3 -5
- package/dist/v1/domain/namespace/member-collection.js +4 -6
- package/dist/v1/domain/validation/create.d.ts +0 -1
- package/dist/v1/domain/validation/create.js +0 -35
- package/dist/v1/language/class/inheritance.d.ts +18 -0
- package/dist/v1/language/class/inheritance.js +73 -0
- package/dist/v1/language/class/property-values.js +2 -4
- package/dist/v1/language/core/facts.d.ts +72 -0
- package/dist/v1/language/core/facts.js +95 -0
- package/dist/v1/language/index.d.ts +1 -0
- package/dist/v1/language/index.js +1 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +2 -1
- package/dist/v1/language/policy/analysis/budgets.d.ts +13 -1
- package/dist/v1/language/policy/analysis/budgets.js +104 -0
- package/dist/v1/language/policy/analysis/typing.d.ts +48 -0
- package/dist/v1/language/policy/analysis/typing.js +338 -0
- package/dist/v1/language/validation/diagnostic.d.ts +15 -1
- package/dist/v1/language/validation/diagnostic.js +21 -0
- package/dist/v1/language/value/compile/fields.js +4 -8
- package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
- package/dist/v1/language/value/inclusion/arrays.js +85 -0
- package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
- package/dist/v1/language/value/inclusion/assertions.js +29 -0
- package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
- package/dist/v1/language/value/inclusion/combinators.js +67 -0
- package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
- package/dist/v1/language/value/inclusion/equivalence.js +74 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +138 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +17 -0
- package/dist/v1/language/value/inclusion/includes.js +25 -719
- package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
- package/dist/v1/language/value/inclusion/keywords.js +31 -0
- package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
- package/dist/v1/language/value/inclusion/kinds.js +57 -0
- package/dist/v1/language/value/inclusion/location.d.ts +24 -0
- package/dist/v1/language/value/inclusion/location.js +63 -0
- package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
- package/dist/v1/language/value/inclusion/numbers.js +41 -0
- package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
- package/dist/v1/language/value/inclusion/objects.js +190 -0
- package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
- package/dist/v1/language/value/inclusion/strings.js +29 -0
- package/dist/v1/language/value/inclusion/types.d.ts +3 -0
- package/dist/v1/language/value/inclusion/types.js +11 -0
- package/dist/v1/language/value/ordering.d.ts +9 -0
- package/dist/v1/language/value/ordering.js +72 -9
- package/dist/v1/language/value/profile/rules.js +5 -7
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/reference/recursion.js +2 -22
- package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
- package/dist/v1/language/value/syntax/pointer.js +5 -2
- package/dist/v1/language/value/syntax/walk.d.ts +2 -0
- package/dist/v1/language/value/syntax/walk.js +19 -20
- package/dist/v1/schema/compatibility/diff.js +2 -4
- package/dist/v1/schema/compatibility/meaning/footprint.js +16 -50
- package/dist/v1/schema/compatibility/structure/requirements.js +26 -58
- package/dist/v1/schema/compatibility/walk.d.ts +17 -0
- package/dist/v1/schema/compatibility/walk.js +41 -0
- package/dist/v1/schema/diagnostic.js +3 -11
- package/dist/v1/schema/resolution/context.js +3 -5
- package/dist/v1/schema/validation/callable.js +3 -5
- package/dist/v1/schema/validation/class.js +10 -52
- package/dist/v1/schema/validation/core.js +65 -199
- package/dist/v1/schema/validation/domain.js +1 -10
- package/dist/v1/schema/validation/domain.structure.js +2 -4
- package/dist/v1/schema/validation/policy/budgets.js +5 -112
- package/dist/v1/schema/validation/policy/context.d.ts +5 -3
- package/dist/v1/schema/validation/policy/context.js +5 -3
- package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
- package/dist/v1/schema/validation/policy/objects.js +6 -14
- package/dist/v1/schema/validation/policy/references.js +5 -6
- package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
- package/dist/v1/schema/validation/policy/typing.js +22 -356
- package/dist/v1/schema/validation/policy/uses.d.ts +1 -1
- package/dist/v1/schema/validation/policy/uses.js +9 -22
- package/dist/v1/schema/validation/policy/validate.js +3 -2
- package/dist/v1/schema/validation/value-api.d.ts +9 -0
- package/dist/v1/schema/validation/value-api.js +23 -1
- package/dist/v1/schema/validation/value.js +5 -7
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/canonical.d.ts +3 -2
- package/dist/value/canonical.js +30 -6
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/index.d.ts +1 -1
- package/dist/value/json.d.ts +1 -1
- package/dist/value/json.js +1 -1
- package/dist/value/types.d.ts +6 -0
- package/dist/value/unicode.d.ts +2 -1
- package/dist/value/unicode.js +2 -0
- package/package.json +1 -1
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
- package/dist/v1/compiled/admission/semantics/cardinality.js +0 -128
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
- package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
- package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
- package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
- package/dist/v1/language/class/index.d.ts +0 -8
- package/dist/v1/language/class/index.js +0 -1
- package/dist/v1/language/core/index.d.ts +0 -2
- package/dist/v1/language/value/index.d.ts +0 -11
- package/dist/v1/language/value/index.js +0 -8
- /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { ResolvedMethod } from '../../language/callable/resolved.js';
|
|
2
|
+
import type { ResolvedProperty } from '../../language/class/resolved.js';
|
|
3
|
+
import type { StateTopology } from '../../language/state/topology.js';
|
|
4
|
+
import type { Method } from '../callable/authoring.js';
|
|
5
|
+
import type { DirectedEdgeClass, NodeClass, UndirectedEdgeClass } from './handle.js';
|
|
6
|
+
/** Compact type of one authored Property: values, requiredness, name, owner and state. */
|
|
7
|
+
export interface AuthoredPropertyProjection<out Input = unknown, out Output = unknown, out Required extends boolean = boolean, out Name extends string = string, out Owner = 'self', out State extends StateTopology | undefined = StateTopology | undefined> {
|
|
8
|
+
readonly input: Input;
|
|
9
|
+
readonly output: Output;
|
|
10
|
+
readonly required: Required;
|
|
11
|
+
readonly name: Name;
|
|
12
|
+
readonly owner: Owner;
|
|
13
|
+
readonly state?: State;
|
|
14
|
+
}
|
|
15
|
+
/** Compact type of one authored Method with its name and owner. */
|
|
16
|
+
export interface AuthoredMethodProjection<out Value extends Method = Method, out Name extends string = string, out Owner = 'self'> {
|
|
17
|
+
readonly value: Value;
|
|
18
|
+
readonly name: Name;
|
|
19
|
+
readonly owner: Owner;
|
|
20
|
+
}
|
|
21
|
+
/** Give `Owner` to every Property projection still owned by `self`. */
|
|
22
|
+
export type BindPropertyOwners<Entries, Owner> = Entries extends AuthoredPropertyProjection<infer Input, infer Output, infer Required, infer Name, infer ExistingOwner, infer State> ? AuthoredPropertyProjection<Input, Output, Required, Name, ExistingOwner extends 'self' ? Owner : ExistingOwner, State> : Entries;
|
|
23
|
+
/** Give `Owner` to every Method projection still owned by `self`. */
|
|
24
|
+
export type BindMethodOwners<Entries, Owner> = Entries extends AuthoredMethodProjection<infer Value, infer Name, infer ExistingOwner> ? AuthoredMethodProjection<Value, Name, ExistingOwner extends 'self' ? Owner : ExistingOwner> : Entries;
|
|
25
|
+
/** Kind and structural identity of an authored Class. */
|
|
26
|
+
export interface ClassIdentityProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown> {
|
|
27
|
+
readonly kind: Kind;
|
|
28
|
+
readonly identity: Identity;
|
|
29
|
+
}
|
|
30
|
+
/** An authored Class as the owner its Properties and Methods name. */
|
|
31
|
+
export interface ClassOwnerProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown, out Properties = unknown, out InstanceMethods = unknown, out StaticMethods = unknown> extends ClassIdentityProjection<Kind, Identity> {
|
|
32
|
+
readonly properties: Properties;
|
|
33
|
+
readonly instanceMethods: InstanceMethods;
|
|
34
|
+
readonly staticMethods: StaticMethods;
|
|
35
|
+
}
|
|
36
|
+
/** An authored Class as a reference, with its effective Properties and Methods. */
|
|
37
|
+
export interface ClassReferenceProjection<out Kind extends 'node' | 'edge' = 'node' | 'edge', out Identity = unknown, out EffectiveProperties = AuthoredPropertyProjection, out EffectiveInstanceMethods = unknown, out EffectiveStaticMethods = unknown> extends ClassIdentityProjection<Kind, Identity> {
|
|
38
|
+
readonly effectiveProperties: EffectiveProperties;
|
|
39
|
+
readonly effectiveInstanceMethods: EffectiveInstanceMethods;
|
|
40
|
+
readonly effectiveStaticMethods: EffectiveStaticMethods;
|
|
41
|
+
}
|
|
42
|
+
type NodeClassIdentity<Config> = Config extends {
|
|
43
|
+
readonly abstract: infer Abstract;
|
|
44
|
+
readonly depth: infer Depth;
|
|
45
|
+
readonly properties: infer Properties;
|
|
46
|
+
readonly methods: infer Methods;
|
|
47
|
+
} ? {
|
|
48
|
+
readonly abstract: Abstract;
|
|
49
|
+
readonly depth: Depth;
|
|
50
|
+
readonly properties: Properties;
|
|
51
|
+
readonly methods: Methods;
|
|
52
|
+
} : never;
|
|
53
|
+
type DirectedEdgeClassIdentity<Config> = Config extends {
|
|
54
|
+
readonly abstract: infer Abstract;
|
|
55
|
+
readonly depth: infer Depth;
|
|
56
|
+
readonly properties: infer Properties;
|
|
57
|
+
readonly source: infer Source;
|
|
58
|
+
readonly target: infer Target;
|
|
59
|
+
readonly constraints: infer Constraints;
|
|
60
|
+
} ? {
|
|
61
|
+
readonly abstract: Abstract;
|
|
62
|
+
readonly depth: Depth;
|
|
63
|
+
readonly properties: Properties;
|
|
64
|
+
readonly source: Source;
|
|
65
|
+
readonly target: Target;
|
|
66
|
+
readonly constraints: Constraints;
|
|
67
|
+
} : never;
|
|
68
|
+
type UndirectedEdgeClassIdentity<Config> = Config extends {
|
|
69
|
+
readonly abstract: infer Abstract;
|
|
70
|
+
readonly depth: infer Depth;
|
|
71
|
+
readonly properties: infer Properties;
|
|
72
|
+
readonly endpoints: infer Endpoints;
|
|
73
|
+
readonly constraints: infer Constraints;
|
|
74
|
+
} ? {
|
|
75
|
+
readonly abstract: Abstract;
|
|
76
|
+
readonly depth: Depth;
|
|
77
|
+
readonly properties: Properties;
|
|
78
|
+
readonly endpoints: Endpoints;
|
|
79
|
+
readonly constraints: Constraints;
|
|
80
|
+
} : never;
|
|
81
|
+
type OwnerErasedPropertyProjection<Entry> = Entry extends AuthoredPropertyProjection<infer Input, infer Output, infer Required, infer Name, unknown, infer State> ? AuthoredPropertyProjection<Input, Output, Required, Name, unknown, State> : Entry extends ResolvedProperty<infer Value, infer Required, infer State, infer Input> & {
|
|
82
|
+
readonly name: infer Name;
|
|
83
|
+
readonly key: infer Key;
|
|
84
|
+
} ? {
|
|
85
|
+
readonly value: Value;
|
|
86
|
+
readonly input: Input;
|
|
87
|
+
readonly required: Required;
|
|
88
|
+
readonly name: Name;
|
|
89
|
+
readonly key: Key;
|
|
90
|
+
readonly state?: State;
|
|
91
|
+
} : never;
|
|
92
|
+
type OwnerErasedMethodProjection<Entry> = Entry extends AuthoredMethodProjection<infer Value, infer Name, unknown> ? AuthoredMethodProjection<Value, Name, unknown> : Entry extends ResolvedMethod<infer Input, infer Output, infer Static, infer Abstract, infer Auth, infer _Policy, infer Key> & {
|
|
93
|
+
readonly name: infer Name;
|
|
94
|
+
} ? {
|
|
95
|
+
readonly input: Input;
|
|
96
|
+
readonly output: Output;
|
|
97
|
+
readonly static: Static;
|
|
98
|
+
readonly abstract: Abstract;
|
|
99
|
+
readonly auth: Auth;
|
|
100
|
+
readonly name: Name;
|
|
101
|
+
readonly key: Key;
|
|
102
|
+
} : never;
|
|
103
|
+
/** Identity projection of a Class handle. */
|
|
104
|
+
export type ClassIdentityProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassIdentityProjection<'node', NodeClassIdentity<Config>> : Value extends DirectedEdgeClass<infer Config> ? ClassIdentityProjection<'edge', DirectedEdgeClassIdentity<Config>> : Value extends UndirectedEdgeClass<infer Config> ? ClassIdentityProjection<'edge', UndirectedEdgeClassIdentity<Config>> : never;
|
|
105
|
+
/** Owner projection of a Class handle. */
|
|
106
|
+
export type ClassOwnerProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassOwnerProjection<'node', NodeClassIdentity<Config>, Config extends {
|
|
107
|
+
readonly effectiveProperties: infer Properties;
|
|
108
|
+
} ? OwnerErasedPropertyProjection<Properties> : never, Config extends {
|
|
109
|
+
readonly effectiveInstanceMethods: infer Methods;
|
|
110
|
+
} ? OwnerErasedMethodProjection<Methods> : never, Config extends {
|
|
111
|
+
readonly effectiveStaticMethods: infer Methods;
|
|
112
|
+
} ? OwnerErasedMethodProjection<Methods> : never> : Value extends DirectedEdgeClass<infer Config> ? ClassOwnerProjection<'edge', DirectedEdgeClassIdentity<Config>, Config extends {
|
|
113
|
+
readonly effectiveProperties: infer Properties;
|
|
114
|
+
} ? OwnerErasedPropertyProjection<Properties> : never, never, never> : Value extends UndirectedEdgeClass<infer Config> ? ClassOwnerProjection<'edge', UndirectedEdgeClassIdentity<Config>, Config extends {
|
|
115
|
+
readonly effectiveProperties: infer Properties;
|
|
116
|
+
} ? OwnerErasedPropertyProjection<Properties> : never, never, never> : never;
|
|
117
|
+
/** Reference projection of a Class handle. */
|
|
118
|
+
export type ClassReferenceProjectionOf<Value> = Value extends NodeClass<infer Config> ? ClassReferenceProjection<'node', NodeClassIdentity<Config>, Config extends {
|
|
119
|
+
readonly effectiveProperties: infer Properties;
|
|
120
|
+
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<NodeClass<Config>>> : never, Config extends {
|
|
121
|
+
readonly effectiveInstanceMethods: infer Methods;
|
|
122
|
+
} ? BindMethodOwners<Methods, ClassOwnerProjectionOf<NodeClass<Config>>> : never, Config extends {
|
|
123
|
+
readonly effectiveStaticMethods: infer Methods;
|
|
124
|
+
} ? BindMethodOwners<Methods, ClassOwnerProjectionOf<NodeClass<Config>>> : never> : Value extends DirectedEdgeClass<infer Config> ? ClassReferenceProjection<'edge', DirectedEdgeClassIdentity<Config>, Config extends {
|
|
125
|
+
readonly effectiveProperties: infer Properties;
|
|
126
|
+
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<DirectedEdgeClass<Config>>> : never, never, never> : Value extends UndirectedEdgeClass<infer Config> ? ClassReferenceProjection<'edge', UndirectedEdgeClassIdentity<Config>, Config extends {
|
|
127
|
+
readonly effectiveProperties: infer Properties;
|
|
128
|
+
} ? BindPropertyOwners<Properties, ClassOwnerProjectionOf<UndirectedEdgeClass<Config>>> : never, never, never> : never;
|
|
129
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Object as JsonObject } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import type { DomainEndpointRef } from '../../language/core/model/core.js';
|
|
3
3
|
import type { PolicyObjectInput } from '../callable/authoring.js';
|
|
4
|
-
import type { EdgeClass, NodeClass } from '../class/
|
|
4
|
+
import type { EdgeClass, NodeClass } from '../class/handle.js';
|
|
5
5
|
import type { AUTHORING } from '../schema/handle.js';
|
|
6
6
|
import type { Lazy } from '../schema/lazy.js';
|
|
7
7
|
import type { CoreNamedPropertyInput } from '../schema/projection.js';
|
|
@@ -14,7 +14,9 @@ export { BuilderError as Error } from './schema/diagnostic.js';
|
|
|
14
14
|
export type { BuilderDiagnostic as Diagnostic, BuilderDiagnosticCode as DiagnosticCode, } from './schema/diagnostic.js';
|
|
15
15
|
export type { CallableInputBase, CallableInput, BinaryInputAuthoring, CallableOutputInput, CallableProjection, CallablePolicyBuilder, CallablePolicyContext, PolicyCheckContext, BinaryOutput, Function, FunctionInput, Method, MethodInput, PolicyObjectInput, StreamOutput, } from './callable/authoring.js';
|
|
16
16
|
export type { CoreEdge, CoreEndpoint, CoreInput, CoreNode } from './core/authoring.js';
|
|
17
|
-
export type {
|
|
17
|
+
export type { Class, DirectedEdgeClass, EdgeClass, NodeClass, UndirectedEdgeClass, } from './class/handle.js';
|
|
18
|
+
export type { ClassReferenceInput as ClassReference, ClassRuleBuilder, ClassRuleContext, DirectedEdgeInput, DirectedSourceInput, DirectedTargetInput, EdgeClassCommon, EdgeClassInput, EdgeClassReferenceInput as EdgeClassReference, EdgeUniqueFieldInput, EdgeUniqueTupleInput, IncidentEndpointInput, NodeClassInput, NodeClassPoliciesInput, NodeClassPolicyInput, NodeClassReferenceInput as NodeClassReference, NodeUniqueTupleInput, UndirectedEdgeInput, } from './class/input.js';
|
|
19
|
+
export type { AuthoredPropertyProjection, AuthoredMethodProjection, ClassIdentityProjection, ClassOwnerProjection, ClassReferenceProjection, } from './class/projection.js';
|
|
18
20
|
export type { PathAuthoring } from './value/path.js';
|
|
19
21
|
export type { Lazy } from './schema/lazy.js';
|
|
20
22
|
export type { MatchPolicyInput, Policy, PolicyBuilder as PolicyFactory, PolicyEdgeInput, PolicyExistsContext, PolicyInput, PolicyNodeBinder, PolicyPatternContext, } from './policy/authoring.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClassDefinition } from '../../language/class/model/class.js';
|
|
2
|
-
import type { Class } from '../class/
|
|
2
|
+
import type { Class } from '../class/handle.js';
|
|
3
3
|
import type { CallableCompiler } from './callable.js';
|
|
4
4
|
import type { PolicyCompiler } from './policy.js';
|
|
5
5
|
import type { BuilderContext } from './schema/context.js';
|
|
@@ -6,7 +6,8 @@ import type { PolicyObjectRef } from '../../../language/index.js';
|
|
|
6
6
|
import type { ValueSchemaRegistry } from '../../../language/value/reference/registry.js';
|
|
7
7
|
import type { DomainSchema, DomainSchemaIR } from '../../../schema/model/schema.js';
|
|
8
8
|
import type { Function, PolicyObjectInput } from '../../callable/authoring.js';
|
|
9
|
-
import type { Class
|
|
9
|
+
import type { Class } from '../../class/handle.js';
|
|
10
|
+
import type { ClassReferenceInput } from '../../class/input.js';
|
|
10
11
|
import type { CoreEndpoint, CoreNode } from '../../core/authoring.js';
|
|
11
12
|
import type { Policy } from '../../policy/authoring.js';
|
|
12
13
|
import type { View } from '../../view/authoring.js';
|
|
@@ -4,6 +4,7 @@ import { isMethodExecutable } from '../../../language/callable/executable.js';
|
|
|
4
4
|
import { admitsForeignSubclass, inheritanceOf } from '../../../language/class/inheritance.js';
|
|
5
5
|
import { policyObjectKey, policyObjectOrigin } from '../../../language/index.js';
|
|
6
6
|
import { graphNodePathSchema } from '../../../language/value/syntax/node-path/schema.js';
|
|
7
|
+
import { escapePointerToken } from '../../../language/value/syntax/pointer.js';
|
|
7
8
|
import { revisionOfDomainSchema } from '../../../schema/canonical/revision.js';
|
|
8
9
|
import { requireDomainClosure } from '../../../schema/resolution/closure.js';
|
|
9
10
|
import { collectUsedForeignOrigins } from '../../../schema/resolution/origins.js';
|
|
@@ -23,7 +24,7 @@ export class BuilderContext {
|
|
|
23
24
|
constructor(origin, dependencies) {
|
|
24
25
|
this.origin = origin;
|
|
25
26
|
for (const [alias, schema] of Object.entries(dependencies)) {
|
|
26
|
-
const pointer = `/dependencies/${
|
|
27
|
+
const pointer = `/dependencies/${escapePointerToken(alias)}`;
|
|
27
28
|
if (!DEPENDENCY_ALIAS_PATTERN.test(alias)) {
|
|
28
29
|
fail('BUILDER_DEPENDENCY_ALIAS', pointer, `Dependency alias ${JSON.stringify(alias)} must be an ASCII lower-camel identifier.`);
|
|
29
30
|
}
|
|
@@ -223,9 +224,6 @@ export class BuilderContext {
|
|
|
223
224
|
this.policyObjectRefs.add(policyObjectKey(ref));
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
|
-
function escapePointer(value) {
|
|
227
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
228
|
-
}
|
|
229
227
|
function isResolvedClass(value) {
|
|
230
228
|
if (typeof value !== 'object' || value === null)
|
|
231
229
|
return false;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { NodeClassReferenceInput } from '../../class/
|
|
1
|
+
import type { NodeClassReferenceInput } from '../../class/input.js';
|
|
2
2
|
import type { ZodValueSchemaOverrideContext } from './zod.js';
|
|
3
3
|
export declare function lowerPathSchema(context: ZodValueSchemaOverrideContext, resolveAccepts: (inputs: readonly NodeClassReferenceInput[], pointer: string) => readonly unknown[], pointer: string): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { escapePointerToken } from '../../../language/value/syntax/pointer.js';
|
|
1
2
|
import { pathAccepts } from '../../value/path-metadata.js';
|
|
2
3
|
export function lowerPathSchema(context, resolveAccepts, pointer) {
|
|
3
4
|
const inputs = pathAccepts(context.zodSchema);
|
|
4
5
|
if (inputs === undefined)
|
|
5
6
|
return;
|
|
6
|
-
const location = context.path.reduce((current, segment) => `${current}/${
|
|
7
|
+
const location = context.path.reduce((current, segment) => `${current}/${escapePointerToken(String(segment))}`, pointer);
|
|
7
8
|
for (const key of Object.keys(context.jsonSchema))
|
|
8
9
|
delete context.jsonSchema[key];
|
|
9
10
|
Object.assign(context.jsonSchema, {
|
|
@@ -15,6 +16,3 @@ export function lowerPathSchema(context, resolveAccepts, pointer) {
|
|
|
15
16
|
},
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
function escapeToken(value) {
|
|
19
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
20
|
-
}
|
|
@@ -4,6 +4,7 @@ import { canonicalizeValueSchema } from '../../../language/value/profile/canonic
|
|
|
4
4
|
import { validateValueSchema } from '../../../language/value/profile/validate.js';
|
|
5
5
|
import { isIRegexp } from '../../../language/value/regexp/syntax.js';
|
|
6
6
|
import { fullMatchSource } from '../../../language/value/syntax/full-match.js';
|
|
7
|
+
import { escapePointerToken } from '../../../language/value/syntax/pointer.js';
|
|
7
8
|
import { diagnostic } from '../../schema/diagnostic.js';
|
|
8
9
|
/**
|
|
9
10
|
* Converts only Zod contracts whose JSON-value acceptance is represented
|
|
@@ -289,9 +290,6 @@ function getCheckDefinition(value) {
|
|
|
289
290
|
function isZodType(value) {
|
|
290
291
|
return value instanceof ZodType;
|
|
291
292
|
}
|
|
292
|
-
function escapePointerToken(value) {
|
|
293
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
294
|
-
}
|
|
295
293
|
function isPlainRecord(value) {
|
|
296
294
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
297
295
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClassRef } from '../../addressing/index.js';
|
|
2
2
|
import type { PolicyCheckExpression, PolicyPatternExpression, PolicyPatternTerm as CanonicalPolicyPatternTerm, PolicyObjectRef } from '../../language/policy/model/policy.js';
|
|
3
3
|
import type { PolicyObjectInput } from '../callable/authoring.js';
|
|
4
|
-
import type { EdgeClassReferenceInput, NodeClassReferenceInput } from '../class/
|
|
4
|
+
import type { EdgeClassReferenceInput, NodeClassReferenceInput } from '../class/input.js';
|
|
5
5
|
import type { AuthoringValue } from '../schema/handle.js';
|
|
6
6
|
import type { Lazy } from '../schema/lazy.js';
|
|
7
7
|
export interface PolicyEdgeInput {
|
|
@@ -2,7 +2,6 @@ import type { Domain } from '../../domain/model/domain.js';
|
|
|
2
2
|
import type { DomainSchema } from '../../schema/model/schema.js';
|
|
3
3
|
import type { DomainSchemaInput, EntrypointOf } from './input.js';
|
|
4
4
|
import type { ResolvedDomainOfInput } from './projection.js';
|
|
5
|
-
export type { DomainSchemaInput } from './input.js';
|
|
6
5
|
/** Exact named Schema produced from one authored input. */
|
|
7
6
|
export interface DefinedSchema<Origin extends string, Resolved extends Domain> extends DomainSchema<Origin, Resolved> {
|
|
8
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DiagnosticCode as LanguageDiagnosticCode } from '../../language/validation/diagnostic.js';
|
|
2
|
+
import { escapePointerToken as escapeToken } from '../../language/value/syntax/pointer.js';
|
|
3
|
+
export { escapeToken };
|
|
2
4
|
export type BuilderDiagnosticCode = LanguageDiagnosticCode | 'BUILDER_ABSTRACT_POLICY' | 'BUILDER_AMBIGUOUS_OWNERSHIP' | 'BUILDER_AUTO_EVENT_INVALID' | 'BUILDER_AUTO_IMMUTABLE' | 'BUILDER_AUTO_NESTED' | 'BUILDER_AUTO_SET_INVALID' | 'BUILDER_CALLABLE_AUTH' | 'BUILDER_CALLABLE_PLACEMENT' | 'BUILDER_CALLABLE_POLICY_AUTH' | 'BUILDER_CLASS_INHERITANCE' | 'BUILDER_CORE_CLASS' | 'BUILDER_CORE_EDGE' | 'BUILDER_CORE_NODE' | 'BUILDER_CORE_PROPERTY' | 'BUILDER_CORE_REF' | 'BUILDER_DEFINITION' | 'BUILDER_DEPENDENCY_CONFLICT' | 'BUILDER_DEPENDENCY_ALIAS' | 'BUILDER_DEPENDENCY_DIRECT' | 'BUILDER_DUPLICATE_MEMBER' | 'BUILDER_EDGE_LIFETIME' | 'BUILDER_FOREIGN_POLICY' | 'BUILDER_FULL_MATCH_INVALID' | 'BUILDER_FUNCTION' | 'BUILDER_METHOD' | 'BUILDER_PATH_DUPLICATE' | 'BUILDER_PATH_EMPTY' | 'BUILDER_POLICY' | 'BUILDER_POLICY_COMPOSITION' | 'BUILDER_POLICY_CYCLE' | 'BUILDER_POLICY_EMPTY_COMPOSITION' | 'BUILDER_POLICY_EMPTY_EXISTS' | 'BUILDER_POLICY_INPUT' | 'BUILDER_POLICY_REF' | 'BUILDER_POLICY_SELF' | 'BUILDER_PROPERTY_IMMUTABLE_INVALID' | 'BUILDER_REFERENCE_CYCLE' | 'BUILDER_REFERENCE_KIND' | 'BUILDER_REFERENCE_MISSING' | 'BUILDER_UNIQUE_PROPERTY' | 'BUILDER_UNKNOWN_FIELD' | 'BUILDER_UNOWNED_REFERENCE' | 'BUILDER_VIEW' | 'ZOD_SCHEMA_NOT_LOSSLESS';
|
|
3
5
|
export interface BuilderDiagnostic<out Code extends BuilderDiagnosticCode = BuilderDiagnosticCode> {
|
|
4
6
|
readonly code: Code;
|
|
@@ -13,4 +15,3 @@ export declare class BuilderError extends Error {
|
|
|
13
15
|
}
|
|
14
16
|
export declare function assertKnownKeys(value: object, allowed: readonly string[], pointer?: string): void;
|
|
15
17
|
export declare function fail(code: BuilderDiagnosticCode, pointer: string, message: string): never;
|
|
16
|
-
export declare function escapeToken(value: string): string;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatDiagnostics, orderDiagnostics } from '../../language/validation/diagnostic.js';
|
|
2
|
+
import { escapePointerToken as escapeToken } from '../../language/value/syntax/pointer.js';
|
|
3
|
+
export { escapeToken };
|
|
2
4
|
export function diagnostic(code, pointer, message, ref) {
|
|
3
5
|
return Object.freeze({ code, pointer, message, ...(ref === undefined ? {} : { ref }) });
|
|
4
6
|
}
|
|
5
7
|
export class BuilderError extends Error {
|
|
6
8
|
diagnostics;
|
|
7
9
|
constructor(diagnostics) {
|
|
8
|
-
const ordered =
|
|
9
|
-
|
|
10
|
-
compareUnicode(left.message, right.message));
|
|
11
|
-
super(ordered
|
|
12
|
-
.map(({ code, pointer, message }) => `${pointer || '/'} [${code}] ${message}`)
|
|
13
|
-
.join('\n'));
|
|
10
|
+
const ordered = orderDiagnostics(diagnostics);
|
|
11
|
+
super(formatDiagnostics(ordered));
|
|
14
12
|
this.name = 'BuilderError';
|
|
15
13
|
this.diagnostics = Object.freeze(ordered);
|
|
16
14
|
}
|
|
@@ -26,6 +24,3 @@ export function assertKnownKeys(value, allowed, pointer = '') {
|
|
|
26
24
|
export function fail(code, pointer, message) {
|
|
27
25
|
throw new BuilderError([diagnostic(code, pointer, message)]);
|
|
28
26
|
}
|
|
29
|
-
export function escapeToken(value) {
|
|
30
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
31
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DomainSchema } from '../../schema/model/schema.js';
|
|
2
2
|
import type { Function } from '../callable/authoring.js';
|
|
3
|
-
import type { Class } from '../class/
|
|
3
|
+
import type { Class } from '../class/handle.js';
|
|
4
4
|
import type { CoreInput } from '../core/authoring.js';
|
|
5
5
|
import type { Policy } from '../policy/authoring.js';
|
|
6
6
|
import type { View } from '../view/authoring.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as language from '../../../language/index.js';
|
|
2
|
-
import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass,
|
|
2
|
+
import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass, Class, ProjectionOfClass } from '../../class/handle.js';
|
|
3
|
+
import type { ClassReferenceProjection } from '../../class/projection.js';
|
|
3
4
|
import type { DomainSchemaInput } from '../input.js';
|
|
4
5
|
import type { OwnInstanceMethodProjectionsOf, OwnStaticMethodProjectionsOf } from './callable.js';
|
|
5
6
|
import type { AbstractOf, ConstraintsOf, ResolveLazy, LocalNameOfReference, ClassesInputOf, LocalNameOf } from './identity.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as language from '../../../language/index.js';
|
|
2
2
|
import type { BlobReceipt } from '../../../language/value/model/blob.js';
|
|
3
|
-
import type { Class
|
|
3
|
+
import type { Class } from '../../class/handle.js';
|
|
4
|
+
import type { AuthoredPropertyProjection } from '../../class/projection.js';
|
|
4
5
|
import type { ResolveLazy, IsMultiple } from './identity.js';
|
|
5
6
|
import type { EffectivePropertyEntriesOfClass } from './property.js';
|
|
6
7
|
/** Derive required, optional and forbidden Core Property inputs by name. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass,
|
|
1
|
+
import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass, Class } from '../../class/handle.js';
|
|
2
|
+
import type { ClassReferenceProjection, ClassReferenceProjectionOf, ClassIdentityProjectionOf, ClassOwnerProjectionOf, ClassOwnerProjection, ClassIdentityProjection } from '../../class/projection.js';
|
|
2
3
|
import type { DomainSchemaInput } from '../input.js';
|
|
3
4
|
/** Extract an authored abstract modifier with its default. */
|
|
4
5
|
export type AbstractOf<Config> = Config extends {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as language from '../../../language/index.js';
|
|
2
|
-
import type { AuthoredPropertyProjection } from '../../class/
|
|
2
|
+
import type { AuthoredPropertyProjection } from '../../class/projection.js';
|
|
3
3
|
import type { DomainSchemaInput } from '../input.js';
|
|
4
4
|
import type { RecordField, ClassInputOf, OwnerNameOf } from './identity.js';
|
|
5
5
|
import type { PropertyProjection } from './model.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { PropertyProjection, MethodProjection, FunctionProjection, ClassProjection,
|
|
1
|
+
export type { PropertyProjection, MethodProjection, FunctionProjection, ClassProjection, } from './projection/model.js';
|
|
2
2
|
export type { ResolvedDomainOfInput } from './projection/domain.js';
|
|
3
3
|
export type { CoreNamedPropertyInput, CorePropertyInput } from './projection/core-input.js';
|
|
4
4
|
export type { ClassProjectionOfResolved } from './projection/resolved-class.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type FullMatch } from '../../language/value/syntax/full-match.js';
|
|
2
|
-
export { fullMatchSource, type FullMatch } from '../../language/value/syntax/full-match.js';
|
|
3
2
|
/** Authoring facade preserving the Builder-owned diagnostic for invalid source syntax. */
|
|
4
3
|
export declare function fullMatch(source: string): FullMatch;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { refuseIRegexp, stateBudgetMessage } from '../../language/value/regexp/syntax.js';
|
|
2
2
|
import { fullMatch as languageFullMatch, } from '../../language/value/syntax/full-match.js';
|
|
3
3
|
import { fail } from '../schema/diagnostic.js';
|
|
4
|
-
export { fullMatchSource } from '../../language/value/syntax/full-match.js';
|
|
5
4
|
/** Authoring facade preserving the Builder-owned diagnostic for invalid source syntax. */
|
|
6
5
|
export function fullMatch(source) {
|
|
7
6
|
const refusal = refuseIRegexp(source);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { NodeClassReferenceInput } from '../class/
|
|
2
|
+
import type { NodeClassReferenceInput } from '../class/input.js';
|
|
3
3
|
export declare function rememberPath(schema: z.ZodType, accepts: readonly NodeClassReferenceInput[]): void;
|
|
4
4
|
export declare function pathAccepts(schema: z.ZodType): readonly NodeClassReferenceInput[] | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ZodString } from 'zod';
|
|
2
|
-
import type { NodeClassReferenceInput } from '../class/
|
|
2
|
+
import type { NodeClassReferenceInput } from '../class/input.js';
|
|
3
3
|
declare const PATH_ACCEPTS: unique symbol;
|
|
4
4
|
export type PathAuthoring<Accepts extends readonly NodeClassReferenceInput[] = readonly NodeClassReferenceInput[]> = ZodString & {
|
|
5
5
|
readonly [PATH_ACCEPTS]: Accepts;
|
package/dist/v1/bundle/codec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { accept as acceptJsonValue, BoundaryError as JsonBoundaryError, json, } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { dependencyLimits } from '../addressing/domain-dependency.js';
|
|
3
3
|
import { compareUnicode } from '../addressing/ordering.js';
|
|
4
|
+
import { escapePointerToken } from '../language/value/syntax/pointer.js';
|
|
4
5
|
import { acceptDomainSchema } from '../schema/admission/accept.js';
|
|
5
6
|
import { canonicalDomainSchemaAfterValidation } from '../schema/canonical/revision.js';
|
|
6
7
|
import { revisionOfDomainSchema } from '../schema/canonical/revision.js';
|
|
@@ -9,9 +10,6 @@ import { SchemaError } from '../schema/diagnostic.js';
|
|
|
9
10
|
import { BundleError, diagnostic } from './diagnostic.js';
|
|
10
11
|
import { asDomainSchemaBundle, } from './model.js';
|
|
11
12
|
import { parseDomainSchemaBundleStructure } from './structure.js';
|
|
12
|
-
function escapeToken(value) {
|
|
13
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
14
|
-
}
|
|
15
13
|
export function acceptDomainSchemaBundle(input) {
|
|
16
14
|
let admitted;
|
|
17
15
|
try {
|
|
@@ -136,7 +134,7 @@ function collectReachable(current, root, candidates, reachable, active, revision
|
|
|
136
134
|
return;
|
|
137
135
|
}
|
|
138
136
|
for (const [alias, dependency] of Object.entries(current.schema.dependencies)) {
|
|
139
|
-
const pointer = `${current.pointer}/dependencies/${
|
|
137
|
+
const pointer = `${current.pointer}/dependencies/${escapePointerToken(alias)}`;
|
|
140
138
|
const dependencyKey = keyOf(dependency.origin, dependency.revision);
|
|
141
139
|
if (dependencyKey === root.key) {
|
|
142
140
|
diagnostics.push(diagnostic('BUNDLE_CLOSURE_CYCLE', pointer, 'Bundle dependency closure returns to its root.'));
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatDiagnostics, orderDiagnostics } from '../language/validation/diagnostic.js';
|
|
2
2
|
export function diagnostic(code, pointer, message, ref) {
|
|
3
3
|
return Object.freeze({ code, pointer, message, ...(ref === undefined ? {} : { ref }) });
|
|
4
4
|
}
|
|
5
5
|
export class BundleError extends Error {
|
|
6
6
|
diagnostics;
|
|
7
7
|
constructor(diagnostics) {
|
|
8
|
-
const ordered =
|
|
9
|
-
|
|
10
|
-
compareUnicode(left.message, right.message));
|
|
11
|
-
super(ordered
|
|
12
|
-
.map(({ code, pointer, message }) => `${pointer || '/'} [${code}] ${message}`)
|
|
13
|
-
.join('\n'));
|
|
8
|
+
const ordered = orderDiagnostics(diagnostics);
|
|
9
|
+
super(formatDiagnostics(ordered));
|
|
14
10
|
this.name = 'BundleError';
|
|
15
11
|
this.diagnostics = Object.freeze(ordered);
|
|
16
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { escapePointerToken } from '../language/value/syntax/pointer.js';
|
|
1
2
|
import { SchemaError } from '../schema/diagnostic.js';
|
|
2
3
|
import { routeDomainSchema } from '../schema/validation/domain.route.js';
|
|
3
4
|
import { BundleError, diagnostic } from './diagnostic.js';
|
|
@@ -12,7 +13,7 @@ export function parseDomainSchemaBundleStructure(input) {
|
|
|
12
13
|
const expected = new Set(['format', 'version', 'root', 'closure']);
|
|
13
14
|
for (const key of Object.keys(input)) {
|
|
14
15
|
if (!expected.has(key)) {
|
|
15
|
-
diagnostics.push(diagnostic('BUNDLE_STRUCTURE', `/${
|
|
16
|
+
diagnostics.push(diagnostic('BUNDLE_STRUCTURE', `/${escapePointerToken(key)}`, `Unknown bundle field ${key}.`));
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
for (const key of expected) {
|
|
@@ -66,6 +67,3 @@ function isObject(value) {
|
|
|
66
67
|
function describe(value) {
|
|
67
68
|
return value === undefined ? '(missing)' : JSON.stringify(value);
|
|
68
69
|
}
|
|
69
|
-
function escapeToken(value) {
|
|
70
|
-
return value.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
71
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CompiledDiagnosticCode } from '../diagnostic.js';
|
|
2
2
|
/** Append one escaped JSON Pointer segment. */
|
|
3
|
-
export
|
|
3
|
+
export { appendPointer as pointer } from '../../language/value/syntax/pointer.js';
|
|
4
4
|
/** Report a structural compiled-input violation with its stable diagnostic code. */
|
|
5
5
|
export declare function invalid(label: string, code?: CompiledDiagnosticCode, path?: string): never;
|
|
6
6
|
/** Report a contextual compiled-language violation at its original source pointer. */
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { invalidCompiled } from '../diagnostic.js';
|
|
2
2
|
/** Append one escaped JSON Pointer segment. */
|
|
3
|
-
export
|
|
4
|
-
return `${parent}/${String(member).replaceAll('~', '~0').replaceAll('/', '~1')}`;
|
|
5
|
-
}
|
|
3
|
+
export { appendPointer as pointer } from '../../language/value/syntax/pointer.js';
|
|
6
4
|
/** Report a structural compiled-input violation with its stable diagnostic code. */
|
|
7
5
|
export function invalid(label, code = 'COMPILED_STRUCTURE_INVALID', path = '') {
|
|
8
6
|
return invalidCompiled(code, `Invalid compiled Schema ${label}.`, path);
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { Revision } from '../../addressing/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FunctionDefinition, MethodDefinition } from '../../language/callable/model/callable.js';
|
|
3
|
+
import type { JsonSchema } from '../../language/value/model/schema.js';
|
|
4
|
+
import type { CompiledFunction, CompiledMethod, CompiledSchemaEntry } from '../model/schema.js';
|
|
3
5
|
/** Derive the exact canonical source-revision preimage without constructing an authored Schema. */
|
|
4
6
|
export declare function revisionOfCompiledEntry(entry: CompiledSchemaEntry): Revision;
|
|
7
|
+
/** The source definition of a compiled Method: its value programs back to their schemas. */
|
|
8
|
+
export declare function sourceMethod(entry: CompiledSchemaEntry, method: CompiledMethod): MethodDefinition;
|
|
9
|
+
/** The source definition of a compiled Function: its value programs back to their schemas. */
|
|
10
|
+
export declare function sourceFunction(entry: CompiledSchemaEntry, definition: CompiledFunction): FunctionDefinition;
|
|
11
|
+
/** The schema of the root node of the entry's value program `index`. */
|
|
12
|
+
export declare function schemaOf(entry: CompiledSchemaEntry, index: number): JsonSchema;
|
|
@@ -44,7 +44,8 @@ function sourceClass(entry, definition) {
|
|
|
44
44
|
methods: Object.fromEntries(methods.map((method) => [method.name, sourceMethod(entry, method)])),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
/** The source definition of a compiled Method: its value programs back to their schemas. */
|
|
48
|
+
export function sourceMethod(entry, method) {
|
|
48
49
|
const { name: _, input, fields: __, output, ...rest } = method;
|
|
49
50
|
return {
|
|
50
51
|
...rest,
|
|
@@ -52,7 +53,8 @@ function sourceMethod(entry, method) {
|
|
|
52
53
|
output: sourceOutput(entry, output),
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
/** The source definition of a compiled Function: its value programs back to their schemas. */
|
|
57
|
+
export function sourceFunction(entry, definition) {
|
|
56
58
|
const { input, fields: _, output, ...rest } = definition;
|
|
57
59
|
return {
|
|
58
60
|
...rest,
|
|
@@ -72,7 +74,8 @@ function sourceOutput(entry, output) {
|
|
|
72
74
|
const schema = schemaOf(entry, output.value);
|
|
73
75
|
return output.mode === 'value' ? { mode: 'value', schema } : { mode: 'stream', item: schema };
|
|
74
76
|
}
|
|
75
|
-
|
|
77
|
+
/** The schema of the root node of the entry's value program `index`. */
|
|
78
|
+
export function schemaOf(entry, index) {
|
|
76
79
|
const program = entry.values[index];
|
|
77
80
|
const root = program?.nodes[program.root];
|
|
78
81
|
if (root === undefined)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type Located, type CompiledClass, type ClassAnalysis, type SemanticIndex } from './context.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Compose inherited Properties, Methods and Data ownership once per Class. The closure check has
|
|
4
|
+
* already proved every parent present and the inheritance graph acyclic.
|
|
5
|
+
*/
|
|
3
6
|
export declare function analyzeClasses(classes: ReadonlyMap<string, Located<CompiledClass>>): ReadonlyMap<string, ClassAnalysis>;
|
|
4
7
|
/** Check automatic Properties, immutability and abstract Class obligations. */
|
|
5
8
|
export declare function validateClassFacets(context: SemanticIndex): void;
|
|
@@ -7,22 +7,19 @@ import { bindValueProgram } from '../../../language/value/compile/load.js';
|
|
|
7
7
|
import {} from '../../model/schema.js';
|
|
8
8
|
import { fail } from '../diagnostic.js';
|
|
9
9
|
import {} from './context.js';
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Compose inherited Properties, Methods and Data ownership once per Class. The closure check has
|
|
12
|
+
* already proved every parent present and the inheritance graph acyclic.
|
|
13
|
+
*/
|
|
11
14
|
export function analyzeClasses(classes) {
|
|
12
15
|
const analyses = new Map();
|
|
13
|
-
const visiting = new Set();
|
|
14
16
|
const analyze = (located) => {
|
|
15
17
|
const classKey = Key.of(located.value.ref);
|
|
16
18
|
const cached = analyses.get(classKey);
|
|
17
19
|
if (cached !== undefined)
|
|
18
20
|
return cached;
|
|
19
|
-
if (visiting.has(classKey))
|
|
20
|
-
fail(`${located.pointer}/extends`, 'Class inheritance is cyclic.');
|
|
21
|
-
visiting.add(classKey);
|
|
22
21
|
const parents = located.value.extends.map((ref, index) => {
|
|
23
22
|
const parent = classes.get(Key.of(ref));
|
|
24
|
-
if (parent === undefined)
|
|
25
|
-
fail(`${located.pointer}/extends/${index}`, 'Parent Class is absent.');
|
|
26
23
|
if (parent.value.inheritance === 'final')
|
|
27
24
|
fail(`${located.pointer}/extends/${index}`, 'A final Class has no subclass.');
|
|
28
25
|
return analyze(parent);
|
|
@@ -71,7 +68,6 @@ export function analyzeClasses(classes) {
|
|
|
71
68
|
...(dataOwner === undefined ? {} : { dataOwner }),
|
|
72
69
|
};
|
|
73
70
|
analyses.set(classKey, analysis);
|
|
74
|
-
visiting.delete(classKey);
|
|
75
71
|
return analysis;
|
|
76
72
|
};
|
|
77
73
|
for (const value of classes.values())
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { type ClassRef } from '../../../addressing/index.js';
|
|
2
|
-
import { type CoreEdge } from '../../../language/core/model/core.js';
|
|
3
1
|
import { type CompiledSchemaEntry, type CompiledSchema } from '../../model/schema.js';
|
|
4
|
-
import { type Located, type CompiledClass, type ClassAnalysis, type
|
|
2
|
+
import { type Located, type CompiledClass, type ClassAnalysis, type SemanticIndex } from './context.js';
|
|
5
3
|
/** A local Core Node paired with its admitted Class analysis. */
|
|
6
4
|
export interface CoreNode {
|
|
7
5
|
readonly key: string;
|
|
@@ -10,26 +8,5 @@ export interface CoreNode {
|
|
|
10
8
|
readonly analysis: ClassAnalysis;
|
|
11
9
|
readonly pointer: string;
|
|
12
10
|
}
|
|
13
|
-
/**
|
|
14
|
-
* A local Definition other than a Core Node, or a Class-owned Method. The Domain projects it as a
|
|
15
|
-
* Kernel declaration Node, so `class` names that Kernel Class rather than an authored one.
|
|
16
|
-
*/
|
|
17
|
-
interface CoreMemberEndpoint {
|
|
18
|
-
readonly key: string;
|
|
19
|
-
readonly class: ClassRef;
|
|
20
|
-
readonly pointer: string;
|
|
21
|
-
}
|
|
22
|
-
type CoreEndpoint = CoreNode | CoreMemberEndpoint | {
|
|
23
|
-
readonly key: 'domain';
|
|
24
|
-
};
|
|
25
|
-
/** A Core Edge paired with resolved endpoints and its exact Class. */
|
|
26
|
-
export interface CoreEdgeValue {
|
|
27
|
-
readonly source: CoreEndpoint;
|
|
28
|
-
readonly target: CoreEndpoint;
|
|
29
|
-
readonly value: CoreEdge;
|
|
30
|
-
readonly class: Located<CompiledEdge>;
|
|
31
|
-
readonly pointer: string;
|
|
32
|
-
}
|
|
33
11
|
/** Admit local Core Nodes, Properties and Edge endpoint contracts. */
|
|
34
12
|
export declare function validateCore(candidate: CompiledSchema, context: SemanticIndex): void;
|
|
35
|
-
export {};
|