@astrale-os/kernel-dsl 0.2.0-beta.47 → 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.
Files changed (142) hide show
  1. package/dist/v1/addressing/patterns.d.ts +0 -5
  2. package/dist/v1/addressing/patterns.js +5 -5
  3. package/dist/v1/builder/callable/authoring.d.ts +1 -1
  4. package/dist/v1/builder/class/authoring.d.ts +0 -12
  5. package/dist/v1/builder/class/property.d.ts +1 -1
  6. package/dist/v1/builder/index.d.ts +1 -1
  7. package/dist/v1/builder/lowering/callable.d.ts +2 -1
  8. package/dist/v1/builder/lowering/core.d.ts +3 -2
  9. package/dist/v1/builder/lowering/schema/compile.js +14 -1
  10. package/dist/v1/builder/lowering/value/zod.d.ts +3 -2
  11. package/dist/v1/builder/lowering/view.d.ts +2 -1
  12. package/dist/v1/builder/schema/define.d.ts +4 -2
  13. package/dist/v1/builder/schema/handle.d.ts +2 -1
  14. package/dist/v1/builder/schema/input.d.ts +8 -0
  15. package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
  16. package/dist/v1/builder/schema/projection/callable.js +1 -0
  17. package/dist/v1/builder/schema/projection/class.d.ts +89 -0
  18. package/dist/v1/builder/schema/projection/class.js +1 -0
  19. package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
  20. package/dist/v1/builder/schema/projection/core-input.js +1 -0
  21. package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
  22. package/dist/v1/builder/schema/projection/domain.js +1 -0
  23. package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
  24. package/dist/v1/builder/schema/projection/identity.js +1 -0
  25. package/dist/v1/builder/schema/projection/model.d.ts +59 -0
  26. package/dist/v1/builder/schema/projection/model.js +1 -0
  27. package/dist/v1/builder/schema/projection/property.d.ts +32 -0
  28. package/dist/v1/builder/schema/projection/property.js +1 -0
  29. package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
  30. package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
  31. package/dist/v1/builder/schema/projection.d.ts +4 -375
  32. package/dist/v1/bundle/structure.d.ts +2 -1
  33. package/dist/v1/compiled/admission/accept.d.ts +1 -1
  34. package/dist/v1/compiled/admission/accept.js +7 -1005
  35. package/dist/v1/compiled/admission/closure.d.ts +3 -0
  36. package/dist/v1/compiled/admission/closure.js +173 -0
  37. package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
  38. package/dist/v1/compiled/admission/diagnostic.js +13 -0
  39. package/dist/v1/compiled/admission/revision.js +2 -0
  40. package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
  41. package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
  42. package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
  43. package/dist/v1/compiled/admission/semantics/class.js +125 -0
  44. package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
  45. package/dist/v1/compiled/admission/semantics/context.js +81 -0
  46. package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
  47. package/dist/v1/compiled/admission/semantics/core.js +123 -0
  48. package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
  49. package/dist/v1/compiled/admission/semantics/edge.js +89 -0
  50. package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
  51. package/dist/v1/compiled/admission/semantics/policy/admit.js +57 -0
  52. package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
  53. package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
  54. package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
  55. package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
  56. package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
  57. package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
  58. package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
  59. package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
  60. package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
  61. package/dist/v1/compiled/admission/semantics/policy/parity.js +126 -0
  62. package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
  63. package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
  64. package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
  65. package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
  66. package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
  67. package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
  68. package/dist/v1/compiled/admission/semantics.d.ts +1 -1
  69. package/dist/v1/compiled/admission/semantics.js +8 -1222
  70. package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
  71. package/dist/v1/compiled/admission/wire/callable.js +90 -0
  72. package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
  73. package/dist/v1/compiled/admission/wire/class.js +117 -0
  74. package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
  75. package/dist/v1/compiled/admission/wire/core.js +32 -0
  76. package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
  77. package/dist/v1/compiled/admission/wire/dependency.js +43 -0
  78. package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
  79. package/dist/v1/compiled/admission/wire/entry.js +100 -0
  80. package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
  81. package/dist/v1/compiled/admission/wire/pattern.js +111 -0
  82. package/dist/v1/compiled/admission/wire/policy.d.ts +5 -0
  83. package/dist/v1/compiled/admission/wire/policy.js +168 -0
  84. package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
  85. package/dist/v1/compiled/admission/wire/program.js +52 -0
  86. package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
  87. package/dist/v1/compiled/admission/wire/property.js +74 -0
  88. package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
  89. package/dist/v1/compiled/admission/wire/reference.js +33 -0
  90. package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
  91. package/dist/v1/compiled/admission/wire/value.js +98 -0
  92. package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
  93. package/dist/v1/compiled/admission/wire/view.js +17 -0
  94. package/dist/v1/compiled/compiler/compile.js +2 -0
  95. package/dist/v1/compiled/model/schema.d.ts +5 -1
  96. package/dist/v1/domain/projection/classes.js +2 -9
  97. package/dist/v1/index.d.ts +1 -1
  98. package/dist/v1/language/class/inheritance.d.ts +12 -0
  99. package/dist/v1/language/class/inheritance.js +25 -0
  100. package/dist/v1/language/class/resolved.d.ts +5 -1
  101. package/dist/v1/language/definition/metadata.d.ts +8 -0
  102. package/dist/v1/language/definition/metadata.js +12 -0
  103. package/dist/v1/language/value/model/blob.d.ts +0 -2
  104. package/dist/v1/language/value/model/blob.js +2 -2
  105. package/dist/v1/language/value/model/instant.d.ts +0 -2
  106. package/dist/v1/language/value/model/instant.js +1 -1
  107. package/dist/v1/language/value/model/schema.d.ts +2 -1
  108. package/dist/v1/language/value/model/schema.js +1 -5
  109. package/dist/v1/language/value/reference/registry.d.ts +2 -1
  110. package/dist/v1/language/value/regexp/syntax.d.ts +2 -1
  111. package/dist/v1/language/view/model/view.d.ts +2 -10
  112. package/dist/v1/schema/analysis/class.d.ts +2 -1
  113. package/dist/v1/schema/canonical/revision.d.ts +2 -1
  114. package/dist/v1/schema/compatibility/comparators/classes.d.ts +2 -1
  115. package/dist/v1/schema/compatibility/coordinate.d.ts +2 -1
  116. package/dist/v1/schema/compatibility/references.js +1 -10
  117. package/dist/v1/schema/compatibility/report.d.ts +2 -1
  118. package/dist/v1/schema/compatibility/scope.d.ts +0 -4
  119. package/dist/v1/schema/compatibility/scope.js +1 -1
  120. package/dist/v1/schema/diagnostic.d.ts +1 -1
  121. package/dist/v1/schema/model/schema.d.ts +5 -1
  122. package/dist/v1/schema/normalization/domain.js +11 -6
  123. package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
  124. package/dist/v1/schema/resolution/definition.index.js +0 -3
  125. package/dist/v1/schema/resolution/origins.d.ts +1 -1
  126. package/dist/v1/schema/resolution/origins.js +0 -5
  127. package/dist/v1/schema/validation/class.js +10 -50
  128. package/dist/v1/schema/validation/core.js +1 -27
  129. package/dist/v1/schema/validation/domain.d.ts +2 -1
  130. package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
  131. package/dist/v1/schema/validation/domain.structure.js +8 -8
  132. package/dist/v1/schema/validation/policy/context.js +5 -16
  133. package/dist/v1/schema/validation/view.js +14 -9
  134. package/dist/value/accept.d.ts +1 -1
  135. package/dist/value/accept.js +32 -6
  136. package/dist/value/canonical.js +10 -2
  137. package/dist/value/immutable.optimization.d.ts +4 -1
  138. package/dist/value/immutable.optimization.js +8 -2
  139. package/dist/value/limits.d.ts +1 -1
  140. package/dist/value/unicode.d.ts +3 -0
  141. package/dist/value/unicode.js +27 -0
  142. package/package.json +1 -1
