@astrale-os/kernel-dsl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/builders/bitmask.d.ts +5 -0
  2. package/dist/builders/bitmask.d.ts.map +1 -0
  3. package/dist/builders/bitmask.js +11 -0
  4. package/dist/builders/data.d.ts +7 -0
  5. package/dist/builders/data.d.ts.map +1 -0
  6. package/dist/builders/data.js +17 -0
  7. package/dist/builders/definition/base.d.ts +13 -0
  8. package/dist/builders/definition/base.d.ts.map +1 -0
  9. package/dist/builders/definition/base.js +23 -0
  10. package/dist/builders/definition/edge-class.d.ts +8 -0
  11. package/dist/builders/definition/edge-class.d.ts.map +1 -0
  12. package/dist/builders/definition/edge-class.js +8 -0
  13. package/dist/builders/definition/edge-interface.d.ts +8 -0
  14. package/dist/builders/definition/edge-interface.d.ts.map +1 -0
  15. package/dist/builders/definition/edge-interface.js +8 -0
  16. package/dist/builders/definition/index.d.ts +5 -0
  17. package/dist/builders/definition/index.d.ts.map +1 -0
  18. package/dist/builders/definition/index.js +4 -0
  19. package/dist/builders/definition/node-class.d.ts +7 -0
  20. package/dist/builders/definition/node-class.d.ts.map +1 -0
  21. package/dist/builders/definition/node-class.js +8 -0
  22. package/dist/builders/definition/node-interface.d.ts +7 -0
  23. package/dist/builders/definition/node-interface.d.ts.map +1 -0
  24. package/dist/builders/definition/node-interface.js +8 -0
  25. package/dist/builders/function.d.ts +14 -0
  26. package/dist/builders/function.d.ts.map +1 -0
  27. package/dist/builders/function.js +4 -0
  28. package/dist/builders/index.d.ts +10 -0
  29. package/dist/builders/index.d.ts.map +1 -0
  30. package/dist/builders/index.js +9 -0
  31. package/dist/builders/prop.d.ts +7 -0
  32. package/dist/builders/prop.d.ts.map +1 -0
  33. package/dist/builders/prop.js +8 -0
  34. package/dist/builders/ref.d.ts +12 -0
  35. package/dist/builders/ref.d.ts.map +1 -0
  36. package/dist/builders/ref.js +26 -0
  37. package/dist/grammar/definition/base.d.ts +13 -0
  38. package/dist/grammar/definition/base.d.ts.map +1 -0
  39. package/dist/grammar/definition/base.js +1 -0
  40. package/dist/grammar/definition/discriminants.d.ts +31 -0
  41. package/dist/grammar/definition/discriminants.d.ts.map +1 -0
  42. package/dist/grammar/definition/discriminants.js +32 -0
  43. package/dist/grammar/definition/edge-class.d.ts +19 -0
  44. package/dist/grammar/definition/edge-class.d.ts.map +1 -0
  45. package/dist/grammar/definition/edge-class.js +1 -0
  46. package/dist/grammar/definition/edge-interface.d.ts +18 -0
  47. package/dist/grammar/definition/edge-interface.d.ts.map +1 -0
  48. package/dist/grammar/definition/edge-interface.js +1 -0
  49. package/dist/grammar/definition/index.d.ts +8 -0
  50. package/dist/grammar/definition/index.d.ts.map +1 -0
  51. package/dist/grammar/definition/index.js +1 -0
  52. package/dist/grammar/definition/node-class.d.ts +21 -0
  53. package/dist/grammar/definition/node-class.d.ts.map +1 -0
  54. package/dist/grammar/definition/node-class.js +1 -0
  55. package/dist/grammar/definition/node-interface.d.ts +14 -0
  56. package/dist/grammar/definition/node-interface.d.ts.map +1 -0
  57. package/dist/grammar/definition/node-interface.js +1 -0
  58. package/dist/grammar/facets/constraints.d.ts +8 -0
  59. package/dist/grammar/facets/constraints.d.ts.map +1 -0
  60. package/dist/grammar/facets/constraints.js +1 -0
  61. package/dist/grammar/facets/content.d.ts +4 -0
  62. package/dist/grammar/facets/content.d.ts.map +1 -0
  63. package/dist/grammar/facets/content.js +1 -0
  64. package/dist/grammar/facets/endpoints.d.ts +14 -0
  65. package/dist/grammar/facets/endpoints.d.ts.map +1 -0
  66. package/dist/grammar/facets/endpoints.js +2 -0
  67. package/dist/grammar/facets/index.d.ts +9 -0
  68. package/dist/grammar/facets/index.d.ts.map +1 -0
  69. package/dist/grammar/facets/index.js +3 -0
  70. package/dist/grammar/facets/indexes.d.ts +12 -0
  71. package/dist/grammar/facets/indexes.d.ts.map +1 -0
  72. package/dist/grammar/facets/indexes.js +8 -0
  73. package/dist/grammar/facets/properties.d.ts +26 -0
  74. package/dist/grammar/facets/properties.d.ts.map +1 -0
  75. package/dist/grammar/facets/properties.js +44 -0
  76. package/dist/grammar/function/config.d.ts +14 -0
  77. package/dist/grammar/function/config.d.ts.map +1 -0
  78. package/dist/grammar/function/config.js +1 -0
  79. package/dist/grammar/function/def.d.ts +33 -0
  80. package/dist/grammar/function/def.d.ts.map +1 -0
  81. package/dist/grammar/function/def.js +1 -0
  82. package/dist/grammar/function/index.d.ts +5 -0
  83. package/dist/grammar/function/index.d.ts.map +1 -0
  84. package/dist/grammar/function/index.js +1 -0
  85. package/dist/grammar/function/inheritance.d.ts +3 -0
  86. package/dist/grammar/function/inheritance.d.ts.map +1 -0
  87. package/dist/grammar/function/inheritance.js +1 -0
  88. package/dist/grammar/function/output.d.ts +3 -0
  89. package/dist/grammar/function/output.d.ts.map +1 -0
  90. package/dist/grammar/function/output.js +1 -0
  91. package/dist/grammar/index.d.ts +5 -0
  92. package/dist/grammar/index.d.ts.map +1 -0
  93. package/dist/grammar/index.js +4 -0
  94. package/dist/grammar/values/bitmask.d.ts +7 -0
  95. package/dist/grammar/values/bitmask.d.ts.map +1 -0
  96. package/dist/grammar/values/bitmask.js +1 -0
  97. package/dist/grammar/values/data.d.ts +30 -0
  98. package/dist/grammar/values/data.d.ts.map +1 -0
  99. package/dist/grammar/values/data.js +1 -0
  100. package/dist/grammar/values/index.d.ts +9 -0
  101. package/dist/grammar/values/index.d.ts.map +1 -0
  102. package/dist/grammar/values/index.js +4 -0
  103. package/dist/grammar/values/ref.d.ts +26 -0
  104. package/dist/grammar/values/ref.d.ts.map +1 -0
  105. package/dist/grammar/values/ref.js +1 -0
  106. package/dist/grammar/values/self.d.ts +12 -0
  107. package/dist/grammar/values/self.d.ts.map +1 -0
  108. package/dist/grammar/values/self.js +5 -0
  109. package/dist/index.d.ts +53 -0
  110. package/dist/index.d.ts.map +1 -0
  111. package/dist/index.js +29 -0
  112. package/dist/inference/content.d.ts +27 -0
  113. package/dist/inference/content.d.ts.map +1 -0
  114. package/dist/inference/content.js +1 -0
  115. package/dist/inference/index.d.ts +7 -0
  116. package/dist/inference/index.d.ts.map +1 -0
  117. package/dist/inference/index.js +1 -0
  118. package/dist/inference/inheritance.d.ts +48 -0
  119. package/dist/inference/inheritance.d.ts.map +1 -0
  120. package/dist/inference/inheritance.js +1 -0
  121. package/dist/inference/input.d.ts +30 -0
  122. package/dist/inference/input.d.ts.map +1 -0
  123. package/dist/inference/input.js +1 -0
  124. package/dist/inference/methods.d.ts +69 -0
  125. package/dist/inference/methods.d.ts.map +1 -0
  126. package/dist/inference/methods.js +1 -0
  127. package/dist/inference/properties.d.ts +37 -0
  128. package/dist/inference/properties.d.ts.map +1 -0
  129. package/dist/inference/properties.js +1 -0
  130. package/dist/inference/schema.d.ts +37 -0
  131. package/dist/inference/schema.d.ts.map +1 -0
  132. package/dist/inference/schema.js +1 -0
  133. package/dist/instance/core/define.d.ts +13 -0
  134. package/dist/instance/core/define.d.ts.map +1 -0
  135. package/dist/instance/core/define.js +62 -0
  136. package/dist/instance/core/edge.d.ts +9 -0
  137. package/dist/instance/core/edge.d.ts.map +1 -0
  138. package/dist/instance/core/edge.js +10 -0
  139. package/dist/instance/core/endpoint.d.ts +11 -0
  140. package/dist/instance/core/endpoint.d.ts.map +1 -0
  141. package/dist/instance/core/endpoint.js +18 -0
  142. package/dist/instance/core/index.d.ts +7 -0
  143. package/dist/instance/core/index.d.ts.map +1 -0
  144. package/dist/instance/core/index.js +5 -0
  145. package/dist/instance/core/node.d.ts +7 -0
  146. package/dist/instance/core/node.d.ts.map +1 -0
  147. package/dist/instance/core/node.js +8 -0
  148. package/dist/instance/core/path.d.ts +21 -0
  149. package/dist/instance/core/path.d.ts.map +1 -0
  150. package/dist/instance/core/path.js +20 -0
  151. package/dist/instance/core/self.d.ts +15 -0
  152. package/dist/instance/core/self.d.ts.map +1 -0
  153. package/dist/instance/core/self.js +7 -0
  154. package/dist/instance/core/types.d.ts +45 -0
  155. package/dist/instance/core/types.d.ts.map +1 -0
  156. package/dist/instance/core/types.js +1 -0
  157. package/dist/instance/index.d.ts +4 -0
  158. package/dist/instance/index.d.ts.map +1 -0
  159. package/dist/instance/index.js +2 -0
  160. package/dist/instance/seed/define.d.ts +12 -0
  161. package/dist/instance/seed/define.d.ts.map +1 -0
  162. package/dist/instance/seed/define.js +33 -0
  163. package/dist/instance/seed/index.d.ts +3 -0
  164. package/dist/instance/seed/index.d.ts.map +1 -0
  165. package/dist/instance/seed/index.js +1 -0
  166. package/dist/instance/seed/types.d.ts +12 -0
  167. package/dist/instance/seed/types.d.ts.map +1 -0
  168. package/dist/instance/seed/types.js +1 -0
  169. package/dist/ir/classes.d.ts +72 -0
  170. package/dist/ir/classes.d.ts.map +1 -0
  171. package/dist/ir/classes.js +1 -0
  172. package/dist/ir/domain.d.ts +13 -0
  173. package/dist/ir/domain.d.ts.map +1 -0
  174. package/dist/ir/domain.js +1 -0
  175. package/dist/ir/endpoints.d.ts +27 -0
  176. package/dist/ir/endpoints.d.ts.map +1 -0
  177. package/dist/ir/endpoints.js +1 -0
  178. package/dist/ir/functions.d.ts +19 -0
  179. package/dist/ir/functions.d.ts.map +1 -0
  180. package/dist/ir/functions.js +1 -0
  181. package/dist/ir/index.d.ts +8 -0
  182. package/dist/ir/index.d.ts.map +1 -0
  183. package/dist/ir/index.js +1 -0
  184. package/dist/ir/ir.d.ts +63 -0
  185. package/dist/ir/ir.d.ts.map +1 -0
  186. package/dist/ir/ir.js +4 -0
  187. package/dist/ir/json-schema.d.ts +20 -0
  188. package/dist/ir/json-schema.d.ts.map +1 -0
  189. package/dist/ir/json-schema.js +1 -0
  190. package/dist/schema/classify.d.ts +8 -0
  191. package/dist/schema/classify.d.ts.map +1 -0
  192. package/dist/schema/classify.js +19 -0
  193. package/dist/schema/define.d.ts +19 -0
  194. package/dist/schema/define.d.ts.map +1 -0
  195. package/dist/schema/define.js +47 -0
  196. package/dist/schema/error.d.ts +8 -0
  197. package/dist/schema/error.d.ts.map +1 -0
  198. package/dist/schema/error.js +13 -0
  199. package/dist/schema/index.d.ts +8 -0
  200. package/dist/schema/index.d.ts.map +1 -0
  201. package/dist/schema/index.js +5 -0
  202. package/dist/schema/refs.d.ts +80 -0
  203. package/dist/schema/refs.d.ts.map +1 -0
  204. package/dist/schema/refs.js +116 -0
  205. package/dist/schema/resolve/index.d.ts +5 -0
  206. package/dist/schema/resolve/index.d.ts.map +1 -0
  207. package/dist/schema/resolve/index.js +4 -0
  208. package/dist/schema/resolve/methods.d.ts +8 -0
  209. package/dist/schema/resolve/methods.d.ts.map +1 -0
  210. package/dist/schema/resolve/methods.js +17 -0
  211. package/dist/schema/resolve/properties.d.ts +13 -0
  212. package/dist/schema/resolve/properties.d.ts.map +1 -0
  213. package/dist/schema/resolve/properties.js +36 -0
  214. package/dist/schema/resolve/self.d.ts +7 -0
  215. package/dist/schema/resolve/self.d.ts.map +1 -0
  216. package/dist/schema/resolve/self.js +32 -0
  217. package/dist/schema/resolve/thunks.d.ts +12 -0
  218. package/dist/schema/resolve/thunks.d.ts.map +1 -0
  219. package/dist/schema/resolve/thunks.js +36 -0
  220. package/dist/schema/schema.d.ts +21 -0
  221. package/dist/schema/schema.d.ts.map +1 -0
  222. package/dist/schema/schema.js +1 -0
  223. package/dist/schema/validators/context.d.ts +13 -0
  224. package/dist/schema/validators/context.d.ts.map +1 -0
  225. package/dist/schema/validators/context.js +1 -0
  226. package/dist/schema/validators/endpoints.d.ts +4 -0
  227. package/dist/schema/validators/endpoints.d.ts.map +1 -0
  228. package/dist/schema/validators/endpoints.js +26 -0
  229. package/dist/schema/validators/index.d.ts +11 -0
  230. package/dist/schema/validators/index.d.ts.map +1 -0
  231. package/dist/schema/validators/index.js +21 -0
  232. package/dist/schema/validators/indexes.d.ts +4 -0
  233. package/dist/schema/validators/indexes.d.ts.map +1 -0
  234. package/dist/schema/validators/indexes.js +18 -0
  235. package/dist/schema/validators/inheritance.d.ts +4 -0
  236. package/dist/schema/validators/inheritance.d.ts.map +1 -0
  237. package/dist/schema/validators/inheritance.js +26 -0
  238. package/dist/schema/validators/methods.d.ts +9 -0
  239. package/dist/schema/validators/methods.d.ts.map +1 -0
  240. package/dist/schema/validators/methods.js +43 -0
  241. package/dist/schema/validators/names.d.ts +4 -0
  242. package/dist/schema/validators/names.d.ts.map +1 -0
  243. package/dist/schema/validators/names.js +18 -0
  244. package/dist/schema/validators/ref-targets.d.ts +4 -0
  245. package/dist/schema/validators/ref-targets.d.ts.map +1 -0
  246. package/dist/schema/validators/ref-targets.js +53 -0
  247. package/dist/serializer/context.d.ts +32 -0
  248. package/dist/serializer/context.d.ts.map +1 -0
  249. package/dist/serializer/context.js +308 -0
  250. package/dist/serializer/helpers.d.ts +34 -0
  251. package/dist/serializer/helpers.d.ts.map +1 -0
  252. package/dist/serializer/helpers.js +115 -0
  253. package/dist/serializer/index.d.ts +2 -0
  254. package/dist/serializer/index.d.ts.map +1 -0
  255. package/dist/serializer/index.js +1 -0
  256. package/dist/serializer/serialize.d.ts +12 -0
  257. package/dist/serializer/serialize.d.ts.map +1 -0
  258. package/dist/serializer/serialize.js +5 -0
  259. package/package.json +45 -0
