@astrale-os/kernel-dsl 0.2.0-beta.8 → 1.0.0-beta.1

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 (321) hide show
  1. package/dist/v1/addressing/class-key.js +5 -4
  2. package/dist/v1/addressing/method-key.js +3 -2
  3. package/dist/v1/addressing/patterns.d.ts +0 -5
  4. package/dist/v1/addressing/patterns.js +5 -5
  5. package/dist/v1/builder/callable/authoring.d.ts +87 -41
  6. package/dist/v1/builder/callable/authoring.js +29 -14
  7. package/dist/v1/builder/class/authoring.d.ts +311 -36
  8. package/dist/v1/builder/class/authoring.js +3 -4
  9. package/dist/v1/builder/class/property.d.ts +16 -8
  10. package/dist/v1/builder/class/property.js +21 -5
  11. package/dist/v1/builder/core/authoring.d.ts +28 -13
  12. package/dist/v1/builder/core/authoring.js +22 -2
  13. package/dist/v1/builder/index.d.ts +9 -8
  14. package/dist/v1/builder/index.js +2 -2
  15. package/dist/v1/builder/lowering/callable.d.ts +3 -1
  16. package/dist/v1/builder/lowering/callable.js +43 -51
  17. package/dist/v1/builder/lowering/class.d.ts +7 -0
  18. package/dist/v1/builder/lowering/class.js +79 -29
  19. package/dist/v1/builder/lowering/core.d.ts +3 -2
  20. package/dist/v1/builder/lowering/core.js +9 -6
  21. package/dist/v1/builder/lowering/policy.d.ts +8 -1
  22. package/dist/v1/builder/lowering/policy.js +35 -0
  23. package/dist/v1/builder/lowering/schema/capture.js +9 -4
  24. package/dist/v1/builder/lowering/schema/compile.d.ts +2 -2
  25. package/dist/v1/builder/lowering/schema/compile.js +15 -2
  26. package/dist/v1/builder/lowering/schema/context.d.ts +11 -8
  27. package/dist/v1/builder/lowering/schema/context.js +59 -29
  28. package/dist/v1/builder/lowering/schema/ownership.d.ts +3 -3
  29. package/dist/v1/builder/lowering/schema/ownership.js +2 -1
  30. package/dist/v1/builder/lowering/value/compile.js +14 -4
  31. package/dist/v1/builder/lowering/value/zod.d.ts +7 -6
  32. package/dist/v1/builder/lowering/value/zod.js +16 -7
  33. package/dist/v1/builder/lowering/view.d.ts +4 -3
  34. package/dist/v1/builder/lowering/view.js +2 -14
  35. package/dist/v1/builder/policy/authoring.d.ts +23 -6
  36. package/dist/v1/builder/policy/authoring.js +35 -8
  37. package/dist/v1/builder/schema/define.d.ts +8 -5
  38. package/dist/v1/builder/schema/diagnostic.d.ts +1 -1
  39. package/dist/v1/builder/schema/handle.d.ts +2 -1
  40. package/dist/v1/builder/schema/input.d.ts +9 -1
  41. package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
  42. package/dist/v1/builder/schema/projection/callable.js +1 -0
  43. package/dist/v1/builder/schema/projection/class.d.ts +89 -0
  44. package/dist/v1/builder/schema/projection/class.js +1 -0
  45. package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
  46. package/dist/v1/builder/schema/projection/core-input.js +1 -0
  47. package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
  48. package/dist/v1/builder/schema/projection/domain.js +1 -0
  49. package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
  50. package/dist/v1/builder/schema/projection/identity.js +1 -0
  51. package/dist/v1/builder/schema/projection/model.d.ts +59 -0
  52. package/dist/v1/builder/schema/projection/model.js +1 -0
  53. package/dist/v1/builder/schema/projection/property.d.ts +32 -0
  54. package/dist/v1/builder/schema/projection/property.js +1 -0
  55. package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
  56. package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
  57. package/dist/v1/builder/schema/projection.d.ts +4 -258
  58. package/dist/v1/builder/value/full-match.js +6 -3
  59. package/dist/v1/builder/value/path.d.ts +2 -2
  60. package/dist/v1/builder/value/path.js +2 -2
  61. package/dist/v1/builder/view/authoring.d.ts +6 -14
  62. package/dist/v1/builder/view/authoring.js +13 -5
  63. package/dist/v1/bundle/structure.d.ts +2 -1
  64. package/dist/v1/compiled/admission/accept.d.ts +1 -1
  65. package/dist/v1/compiled/admission/accept.js +11 -814
  66. package/dist/v1/compiled/admission/closure.d.ts +3 -0
  67. package/dist/v1/compiled/admission/closure.js +173 -0
  68. package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
  69. package/dist/v1/compiled/admission/diagnostic.js +13 -0
  70. package/dist/v1/compiled/admission/revision.js +9 -1
  71. package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
  72. package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
  73. package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
  74. package/dist/v1/compiled/admission/semantics/class.js +125 -0
  75. package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
  76. package/dist/v1/compiled/admission/semantics/context.js +81 -0
  77. package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
  78. package/dist/v1/compiled/admission/semantics/core.js +123 -0
  79. package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
  80. package/dist/v1/compiled/admission/semantics/edge.js +89 -0
  81. package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
  82. package/dist/v1/compiled/admission/semantics/policy/admit.js +63 -0
  83. package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
  84. package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
  85. package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
  86. package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
  87. package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
  88. package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
  89. package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
  90. package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
  91. package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
  92. package/dist/v1/compiled/admission/semantics/policy/parity.js +138 -0
  93. package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
  94. package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
  95. package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
  96. package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
  97. package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
  98. package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
  99. package/dist/v1/compiled/admission/semantics.d.ts +1 -1
  100. package/dist/v1/compiled/admission/semantics.js +8 -1078
  101. package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
  102. package/dist/v1/compiled/admission/wire/callable.js +90 -0
  103. package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
  104. package/dist/v1/compiled/admission/wire/class.js +133 -0
  105. package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
  106. package/dist/v1/compiled/admission/wire/core.js +32 -0
  107. package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
  108. package/dist/v1/compiled/admission/wire/dependency.js +43 -0
  109. package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
  110. package/dist/v1/compiled/admission/wire/entry.js +100 -0
  111. package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
  112. package/dist/v1/compiled/admission/wire/pattern.js +111 -0
  113. package/dist/v1/compiled/admission/wire/policy.d.ts +10 -0
  114. package/dist/v1/compiled/admission/wire/policy.js +189 -0
  115. package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
  116. package/dist/v1/compiled/admission/wire/program.js +52 -0
  117. package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
  118. package/dist/v1/compiled/admission/wire/property.js +74 -0
  119. package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
  120. package/dist/v1/compiled/admission/wire/reference.js +33 -0
  121. package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
  122. package/dist/v1/compiled/admission/wire/value.js +98 -0
  123. package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
  124. package/dist/v1/compiled/admission/wire/view.js +17 -0
  125. package/dist/v1/compiled/compiler/compile.js +43 -11
  126. package/dist/v1/compiled/generated.d.ts +10 -0
  127. package/dist/v1/compiled/generated.js +15 -0
  128. package/dist/v1/compiled/loader/load.d.ts +5 -0
  129. package/dist/v1/compiled/loader/load.js +18 -4
  130. package/dist/v1/compiled/model/schema.d.ts +16 -7
  131. package/dist/v1/domain/create.js +18 -28
  132. package/dist/v1/domain/model/domain.d.ts +0 -1
  133. package/dist/v1/domain/model/input.d.ts +3 -0
  134. package/dist/v1/domain/projection/classes.js +13 -41
  135. package/dist/v1/domain/validation/create.d.ts +2 -0
  136. package/dist/v1/domain/validation/create.js +12 -0
  137. package/dist/v1/index.d.ts +5 -2
  138. package/dist/v1/index.js +3 -1
  139. package/dist/v1/language/callable/composition.d.ts +27 -0
  140. package/dist/v1/language/callable/composition.js +52 -0
  141. package/dist/v1/language/callable/executable.d.ts +6 -0
  142. package/dist/v1/language/callable/executable.js +4 -0
  143. package/dist/v1/language/callable/model/callable.d.ts +34 -9
  144. package/dist/v1/language/callable/model/callable.js +3 -1
  145. package/dist/v1/language/callable/resolved.d.ts +23 -8
  146. package/dist/v1/language/class/facets.d.ts +5 -2
  147. package/dist/v1/language/class/inheritance.d.ts +12 -0
  148. package/dist/v1/language/class/inheritance.js +25 -0
  149. package/dist/v1/language/class/lifetime.d.ts +17 -0
  150. package/dist/v1/language/class/lifetime.js +26 -0
  151. package/dist/v1/language/class/model/class.d.ts +8 -4
  152. package/dist/v1/language/class/model/property.d.ts +4 -2
  153. package/dist/v1/language/class/property-values.js +5 -2
  154. package/dist/v1/language/class/resolved.d.ts +25 -15
  155. package/dist/v1/language/core/model/core.d.ts +7 -1
  156. package/dist/v1/language/core/resolved.d.ts +6 -2
  157. package/dist/v1/language/definition/metadata.d.ts +8 -0
  158. package/dist/v1/language/definition/metadata.js +12 -0
  159. package/dist/v1/language/index.d.ts +9 -0
  160. package/dist/v1/language/index.js +6 -0
  161. package/dist/v1/language/policy/analysis/branches.d.ts +4 -3
  162. package/dist/v1/language/policy/analysis/branches.js +54 -12
  163. package/dist/v1/language/policy/analysis/budgets.js +1 -1
  164. package/dist/v1/language/policy/analysis/checks.d.ts +28 -0
  165. package/dist/v1/language/policy/analysis/checks.js +80 -0
  166. package/dist/v1/language/policy/index.d.ts +1 -0
  167. package/dist/v1/language/policy/index.js +1 -0
  168. package/dist/v1/language/policy/model/policy.d.ts +71 -5
  169. package/dist/v1/language/policy/model/policy.js +52 -1
  170. package/dist/v1/language/policy/normalization/normalize.d.ts +12 -1
  171. package/dist/v1/language/policy/normalization/normalize.js +178 -44
  172. package/dist/v1/language/state/index.d.ts +3 -0
  173. package/dist/v1/language/state/index.js +1 -0
  174. package/dist/v1/language/state/machine.d.ts +28 -0
  175. package/dist/v1/language/state/machine.js +40 -0
  176. package/dist/v1/language/state/topology.d.ts +14 -0
  177. package/dist/v1/language/state/topology.js +69 -0
  178. package/dist/v1/language/value/compile/fields.d.ts +1 -1
  179. package/dist/v1/language/value/compile/load.d.ts +4 -2
  180. package/dist/v1/language/value/compile/load.js +22 -1
  181. package/dist/v1/language/value/compile/model.d.ts +16 -1
  182. package/dist/v1/language/value/evaluate/assertions.d.ts +2 -0
  183. package/dist/v1/language/value/evaluate/assertions.js +13 -0
  184. package/dist/v1/language/value/evaluate/evaluator.js +111 -28
  185. package/dist/v1/language/value/evaluate/preparation.d.ts +10 -1
  186. package/dist/v1/language/value/evaluate/preparation.js +17 -26
  187. package/dist/v1/language/value/evaluate/program.js +1 -1
  188. package/dist/v1/language/value/evaluate/validate.d.ts +6 -2
  189. package/dist/v1/language/value/evaluate/validate.js +18 -11
  190. package/dist/v1/language/value/inclusion/includes.d.ts +9 -0
  191. package/dist/v1/language/value/inclusion/includes.js +777 -0
  192. package/dist/v1/language/value/model/blob.d.ts +31 -0
  193. package/dist/v1/language/value/model/blob.js +90 -0
  194. package/dist/v1/language/value/model/instant.d.ts +0 -2
  195. package/dist/v1/language/value/model/instant.js +1 -1
  196. package/dist/v1/language/value/model/schema.d.ts +2 -1
  197. package/dist/v1/language/value/model/schema.js +1 -5
  198. package/dist/v1/language/value/ordering.d.ts +2 -0
  199. package/dist/v1/language/value/ordering.js +4 -8
  200. package/dist/v1/language/value/profile/json.validate.js +1 -1
  201. package/dist/v1/language/value/profile/rules.js +48 -12
  202. package/dist/v1/language/value/reference/registry.d.ts +2 -1
  203. package/dist/v1/language/value/regexp/ast.js +3 -64
  204. package/dist/v1/language/value/regexp/compile.d.ts +32 -3
  205. package/dist/v1/language/value/regexp/compile.js +117 -21
  206. package/dist/v1/language/value/regexp/matcher.d.ts +6 -3
  207. package/dist/v1/language/value/regexp/matcher.js +185 -28
  208. package/dist/v1/language/value/regexp/syntax.d.ts +12 -1
  209. package/dist/v1/language/value/regexp/syntax.js +14 -2
  210. package/dist/v1/language/value/regexp/unicode.d.ts +32 -0
  211. package/dist/v1/language/value/regexp/unicode.js +139 -0
  212. package/dist/v1/language/value/syntax/full-match.js +8 -5
  213. package/dist/v1/language/value/syntax/node-path/validate.js +4 -6
  214. package/dist/v1/language/view/model/view.d.ts +2 -4
  215. package/dist/v1/language/view/resolved.d.ts +2 -2
  216. package/dist/v1/schema/analysis/class.d.ts +36 -6
  217. package/dist/v1/schema/analysis/class.js +31 -66
  218. package/dist/v1/schema/canonical/revision.d.ts +2 -1
  219. package/dist/v1/schema/canonical/revision.js +4 -1
  220. package/dist/v1/schema/compatibility/api.d.ts +3 -0
  221. package/dist/v1/schema/compatibility/api.js +2 -0
  222. package/dist/v1/schema/compatibility/comparators/callables.d.ts +39 -0
  223. package/dist/v1/schema/compatibility/comparators/callables.js +101 -0
  224. package/dist/v1/schema/compatibility/comparators/classes.d.ts +47 -0
  225. package/dist/v1/schema/compatibility/comparators/classes.js +160 -0
  226. package/dist/v1/schema/compatibility/comparators/index.d.ts +12 -0
  227. package/dist/v1/schema/compatibility/comparators/index.js +53 -0
  228. package/dist/v1/schema/compatibility/comparators/members.d.ts +4 -0
  229. package/dist/v1/schema/compatibility/comparators/members.js +49 -0
  230. package/dist/v1/schema/compatibility/comparators/values.d.ts +5 -0
  231. package/dist/v1/schema/compatibility/comparators/values.js +37 -0
  232. package/dist/v1/schema/compatibility/compare.d.ts +5 -0
  233. package/dist/v1/schema/compatibility/compare.js +23 -0
  234. package/dist/v1/schema/compatibility/context.d.ts +19 -0
  235. package/dist/v1/schema/compatibility/context.js +49 -0
  236. package/dist/v1/schema/compatibility/coordinate.d.ts +40 -0
  237. package/dist/v1/schema/compatibility/coordinate.js +38 -0
  238. package/dist/v1/schema/compatibility/diff.d.ts +12 -0
  239. package/dist/v1/schema/compatibility/diff.js +39 -0
  240. package/dist/v1/schema/compatibility/evidence.d.ts +16 -0
  241. package/dist/v1/schema/compatibility/evidence.js +62 -0
  242. package/dist/v1/schema/compatibility/fields.d.ts +194 -0
  243. package/dist/v1/schema/compatibility/fields.js +94 -0
  244. package/dist/v1/schema/compatibility/index.d.ts +6 -0
  245. package/dist/v1/schema/compatibility/index.js +3 -0
  246. package/dist/v1/schema/compatibility/meaning/footprint.d.ts +7 -0
  247. package/dist/v1/schema/compatibility/meaning/footprint.js +59 -0
  248. package/dist/v1/schema/compatibility/meaning/index.d.ts +3 -0
  249. package/dist/v1/schema/compatibility/meaning/index.js +16 -0
  250. package/dist/v1/schema/compatibility/model.d.ts +131 -0
  251. package/dist/v1/schema/compatibility/model.js +1 -0
  252. package/dist/v1/schema/compatibility/references.d.ts +38 -0
  253. package/dist/v1/schema/compatibility/references.js +149 -0
  254. package/dist/v1/schema/compatibility/report.d.ts +27 -0
  255. package/dist/v1/schema/compatibility/report.js +100 -0
  256. package/dist/v1/schema/compatibility/scope.d.ts +36 -0
  257. package/dist/v1/schema/compatibility/scope.js +110 -0
  258. package/dist/v1/schema/compatibility/structure/index.d.ts +3 -0
  259. package/dist/v1/schema/compatibility/structure/index.js +40 -0
  260. package/dist/v1/schema/compatibility/structure/inheritance.d.ts +7 -0
  261. package/dist/v1/schema/compatibility/structure/inheritance.js +68 -0
  262. package/dist/v1/schema/compatibility/structure/requirements.d.ts +7 -0
  263. package/dist/v1/schema/compatibility/structure/requirements.js +97 -0
  264. package/dist/v1/schema/compatibility/subjects.d.ts +39 -0
  265. package/dist/v1/schema/compatibility/subjects.js +143 -0
  266. package/dist/v1/schema/compatibility/versioning/index.d.ts +8 -0
  267. package/dist/v1/schema/compatibility/versioning/index.js +50 -0
  268. package/dist/v1/schema/compatibility/versioning/members.d.ts +12 -0
  269. package/dist/v1/schema/compatibility/versioning/members.js +47 -0
  270. package/dist/v1/schema/compatibility/versioning/surface.d.ts +11 -0
  271. package/dist/v1/schema/compatibility/versioning/surface.js +61 -0
  272. package/dist/v1/schema/diagnostic.d.ts +1 -1
  273. package/dist/v1/schema/fingerprint.d.ts +2 -0
  274. package/dist/v1/schema/fingerprint.js +1 -0
  275. package/dist/v1/schema/index.d.ts +4 -3
  276. package/dist/v1/schema/index.js +2 -1
  277. package/dist/v1/schema/model/schema.d.ts +8 -11
  278. package/dist/v1/schema/normalization/domain.js +57 -13
  279. package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
  280. package/dist/v1/schema/resolution/definition.index.js +0 -3
  281. package/dist/v1/schema/resolution/domain.d.ts +4 -1
  282. package/dist/v1/schema/resolution/domain.js +26 -18
  283. package/dist/v1/schema/resolution/origins.d.ts +28 -5
  284. package/dist/v1/schema/resolution/origins.js +68 -31
  285. package/dist/v1/schema/validation/callable.d.ts +4 -0
  286. package/dist/v1/schema/validation/callable.js +39 -0
  287. package/dist/v1/schema/validation/class.d.ts +10 -0
  288. package/dist/v1/schema/validation/class.js +79 -60
  289. package/dist/v1/schema/validation/core.js +83 -55
  290. package/dist/v1/schema/validation/domain.d.ts +2 -1
  291. package/dist/v1/schema/validation/domain.js +2 -0
  292. package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
  293. package/dist/v1/schema/validation/domain.structure.js +214 -171
  294. package/dist/v1/schema/validation/policy/budgets.js +36 -6
  295. package/dist/v1/schema/validation/policy/context.js +5 -16
  296. package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
  297. package/dist/v1/schema/validation/policy/objects.js +71 -0
  298. package/dist/v1/schema/validation/policy/references.js +16 -4
  299. package/dist/v1/schema/validation/policy/typing.d.ts +2 -0
  300. package/dist/v1/schema/validation/policy/typing.js +55 -7
  301. package/dist/v1/schema/validation/policy/uses.js +73 -99
  302. package/dist/v1/schema/validation/value-api.d.ts +2 -0
  303. package/dist/v1/schema/validation/value-api.js +1 -0
  304. package/dist/v1/schema/validation/value.js +7 -1
  305. package/dist/v1/schema/validation/view.js +14 -9
  306. package/dist/value/accept.d.ts +9 -0
  307. package/dist/value/accept.js +106 -7
  308. package/dist/value/canonical.d.ts +3 -0
  309. package/dist/value/canonical.js +22 -6
  310. package/dist/value/immutable.optimization.d.ts +15 -0
  311. package/dist/value/immutable.optimization.js +34 -0
  312. package/dist/value/index.d.ts +1 -1
  313. package/dist/value/index.js +1 -1
  314. package/dist/value/json.d.ts +1 -1
  315. package/dist/value/json.js +1 -1
  316. package/dist/value/limits.d.ts +1 -1
  317. package/dist/value/unicode.d.ts +4 -1
  318. package/dist/value/unicode.js +28 -0
  319. package/package.json +20 -5
  320. package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
  321. package/dist/v1/schema/compatibility/meaning.js +0 -605