@@ -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
- export const DOMAIN_REVISION_FULL_MATCH = 'sha256:[0-9a-f]{64}';
7
- export 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
- export const MEMBER_NAME_FULL_MATCH = '[A-Za-z][A-Za-z0-9_]*';
9
- export const DEPENDENCY_ALIAS_FULL_MATCH = '[a-z][A-Za-z0-9]*';
10
- export 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_]*';
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,
@@ -109,7 +109,7 @@ export interface Method<out Projection = unknown> {
109
109
  export type ProjectionOfCallable<Value extends Function | Method> = Value extends Function<infer Projection> ? Projection : Value extends Method<infer Projection> ? Projection : never;
110
110
  /** Internal lowering access; Callable authoring handles expose no public configuration object. */
111
111
  export declare function callableConfiguration(value: Function | Method): CallableInput;
112
- export type PolicyObjectAuthoring = Class | Function | Method | Policy | View | CoreNode;
112
+ type PolicyObjectAuthoring = Class | Function | Method | Policy | View | CoreNode;
113
113
  export type PolicyObjectInput = Lazy<PolicyObjectAuthoring | PolicyObjectRef>;
114
114
  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>>;
115
115
  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 {
@@ -79,18 +79,6 @@ export interface UndirectedEdgeInput extends Omit<EdgeClassOptions, 'constraints
79
79
  }
80
80
  export type EdgeClassCommon = EdgeClassOptions;
81
81
  export type EdgeClassInput = DirectedEdgeInput | UndirectedEdgeInput;
82
- export type ClassInput = ({
83
- readonly kind: 'node';
84
- readonly abstract: boolean;
85
- } & NodeClassInput) | ({
86
- readonly kind: 'edge';
87
- readonly orientation: 'directed';
88
- readonly abstract: boolean;
89
- } & Omit<DirectedEdgeInput, 'orientation'>) | ({
90
- readonly kind: 'edge';
91
- readonly orientation: 'undirected';
92
- readonly abstract: boolean;
93
- } & Omit<UndirectedEdgeInput, 'orientation'>);
94
82
  export type Class = NodeClass | EdgeClass;
95
83
  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> {
96
84
  readonly input: Input;
@@ -37,7 +37,7 @@ export interface AutoProperty<out PropertyValue extends Property = Property> {
37
37
  };
38
38
  };
39
39
  }
