@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,5 @@
1
+ import { z } from 'zod';
2
+ import { type BitmaskDef } from '../grammar/values/bitmask.js';
3
+ /** Create a bitmask value type — permissions bitfield (resolves to integer) */
4
+ export declare function bitmask(): z.ZodNumber & BitmaskDef;
5
+ //# sourceMappingURL=bitmask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitmask.d.ts","sourceRoot":"","sources":["../../src/builders/bitmask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAK9D,+EAA+E;AAC/E,wBAAgB,OAAO,IAAI,CAAC,CAAC,SAAS,GAAG,UAAU,CAMlD"}
@@ -0,0 +1,11 @@
1
+ // oxlint-disable typescript/no-explicit-any
2
+ import { z } from 'zod';
3
+ import {} from '../grammar/values/bitmask.js';
4
+ // Runtime symbol matching the declared unique symbol
5
+ const BITMASK_TAG_RUNTIME = Symbol.for('BITMASK_TAG');
6
+ /** Create a bitmask value type — permissions bitfield (resolves to integer) */
7
+ export function bitmask() {
8
+ const schema = z.number().int().nonnegative();
9
+ schema[BITMASK_TAG_RUNTIME] = true;
10
+ return schema;
11
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyDef } from '../grammar/definition/discriminants.js';
2
+ import { type DataGrantSchema, type DataSelfSchema } from '../grammar/values/data.js';
3
+ /** Create a data-self marker (owning node's datastore content) */
4
+ export declare function data(): DataSelfSchema;
5
+ /** Create a data-grant marker (another node's datastore content) */
6
+ export declare function data<D extends AnyDef>(target: D): DataGrantSchema<D>;
7
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/builders/data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAA;AAGpE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAKrF,kEAAkE;AAClE,wBAAgB,IAAI,IAAI,cAAc,CAAA;AACtC,oEAAoE;AACpE,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ // oxlint-disable typescript/no-explicit-any
2
+ import { z } from 'zod';
3
+ import {} from '../grammar/values/data.js';
4
+ // Runtime symbol matching the declared unique symbol
5
+ const DATA_TAG_RUNTIME = Symbol.for('DATA_TAG');
6
+ export function data(target) {
7
+ const schema = z.unknown();
8
+ if (target === undefined) {
9
+ ;
10
+ schema[DATA_TAG_RUNTIME] = { kind: 'self' };
11
+ }
12
+ else {
13
+ ;
14
+ schema[DATA_TAG_RUNTIME] = { kind: 'grant', target };
15
+ }
16
+ return schema;
17
+ }
@@ -0,0 +1,13 @@
1
+ import type { Kind } from '../../grammar/definition/discriminants.js';
2
+ /**
3
+ * Internal factory that tags a config with __kind and __brand.
4
+ * Handles thunk wrapping: if config is a function, it's stored as-is
5
+ * and resolved later during defineSchema().
6
+ */
7
+ export declare function createDef<K extends Kind>(kind: K, config: object): any;
8
+ /**
9
+ * Internal factory for edge definitions.
10
+ * Endpoints are top-level, config is the rest.
11
+ */
12
+ export declare function createEdgeDef<K extends Kind>(kind: K, from: object, to: object, config?: object): any;
13
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAA;AAErE;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAKtE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,EAC1C,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,GACd,GAAG,CAOL"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Internal factory that tags a config with __kind and __brand.
3
+ * Handles thunk wrapping: if config is a function, it's stored as-is
4
+ * and resolved later during defineSchema().
5
+ */
6
+ export function createDef(kind, config) {
7
+ return {
8
+ __kind: kind,
9
+ config,
10
+ };
11
+ }
12
+ /**
13
+ * Internal factory for edge definitions.
14
+ * Endpoints are top-level, config is the rest.
15
+ */
16
+ export function createEdgeDef(kind, from, to, config) {
17
+ return {
18
+ __kind: kind,
19
+ from,
20
+ to,
21
+ config: config ?? {},
22
+ };
23
+ }
@@ -0,0 +1,8 @@
1
+ import type { EdgeClassConfig, EdgeClassDef } from '../../grammar/definition/edge-class.js';
2
+ import type { EndpointConfig } from '../../grammar/facets/endpoints.js';
3
+ /**
4
+ * Create an edge class (concrete, has endpoints).
5
+ * Endpoints are positional, config is optional.
6
+ */
7
+ export declare function edgeClass<const From extends EndpointConfig, const To extends EndpointConfig, const C extends EdgeClassConfig>(from: From, to: To, config?: C): EdgeClassDef<From, To, C & EdgeClassConfig>;
8
+ //# sourceMappingURL=edge-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-class.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/edge-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAIvE;;;GAGG;AACH,wBAAgB,SAAS,CACvB,KAAK,CAAC,IAAI,SAAS,cAAc,EACjC,KAAK,CAAC,EAAE,SAAS,cAAc,EAC/B,KAAK,CAAC,CAAC,SAAS,eAAe,EAC/B,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,eAAe,CAAC,CAE7E"}
@@ -0,0 +1,8 @@
1
+ import { createEdgeDef } from './base.js';
2
+ /**
3
+ * Create an edge class (concrete, has endpoints).
4
+ * Endpoints are positional, config is optional.
5
+ */
6
+ export function edgeClass(from, to, config) {
7
+ return createEdgeDef('edge-class', from, to, config);
8
+ }
@@ -0,0 +1,8 @@
1
+ import type { EdgeInterfaceConfig, EdgeInterfaceDef } from '../../grammar/definition/edge-interface.js';
2
+ import type { EndpointConfig } from '../../grammar/facets/endpoints.js';
3
+ /**
4
+ * Create an edge interface (abstract, has endpoints).
5
+ * Endpoints are positional, config is optional.
6
+ */
7
+ export declare function edgeInterface<const From extends EndpointConfig, const To extends EndpointConfig, const C extends EdgeInterfaceConfig>(from: From, to: To, config?: C): EdgeInterfaceDef<From, To, C & EdgeInterfaceConfig>;
8
+ //# sourceMappingURL=edge-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-interface.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/edge-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,4CAA4C,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAIvE;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,CAAC,IAAI,SAAS,cAAc,EACjC,KAAK,CAAC,EAAE,SAAS,cAAc,EAC/B,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACnC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAErF"}
@@ -0,0 +1,8 @@
1
+ import { createEdgeDef } from './base.js';
2
+ /**
3
+ * Create an edge interface (abstract, has endpoints).
4
+ * Endpoints are positional, config is optional.
5
+ */
6
+ export function edgeInterface(from, to, config) {
7
+ return createEdgeDef('edge-interface', from, to, config);
8
+ }
@@ -0,0 +1,5 @@
1
+ export { nodeInterface } from './node-interface.js';
2
+ export { nodeClass } from './node-class.js';
3
+ export { edgeInterface } from './edge-interface.js';
4
+ export { edgeClass } from './edge-class.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { nodeInterface } from './node-interface.js';
2
+ export { nodeClass } from './node-class.js';
3
+ export { edgeInterface } from './edge-interface.js';
4
+ export { edgeClass } from './edge-class.js';
@@ -0,0 +1,7 @@
1
+ import type { NodeClassConfig, NodeClassDef } from '../../grammar/definition/node-class.js';
2
+ /**
3
+ * Create a node class (concrete, no endpoints).
4
+ * Accepts a config object or a thunk for forward references.
5
+ */
6
+ export declare function nodeClass<const C extends NodeClassConfig>(config: C | (() => C)): NodeClassDef<C>;
7
+ //# sourceMappingURL=node-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-class.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/node-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAI3F;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,eAAe,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAEjG"}
@@ -0,0 +1,8 @@
1
+ import { createDef } from './base.js';
2
+ /**
3
+ * Create a node class (concrete, no endpoints).
4
+ * Accepts a config object or a thunk for forward references.
5
+ */
6
+ export function nodeClass(config) {
7
+ return createDef('node-class', typeof config === 'function' ? config : config);
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { NodeInterfaceConfig, NodeInterfaceDef } from '../../grammar/definition/node-interface.js';
2
+ /**
3
+ * Create a node interface (abstract, no endpoints).
4
+ * Accepts a config object or a thunk for forward references.
5
+ */
6
+ export declare function nodeInterface<const C extends NodeInterfaceConfig>(config: C | (() => C)): NodeInterfaceDef<C>;
7
+ //# sourceMappingURL=node-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-interface.d.ts","sourceRoot":"","sources":["../../../src/builders/definition/node-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,4CAA4C,CAAA;AAInD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EAC/D,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GACpB,gBAAgB,CAAC,CAAC,CAAC,CAErB"}
@@ -0,0 +1,8 @@
1
+ import { createDef } from './base.js';
2
+ /**
3
+ * Create a node interface (abstract, no endpoints).
4
+ * Accepts a config object or a thunk for forward references.
5
+ */
6
+ export function nodeInterface(config) {
7
+ return createDef('node-interface', config);
8
+ }
@@ -0,0 +1,14 @@
1
+ import type { z } from 'zod';
2
+ import type { ParamShape } from '../grammar/function/config.js';
3
+ import type { FnDef } from '../grammar/function/def.js';
4
+ import type { MethodInheritance } from '../grammar/function/inheritance.js';
5
+ import type { OutputMode } from '../grammar/function/output.js';
6
+ /** Create a function definition — the behavioral primitive */
7
+ export declare function fn<const P extends ParamShape = Record<string, never>, const R extends z.ZodType = z.ZodType, const I extends MethodInheritance = 'default', const S extends boolean = false>(config: {
8
+ readonly params?: P | (() => P);
9
+ readonly returns: R;
10
+ readonly inheritance?: I;
11
+ readonly output?: OutputMode;
12
+ readonly static?: S;
13
+ }): FnDef<P, R, I, S>;
14
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/builders/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAE/D,8DAA8D;AAC9D,wBAAgB,EAAE,CAChB,KAAK,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAClD,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,EACrC,KAAK,CAAC,CAAC,SAAS,iBAAiB,GAAG,SAAS,EAC7C,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EAC/B,MAAM,EAAE;IACR,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAA;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;CACpB,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAEpB"}
@@ -0,0 +1,4 @@
1
+ /** Create a function definition — the behavioral primitive */
2
+ export function fn(config) {
3
+ return { __type: 'fn', config };
4
+ }
@@ -0,0 +1,10 @@
1
+ export { nodeInterface } from './definition/node-interface.js';
2
+ export { nodeClass } from './definition/node-class.js';
3
+ export { edgeInterface } from './definition/edge-interface.js';
4
+ export { edgeClass } from './definition/edge-class.js';
5
+ export { fn } from './function.js';
6
+ export { ref } from './ref.js';
7
+ export { data } from './data.js';
8
+ export { prop } from './prop.js';
9
+ export { bitmask } from './bitmask.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,9 @@
1
+ export { nodeInterface } from './definition/node-interface.js';
2
+ export { nodeClass } from './definition/node-class.js';
3
+ export { edgeInterface } from './definition/edge-interface.js';
4
+ export { edgeClass } from './definition/edge-class.js';
5
+ export { fn } from './function.js';
6
+ export { ref } from './ref.js';
7
+ export { data } from './data.js';
8
+ export { prop } from './prop.js';
9
+ export { bitmask } from './bitmask.js';
@@ -0,0 +1,7 @@
1
+ import type { z } from 'zod';
2
+ import type { PropertyDef } from '../grammar/facets/properties.js';
3
+ /** Create a property definition with explicit metadata */
4
+ export declare function prop<S extends z.ZodType>(schema: S, opts?: {
5
+ private?: boolean;
6
+ }): PropertyDef<S>;
7
+ //# sourceMappingURL=prop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../src/builders/prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,0DAA0D;AAC1D,wBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAMjG"}
@@ -0,0 +1,8 @@
1
+ /** Create a property definition with explicit metadata */
2
+ export function prop(schema, opts) {
3
+ return {
4
+ _tag: 'PropertyDef',
5
+ schema,
6
+ private: opts?.private ?? false,
7
+ };
8
+ }
@@ -0,0 +1,12 @@
1
+ import type { AnyDef } from '../grammar/definition/discriminants.js';
2
+ import { type RefSchema } from '../grammar/values/ref.js';
3
+ import { type SelfDef } from '../grammar/values/self.js';
4
+ /** Create a ref schema for SELF */
5
+ export declare function ref(target: SelfDef): RefSchema<SelfDef, false>;
6
+ /** Create a ref schema for a definition */
7
+ export declare function ref<D extends AnyDef>(target: D): RefSchema<D, false>;
8
+ /** Create a ref schema for a definition, including its data */
9
+ export declare function ref<D extends AnyDef>(target: D, opts: {
10
+ data: true;
11
+ }): RefSchema<D, true>;
12
+ //# sourceMappingURL=ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../src/builders/ref.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAA;AAIpE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAcxD,mCAAmC;AACnC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AAC/D,2CAA2C;AAC3C,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AACrE,+DAA+D;AAC/D,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ // oxlint-disable typescript/no-explicit-any
2
+ import { z } from 'zod';
3
+ import {} from '../grammar/values/ref.js';
4
+ import {} from '../grammar/values/self.js';
5
+ // Runtime symbol matching the declared unique symbol
6
+ const REF_TAG_RUNTIME = Symbol.for('REF_TAG');
7
+ /** Check if a value is a SELF token */
8
+ function isSelf(value) {
9
+ return (typeof value === 'object' &&
10
+ value !== null &&
11
+ Symbol.for('SELF_TAG') in value);
12
+ }
13
+ export function ref(target, opts) {
14
+ const schema = z
15
+ .union([z.string(), z.object({ id: z.string() }).passthrough()])
16
+ .transform((value) => (typeof value === 'string' ? { id: value } : value));
17
+ schema[REF_TAG_RUNTIME] = {
18
+ target,
19
+ includeData: opts?.data ?? false,
20
+ };
21
+ if (isSelf(target)) {
22
+ ;
23
+ schema.__self = true;
24
+ }
25
+ return schema;
26
+ }
@@ -0,0 +1,13 @@
1
+ import type { IndexDef } from '../facets/indexes.js';
2
+ import type { PropertyShape } from '../facets/properties.js';
3
+ import type { FnDef } from '../function/def.js';
4
+ /**
5
+ * Common configuration shared by all 4 definition roles.
6
+ * Each role extends this with its specific facets.
7
+ */
8
+ export interface DefConfigBase {
9
+ readonly properties?: PropertyShape;
10
+ readonly indexes?: readonly IndexDef[];
11
+ readonly methods?: Record<string, FnDef>;
12
+ }
13
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAA;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CACzC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { EdgeClassDef } from './edge-class.js';
2
+ import type { EdgeInterfaceDef } from './edge-interface.js';
3
+ import type { NodeClassDef } from './node-class.js';
4
+ import type { NodeInterfaceDef } from './node-interface.js';
5
+ /** The 4 definition kinds as a const enum */
6
+ export declare const Kind: {
7
+ readonly NodeInterface: 'node-interface';
8
+ readonly NodeClass: 'node-class';
9
+ readonly EdgeInterface: 'edge-interface';
10
+ readonly EdgeClass: 'edge-class';
11
+ };
12
+ export type Kind = (typeof Kind)[keyof typeof Kind];
13
+ /** Any definition — discriminated union of all 4 roles */
14
+ export type AnyDef = NodeInterfaceDef<any> | NodeClassDef<any> | EdgeInterfaceDef<any, any> | EdgeClassDef<any, any>;
15
+ /** Any node definition (interface or class) */
16
+ export type AnyNodeDef = NodeInterfaceDef<any> | NodeClassDef<any>;
17
+ /** Any edge definition (interface or class) */
18
+ export type AnyEdgeDef = EdgeInterfaceDef<any, any> | EdgeClassDef<any, any>;
19
+ /** Any interface (node or edge) */
20
+ export type AnyInterfaceDef = NodeInterfaceDef<any> | EdgeInterfaceDef<any, any>;
21
+ /** Any class (node or edge) */
22
+ export type AnyClassDef = NodeClassDef<any> | EdgeClassDef<any, any>;
23
+ export declare function isNodeInterface(def: AnyDef): def is NodeInterfaceDef;
24
+ export declare function isNodeClass(def: AnyDef): def is NodeClassDef;
25
+ export declare function isEdgeInterface(def: AnyDef): def is EdgeInterfaceDef;
26
+ export declare function isEdgeClass(def: AnyDef): def is EdgeClassDef;
27
+ export declare function isAbstract(def: AnyDef): def is AnyInterfaceDef;
28
+ export declare function isConcrete(def: AnyDef): def is AnyClassDef;
29
+ export declare function isEdge(def: AnyDef): def is AnyEdgeDef;
30
+ export declare function isNode(def: AnyDef): def is AnyNodeDef;
31
+ //# sourceMappingURL=discriminants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discriminants.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/discriminants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,6CAA6C;AAC7C,eAAO,MAAM,IAAI;aACf,aAAa,EAAE,gBAAgB;aAC/B,SAAS,EAAE,YAAY;aACvB,aAAa,EAAE,gBAAgB;aAC/B,SAAS,EAAE,YAAY;CACf,CAAA;AAEV,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAA;AAEnD,0DAA0D;AAC1D,MAAM,MAAM,MAAM,GACd,gBAAgB,CAAC,GAAG,CAAC,GACrB,YAAY,CAAC,GAAG,CAAC,GACjB,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC1B,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAE1B,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;AAElE,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAE5E,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAEhF,+BAA+B;AAC/B,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAIpE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAEpE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,YAAY,CAE5D;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAEpE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,YAAY,CAE5D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,eAAe,CAE9D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,WAAW,CAE1D;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,UAAU,CAErD;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,UAAU,CAErD"}
@@ -0,0 +1,32 @@
1
+ /** The 4 definition kinds as a const enum */
2
+ export const Kind = {
3
+ NodeInterface: 'node-interface',
4
+ NodeClass: 'node-class',
5
+ EdgeInterface: 'edge-interface',
6
+ EdgeClass: 'edge-class',
7
+ };
8
+ // ── Type guards ──────────────────────────────────────────────────
9
+ export function isNodeInterface(def) {
10
+ return def.__kind === Kind.NodeInterface;
11
+ }
12
+ export function isNodeClass(def) {
13
+ return def.__kind === Kind.NodeClass;
14
+ }
15
+ export function isEdgeInterface(def) {
16
+ return def.__kind === Kind.EdgeInterface;
17
+ }
18
+ export function isEdgeClass(def) {
19
+ return def.__kind === Kind.EdgeClass;
20
+ }
21
+ export function isAbstract(def) {
22
+ return def.__kind === Kind.NodeInterface || def.__kind === Kind.EdgeInterface;
23
+ }
24
+ export function isConcrete(def) {
25
+ return def.__kind === Kind.NodeClass || def.__kind === Kind.EdgeClass;
26
+ }
27
+ export function isEdge(def) {
28
+ return def.__kind === Kind.EdgeInterface || def.__kind === Kind.EdgeClass;
29
+ }
30
+ export function isNode(def) {
31
+ return def.__kind === Kind.NodeInterface || def.__kind === Kind.NodeClass;
32
+ }
@@ -0,0 +1,19 @@
1
+ import type { DefConstraints } from '../facets/constraints.js';
2
+ import type { EndpointConfig } from '../facets/endpoints.js';
3
+ import type { DefConfigBase } from './base.js';
4
+ import type { EdgeInterfaceDef } from './edge-interface.js';
5
+ import type { NodeInterfaceDef } from './node-interface.js';
6
+ /** Configuration for an edge class (concrete, has endpoints) */
7
+ export interface EdgeClassConfig extends DefConfigBase {
8
+ readonly inherits?: readonly (EdgeInterfaceDef<any, any> | NodeInterfaceDef<any>)[];
9
+ readonly constraints?: DefConstraints;
10
+ }
11
+ /** Branded edge class definition */
12
+ export interface EdgeClassDef<out From extends EndpointConfig = EndpointConfig, out To extends EndpointConfig = EndpointConfig, out C extends EdgeClassConfig = EdgeClassConfig> {
13
+ readonly __kind: 'edge-class';
14
+ readonly __brand: unique symbol;
15
+ readonly from: From;
16
+ readonly to: To;
17
+ readonly config: C;
18
+ }
19
+ //# sourceMappingURL=edge-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-class.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/edge-class.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,gEAAgE;AAChE,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;IACnF,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAA;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY,CAC3B,GAAG,CAAC,IAAI,SAAS,cAAc,GAAG,cAAc,EAChD,GAAG,CAAC,EAAE,SAAS,cAAc,GAAG,cAAc,EAC9C,GAAG,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAE/C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;IACf,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { DefConstraints } from '../facets/constraints.js';
2
+ import type { EndpointConfig } from '../facets/endpoints.js';
3
+ import type { DefConfigBase } from './base.js';
4
+ import type { NodeInterfaceDef } from './node-interface.js';
5
+ /** Configuration for an edge interface (abstract, has endpoints) */
6
+ export interface EdgeInterfaceConfig extends DefConfigBase {
7
+ readonly inherits?: readonly (EdgeInterfaceDef<any, any> | NodeInterfaceDef<any>)[];
8
+ readonly constraints?: DefConstraints;
9
+ }
10
+ /** Branded edge interface definition */
11
+ export interface EdgeInterfaceDef<out From extends EndpointConfig = EndpointConfig, out To extends EndpointConfig = EndpointConfig, out C extends EdgeInterfaceConfig = EdgeInterfaceConfig> {
12
+ readonly __kind: 'edge-interface';
13
+ readonly __brand: unique symbol;
14
+ readonly from: From;
15
+ readonly to: To;
16
+ readonly config: C;
17
+ }
18
+ //# sourceMappingURL=edge-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-interface.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/edge-interface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,oEAAoE;AACpE,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;IACnF,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAA;CACtC;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB,CAC/B,GAAG,CAAC,IAAI,SAAS,cAAc,GAAG,cAAc,EAChD,GAAG,CAAC,EAAE,SAAS,cAAc,GAAG,cAAc,EAC9C,GAAG,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB;IAEvD,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;IACf,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export type { DefConfigBase } from './base.js';
2
+ export type { NodeInterfaceDef, NodeInterfaceConfig } from './node-interface.js';
3
+ export type { NodeClassDef, NodeClassConfig } from './node-class.js';
4
+ export type { EdgeInterfaceDef, EdgeInterfaceConfig } from './edge-interface.js';
5
+ export type { EdgeClassDef, EdgeClassConfig } from './edge-class.js';
6
+ export type { AnyDef, AnyNodeDef, AnyEdgeDef, AnyInterfaceDef, AnyClassDef, Kind, } from './discriminants.js';
7
+ export { Kind as KindEnum, isNodeInterface, isNodeClass, isEdgeInterface, isEdgeClass, isAbstract, isConcrete, isEdge, isNode, } from './discriminants.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE9C,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAChF,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACpE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAChF,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEpE,YAAY,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,IAAI,GACL,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,UAAU,EACV,MAAM,EACN,MAAM,GACP,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1 @@
1
+ export { Kind as KindEnum, isNodeInterface, isNodeClass, isEdgeInterface, isEdgeClass, isAbstract, isConcrete, isEdge, isNode, } from './discriminants.js';
@@ -0,0 +1,21 @@
1
+ import type { ContentShape } from '../facets/content.js';
2
+ import type { DefConfigBase } from './base.js';
3
+ import type { NodeInterfaceDef } from './node-interface.js';
4
+ /** Configuration for a node class (concrete, no endpoints) */
5
+ export interface NodeClassConfig extends DefConfigBase {
6
+ readonly inherits?: readonly NodeInterfaceDef<any>[];
7
+ readonly content?: ContentShape;
8
+ /**
9
+ * Class-level icon: raw SVG markup materialized onto the class `self` node
10
+ * (carried on the `Iconable.icon` property). Clients resolve an instance's
11
+ * icon via its class. Keep tiny — one per type, travels in the class node.
12
+ */
13
+ readonly icon?: string;
14
+ }
15
+ /** Branded node class definition */
16
+ export interface NodeClassDef<out C extends NodeClassConfig = NodeClassConfig> {
17
+ readonly __kind: 'node-class';
18
+ readonly __brand: unique symbol;
19
+ readonly config: C;
20
+ }
21
+ //# sourceMappingURL=node-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-class.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/node-class.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,8DAA8D;AAC9D,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAA;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAA;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY,CAAC,GAAG,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC3E,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;IAC/B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ContentShape } from '../facets/content.js';
2
+ import type { DefConfigBase } from './base.js';
3
+ /** Configuration for a node interface (abstract, no endpoints) */
4
+ export interface NodeInterfaceConfig extends DefConfigBase {
5
+ readonly inherits?: readonly NodeInterfaceDef<any>[];
6
+ readonly content?: ContentShape;
7
+ }
8
+ /** Branded node interface definition */
9
+ export interface NodeInterfaceDef<out C extends NodeInterfaceConfig = NodeInterfaceConfig> {
10
+ readonly __kind: 'node-interface';
11
+ readonly __brand: unique symbol;
12
+ readonly config: C;
13
+ }
14
+ //# sourceMappingURL=node-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-interface.d.ts","sourceRoot":"","sources":["../../../src/grammar/definition/node-interface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE9C,kEAAkE;AAClE,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAA;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAA;CAChC;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB,CAAC,GAAG,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB;IACvF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;IAC/B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /** Structural invariants for edge definitions */
2
+ export interface DefConstraints {
3
+ readonly noSelf?: boolean;
4
+ readonly acyclic?: boolean;
5
+ readonly unique?: boolean;
6
+ readonly symmetric?: boolean;
7
+ }
8
+ //# sourceMappingURL=constraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../../src/grammar/facets/constraints.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { z } from 'zod';
2
+ /** Shape of the content record on a node definition config (datastore-backed fields) */
3
+ export type ContentShape = Record<string, z.ZodType>;
4
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/grammar/facets/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ /** Cardinality for an endpoint */
2
+ export type Cardinality = '0..*' | '1..*' | '0..1' | '1';
3
+ /** Default cardinality when omitted */
4
+ export declare const DEFAULT_CARDINALITY: Cardinality;
5
+ /**
6
+ * Edge endpoint configuration.
7
+ * Const generics capture literal types for `as`, `types`, and `cardinality`.
8
+ */
9
+ export interface EndpointConfig<As extends string = string, Types extends readonly any[] = readonly any[], Card extends Cardinality = Cardinality> {
10
+ readonly as: As;
11
+ readonly types: Types;
12
+ readonly cardinality?: Card;
13
+ }
14
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/grammar/facets/endpoints.ts"],"names":[],"mappings":"AACA,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,CAAA;AAExD,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,EAAE,WAAoB,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,cAAc,CAC7B,EAAE,SAAS,MAAM,GAAG,MAAM,EAC1B,KAAK,SAAS,SAAS,GAAG,EAAE,GAAG,SAAS,GAAG,EAAE,EAC7C,IAAI,SAAS,WAAW,GAAG,WAAW;IAEtC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;IACf,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAA;CAC5B"}
@@ -0,0 +1,2 @@
1
+ /** Default cardinality when omitted */
2
+ export const DEFAULT_CARDINALITY = '0..*';