@@ -1,19 +1,39 @@
1
1
  import { accept as acceptJsonValue } from '@astrale-os/kernel-dsl/value';
2
2
  import { authoringValue } from '../schema/handle.js';
3
+ const coreNodeConfigurations = new WeakMap();
4
+ const coreEdgeConfigurations = new WeakMap();
3
5
  /** Reference the owning Domain instance as one Core Edge endpoint. */
4
6
  const domain = Object.freeze({ kind: 'domain' });
7
+ /** Internal lowering access; Core Node handles expose no public configuration object. */
8
+ export function coreNodeConfiguration(value) {
9
+ const configuration = coreNodeConfigurations.get(value);
10
+ if (configuration === undefined)
11
+ throw new TypeError('Unknown Core Node authoring handle.');
12
+ return configuration;
13
+ }
14
+ /** Internal lowering access; Core Edge handles expose no public configuration object. */
15
+ export function coreEdgeConfiguration(value) {
16
+ const configuration = coreEdgeConfigurations.get(value);
17
+ if (configuration === undefined)
18
+ throw new TypeError('Unknown Core Edge authoring handle.');
19
+ return configuration;
20
+ }
5
21
  function node(definition, properties) {
6
- return authoringValue('core-node', {
22
+ const value = authoringValue('core-node', {});
23
+ coreNodeConfigurations.set(value, {
7
24
  class: definition,
8
25
  properties: acceptJsonValue(properties),
9
26
  });
27
+ return value;
10
28
  }
11
29
  function edge(source, definition, target, properties) {
12
- return authoringValue('core-edge', {
30
+ const value = authoringValue('core-edge', {});
31
+ coreEdgeConfigurations.set(value, {
13
32
  source,
14
33
  class: definition,
15
34
  target,
16
35
  properties: acceptJsonValue(properties),
17
36
  });
37
+ return value;
18
38
  }
19
39
  export const core = Object.freeze({ node, edge, domain });
@@ -1,25 +1,26 @@
1
- export { func, method, output } from './callable/authoring.js';
1
+ export { func, input, method, output } from './callable/authoring.js';
2
2
  export { core } from './core/authoring.js';
3
3
  export { defineClass, edgeClass, nodeClass } from './class/authoring.js';
4
4
  export { fullMatch } from './value/full-match.js';
5
5
  export { path } from './value/path.js';
6
6
  export { policy } from './policy/authoring.js';
7
- export { auto, property } from './class/property.js';
7
+ export { auto, property, stateProperty } from './class/property.js';
8
8
  export { defineSchema } from './schema/define.js';
9
9
  export type { DefinedSchema } from './schema/define.js';
10
- export type { DirectDependenciesOf, DomainOfInput } from './schema/projection.js';
10
+ export type { ResolvedDomainOfInput } from './schema/projection.js';
11
11
  export { valueSchema } from './value/schema.js';
12
12
  export { view } from './view/authoring.js';
13
13
  export { BuilderError as Error } from './schema/diagnostic.js';
14
14
  export type { BuilderDiagnostic as Diagnostic, BuilderDiagnosticCode as DiagnosticCode, } from './schema/diagnostic.js';
15
- export type { CallableInputBase, CallableInput, CallableOutputInput, CallablePolicyBuilder, CallablePolicyContext, BinaryOutput, Function, FunctionInput, Method, MethodInput, PolicyObjectInput, StreamOutput, } from './callable/authoring.js';
15
+ export type { CallableInputBase, CallableInput, BinaryInputAuthoring, CallableOutputInput, CallableProjection, CallablePolicyBuilder, CallablePolicyContext, PolicyCheckContext, BinaryOutput, Function, FunctionInput, Method, MethodInput, PolicyObjectInput, StreamOutput, } from './callable/authoring.js';
16
16
  export type { CoreEdge, CoreEndpoint, CoreInput, CoreNode } from './core/authoring.js';
17
- export type { Class, ClassReferenceInput as ClassReference, DirectedEdgeInput, DirectedEdgeClass, DirectedSourceInput, DirectedTargetInput, EdgeClassCommon, EdgeClassInput, EdgeClass, EdgeClassReferenceInput as EdgeClassReference, IncidentEndpointInput, NodeClass, NodeClassInput, NodeClassReferenceInput as NodeClassReference, UndirectedEdgeInput, UndirectedEdgeClass, } from './class/authoring.js';
17
+ export type { AuthoredPropertyProjection, AuthoredMethodProjection, Class, ClassIdentityProjection, ClassOwnerProjection, ClassReferenceProjection, ClassReferenceInput as ClassReference, ClassRuleBuilder, ClassRuleContext, DirectedEdgeInput, DirectedEdgeClass, DirectedSourceInput, DirectedTargetInput, EdgeClassCommon, EdgeClassInput, EdgeClass, EdgeClassReferenceInput as EdgeClassReference, IncidentEndpointInput, NodeClass, NodeClassInput, NodeClassPoliciesInput, NodeClassPolicyInput, NodeClassReferenceInput as NodeClassReference, UndirectedEdgeInput, UndirectedEdgeClass, } from './class/authoring.js';
18
18
  export type { PathAuthoring } from './value/path.js';
19
19
  export type { Lazy } from './schema/lazy.js';
20
- export type { MatchPolicyInput, Policy, PolicyBuilder as PolicyFactory, PolicyEdgeInput, PolicyExistsContext, PolicyInput, PolicyPatternContext, } from './policy/authoring.js';
20
+ export type { MatchPolicyInput, Policy, PolicyBuilder as PolicyFactory, PolicyEdgeInput, PolicyExistsContext, PolicyInput, PolicyNodeBinder, PolicyPatternContext, } from './policy/authoring.js';
21
21
  export type { AutoOptions, AutoProperty, Property, PropertyFieldInput as PropertyField, PropertyOptions, ValueSchemaInput, } from './class/property.js';
22
- export type { CorePropertyInput, ResolvedClassOfAuthoring } from './schema/projection.js';
23
- export type { DomainSchemaInput as SchemaInput } from './schema/input.js';
22
+ export type { CorePropertyInput } from './schema/projection.js';
23
+ export type { ClassProjection, FunctionProjection, MethodProjection, PropertyProjection, } from './schema/projection.js';
24
+ export type { DomainSchemaInput as SchemaInput, EntrypointOf } from './schema/input.js';
24
25
  export type { TypedValueSchema } from './value/schema.js';
25
26
  export type { View, ViewInput } from './view/authoring.js';
@@ -1,10 +1,10 @@
1
- export { func, method, output } from './callable/authoring.js';
1
+ export { func, input, method, output } from './callable/authoring.js';
2
2
  export { core } from './core/authoring.js';
3
3
  export { defineClass, edgeClass, nodeClass } from './class/authoring.js';
4
4
  export { fullMatch } from './value/full-match.js';
5
5
  export { path } from './value/path.js';
6
6
  export { policy } from './policy/authoring.js';
7
- export { auto, property } from './class/property.js';
7
+ export { auto, property, stateProperty } from './class/property.js';
8
8
  export { defineSchema } from './schema/define.js';
9
9
  export { valueSchema } from './value/schema.js';
10
10
  export { view } 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;
@@ -19,6 +19,8 @@ export declare class V1CallableCompiler implements CallableCompiler {
19
19
  readonly values: BuilderValueSchemas;
20
20
  constructor(context: BuilderContext, values: BuilderValueSchemas);
21
21
  compile(value: Function | Method, placement: CallablePlacement): FunctionDefinition | MethodDefinition;
22
+ private callablePolicy;
22
23
  private compileOutput;
23
24
  private policyContext;
24
25
  }
26
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { normalizePolicyChecks } from '../../language/policy/normalization/normalize.js';
2
- import { callableInputField, callableAuthoringInput, callablePolicyObject, callableRef, callableSelf, isCallableOutputAuthoring, } from '../callable/authoring.js';
2
+ import { callableInputField, callableConfiguration, isBinaryInputAuthoring, isCallableOutputAuthoring, } from '../callable/authoring.js';
3
3
  import { fail } from '../schema/diagnostic.js';
4
+ import { policyCheckContext } from './policy.js';
4
5
  export class V1CallableCompiler {
5
6
  context;
6
7
  values;
@@ -9,7 +10,7 @@ export class V1CallableCompiler {
9
10
  this.values = values;
10
11
  }
11
12
  compile(value, placement) {
12
- const config = callableAuthoringInput(value);
13
+ const config = callableConfiguration(value);
13
14
  if (config.auth !== 'anonymous' &&
14
15
  config.auth !== 'authenticated' &&
15
16
  config.auth !== 'authorized') {
@@ -20,35 +21,55 @@ export class V1CallableCompiler {
20
21
  fail('BUILDER_CALLABLE_POLICY_AUTH', `${placement.pointer}/policy`, 'Only an authorized Function or Method may declare a Policy check.');
21
22
  }
22
23
  const method = placement.kind !== 'function';
23
- if (!method && (config.static !== undefined || config.inheritance !== undefined)) {
24
- fail('BUILDER_CALLABLE_PLACEMENT', placement.pointer, 'A standalone Function cannot declare Method staticness or inheritance.');
24
+ if (!method && (config.static !== undefined || config.abstract !== undefined)) {
25
+ fail('BUILDER_CALLABLE_PLACEMENT', placement.pointer, 'A standalone Function cannot declare Method staticness or abstractness.');
25
26
  }
26
27
  const isStatic = method ? (config.static ?? false) : undefined;
27
- const inheritance = method ? (config.inheritance ?? 'default') : undefined;
28
- if (inheritance === 'abstract' && config.policy !== undefined) {
29
- fail('BUILDER_ABSTRACT_POLICY', `${placement.pointer}/policy`, 'An abstract Method cannot declare a Policy check.');
28
+ const isAbstract = method ? (config.abstract ?? false) : undefined;
29
+ const binaryInput = isBinaryInputAuthoring(config.input) ? config.input : undefined;
30
+ if (method && binaryInput !== undefined) {
31
+ fail('BUILDER_CALLABLE_PLACEMENT', `${placement.pointer}/input`, 'Methods require Value input.');
30
32
  }
31
- const input = this.values.schema(config.input, 'callable-input', `${placement.pointer}/input`);
33
+ const metadata = isBinaryInputAuthoring(config.input) ? config.input.metadata : config.input;
34
+ const inputSchema = this.values.schema(metadata, 'callable-input', binaryInput ? `${placement.pointer}/input/metadata` : `${placement.pointer}/input`);
35
+ const input = binaryInput
36
+ ? { mode: 'binary', metadata: inputSchema, maximumBytes: binaryInput.maximumBytes }
37
+ : inputSchema;
32
38
  const output = this.compileOutput(config.output, `${placement.pointer}/output`);
33
- const policy = config.policy === undefined
34
- ? undefined
35
- : normalizePolicyChecks(config.policy(this.policyContext(input, placement, isStatic ?? false)));
39
+ const policy = this.callablePolicy(config.policy, `${placement.pointer}/policy`, () => this.policyContext(inputSchema, placement, isStatic ?? false));
36
40
  const base = {
37
41
  ...(config.description === undefined ? {} : { description: config.description }),
38
42
  input,
39
43
  output,
44
+ ...(config.execution === undefined ? {} : { execution: config.execution }),
40
45
  };
41
46
  const contract = auth === 'authorized'
42
47
  ? { ...base, auth, ...(policy === undefined ? {} : { policy }) }
43
48
  : { ...base, auth };
44
- if (!method)
45
- return { ref: placement.ref, ...contract };
49
+ if (!method) {
50
+ return {
51
+ ref: placement.ref,
52
+ ...contract,
53
+ };
54
+ }
46
55
  return {
47
56
  ...contract,
57
+ input: inputSchema,
48
58
  static: isStatic,
49
- inheritance: inheritance,
59
+ abstract: isAbstract,
50
60
  };
51
61
  }
62
+ callablePolicy(value, pointer, context) {
63
+ if (value === undefined)
64
+ return undefined;
65
+ if (typeof value === 'function')
66
+ return normalizePolicyChecks(value(context()));
67
+ if (typeof value !== 'boolean') {
68
+ fail('BUILDER_POLICY', pointer, 'A callable Policy is a check builder, true or false.');
69
+ }
70
+ // `false` is the meaning of an absent Policy, so it lowers to none.
71
+ return value ? true : undefined;
72
+ }
52
73
  compileOutput(value, pointer) {
53
74
  if (!isCallableOutputAuthoring(value)) {
54
75
  return {
@@ -69,43 +90,18 @@ export class V1CallableCompiler {
69
90
  return typeof key === 'string' ? callableInputField(key) : undefined;
70
91
  },
71
92
  });
72
- const self = callableSelf();
93
+ const pointer = `${placement.pointer}/policy`;
73
94
  return Object.freeze({
74
95
  input,
75
- self,
76
- ref: (member) => callableRef(this.context.resolvePolicyObject(member, `${placement.pointer}/policy/ref`)),
77
- check: (policy, object) => {
78
- const resolvedObject = callablePolicyObject(object);
79
- let admittedObject = resolvedObject;
80
- if (resolvedObject.kind === 'self') {
81
- if (placement.kind === 'function' || isStatic) {
82
- fail('BUILDER_POLICY_SELF', `${placement.pointer}/policy`, 'self is available only to a non-static Node Method.');
83
- }
96
+ ...policyCheckContext(this.context, pointer, (object) => {
97
+ if (object.kind === 'self' && (placement.kind === 'function' || isStatic)) {
98
+ fail('BUILDER_POLICY_SELF', pointer, 'self is available only to a non-static Node Method.');
84
99
  }
85
- else if (resolvedObject.kind === 'input') {
86
- if (isRequiredDirectNodePath(inputSchema, resolvedObject.field)) {
87
- // The field contract is admitted below as-is.
88
- }
89
- else {
90
- fail('BUILDER_POLICY_INPUT', `${placement.pointer}/policy`, `input.${resolvedObject.field} is not one direct required single-Node path field.`);
91
- }
100
+ if (object.kind === 'input' && !isRequiredDirectNodePath(inputSchema, object.field)) {
101
+ fail('BUILDER_POLICY_INPUT', pointer, `input.${object.field} is not one direct required single-Node path field.`);
92
102
  }
93
- else {
94
- admittedObject = callableRef(this.context.resolvePolicyObject(resolvedObject.ref, `${placement.pointer}/policy/ref`));
95
- }
96
- return {
97
- check: this.context.resolvePolicy(policy, `${placement.pointer}/policy/check`),
98
- object: admittedObject,
99
- };
100
- },
101
- allOf: (...expressions) => {
102
- nonEmpty(expressions, `${placement.pointer}/policy/allOf`);
103
- return { allOf: expressions };
104
- },
105
- anyOf: (...expressions) => {
106
- nonEmpty(expressions, `${placement.pointer}/policy/anyOf`);
107
- return { anyOf: expressions };
108
- },
103
+ return object;
104
+ }),
109
105
  });
110
106
  }
111
107
  }
@@ -129,7 +125,3 @@ function isRequiredDirectNodePath(schema, field) {
129
125
  'https://schemas.astrale.ai/graph/1/node-path' &&
130
126
  Object.hasOwn(fieldSchema, 'x-astrale-path'));
131
127
  }
132
- function nonEmpty(values, pointer) {
133
- if (values.length === 0)
134
- fail('BUILDER_POLICY_EMPTY_COMPOSITION', pointer, 'Policy check composition must be non-empty.');
135
- }
@@ -13,6 +13,13 @@ export declare class V1DefinitionCompiler {
13
13
  compileClass(value: Class, name: string, pointer: string): ClassDefinition;
14
14
  private nodeClass;
15
15
  private edgeClass;
16
+ private classPolicies;
17
+ /**
18
+ * A lazy Policy ignores the context it is called with; a rule builder returns Policy checks. Both
19
+ * are functions, so the result tells them apart.
20
+ */
21
+ private classPolicy;
22
+ private classRuleContext;
16
23
  private endpointBase;
17
24
  private directedSource;
18
25
  private directedTarget;
@@ -1,6 +1,12 @@
1
1
  import { compareDefinitionRefs } from '../../addressing/ordering.js';
2
- import { classAuthoringInput } from '../class/authoring.js';
3
- import { escapeToken } from '../schema/diagnostic.js';
2
+ import { isMethodExecutable } from '../../language/callable/executable.js';
3
+ import { isClassRuleChecks } from '../../language/policy/model/policy.js';
4
+ import { normalizeClassRule } from '../../language/policy/normalization/normalize.js';
5
+ import { callableConfiguration } from '../callable/authoring.js';
6
+ import { classConfiguration } from '../class/authoring.js';
7
+ import { escapeToken, fail } from '../schema/diagnostic.js';
8
+ import { isAuthoringValue } from '../schema/handle.js';
9
+ import { policyCheckContext } from './policy.js';
4
10
  export class V1DefinitionCompiler {
5
11
  context;
6
12
  values;
@@ -18,7 +24,7 @@ export class V1DefinitionCompiler {
18
24
  : this.edgeClass(value, name, pointer);
19
25
  }
20
26
  nodeClass(value, name, pointer) {
21
- const input = classAuthoringInput(value);
27
+ const input = classConfiguration(value);
22
28
  const facet = this.values.properties(input.properties, `${pointer}/properties`);
23
29
  const data = dataDeclaration(input.data);
24
30
  return {
@@ -28,27 +34,18 @@ export class V1DefinitionCompiler {
28
34
  ...(input.description === undefined ? {} : { description: input.description }),
29
35
  extends: this.parents(input.extends, 'node', `${pointer}/extends`),
30
36
  properties: facet,
31
- methods: this.methods(input.methods, `${pointer}/methods`),
37
+ methods: this.methods(input.methods, input.abstract ?? false, `${pointer}/methods`),
32
38
  ...(data === undefined ? {} : { data }),
33
39
  ...(input.icon === undefined ? {} : { icon: input.icon }),
34
- policies: {
35
- ...(input.policies?.read === undefined
36
- ? {}
37
- : { read: this.policies.ref(input.policies.read, `${pointer}/policies/read`) }),
38
- ...(input.policies?.traverse === undefined
39
- ? {}
40
- : {
41
- traverse: this.policies.ref(input.policies.traverse, `${pointer}/policies/traverse`),
42
- }),
43
- },
40
+ policies: this.classPolicies(input, 'node', `${pointer}/policies`),
44
41
  };
45
42
  }
46
43
  edgeClass(value, name, pointer) {
47
- const input = classAuthoringInput(value);
44
+ const input = classConfiguration(value);
48
45
  const facet = this.values.properties(input.properties, `${pointer}/properties`);
49
46
  const contract = (() => {
50
47
  if (value.orientation === 'directed') {
51
- const directed = classAuthoringInput(value);
48
+ const directed = classConfiguration(value);
52
49
  return {
53
50
  orientation: 'directed',
54
51
  endpoints: {
@@ -58,7 +55,7 @@ export class V1DefinitionCompiler {
58
55
  constraints: directedConstraints(directed),
59
56
  };
60
57
  }
61
- const undirected = classAuthoringInput(value);
58
+ const undirected = classConfiguration(value);
62
59
  return {
63
60
  orientation: 'undirected',
64
61
  endpoints: [
@@ -76,13 +73,53 @@ export class V1DefinitionCompiler {
76
73
  extends: this.parents(input.extends, 'edge', `${pointer}/extends`),
77
74
  properties: facet,
78
75
  ...contract,
79
- policies: input.policies?.traverse === undefined
80
- ? {}
81
- : {
82
- traverse: this.policies.ref(input.policies.traverse, `${pointer}/policies/traverse`),
83
- },
76
+ // classPolicy refuses Policy checks on an Edge Class, so only Class Policies remain.
77
+ policies: this.classPolicies(input, 'edge', `${pointer}/policies`),
84
78
  };
85
79
  }
80
+ classPolicies(input, kind, pointer) {
81
+ const slot = (operation) => {
82
+ const value = input.policies?.[operation];
83
+ if (value === undefined)
84
+ return undefined;
85
+ if (typeof value !== 'boolean')
86
+ return this.classPolicy(value, kind, `${pointer}/${operation}`);
87
+ // `true` on an abstract Class would otherwise lower to nothing and pass unnoticed.
88
+ if (input.abstract === true) {
89
+ fail('BUILDER_ABSTRACT_POLICY', `${pointer}/${operation}`, 'Abstract Classes cannot declare observation Policies.');
90
+ }
91
+ // `true` is the meaning of an absent observation Policy, so it lowers to none.
92
+ return value ? undefined : false;
93
+ };
94
+ const read = slot('read');
95
+ const traverse = slot('traverse');
96
+ return {
97
+ ...(read === undefined ? {} : { read }),
98
+ ...(traverse === undefined ? {} : { traverse }),
99
+ };
100
+ }
101
+ /**
102
+ * A lazy Policy ignores the context it is called with; a rule builder returns Policy checks. Both
103
+ * are functions, so the result tells them apart.
104
+ */
105
+ classPolicy(value, kind, pointer) {
106
+ if (typeof value !== 'function')
107
+ return this.policies.ref(value, pointer);
108
+ const result = value(this.classRuleContext(pointer));
109
+ if (!isClassRuleResult(result))
110
+ return this.policies.ref(result, pointer);
111
+ if (kind === 'edge') {
112
+ fail('BUILDER_POLICY', pointer, 'An Edge Class observation names one Policy, true or false.');
113
+ }
114
+ return normalizeClassRule(result);
115
+ }
116
+ classRuleContext(pointer) {
117
+ return policyCheckContext(this.context, pointer, (object) => {
118
+ if (object?.kind === 'self' || object?.kind === 'ref')
119
+ return object;
120
+ fail('BUILDER_POLICY_INPUT', pointer, 'A Class rule checks self or one ref(...) member.');
121
+ });
122
+ }
86
123
  endpointBase(value, pointer) {
87
124
  return {
88
125
  role: value.as,
@@ -105,14 +142,20 @@ export class V1DefinitionCompiler {
105
142
  .map((entry, index) => this.context.resolveClass(entry, kind, `${pointer}/${index}`))
106
143
  .sort(compareDefinitionRefs);
107
144
  }
108
- methods(values, pointer) {
109
- return Object.fromEntries(Object.entries(values ?? {}).map(([name, value]) => [
110
- name,
111
- this.callables.compile(value, {
145
+ methods(values, abstractOwner, pointer) {
146
+ return Object.fromEntries(Object.entries(values ?? {}).map(([name, value]) => {
147
+ const methodPointer = `${pointer}/${escapeToken(name)}`;
148
+ const method = this.callables.compile(value, {
112
149
  kind: 'node-class-method',
113
- pointer: `${pointer}/${escapeToken(name)}`,
114
- }),
115
- ]));
150
+ pointer: methodPointer,
151
+ });
152
+ // `false` on a contract-only Method would otherwise lower to nothing and pass unnoticed.
153
+ if (!isMethodExecutable({ abstract: abstractOwner }, method) &&
154
+ typeof callableConfiguration(value).policy === 'boolean') {
155
+ fail('BUILDER_ABSTRACT_POLICY', `${methodPointer}/policy`, 'Abstract Methods cannot have a Policy.');
156
+ }
157
+ return [name, method];
158
+ }));
116
159
  }
117
160
  }
118
161
  function dataDeclaration(mediaType) {
@@ -127,3 +170,10 @@ function directedConstraints(options) {
127
170
  function undirectedConstraints(options) {
128
171
  return options.constraints?.noSelf === true ? { noSelf: true } : {};
129
172
  }
173
+ /** A rule builder's result, not the Policy handle a lazy reference returns. */
174
+ function isClassRuleResult(value) {
175
+ return (typeof value === 'object' &&
176
+ value !== null &&
177
+ !isAuthoringValue(value, 'policy') &&
178
+ isClassRuleChecks(value));
179
+ }
@@ -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 {};
@@ -1,3 +1,4 @@
1
+ import { coreEdgeConfiguration, coreNodeConfiguration } from '../core/authoring.js';
1
2
  import { escapeToken, fail } from '../schema/diagnostic.js';
2
3
  import { isAuthoringValue } from '../schema/handle.js';
3
4
  export function captureCore(input, context) {
@@ -17,29 +18,31 @@ export function compileCore(input, context) {
17
18
  return { nodes, edges };
18
19
  }
19
20
  function compileNode(slug, value, context, pointer) {
20
- const ref = context.resolveNodeClass(value.class, `${pointer}/class`);
21
+ const configuration = coreNodeConfiguration(value);
22
+ const ref = context.resolveNodeClass(configuration.class, `${pointer}/class`);
21
23
  if (ref.origin !== context.origin) {
22
24
  fail('BUILDER_CORE_CLASS', `${pointer}/class`, 'A Core Node Class must be local to the owning Domain.');
23
25
  }
24
26
  return {
25
27
  ref: { origin: context.origin, kind: 'core', name: slug },
26
28
  class: ref,
27
- properties: value.properties,
29
+ properties: configuration.properties,
28
30
  };
29
31
  }
30
32
  function compileEdge(value, context, pointer) {
31
33
  if (!isAuthoringValue(value, 'core-edge')) {
32
34
  fail('BUILDER_CORE_EDGE', pointer, 'core.edges entries are created by edge(...).');
33
35
  }
34
- const ref = context.resolveEdgeClass(value.class, `${pointer}/class`);
36
+ const configuration = coreEdgeConfiguration(value);
37
+ const ref = context.resolveEdgeClass(configuration.class, `${pointer}/class`);
35
38
  if (ref.origin !== context.origin) {
36
39
  fail('BUILDER_CORE_CLASS', `${pointer}/class`, 'A Core Edge Class must be local to the owning Domain.');
37
40
  }
38
41
  return {
39
42
  class: ref,
40
- source: resolveEndpoint(value.source, context, `${pointer}/source`),
41
- target: resolveEndpoint(value.target, context, `${pointer}/target`),
42
- properties: value.properties,
43
+ source: resolveEndpoint(configuration.source, context, `${pointer}/source`),
44
+ target: resolveEndpoint(configuration.target, context, `${pointer}/target`),
45
+ properties: configuration.properties,
43
46
  };
44
47
  }
45
48
  function resolveEndpoint(value, context, pointer) {
@@ -1,5 +1,6 @@
1
1
  import type { PolicyRef } from '../../addressing/index.js';
2
- import type { PolicyDefinition } from '../../language/policy/model/policy.js';
2
+ import type { PolicyCheckObject, PolicyDefinition } from '../../language/policy/model/policy.js';
3
+ import type { PolicyCheckContext } from '../callable/authoring.js';
3
4
  import type { Policy } from '../policy/authoring.js';
4
5
  import type { Lazy } from '../schema/lazy.js';
5
6
  import type { BuilderContext } from './schema/context.js';
@@ -14,3 +15,9 @@ export declare class V1PolicyCompiler implements PolicyCompiler {
14
15
  compile(value: Policy, name: string, pointer: string): PolicyDefinition;
15
16
  }
16
17
  export declare function assertPolicyCompositionAcyclic(declarations: Readonly<Record<string, PolicyDefinition>>, origin: string): void;
18
+ /**
19
+ * The check vocabulary of every rule site: an authorized callable's Policy and a Node Class rule.
20
+ * A `ref` object resolves to one exact projected member however it was written; `admit` keeps the
21
+ * objects the site accepts. `pointer` is the site's rule slot.
22
+ */
23
+ export declare function policyCheckContext<Object extends PolicyCheckObject>(context: BuilderContext, pointer: string, admit: (object: PolicyCheckObject) => Object): PolicyCheckContext<Object>;
@@ -1,4 +1,5 @@
1
1
  import { normalizePolicyExpression } from '../../language/policy/normalization/normalize.js';
2
+ import { callableRef, callableSelf } from '../callable/authoring.js';
2
3
  import { createPatternContext, policyDeclaration } from '../policy/authoring.js';
3
4
  import { fail } from '../schema/diagnostic.js';
4
5
  export class V1PolicyCompiler {
@@ -20,6 +21,7 @@ export class V1PolicyCompiler {
20
21
  };
21
22
  }
22
23
  const match = input.match(createPatternContext({
24
+ resolveObject: (member, refPointer) => this.context.resolvePolicyObject(member, refPointer),
23
25
  resolveEdgeClass: (definition, refPointer) => this.context.resolveEdgeClass(definition, refPointer),
24
26
  resolveNodeClass: (definition, refPointer) => this.context.resolveNodeClass(definition, refPointer),
25
27
  pointer,
@@ -57,3 +59,36 @@ export function assertPolicyCompositionAcyclic(declarations, origin) {
57
59
  for (const name of Object.keys(declarations))
58
60
  visit(name);
59
61
  }
62
+ /**
63
+ * The check vocabulary of every rule site: an authorized callable's Policy and a Node Class rule.
64
+ * A `ref` object resolves to one exact projected member however it was written; `admit` keeps the
65
+ * objects the site accepts. `pointer` is the site's rule slot.
66
+ */
67
+ export function policyCheckContext(context, pointer, admit) {
68
+ const object = (value) => admit(value?.kind === 'ref'
69
+ ? callableRef(context.resolvePolicyObject(value.ref, `${pointer}/ref`))
70
+ : value);
71
+ return Object.freeze({
72
+ self: callableSelf(),
73
+ ref: (member) => callableRef(context.resolvePolicyObject(member, `${pointer}/ref`)),
74
+ check: (policy, value) => ({
75
+ check: context.resolvePolicy(policy, `${pointer}/check`),
76
+ object: object(value),
77
+ }),
78
+ sameNode: (left, right) => ({
79
+ sameNode: { left: object(left), right: object(right) },
80
+ }),
81
+ allOf: (...expressions) => {
82
+ nonEmpty(expressions, `${pointer}/allOf`);
83
+ return { allOf: expressions };
84
+ },
85
+ anyOf: (...expressions) => {
86
+ nonEmpty(expressions, `${pointer}/anyOf`);
87
+ return { anyOf: expressions };
88
+ },
89
+ });
90
+ }
91
+ function nonEmpty(values, pointer) {
92
+ if (values.length === 0)
93
+ fail('BUILDER_POLICY_EMPTY_COMPOSITION', pointer, 'Policy check composition must be non-empty.');
94
+ }
@@ -1,5 +1,4 @@
1
- import { MethodKey } from '../../../addressing/index.js';
2
- import { classAuthoringInput } from '../../class/authoring.js';
1
+ import { classConfiguration } from '../../class/authoring.js';
3
2
  import { escapeToken, fail } from '../../schema/diagnostic.js';
4
3
  import { isAuthoringValue } from '../../schema/handle.js';
5
4
  import { captureCore } from '../core.js';
@@ -38,11 +37,17 @@ function captureExecutables(input, context) {
38
37
  for (const [definitionName, definition] of Object.entries(input.classes ?? {})) {
39
38
  if (definition.kind !== 'node')
40
39
  continue;
41
- const methods = classAuthoringInput(definition).methods;
40
+ const methods = classConfiguration(definition).methods;
42
41
  for (const [methodName, method] of Object.entries(methods ?? {})) {
43
42
  const pointer = `/classes/${escapeToken(definitionName)}/methods/${escapeToken(methodName)}`;
44
43
  assertMethod(method, pointer);
45
- context.ownership.capture(method, MethodKey.of({ origin: context.origin, kind: 'class', name: definitionName }, methodName), pointer);
44
+ const ref = {
45
+ kind: 'method',
46
+ owner: { origin: context.origin, kind: 'class', name: definitionName },
47
+ name: methodName,
48
+ };
49
+ context.ownership.captureDefinition(method, ref, pointer);
50
+ context.capturePolicyObject(method, ref);
46
51
  }
47
52
  }
48
53
  for (const [name, value] of Object.entries(input.views ?? {})) {
@@ -1,10 +1,10 @@
1
1
  import type { DomainSchema } from '../../../schema/model/schema.js';
2
2
  import type { DomainSchemaInput } from '../../schema/input.js';
3
- import type { DomainOfInput } from '../../schema/projection.js';
3
+ import type { ResolvedDomainOfInput } from '../../schema/projection.js';
4
4
  /**
5
5
  * Compile the V1 TypeScript builder graph through the same semantic acceptance
6
6
  * path used for untrusted decoded schemas.
7
7
  *
8
8
  * This is the private implementation behind defineSchema.
9
9
  */
10
- export declare function compileSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input): DomainSchema<Origin, Input, DomainOfInput<Origin, Input>>;
10
+ export declare function compileSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input): DomainSchema<Origin, ResolvedDomainOfInput<Origin, Input>>;
@@ -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 ?? {});
@@ -47,12 +56,16 @@ function assembleDomainSchema(origin, input, lookup) {
47
56
  }));
48
57
  const policies = mapRecord(input.policies ?? {}, (value, name) => policyCompiler.compile(value, name, `/policies/${escapeToken(name)}`));
49
58
  assertPolicyCompositionAcyclic(policies, origin);
50
- const views = mapRecord(input.views ?? {}, (value, name) => viewCompiler.compile(value, name, `/views/${escapeToken(name)}`));
59
+ const views = mapRecord(input.views ?? {}, (value, name) => viewCompiler.compile(value, name));
51
60
  const core = compileCore(input.core, context);
52
61
  const semanticContent = {
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(),