40
- export type PropertyAuthoringInput<Value extends Property> = Value extends Property<infer Schema, infer Options, infer Machine> ? {
40
+ type PropertyAuthoringInput<Value extends Property> = Value extends Property<infer Schema, infer Options, infer Machine> ? {
41
41
  readonly schema: Schema;
42
42
  readonly options: Options;
43
43
  readonly machine?: Machine;
@@ -21,6 +21,6 @@ export type { MatchPolicyInput, Policy, PolicyBuilder as PolicyFactory, PolicyEd
21
21
  export type { AutoOptions, AutoProperty, Property, PropertyFieldInput as PropertyField, PropertyOptions, ValueSchemaInput, } from './class/property.js';
22
22
  export type { CorePropertyInput } from './schema/projection.js';
23
23
  export type { ClassProjection, FunctionProjection, MethodProjection, PropertyProjection, } from './schema/projection.js';
24
- export type { DomainSchemaInput as SchemaInput } from './schema/input.js';
24
+ export type { DomainSchemaInput as SchemaInput, EntrypointOf } from './schema/input.js';
25
25
  export type { TypedValueSchema } from './value/schema.js';
26
26
  export type { View, ViewInput } from './view/authoring.js';
@@ -3,7 +3,7 @@ import type { FunctionDefinition, MethodDefinition } from '../../language/callab
3
3
  import type { Function, Method } from '../callable/authoring.js';
4
4
  import type { BuilderContext } from './schema/context.js';
5
5
  import type { BuilderValueSchemas } from './value/compile.js';
6
- export type CallablePlacement = {
6
+ type CallablePlacement = {
7
7
  readonly kind: 'function';
8
8
  readonly ref: FunctionRef;
9
9
  readonly pointer: string;
@@ -22,3 +22,4 @@ export declare class V1CallableCompiler implements CallableCompiler {
22
22
  private compileOutput;
23
23
  private policyContext;
24
24
  }
25
+ export {};
@@ -4,12 +4,12 @@ import type { CoreEndpointRef } from '../../language/core/model/core.js';
4
4
  import type { CoreInput } from '../core/authoring.js';
5
5
  import type { BuilderContext } from './schema/context.js';
6
6
  export declare function captureCore(input: CoreInput | undefined, context: BuilderContext): void;
7
- export interface UnqualifiedCoreDefinition {
7
+ interface UnqualifiedCoreDefinition {
8
8
  readonly ref: CoreRef;
9
9
  readonly class: ClassRef;
10
10
  readonly properties: JsonObject;
11
11
  }
12
- export interface UnqualifiedCoreEdge {
12
+ interface UnqualifiedCoreEdge {
13
13
  readonly class: ClassRef;
14
14
  readonly source: CoreEndpointRef;
15
15
  readonly target: CoreEndpointRef;
@@ -20,3 +20,4 @@ export interface UnqualifiedCoreContent {
20
20
  readonly edges: readonly UnqualifiedCoreEdge[];
21
21
  }
22
22
  export declare function compileCore(input: CoreInput | undefined, context: BuilderContext): UnqualifiedCoreContent;
23
+ export {};
@@ -29,7 +29,16 @@ export function compileSchema(origin, input) {
29
29
  }
30
30
  /** Structural assembly before whole-Domain semantic acceptance. */
31
31
  function assembleDomainSchema(origin, input, lookup) {
32
- assertKnownKeys(input, ['dependencies', 'classes', 'functions', 'policies', 'views', 'core']);
32
+ assertKnownKeys(input, [
33
+ 'name',
34
+ 'entrypoint',
35
+ 'dependencies',
36
+ 'classes',
37
+ 'functions',
38
+ 'policies',
39
+ 'views',
40
+ 'core',
41
+ ]);
33
42
  if (input.core !== undefined)
34
43
  assertKnownKeys(input.core, ['nodes', 'edges'], '/core');
35
44
  const context = new BuilderContext(origin, input.dependencies ?? {});
@@ -53,6 +62,10 @@ function assembleDomainSchema(origin, input, lookup) {
53
62
  format: 'astrale.dsl',
54
63
  version: 'v1',
55
64
  origin,
65
+ name: input.name,
66
+ ...(input.entrypoint === undefined
67
+ ? {}
68
+ : { entrypoint: { origin, kind: 'view', name: input.entrypoint } }),
56
69
  // Class/Property resolution needs every dependency already referenced by
57
70
  // authored Definitions. Core endpoint refs are added immediately below.
58
71
  dependencies: context.dependencies(),
@@ -2,7 +2,7 @@ import { ZodType } from 'zod';
2
2
  import type { JsonSchema, ValueSchemaContext } from '../../../language/value/model/schema.js';
3
3
  import type { ValueSchemaRegistry } from '../../../language/value/reference/registry.js';
4
4
  import type { BuilderDiagnostic } from '../../schema/diagnostic.js';
5
- export type ZodValueSchemaConversion = {
5
+ type ZodValueSchemaConversion = {
6
6
  readonly ok: true;
7
7
  readonly schema: JsonSchema;
8
8
  readonly diagnostics: readonly [];
@@ -10,7 +10,7 @@ export type ZodValueSchemaConversion = {
10
10
  readonly ok: false;
11
11
  readonly diagnostics: readonly BuilderDiagnostic[];
12
12
  };
13
- export interface ZodValueSchemaConversionOptions {
13
+ interface ZodValueSchemaConversionOptions {
14
14
  /** Undefined is representable only as absence at a containing object-property boundary. */
15
15
  readonly position?: 'value' | 'object-property';
16
16
  /** Builder-only lowering hook keyed by the original Zod schema identity. */
@@ -30,3 +30,4 @@ export interface ZodValueSchemaOverrideContext {
30
30
  export declare function convertZodToValueSchema(zodSchema: ZodType, context: ValueSchemaContext, registry: ValueSchemaRegistry, pointer?: string, options?: ZodValueSchemaConversionOptions): ZodValueSchemaConversion;
31
31
  /** Whether explicit Zod optionality makes a containing object property absent-able. */
32
32
  export declare function zodObjectPropertyIsOptional(schema: ZodType): boolean;
33
+ export {};
@@ -1,7 +1,7 @@
1
1
  import type { ViewDefinition } from '../../language/view/model/view.js';
2
2
  import type { View } from '../view/authoring.js';
3
3
  import type { BuilderContext } from './schema/context.js';
4
- export interface ViewCompiler {
4
+ interface ViewCompiler {
5
5
  compile(value: View, name: string): ViewDefinition;
6
6
  }
7
7
  export declare class V1ViewCompiler implements ViewCompiler {
@@ -9,3 +9,4 @@ export declare class V1ViewCompiler implements ViewCompiler {
9
9
  constructor(context: BuilderContext);
10
10
  compile(value: View, name: string): ViewDefinition;
11
11
  }
12
+ export {};
@@ -1,11 +1,13 @@
1
1
  import type { Domain } from '../../domain/model/domain.js';
2
2
  import type { DomainSchema } from '../../schema/model/schema.js';
3
- import type { DomainSchemaInput } from './input.js';
3
+ import type { DomainSchemaInput, EntrypointOf } from './input.js';
4
4
  import type { ResolvedDomainOfInput } from './projection.js';
5
5
  export type { DomainSchemaInput } from './input.js';
6
6
  /** Exact named Schema produced from one authored input. */
7
7
  export interface DefinedSchema<Origin extends string, Resolved extends Domain> extends DomainSchema<Origin, Resolved> {
8
8
  }
9
9
  /** Build and semantically accept one immutable V1 DomainSchema. */
10
- export declare function defineSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input): DefinedSchema<Origin, ResolvedDomainOfInput<Origin, Input>>;
10
+ export declare function defineSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input & {
11
+ readonly entrypoint?: EntrypointOf<Input>;
12
+ }): DefinedSchema<Origin, ResolvedDomainOfInput<Origin, Input>>;
11
13
  export type { ResolvedDomainOfInput } from './projection.js';
@@ -1,7 +1,8 @@
1
1
  export declare const AUTHORING: unique symbol;
2
- export type AuthoringKind = 'definition' | 'function' | 'method' | 'callable-input' | 'callable-output' | 'policy' | 'view' | 'core-node' | 'core-edge' | 'property' | 'auto';
2
+ type AuthoringKind = 'definition' | 'function' | 'method' | 'callable-input' | 'callable-output' | 'policy' | 'view' | 'core-node' | 'core-edge' | 'property' | 'auto';
3
3
  export interface AuthoringValue<Kind extends AuthoringKind> {
4
4
  readonly [AUTHORING]: Kind;
5
5
  }
6
6
  export declare function authoringValue<Kind extends AuthoringKind, Value extends object>(kind: Kind, value: Value): Readonly<Value & AuthoringValue<Kind>>;
7
7
  export declare function isAuthoringValue<Kind extends AuthoringKind>(value: unknown, kind: Kind): value is AuthoringValue<Kind> & object;
8
+ export {};
@@ -6,6 +6,10 @@ import type { Policy } from '../policy/authoring.js';
6
6
  import type { View } from '../view/authoring.js';
7
7
  /** Complete authoring input accepted by defineSchema. */
8
8
  export interface DomainSchemaInput {
9
+ /** Display name of the Domain, one trimmed line of 1 to 100 characters. */
10
+ readonly name: string;
11
+ /** Name of the one declared View this Domain opens by default. */
12
+ readonly entrypoint?: string;
9
13
  readonly dependencies?: Readonly<Record<string, DomainSchema<string>>>;
10
14
  readonly classes?: Readonly<Record<string, Class>>;
11
15
  readonly functions?: Readonly<Record<string, Function>>;
@@ -13,3 +17,7 @@ export interface DomainSchemaInput {
13
17
  readonly views?: Readonly<Record<string, View>>;
14
18
  readonly core?: CoreInput;
15
19
  }
20
+ /** An entrypoint can only name one of the Views the same input declares. */
21
+ export type EntrypointOf<Input extends DomainSchemaInput> = Input extends {
22
+ readonly views: infer Views;
23
+ } ? Extract<keyof Views, string> : never;
@@ -0,0 +1,51 @@
1
+ import type * as language from '../../../language/index.js';
2
+ import type { Method, CallableProjection, Function } from '../../callable/authoring.js';
3
+ import type { RecordField, ClassInputOf, AbstractOf } from './identity.js';
4
+ import type { MethodProjection, FunctionProjection } from './model.js';
5
+ type MethodExecutableOf<OwnerAbstract extends boolean, MethodAbstract extends boolean> = MethodAbstract extends false ? true : OwnerAbstract extends false ? true : false;
6
+ type MethodFieldsOf<Value> = RecordField<ClassInputOf<Value>, 'methods'>;
7
+ interface AuthoredMethodEntry<Owner, Name extends string, Value extends Method> {
8
+ readonly owner: Owner;
9
+ readonly name: Name;
10
+ readonly value: Value;
11
+ }
12
+ type OwnMethodEntries<Value, Static extends boolean> = {
13
+ [Name in keyof MethodFieldsOf<Value>]: MethodFieldsOf<Value>[Name] extends infer MethodValue extends Method ? CallableConfig<MethodValue> extends {
14
+ readonly static: true;
15
+ } ? Static extends true ? AuthoredMethodEntry<Value, Extract<Name, string>, MethodValue> : never : Static extends false ? AuthoredMethodEntry<Value, Extract<Name, string>, MethodValue> : never : never;
16
+ }[keyof MethodFieldsOf<Value>];
17
+ type CallableConfig<Value> = Value extends Method<infer Config> ? Config extends CallableProjection ? Config : never : Value extends Function<infer Config> ? Config extends CallableProjection ? Config : never : never;
18
+ type CallableInputValue<Value extends Method | Function> = CallableConfig<Value>['input'];
19
+ type CallableOutputValue<Value extends Method | Function> = CallableConfig<Value>['output'];
20
+ type CallableExecutionOf<Value extends Method | Function> = CallableConfig<Value>['execution'];
21
+ type CallableStaticOf<Value extends Method> = CallableConfig<Value> extends {
22
+ readonly static: true;
23
+ } ? true : false;
24
+ type CallableAbstractOf<Value extends Method> = CallableConfig<Value> extends {
25
+ readonly abstract: infer Abstract extends boolean;
26
+ } ? Abstract : false;
27
+ type CallableAuthOf<Value extends Method | Function> = CallableConfig<Value>['auth'];
28
+ type MethodProjectionOfEntry<Origin extends string, OwnerName extends string, Entry> = Entry extends language.ResolvedMethod ? MethodProjectionOfResolved<Entry> : Entry extends AuthoredMethodEntry<infer Owner, infer Name, infer Value> ? MethodProjection<CallableInputValue<Value>, CallableOutputValue<Value>, CallableStaticOf<Value>, CallableAbstractOf<Value>, CallableAuthOf<Value>, Name, language.MethodKey<Origin, OwnerName, Name>, MethodExecutableOf<AbstractOf<ClassInputOf<Owner>>, CallableAbstractOf<Value>>, CallableExecutionOf<Value>> : never;
29
+ type MethodProjectionOfEntries<Origin extends string, OwnerName extends string, Entries> = Entries extends unknown ? MethodProjectionOfEntry<Origin, OwnerName, Entries> : never;
30
+ type MethodProjectionOfResolved<Value> = Value extends language.ResolvedMethod<infer Input, infer Output, infer Static, infer Abstract, infer Auth, infer _Policy, infer Key> & {
31
+ readonly name: infer Name extends string;
32
+ } ? MethodProjection<Input, Output, Static, Abstract, Auth, Name, Key, Value['executable'], Value['execution']> : never;
33
+ /** Capture each Method through its qualified lookup key. */
34
+ export type MethodsOfCollection<Value> = Value extends {
35
+ readonly byKey: infer ByKey extends Readonly<Record<language.MethodKey, language.ResolvedMethod>>;
36
+ } ? MethodProjectionOfResolved<ByKey[keyof ByKey]> : never;
37
+ /** Project the instance Methods declared directly by one Class. */
38
+ export type OwnInstanceMethodProjectionsOf<Origin extends string, Name extends string, Value> = MethodProjectionOfEntries<Origin, Name, OwnMethodEntries<Value, false>>;
39
+ /** Project the static Methods declared directly by one Class. */
40
+ export type OwnStaticMethodProjectionsOf<Origin extends string, Name extends string, Value> = MethodProjectionOfEntries<Origin, Name, OwnMethodEntries<Value, true>>;
41
+ /** Bind an authored Function to its exact Domain coordinates. */
42
+ export type FunctionProjectionOfAuthoring<Origin extends string, Name extends string, Value> = Value extends Function ? FunctionProjection<CallableInputValue<Value>, CallableOutputValue<Value>, CallableAuthOf<Value>, language.FunctionRef<Name> & {
43
+ readonly origin: Origin;
44
+ }, language.DefinitionKey<Origin, 'function', Name>, CallableExecutionOf<Value>> : never;
45
+ /** Restore a resolved Function while preserving its execution modifier. */
46
+ export type ResolvedFunctionOfProjection<Value extends FunctionProjection> = Value extends FunctionProjection<infer Input, infer Output, infer Auth, infer Ref, infer Key, infer Execution> ? language.ResolvedFunction<Input, Output, Auth, language.PolicyCheckExpression> & {
47
+ readonly ref: Ref;
48
+ readonly key: Key;
49
+ readonly execution: Execution;
50
+ } : never;
51
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,89 @@
1
+ import type * as language from '../../../language/index.js';
2
+ import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass, ClassReferenceProjection, Class, ProjectionOfClass } from '../../class/authoring.js';
3
+ import type { DomainSchemaInput } from '../input.js';
4
+ import type { OwnInstanceMethodProjectionsOf, OwnStaticMethodProjectionsOf } from './callable.js';
5
+ import type { AbstractOf, ConstraintsOf, ResolveLazy, LocalNameOfReference, ClassesInputOf, LocalNameOf } from './identity.js';
6
+ import type { ClassProjection } from './model.js';
7
+ import type { EffectivePropertyProjectionsOf, OwnPropertyProjectionsOf } from './property.js';
8
+ import type { ClassProjectionOfResolved, ExactClass } from './resolved-class.js';
9
+ type ProjectedClassDefinition<Origin extends string, Name extends string, Value> = Value extends NodeClass<infer Config> ? language.NodeClassDefinition & {
10
+ readonly ref: language.ClassRef<Name> & {
11
+ readonly origin: Origin;
12
+ };
13
+ readonly kind: 'node';
14
+ readonly abstract: AbstractOf<Config>;
15
+ } : Value extends DirectedEdgeClass<infer Input> ? Input extends {
16
+ readonly source: infer Source extends {
17
+ readonly as: string;
18
+ readonly outgoing: language.EdgeCount;
19
+ };
20
+ readonly target: infer Target extends {
21
+ readonly as: string;
22
+ readonly incoming: language.EdgeCount;
23
+ };
24
+ } ? language.EdgeClassDefinition & {
25
+ readonly ref: language.ClassRef<Name> & {
26
+ readonly origin: Origin;
27
+ };
28
+ readonly kind: 'edge';
29
+ readonly abstract: AbstractOf<Input>;
30
+ readonly orientation: 'directed';
31
+ readonly endpoints: {
32
+ readonly source: language.DirectedSourceEndpoint & {
33
+ readonly role: Source['as'];
34
+ readonly outgoing: Source['outgoing'];
35
+ };
36
+ readonly target: language.DirectedTargetEndpoint & {
37
+ readonly role: Target['as'];
38
+ readonly incoming: Target['incoming'];
39
+ };
40
+ };
41
+ readonly constraints: language.DirectedEdgeConstraints & ConstraintsOf<Input>;
42
+ } : never : Value extends UndirectedEdgeClass<infer Input> ? Input extends {
43
+ readonly endpoints: readonly [
44
+ infer First extends {
45
+ readonly as: string;
46
+ readonly incident: language.EdgeCount;
47
+ },
48
+ infer Second extends {
49
+ readonly as: string;
50
+ readonly incident: language.EdgeCount;
51
+ }
52
+ ];
53
+ } ? language.EdgeClassDefinition & {
54
+ readonly ref: language.ClassRef<Name> & {
55
+ readonly origin: Origin;
56
+ };
57
+ readonly kind: 'edge';
58
+ readonly abstract: AbstractOf<Input>;
59
+ readonly orientation: 'undirected';
60
+ readonly endpoints: readonly [
61
+ language.IncidentEndpoint & {
62
+ readonly role: First['as'];
63
+ readonly incident: First['incident'];
64
+ },
65
+ language.IncidentEndpoint & {
66
+ readonly role: Second['as'];
67
+ readonly incident: Second['incident'];
68
+ }
69
+ ];
70
+ readonly constraints: language.UndirectedEdgeConstraints & ConstraintsOf<Input>;
71
+ } : never : never;
72
+ type ParentInputsOfConfig<Config> = Config extends {
73
+ readonly extends?: infer Parents extends readonly unknown[];
74
+ } ? Parents : readonly [];
75
+ type ParentClassProjectionOf<Origin extends string, Parent, Root extends DomainSchemaInput, Seen> = ResolveLazy<Parent> extends infer Resolved ? Resolved extends ClassReferenceProjection<infer _Kind, infer _Identity, infer _Properties, infer _InstanceMethods, infer _StaticMethods> ? LocalNameOfReference<Root, Resolved> extends infer Name extends string ? Name extends keyof ClassesInputOf<Root> ? ShallowClassProjectionOfAuthoring<Origin, Name, Extract<ClassesInputOf<Root>[Name], Class>, Root> : never : never : Resolved extends ClassProjection ? Resolved : Resolved extends language.AnyResolvedClass ? ClassProjectionOfResolved<ExactClass<Resolved>> : LocalNameOf<Root, Resolved> extends infer Name extends string ? Resolved extends Seen ? never : ClassProjectionOfAuthoring<Origin, Name, Resolved, Root, Seen | Resolved> : never : never;
76
+ type ParentClassProjectionTuple<Origin extends string, Parents extends readonly unknown[], Root extends DomainSchemaInput, Seen> = Parents extends readonly [] ? readonly [] : Parents extends readonly [infer Parent, ...infer Rest] ? readonly [
77
+ ParentClassProjectionOf<Origin, Parent, Root, Seen>,
78
+ ...ParentClassProjectionTuple<Origin, Rest, Root, Seen>
79
+ ] : readonly ParentClassProjectionOf<Origin, Parents[number], Root, Seen>[];
80
+ /** A shallow parent retains member contracts without expanding another parent tuple. */
81
+ type ShallowClassProjectionOfAuthoring<Origin extends string, Name extends string, Value, Root extends DomainSchemaInput> = ClassProjectionWithParents<Origin, Name, Value, Root, readonly language.AnyResolvedClass[]>;
82
+ /** Project each authored Class independently before computing its parent tuple. */
83
+ export type ClassProjectionOfAuthoring<Origin extends string, Name extends string, Value, Root extends DomainSchemaInput, Seen = Value> = Value extends Class ? ClassProjectionWithParents<Origin, Name, Value, Root, ParentClassProjectionTuple<Origin, ParentInputsOfConfig<ProjectionOfClass<Extract<Value, Class>>>, Root, Seen>> : never;
84
+ type ClassProjectionWithParents<Origin extends string, Name extends string, Value, Root extends DomainSchemaInput, Parents extends readonly unknown[]> = Value extends NodeClass<infer _Config> ? ClassProjection<'node', Extract<ProjectedClassDefinition<Origin, Name, Value>, language.NodeClassDefinition>, language.ClassRef<Name> & {
85
+ readonly origin: Origin;
86
+ }, language.DefinitionKey<Origin, 'class', Name>, Parents, EffectivePropertyProjectionsOf<Origin, Name, Value, Root>, OwnInstanceMethodProjectionsOf<Origin, Name, Value>, OwnStaticMethodProjectionsOf<Origin, Name, Value>, OwnPropertyProjectionsOf<Origin, Name, Value>, OwnInstanceMethodProjectionsOf<Origin, Name, Value>, OwnStaticMethodProjectionsOf<Origin, Name, Value>> : Value extends DirectedEdgeClass | UndirectedEdgeClass ? ClassProjection<'edge', Extract<ProjectedClassDefinition<Origin, Name, Value>, language.EdgeClassDefinition>, language.ClassRef<Name> & {
87
+ readonly origin: Origin;
88
+ }, language.DefinitionKey<Origin, 'class', Name>, Parents, EffectivePropertyProjectionsOf<Origin, Name, Value, Root>, never, never, OwnPropertyProjectionsOf<Origin, Name, Value>, never, never> : never;
89
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import type * as language from '../../../language/index.js';
2
+ import type { BlobReceipt } from '../../../language/value/model/blob.js';
3
+ import type { Class, AuthoredPropertyProjection } from '../../class/authoring.js';
4
+ import type { ResolveLazy, IsMultiple } from './identity.js';
5
+ import type { EffectivePropertyEntriesOfClass } from './property.js';
6
+ /** Derive required, optional and forbidden Core Property inputs by name. */
7
+ export type CoreNamedPropertyInput<ClassValue> = ResolveLazy<ClassValue> extends infer Resolved ? Resolved extends Class ? CorePropertyInputFromAuthoredProjections<EffectivePropertyEntriesOfClass<Resolved>> : Resolved extends language.ResolvedClass ? language.PropertyInputOf<Resolved> : never : never;
8
+ /** Allow exact named Core inputs or canonical qualified Property keys. */
9
+ export type CorePropertyInput<ClassValue> = CoreNamedPropertyInput<ClassValue> | Readonly<Record<language.PropertyKey, language.PropertyValue>>;
10
+ type AuthoredProjectionName<Entry> = Entry extends AuthoredPropertyProjection<unknown, unknown, boolean, infer Name> ? Name : never;
11
+ type AuthoredProjectionInput<Entry> = Entry extends AuthoredPropertyProjection<infer Input, unknown, boolean, string> ? Input : never;
12
+ type CoreProjectionInput<Entry> = Entry extends AuthoredPropertyProjection<infer Input, infer Output, boolean, string> ? Input extends BlobReceipt ? Output : Input : never;
13
+ type AuthoredProjectionRequired<Entry> = Entry extends AuthoredPropertyProjection<unknown, unknown, infer Required, string> ? Required : false;
14
+ type UniqueAuthoredProjections<Entries> = Entries extends unknown ? IsMultiple<Extract<Entries, {
15
+ readonly name: AuthoredProjectionName<Entries>;
16
+ }>> extends true ? never : Entries : never;
17
+ type CoreAuthoredProjections<Entries> = UniqueAuthoredProjections<Entries> extends infer Entry ? Entry extends unknown ? [AuthoredProjectionInput<Entry>] extends [never] ? never : Entry : never : never;
18
+ type RequiredAuthoredPropertyNames<Entries> = CoreAuthoredProjections<Entries> extends infer Entry ? Entry extends unknown ? AuthoredProjectionRequired<Entry> extends true ? AuthoredProjectionName<Entry> : never : never : never;
19
+ type OptionalAuthoredPropertyNames<Entries> = Exclude<AuthoredProjectionName<CoreAuthoredProjections<Entries>>, RequiredAuthoredPropertyNames<Entries>>;
20
+ type AutomaticAuthoredPropertyNames<Entries> = UniqueAuthoredProjections<Entries> extends infer Entry ? Entry extends unknown ? [AuthoredProjectionInput<Entry>] extends [never] ? AuthoredProjectionName<Entry> : never : never : never;
21
+ type CorePropertyInputFromAuthoredProjections<Entries> = Readonly<{
22
+ [Name in RequiredAuthoredPropertyNames<Entries>]: CoreProjectionInput<Extract<CoreAuthoredProjections<Entries>, {
23
+ readonly name: Name;
24
+ }>>;
25
+ } & {
26
+ [Name in OptionalAuthoredPropertyNames<Entries>]?: CoreProjectionInput<Extract<CoreAuthoredProjections<Entries>, {
27
+ readonly name: Name;
28
+ }>>;
29
+ } & {
30
+ [Name in AutomaticAuthoredPropertyNames<Entries>]?: never;
31
+ }>;
32
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ import type { Revision } from '../../../addressing/index.js';
2
+ import type * as domain from '../../../domain/model/domain.js';
3
+ import type * as language from '../../../language/index.js';
4
+ import type { DomainSchema, DomainOfSchema } from '../../../schema/model/schema.js';
5
+ import type { DomainSchemaInput } from '../input.js';
6
+ import type { FunctionProjectionOfAuthoring, ResolvedFunctionOfProjection } from './callable.js';
7
+ import type { ClassProjectionOfAuthoring } from './class.js';
8
+ import type { ClassesInputOf, RecordField } from './identity.js';
9
+ import type { DomainProjection, ClassProjection, FunctionProjection } from './model.js';
10
+ import type { ResolvedClassOfProjection } from './resolved-class.js';
11
+ type ProjectionOfInput<Origin extends string, Input extends DomainSchemaInput> = DomainProjection<{
12
+ readonly [Name in keyof ClassesInputOf<Input>]: ClassProjectionOfAuthoring<Origin, Extract<Name, string>, ClassesInputOf<Input>[Name], Input>;
13
+ }, {
14
+ readonly [Name in keyof FunctionsInputOf<Input>]: FunctionProjectionOfAuthoring<Origin, Extract<Name, string>, FunctionsInputOf<Input>[Name]>;
15
+ }, {
16
+ readonly [Name in keyof PoliciesInputOf<Input>]: language.ResolvedPolicy & {
17
+ readonly ref: language.PolicyRef<Extract<Name, string>> & {
18
+ readonly origin: Origin;
19
+ };
20
+ readonly key: language.DefinitionKey<Origin, 'policy', Extract<Name, string>>;
21
+ };
22
+ }, {
23
+ readonly [Name in keyof ViewsInputOf<Input>]: language.ResolvedView & {
24
+ readonly ref: language.ViewRef<Extract<Name, string>> & {
25
+ readonly origin: Origin;
26
+ };
27
+ readonly key: language.DefinitionKey<Origin, 'view', Extract<Name, string>>;
28
+ };
29
+ }, {
30
+ readonly [Name in keyof CoreNodesInputOf<Input>]: language.ResolvedCoreDefinition & {
31
+ readonly ref: language.CoreRef<Extract<Name, string>> & {
32
+ readonly origin: Origin;
33
+ };
34
+ readonly key: language.DefinitionKey<Origin, 'core', Extract<Name, string>>;
35
+ };
36
+ }, DependencySchemasOf<Input>>;
37
+ interface DomainOfProjection<Projection extends DomainProjection> extends domain.Domain<{
38
+ readonly [Name in keyof Projection['classes']]: ResolvedClassOfProjection<Extract<Projection['classes'][Name], ClassProjection>>;
39
+ }, {
40
+ readonly [Name in keyof Projection['functions']]: ResolvedFunctionOfProjection<Extract<Projection['functions'][Name], FunctionProjection>>;
41
+ }, Extract<Projection['policies'], Readonly<Record<string, language.ResolvedPolicy>>>, Extract<Projection['views'], Readonly<Record<string, language.ResolvedView>>>, Extract<Projection['core'], Readonly<Record<string, language.ResolvedCoreDefinition>>>, Revision> {
42
+ readonly dependencies: domain.DependencyDomainNamespace<{
43
+ readonly [Alias in keyof Projection['dependencies']]: Projection['dependencies'][Alias] extends infer Dependency extends DomainSchema ? DomainOfSchema<Dependency> : never;
44
+ }>;
45
+ }
46
+ /** Resolve compact authored witnesses into the exact public Domain type. */
47
+ export type ResolvedDomainOfInput<Origin extends string, Input extends DomainSchemaInput> = DomainOfProjection<ProjectionOfInput<Origin, Input>>;
48
+ type DependenciesInputOf<Input extends DomainSchemaInput> = RecordField<Input, 'dependencies'>;
49
+ type DependencySchemasOf<Input extends DomainSchemaInput> = {
50
+ readonly [Alias in keyof DependenciesInputOf<Input>]: DependenciesInputOf<Input>[Alias];
51
+ };
52
+ type FunctionsInputOf<Input extends DomainSchemaInput> = RecordField<Input, 'functions'>;
53
+ type PoliciesInputOf<Input extends DomainSchemaInput> = RecordField<Input, 'policies'>;
54
+ type ViewsInputOf<Input extends DomainSchemaInput> = RecordField<Input, 'views'>;
55
+ type CoreInputOf<Input extends DomainSchemaInput> = Input extends {
56
+ readonly core?: infer CoreValue;
57
+ } ? NonNullable<CoreValue> : Record<never, never>;
58
+ type CoreNodesInputOf<Input extends DomainSchemaInput> = RecordField<CoreInputOf<Input>, 'nodes'>;
59
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { NodeClass, DirectedEdgeClass, UndirectedEdgeClass, ClassReferenceProjection, ClassReferenceProjectionOf, Class, ClassIdentityProjectionOf, ClassOwnerProjectionOf, ClassOwnerProjection, ClassIdentityProjection } from '../../class/authoring.js';
2
+ import type { DomainSchemaInput } from '../input.js';
3
+ /** Extract an authored abstract modifier with its default. */
4
+ export type AbstractOf<Config> = Config extends {
5
+ readonly abstract: infer Abstract extends boolean;
6
+ } ? Abstract : false;
7
+ /** Extract only the authored Edge constraints. */
8
+ export type ConstraintsOf<Options> = Options extends {
9
+ readonly constraints?: infer Constraints;
10
+ } ? NonNullable<Constraints> : Record<never, never>;
11
+ /** Extract one optional named declaration dictionary. */
12
+ export type RecordField<Value, Key extends PropertyKey> = Key extends keyof Value ? NonNullable<Value[Key]> extends Readonly<Record<string, unknown>> ? NonNullable<Value[Key]> : Record<never, never> : Record<never, never>;
13
+ /** Select the local Class dictionary of a schema input. */
14
+ export type ClassesInputOf<Input extends DomainSchemaInput> = RecordField<Input, 'classes'>;
15
+ /** Unwrap lazy references within the existing 32-step inference budget. */
16
+ export type ResolveLazy<Value, Depth extends readonly unknown[] = []> = Depth['length'] extends 32 ? Value : Value extends () => infer Resolved ? ResolveLazy<Resolved, readonly [...Depth, unknown]> : Value;
17
+ /** Extract the compact projection retained by a Class handle. */
18
+ export type ClassInputOf<Value> = Value extends NodeClass<infer Input> ? Input : Value extends DirectedEdgeClass<infer Input> ? Input : Value extends UndirectedEdgeClass<infer Input> ? Input : never;
19
+ type Same<Left, Right> = [Left] extends [Right] ? ([Right] extends [Left] ? true : false) : false;
20
+ /** Find a local Class by its exact authoring handle type. */
21
+ export type LocalNameOf<Root extends DomainSchemaInput, Value> = {
22
+ [Name in keyof ClassesInputOf<Root>]: Same<ClassesInputOf<Root>[Name], Value> extends true ? Name : never;
23
+ }[keyof ClassesInputOf<Root>];
24
+ /** Find a local Class by its retained reference projection. */
25
+ export type LocalNameOfReference<Root extends DomainSchemaInput, Value> = {
26
+ [Name in keyof ClassesInputOf<Root>]: Value extends ClassReferenceProjection<'node' | 'edge', unknown, unknown, unknown, unknown> ? Same<ClassReferenceProjectionOf<Extract<ClassesInputOf<Root>[Name], Class>>, Value> extends true ? Name : never : never;
27
+ }[keyof ClassesInputOf<Root>];
28
+ type LocalNameOfIdentity<Root extends DomainSchemaInput, Value> = {
29
+ [Name in keyof ClassesInputOf<Root>]: Same<ClassIdentityProjectionOf<Extract<ClassesInputOf<Root>[Name], Class>>, Value> extends true ? Name : never;
30
+ }[keyof ClassesInputOf<Root>];
31
+ type LocalNameOfOwner<Root extends DomainSchemaInput, Value> = {
32
+ [Name in keyof ClassesInputOf<Root>]: Same<ClassOwnerProjectionOf<Extract<ClassesInputOf<Root>[Name], Class>>, Value> extends true ? Name : never;
33
+ }[keyof ClassesInputOf<Root>];
34
+ type UnionIsMultiple<Value, Whole = Value> = Value extends unknown ? [Whole] extends [Value] ? false : true : never;
35
+ /** Distinguish ambiguous unions from one exact member. */
36
+ export type IsMultiple<Value> = true extends UnionIsMultiple<Value> ? true : false;
37
+ /** Recover the local declaring Class name for an effective member. */
38
+ export type OwnerNameOf<Root extends DomainSchemaInput, CurrentName extends string, Owner> = Owner extends 'self' ? CurrentName : Owner extends ClassOwnerProjection ? Extract<LocalNameOfOwner<Root, Owner>, string> : Owner extends ClassIdentityProjection ? Extract<LocalNameOfIdentity<Root, Owner>, string> : never;
39
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ import type * as language from '../../../language/index.js';
2
+ import type { StateTopology } from '../../../language/state/index.js';
3
+ /** A Property’s exact value, input, ownership and requiredness contracts. */
4
+ export interface PropertyProjection<Value = unknown, Required extends boolean = boolean, Name extends string = string, Key extends language.PropertyKey = language.PropertyKey, State extends StateTopology | undefined = StateTopology | undefined, Input = Value> {
5
+ readonly value: Value;
6
+ readonly required: Required;
7
+ readonly name: Name;
8
+ readonly key: Key;
9
+ readonly state?: State;
10
+ readonly input: Input;
11
+ }
12
+ /** A Method’s exact callable, ownership and executable contracts. */
13
+ export interface MethodProjection<Input = unknown, Output = unknown, Static extends boolean = boolean, Abstract extends boolean = boolean, Auth extends language.FunctionAuth = language.FunctionAuth, Name extends string = string, Key extends language.MethodKey = language.MethodKey, Executable extends boolean = boolean, Execution extends language.CallableExecution | undefined = language.CallableExecution | undefined> {
14
+ readonly input: Input;
15
+ readonly output: Output;
16
+ readonly static: Static;
17
+ readonly abstract: Abstract;
18
+ readonly executable: Executable;
19
+ readonly auth: Auth;
20
+ readonly name: Name;
21
+ readonly key: Key;
22
+ readonly execution: Execution;
23
+ }
24
+ /** A Function’s exact callable and declaration contracts. */
25
+ export interface FunctionProjection<Input = unknown, Output = unknown, Auth extends language.FunctionAuth = language.FunctionAuth, Ref extends language.FunctionRef = language.FunctionRef, Key extends language.DefinitionKey<string, 'function'> = language.DefinitionKey<string, 'function'>, Execution extends language.CallableExecution | undefined = language.CallableExecution | undefined> {
26
+ readonly input: Input;
27
+ readonly output: Output;
28
+ readonly auth: Auth;
29
+ readonly ref: Ref;
30
+ readonly key: Key;
31
+ readonly execution: Execution;
32
+ }
33
+ /** A compact Class witness with effective members and exact self facets. */
34
+ export interface ClassProjection<Kind extends language.ClassKind = language.ClassKind, Definition extends Extract<language.ClassDefinition, {
35
+ readonly kind: Kind;
36
+ }> = Extract<language.ClassDefinition, {
37
+ readonly kind: Kind;
38
+ }>, Ref extends language.ClassRef = language.ClassRef, Key extends language.DefinitionKey<string, 'class'> = language.DefinitionKey<string, 'class'>, Parents extends readonly unknown[] = readonly unknown[], Properties extends PropertyProjection = PropertyProjection, InstanceMethods extends MethodProjection = MethodProjection, StaticMethods extends MethodProjection = MethodProjection, SelfProperties extends PropertyProjection = PropertyProjection, SelfInstanceMethods extends MethodProjection = MethodProjection, SelfStaticMethods extends MethodProjection = MethodProjection> {
39
+ readonly kind: Kind;
40
+ readonly definition: Definition;
41
+ readonly ref: Ref;
42
+ readonly key: Key;
43
+ readonly parents: Parents;
44
+ readonly properties: Properties;
45
+ readonly methods: InstanceMethods;
46
+ readonly staticMethods: StaticMethods;
47
+ readonly selfProperties: SelfProperties;
48
+ readonly selfMethods: SelfInstanceMethods;
49
+ readonly selfStaticMethods: SelfStaticMethods;
50
+ }
51
+ /** The named declaration and direct-dependency witnesses of one Domain. */
52
+ export interface DomainProjection<Classes extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Functions extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Policies extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Views extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, CoreNodes extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Dependencies extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>> {
53
+ readonly classes: Classes;
54
+ readonly functions: Functions;
55
+ readonly policies: Policies;
56
+ readonly views: Views;
57
+ readonly core: CoreNodes;
58
+ readonly dependencies: Dependencies;
59
+ }
@@ -0,0 +1 @@
1
+ export {};