@@ -0,0 +1,116 @@
1
+ /** Separator used in ref strings (package-level constant) */
2
+ export const REF_SEPARATOR = '.';
3
+ /** Build a DefRef string */
4
+ export function defRef(kind, name) {
5
+ return `${kind}${REF_SEPARATOR}${name}`;
6
+ }
7
+ /**
8
+ * Parse a DefRef (`class.Name` / `interface.Name`) back into its kind + bare
9
+ * name. Member names never contain the separator, so a single split on the
10
+ * first `.` is exact. Inverse of {@link defRef}.
11
+ */
12
+ export function parseDefRef(ref) {
13
+ const i = ref.indexOf(REF_SEPARATOR);
14
+ if (i < 0) {
15
+ throw new Error(`malformed DefRef "${ref}": expected "<kind>${REF_SEPARATOR}<name>"`);
16
+ }
17
+ return { kind: ref.slice(0, i), name: ref.slice(i + 1) };
18
+ }
19
+ /** Build a MethodRef string */
20
+ export function methodRef(kind, name, method) {
21
+ return `${kind}${REF_SEPARATOR}${name}${REF_SEPARATOR}${method}`;
22
+ }
23
+ /**
24
+ * Build a reverse map from def objects to their descriptor.
25
+ * Used for schema-scoped lookups.
26
+ */
27
+ export function buildDescriptorMap(schema) {
28
+ const map = new Map();
29
+ for (const [name, def] of Object.entries(schema.interfaces)) {
30
+ map.set(def, { group: 'interface', name, ref: defRef('interface', name) });
31
+ }
32
+ for (const [name, def] of Object.entries(schema.classes)) {
33
+ map.set(def, { group: 'class', name, ref: defRef('class', name) });
34
+ }
35
+ return map;
36
+ }
37
+ /**
38
+ * Build a combined descriptor map that includes both the schema's own defs and all imports.
39
+ * Call once, then pass to isKnownDef for O(1) lookups.
40
+ */
41
+ export function buildDefDescriptorMap(schema) {
42
+ const map = buildDescriptorMap(schema);
43
+ for (const imported of schema.imports ?? []) {
44
+ const importedMap = buildDescriptorMap(imported);
45
+ for (const [def, identity] of importedMap) {
46
+ map.set(def, identity);
47
+ }
48
+ }
49
+ return map;
50
+ }
51
+ /** Check if a def exists in the descriptor map */
52
+ export function isKnownDef(def, descriptorMap) {
53
+ return descriptorMap.has(def);
54
+ }
55
+ /**
56
+ * Walk `schema.imports` transitively (BFS, cycle-safe) and find the declaring
57
+ * schema of `target`. Returns the schema's origin plus the chain of origins
58
+ * traversed to reach it (e.g. `['a.com', 'b.com']` if `target` lives in `b.com`
59
+ * which was imported by `a.com` which was imported by the root). Returns
60
+ * `null` if `target` is not reachable through any import chain.
61
+ *
62
+ * Used by error diagnostics to distinguish "def from transitively-imported
63
+ * schema" from "def from no known schema".
64
+ */
65
+ export function findDefTransitive(root, target) {
66
+ const visited = new Set([root]);
67
+ const queue = (root.imports ?? []).map((s) => ({
68
+ schema: s,
69
+ path: [s.domain],
70
+ }));
71
+ while (queue.length > 0) {
72
+ const { schema, path } = queue.shift();
73
+ if (visited.has(schema))
74
+ continue;
75
+ visited.add(schema);
76
+ if (buildDescriptorMap(schema).has(target)) {
77
+ return { origin: schema.domain, path };
78
+ }
79
+ for (const next of schema.imports ?? []) {
80
+ if (visited.has(next))
81
+ continue;
82
+ queue.push({ schema: next, path: [...path, next.domain] });
83
+ }
84
+ }
85
+ return null;
86
+ }
87
+ /** Build a flat map of all qualified method refs: `{group}.{name}.{method}` → FnDef */
88
+ export function buildMethodRefs(schema) {
89
+ const fns = {};
90
+ const processGroup = (defs, kind) => {
91
+ for (const [name, def] of Object.entries(defs)) {
92
+ const methods = def.config.methods;
93
+ if (!methods)
94
+ continue;
95
+ for (const [methodName, fnDef] of Object.entries(methods)) {
96
+ fns[methodRef(kind, name, methodName)] = fnDef;
97
+ }
98
+ }
99
+ };
100
+ processGroup(schema.interfaces, 'interface');
101
+ processGroup(schema.classes, 'class');
102
+ return fns;
103
+ }
104
+ /**
105
+ * Iterate every def across both groups (interfaces first, then classes)
106
+ * WITHOUT collapsing same-named defs.
107
+ *
108
+ * Unlike `{ ...interfaces, ...classes }`, this preserves a class and an
109
+ * interface that share a name (e.g. the `Function` interface + the `Function`
110
+ * node class): both are yielded, so neither is silently dropped from a
111
+ * resolution or validation pass. For schemas with names unique across groups
112
+ * the behaviour is identical to the old spread.
113
+ */
114
+ export function eachDef(interfaces, classes) {
115
+ return [...Object.entries(interfaces), ...Object.entries(classes)];
116
+ }
@@ -0,0 +1,5 @@
1
+ export { resolveConfigThunks, resolveParamThunks } from './thunks.js';
2
+ export { resolveSelfReferences } from './self.js';
3
+ export { resolveAllMethods } from './methods.js';
4
+ export { resolveAllProperties, resolveAllPropertyKeys } from './properties.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/resolve/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { resolveConfigThunks, resolveParamThunks } from './thunks.js';
2
+ export { resolveSelfReferences } from './self.js';
3
+ export { resolveAllMethods } from './methods.js';
4
+ export { resolveAllProperties, resolveAllPropertyKeys } from './properties.js';
@@ -0,0 +1,8 @@
1
+ import type { AnyDef } from '../../grammar/definition/discriminants.js';
2
+ import type { FnDef } from '../../grammar/function/def.js';
3
+ /**
4
+ * Walk the inheritance chain and collect all methods for a definition.
5
+ * Own methods shadow inherited ones.
6
+ */
7
+ export declare function resolveAllMethods(def: AnyDef): Record<string, FnDef>;
8
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../../src/schema/resolve/methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAE1D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAepE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Walk the inheritance chain and collect all methods for a definition.
3
+ * Own methods shadow inherited ones.
4
+ */
5
+ export function resolveAllMethods(def) {
6
+ const result = {};
7
+ // Collect from ancestors first (later inherits entries shadow earlier ones)
8
+ const inherits = def.config.inherits ?? [];
9
+ for (const parent of inherits) {
10
+ const parentMethods = resolveAllMethods(parent);
11
+ Object.assign(result, parentMethods);
12
+ }
13
+ // Own methods shadow inherited
14
+ const ownMethods = def.config.methods ?? {};
15
+ Object.assign(result, ownMethods);
16
+ return result;
17
+ }
@@ -0,0 +1,13 @@
1
+ import type { AnyDef } from '../../grammar/definition/discriminants.js';
2
+ import type { NormalizedProperty } from '../../grammar/facets/properties.js';
3
+ /**
4
+ * Walk the inheritance chain and collect all property keys.
5
+ * Returns a Set of all available property names (own + inherited).
6
+ */
7
+ export declare function resolveAllPropertyKeys(def: AnyDef): Set<string>;
8
+ /**
9
+ * Walk the inheritance chain and collect all properties resolved.
10
+ * Own properties shadow inherited ones.
11
+ */
12
+ export declare function resolveAllProperties(def: AnyDef): Record<string, NormalizedProperty>;
13
+ //# sourceMappingURL=properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/schema/resolve/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,KAAK,EAAiB,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAI3F;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAgB/D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAepF"}
@@ -0,0 +1,36 @@
1
+ import { normalizeProperty } from '../../grammar/facets/properties.js';
2
+ /**
3
+ * Walk the inheritance chain and collect all property keys.
4
+ * Returns a Set of all available property names (own + inherited).
5
+ */
6
+ export function resolveAllPropertyKeys(def) {
7
+ const keys = new Set();
8
+ const inherits = def.config.inherits ?? [];
9
+ for (const parent of inherits) {
10
+ for (const key of resolveAllPropertyKeys(parent)) {
11
+ keys.add(key);
12
+ }
13
+ }
14
+ const ownProps = def.config.properties ?? {};
15
+ for (const key of Object.keys(ownProps)) {
16
+ keys.add(key);
17
+ }
18
+ return keys;
19
+ }
20
+ /**
21
+ * Walk the inheritance chain and collect all properties resolved.
22
+ * Own properties shadow inherited ones.
23
+ */
24
+ export function resolveAllProperties(def) {
25
+ const result = {};
26
+ const inherits = def.config.inherits ?? [];
27
+ for (const parent of inherits) {
28
+ const parentProps = resolveAllProperties(parent);
29
+ Object.assign(result, parentProps);
30
+ }
31
+ const ownProps = def.config.properties ?? {};
32
+ for (const [key, prop] of Object.entries(ownProps)) {
33
+ result[key] = normalizeProperty(prop);
34
+ }
35
+ return result;
36
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyDef } from '../../grammar/definition/discriminants.js';
2
+ /**
3
+ * Replace all `ref(SELF)` targets in a def's config tree with the actual def object.
4
+ * Walks the config recursively looking for RefSchema objects whose target is SELF.
5
+ */
6
+ export declare function resolveSelfReferences(def: AnyDef): void;
7
+ //# sourceMappingURL=self.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self.d.ts","sourceRoot":"","sources":["../../../src/schema/resolve/self.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAavE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvD"}
@@ -0,0 +1,32 @@
1
+ // Runtime symbols matching declared unique symbols
2
+ const SELF_TAG_RUNTIME = Symbol.for('SELF_TAG');
3
+ const REF_TAG_RUNTIME = Symbol.for('REF_TAG');
4
+ /** Check if a value is a SELF token */
5
+ function isSelf(value) {
6
+ return typeof value === 'object' && value !== null && SELF_TAG_RUNTIME in value;
7
+ }
8
+ /**
9
+ * Replace all `ref(SELF)` targets in a def's config tree with the actual def object.
10
+ * Walks the config recursively looking for RefSchema objects whose target is SELF.
11
+ */
12
+ export function resolveSelfReferences(def) {
13
+ walkAndReplace(def.config, def, new WeakSet());
14
+ }
15
+ function walkAndReplace(obj, actualDef, visited) {
16
+ if (!obj || typeof obj !== 'object' || visited.has(obj))
17
+ return;
18
+ visited.add(obj);
19
+ const record = obj;
20
+ // Check if this object is a RefSchema with a SELF target
21
+ if (REF_TAG_RUNTIME in record) {
22
+ const refMeta = record[REF_TAG_RUNTIME];
23
+ if (isSelf(refMeta.target)) {
24
+ ;
25
+ refMeta.target = actualDef;
26
+ }
27
+ }
28
+ // Recurse into all values
29
+ for (const value of Object.values(record)) {
30
+ walkAndReplace(value, actualDef, visited);
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ import type { AnyDef } from '../../grammar/definition/discriminants.js';
2
+ /**
3
+ * Resolve config thunks: if a def's config was wrapped in `() => ({...})`,
4
+ * call the thunk and replace the config with its result.
5
+ */
6
+ export declare function resolveConfigThunks(name: string, def: AnyDef): void;
7
+ /**
8
+ * Resolve param thunks: if a method's params was wrapped in `() => ({...})`,
9
+ * call the thunk and replace params with its result.
10
+ */
11
+ export declare function resolveParamThunks(name: string, def: AnyDef): void;
12
+ //# sourceMappingURL=thunks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thunks.d.ts","sourceRoot":"","sources":["../../../src/schema/resolve/thunks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAKvE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAanE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAkBlE"}
@@ -0,0 +1,36 @@
1
+ import { SchemaValidationError } from '../error.js';
2
+ /**
3
+ * Resolve config thunks: if a def's config was wrapped in `() => ({...})`,
4
+ * call the thunk and replace the config with its result.
5
+ */
6
+ export function resolveConfigThunks(name, def) {
7
+ if (typeof def.config === 'function') {
8
+ try {
9
+ ;
10
+ def.config = def.config();
11
+ }
12
+ catch (e) {
13
+ throw new SchemaValidationError(`Failed to resolve config thunk for '${name}': ${String(e)}`, name, 'resolvable config thunk', 'unresolvable');
14
+ }
15
+ }
16
+ }
17
+ /**
18
+ * Resolve param thunks: if a method's params was wrapped in `() => ({...})`,
19
+ * call the thunk and replace params with its result.
20
+ */
21
+ export function resolveParamThunks(name, def) {
22
+ const methods = def.config.methods;
23
+ if (!methods)
24
+ return;
25
+ for (const [methodName, fnDef] of Object.entries(methods)) {
26
+ if (typeof fnDef.config.params === 'function') {
27
+ try {
28
+ ;
29
+ fnDef.config.params = fnDef.config.params();
30
+ }
31
+ catch (e) {
32
+ throw new SchemaValidationError(`Failed to resolve param thunk for '${name}.${methodName}': ${String(e)}`, `${name}.${methodName}.params`, 'resolvable thunk', 'unresolvable');
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,21 @@
1
+ import type { AnyInterfaceDef, AnyClassDef } from '../grammar/definition/discriminants.js';
2
+ import type { FnDef } from '../grammar/function/def.js';
3
+ /**
4
+ * The rich schema object — two groups (interfaces + classes),
5
+ * pre-resolved types, ref maps, domain. Produced by `defineSchema`.
6
+ *
7
+ * @typeParam I — Record of interface definitions (node-interface | edge-interface)
8
+ * @typeParam C — Record of class definitions (node-class | edge-class)
9
+ *
10
+ * `imports` is runtime-only at the type level — widened to `readonly Schema[]`
11
+ * so that the concrete types of imported schemas don't flow into consumers'
12
+ * declared types (declaration-emit size regression — see docs/specs/schema-type-inference-size.md).
13
+ */
14
+ export interface Schema<I extends Record<string, AnyInterfaceDef> = Record<string, AnyInterfaceDef>, C extends Record<string, AnyClassDef> = Record<string, AnyClassDef>> {
15
+ readonly domain: string;
16
+ readonly interfaces: Readonly<I>;
17
+ readonly classes: Readonly<C>;
18
+ readonly functions: Record<string, FnDef>;
19
+ readonly imports: readonly Schema[];
20
+ }
21
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,MAAM,CACrB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3E,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAEnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAChC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { AnyDef, AnyInterfaceDef, AnyClassDef } from '../../grammar/definition/discriminants.js';
2
+ import type { DefDescriptor } from '../refs.js';
3
+ import type { Schema } from '../schema.js';
4
+ /** Validation context passed to each validator */
5
+ export interface SchemaContext {
6
+ readonly domain: string;
7
+ readonly interfaces: Record<string, AnyInterfaceDef>;
8
+ readonly classes: Record<string, AnyClassDef>;
9
+ readonly imports: readonly Schema[];
10
+ /** Descriptor map for all defs in this schema */
11
+ readonly descriptorMap: Map<AnyDef, DefDescriptor>;
12
+ }
13
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,WAAW,EACZ,MAAM,2CAA2C,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC7C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,iDAAiD;IACjD,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACnD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /** Validate endpoint types exist and cardinality values are valid */
3
+ export declare function validateEndpoints(ctx: SchemaContext): void;
4
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/endpoints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAQjD,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAkC1D"}
@@ -0,0 +1,26 @@
1
+ import { isEdge } from '../../grammar/definition/discriminants.js';
2
+ import { SchemaValidationError } from '../error.js';
3
+ import { eachDef, isKnownDef } from '../refs.js';
4
+ const VALID_CARDINALITIES = ['0..1', '1', '0..*', '1..*'];
5
+ /** Validate endpoint types exist and cardinality values are valid */
6
+ export function validateEndpoints(ctx) {
7
+ for (const [name, def] of eachDef(ctx.interfaces, ctx.classes)) {
8
+ if (!isEdge(def))
9
+ continue;
10
+ const from = def.from;
11
+ const to = def.to;
12
+ for (const endpoint of [from, to]) {
13
+ // Rule 6: Endpoint types exist
14
+ for (const type of endpoint.types) {
15
+ if (!isKnownDef(type, ctx.descriptorMap)) {
16
+ throw new SchemaValidationError(`Definition '${name}' references an unknown type in endpoint '${endpoint.as}'`, `${name}.${endpoint.as}`, 'a def in this schema or imported', 'unknown reference');
17
+ }
18
+ }
19
+ // Rule 10: Cardinality valid
20
+ if (endpoint.cardinality !== undefined &&
21
+ !VALID_CARDINALITIES.includes(endpoint.cardinality)) {
22
+ throw new SchemaValidationError(`Invalid cardinality '${String(endpoint.cardinality)}' on '${name}' endpoint '${endpoint.as}'`, `${name}.${endpoint.as}.cardinality`, VALID_CARDINALITIES.join(', '), String(endpoint.cardinality));
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { SchemaContext } from './context.js';
2
+ export type { SchemaContext } from './context.js';
3
+ export { validateUniqueNames } from './names.js';
4
+ export { validateInheritance } from './inheritance.js';
5
+ export { validateEndpoints } from './endpoints.js';
6
+ export { validateIndexes } from './indexes.js';
7
+ export { validateRefTargets } from './ref-targets.js';
8
+ export { validateMethods } from './methods.js';
9
+ /** Run all schema validators in sequence */
10
+ export declare function validateSchema(ctx: SchemaContext): void;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AASjD,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAOvD"}
@@ -0,0 +1,21 @@
1
+ import { validateEndpoints } from './endpoints.js';
2
+ import { validateIndexes } from './indexes.js';
3
+ import { validateInheritance } from './inheritance.js';
4
+ import { validateMethods } from './methods.js';
5
+ import { validateUniqueNames } from './names.js';
6
+ import { validateRefTargets } from './ref-targets.js';
7
+ export { validateUniqueNames } from './names.js';
8
+ export { validateInheritance } from './inheritance.js';
9
+ export { validateEndpoints } from './endpoints.js';
10
+ export { validateIndexes } from './indexes.js';
11
+ export { validateRefTargets } from './ref-targets.js';
12
+ export { validateMethods } from './methods.js';
13
+ /** Run all schema validators in sequence */
14
+ export function validateSchema(ctx) {
15
+ validateUniqueNames(ctx);
16
+ validateInheritance(ctx);
17
+ validateEndpoints(ctx);
18
+ validateIndexes(ctx);
19
+ validateRefTargets(ctx);
20
+ validateMethods(ctx);
21
+ }
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /** Validate that all indexed properties exist on the definition or its ancestors */
3
+ export declare function validateIndexes(ctx: SchemaContext): void;
4
+ //# sourceMappingURL=indexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexes.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/indexes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAMjD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAmBxD"}
@@ -0,0 +1,18 @@
1
+ import { SchemaValidationError } from '../error.js';
2
+ import { eachDef } from '../refs.js';
3
+ import { resolveAllPropertyKeys } from '../resolve/properties.js';
4
+ /** Validate that all indexed properties exist on the definition or its ancestors */
5
+ export function validateIndexes(ctx) {
6
+ for (const [name, def] of eachDef(ctx.interfaces, ctx.classes)) {
7
+ const indexes = def.config.indexes;
8
+ if (!indexes)
9
+ continue;
10
+ const available = resolveAllPropertyKeys(def);
11
+ for (const idx of indexes) {
12
+ const prop = typeof idx === 'string' ? idx : idx.property;
13
+ if (!available.has(prop)) {
14
+ throw new SchemaValidationError(`Index on '${name}' references unknown property '${prop}'`, `${name}.indexes`, [...available].join(', ') || '(no properties)', prop);
15
+ }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /** Validate inheritance rules for all definitions */
3
+ export declare function validateInheritance(ctx: SchemaContext): void;
4
+ //# sourceMappingURL=inheritance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inheritance.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/inheritance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAMjD,qDAAqD;AACrD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAsC5D"}
@@ -0,0 +1,26 @@
1
+ import { isAbstract, isNode } from '../../grammar/definition/discriminants.js';
2
+ import { SchemaValidationError } from '../error.js';
3
+ import { eachDef, isKnownDef } from '../refs.js';
4
+ /** Validate inheritance rules for all definitions */
5
+ export function validateInheritance(ctx) {
6
+ for (const [name, def] of eachDef(ctx.interfaces, ctx.classes)) {
7
+ const parents = def.config.inherits;
8
+ if (!parents)
9
+ continue;
10
+ for (const parent of parents) {
11
+ // Rule 3: Inheritance targets exist
12
+ if (!isKnownDef(parent, ctx.descriptorMap)) {
13
+ throw new SchemaValidationError(`Definition '${name}' inherits from an unknown type`, `${name}.inherits`, 'a def in this schema or imported', 'unknown reference');
14
+ }
15
+ // Rule 5: No concrete inheritance — only abstract can be inherited
16
+ if (!isAbstract(parent)) {
17
+ throw new SchemaValidationError(`Definition '${name}' inherits from a concrete type (kind: '${parent.__kind}'). Only interfaces can be inherited.`, `${name}.inherits`, 'node-interface | edge-interface', parent.__kind);
18
+ }
19
+ // Rule 4: Kind match — node defs inherit node interfaces only;
20
+ // edge defs can inherit from both edge interfaces and node interfaces (mixins)
21
+ if (isNode(def) && !isNode(parent)) {
22
+ throw new SchemaValidationError(`Node definition '${name}' inherits from an edge interface`, `${name}.inherits`, 'node-interface', parent.__kind);
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,9 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /**
3
+ * Validate method inheritance rules:
4
+ * - Sealed methods are not overridden
5
+ * - Concrete defs implement all inherited abstract methods
6
+ * - Inheritance modifier only allowed on interfaces
7
+ */
8
+ export declare function validateMethods(ctx: SchemaContext): void;
9
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/methods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAOjD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAkDxD"}
@@ -0,0 +1,43 @@
1
+ import { isConcrete } from '../../grammar/definition/discriminants.js';
2
+ import { SchemaValidationError } from '../error.js';
3
+ import { eachDef } from '../refs.js';
4
+ import { resolveAllMethods } from '../resolve/methods.js';
5
+ /**
6
+ * Validate method inheritance rules:
7
+ * - Sealed methods are not overridden
8
+ * - Concrete defs implement all inherited abstract methods
9
+ * - Inheritance modifier only allowed on interfaces
10
+ */
11
+ export function validateMethods(ctx) {
12
+ for (const [name, def] of eachDef(ctx.interfaces, ctx.classes)) {
13
+ const ownMethods = def.config.methods ?? {};
14
+ // Concrete defs must not declare inheritance on own methods
15
+ if (isConcrete(def)) {
16
+ for (const [methodName, fnDef] of Object.entries(ownMethods)) {
17
+ if (fnDef.config.inheritance) {
18
+ throw new SchemaValidationError(`Concrete def '${name}' declares '${methodName}' with inheritance '${fnDef.config.inheritance}'. ` +
19
+ `The 'inheritance' modifier is only allowed on interface methods.`, `${name}.${methodName}.inheritance`, 'undefined (no inheritance on concrete defs)', fnDef.config.inheritance);
20
+ }
21
+ }
22
+ }
23
+ // Check sealed override violations
24
+ const parents = def.config.inherits ?? [];
25
+ for (const parent of parents) {
26
+ const parentMethods = resolveAllMethods(parent);
27
+ for (const [methodName, parentFn] of Object.entries(parentMethods)) {
28
+ if (parentFn.config.inheritance === 'sealed' && methodName in ownMethods) {
29
+ throw new SchemaValidationError(`Definition '${name}' overrides sealed method '${methodName}'`, `${name}.${methodName}`, 'no override (method is sealed)', 'override declared');
30
+ }
31
+ }
32
+ }
33
+ // Concrete defs must implement all inherited abstract methods
34
+ if (isConcrete(def)) {
35
+ const allInherited = resolveAllMethods(def);
36
+ for (const [methodName, fnDef] of Object.entries(allInherited)) {
37
+ if (fnDef.config.inheritance === 'abstract' && !(methodName in ownMethods)) {
38
+ throw new SchemaValidationError(`Concrete def '${name}' does not implement abstract method '${methodName}'`, `${name}.${methodName}`, 'method implementation', 'missing');
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /** Validate that no two definitions share a name within the same group */
3
+ export declare function validateUniqueNames(ctx: SchemaContext): void;
4
+ //# sourceMappingURL=names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA0B5D"}
@@ -0,0 +1,18 @@
1
+ import { SchemaValidationError } from '../error.js';
2
+ /** Validate that no two definitions share a name within the same group */
3
+ export function validateUniqueNames(ctx) {
4
+ const interfaceNames = new Set();
5
+ for (const name of Object.keys(ctx.interfaces)) {
6
+ if (interfaceNames.has(name)) {
7
+ throw new SchemaValidationError(`Duplicate interface name '${name}'`, 'interfaces', 'unique names', name);
8
+ }
9
+ interfaceNames.add(name);
10
+ }
11
+ const classNames = new Set();
12
+ for (const name of Object.keys(ctx.classes)) {
13
+ if (classNames.has(name)) {
14
+ throw new SchemaValidationError(`Duplicate class name '${name}'`, 'classes', 'unique names', name);
15
+ }
16
+ classNames.add(name);
17
+ }
18
+ }
@@ -0,0 +1,4 @@
1
+ import type { SchemaContext } from './context.js';
2
+ /** Validate that all ref() targets in params/returns point to known definitions */
3
+ export declare function validateRefTargets(ctx: SchemaContext): void;
4
+ //# sourceMappingURL=ref-targets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-targets.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/ref-targets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAiCjD,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAoC3D"}