@astrale-os/kernel-dsl 0.2.0-beta.8 → 0.2.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 (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 +139 -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
@@ -0,0 +1,15 @@
1
+ import { realize } from './loader/load.js';
2
+ /** Realize immutable, build-owned compiled material without repeating external admission. */
3
+ export function load(input) {
4
+ return realize(deepFreeze(input));
5
+ }
6
+ function deepFreeze(input, seen = new WeakSet()) {
7
+ if (input === null || typeof input !== 'object' || seen.has(input))
8
+ return input;
9
+ seen.add(input);
10
+ for (const value of Object.values(input))
11
+ deepFreeze(value, seen);
12
+ if (!Object.isFrozen(input))
13
+ Object.freeze(input);
14
+ return input;
15
+ }
@@ -2,3 +2,8 @@ import type { CompiledSchema, DomainOfCompiled } from '../model/schema.js';
2
2
  /** Load admitted compiled data through the one resolved Domain constructor. */
3
3
  export declare function load<const Input extends CompiledSchema>(input: Input): DomainOfCompiled<Input>;
4
4
  export declare function load(input: unknown): import('../../domain/model/domain.js').Domain;
5
+ /**
6
+ * Realize compiled material whose exact embedded bytes were already proven by generated build code.
7
+ * External bytes and caller-provided values must continue through {@link load}.
8
+ */
9
+ export declare function realize(compiled: CompiledSchema): import('../../domain/model/domain.js').Domain;
@@ -2,10 +2,17 @@ import { Key, MethodKey, PropertyKey as PropertyKeyValue } from '../../addressin
2
2
  import { compareUnicode } from '../../addressing/ordering.js';
3
3
  import { createDomain } from '../../domain/create.js';
4
4
  import { combineDomainValidation, createDomainValidation, unknownInputField, } from '../../domain/validation/create.js';
5
+ import { bindValueProgram } from '../../language/value/compile/load.js';
5
6
  import { validateValueProgram } from '../../language/value/evaluate/program.js';
6
7
  import { acceptCompiledSchema } from '../admission/accept.js';
7
8
  export function load(input) {
8
- const compiled = acceptCompiledSchema(input);
9
+ return realize(acceptCompiledSchema(input));
10
+ }
11
+ /**
12
+ * Realize compiled material whose exact embedded bytes were already proven by generated build code.
13
+ * External bytes and caller-provided values must continue through {@link load}.
14
+ */
15
+ export function realize(compiled) {
9
16
  const entries = new Map(compiled.closure.map((entry) => [entry.origin, loadEntry(entry)]));
10
17
  const root = entries.get(compiled.root.origin);
11
18
  if (root === undefined || root.entry.revision !== compiled.root.revision) {
@@ -62,7 +69,7 @@ function loadEntry(entry) {
62
69
  ...entry.definitions.views,
63
70
  ...entry.definitions.core,
64
71
  ]),
65
- validation: programValidation(entry.values, propertyPrograms, propertyOrdering, callablePrograms),
72
+ validation: programValidation(entry.values.map((value) => bindValueProgram(value, entry.patterns)), propertyPrograms, propertyOrdering, callablePrograms),
66
73
  };
67
74
  }
68
75
  function loadMethod(entry, value) {
@@ -77,7 +84,13 @@ function loadFunction(entry, value) {
77
84
  const { input, fields: _, output, ...definition } = value;
78
85
  return Object.freeze({
79
86
  ...definition,
80
- input: schemaOf(entry, input),
87
+ input: typeof input === 'number'
88
+ ? schemaOf(entry, input)
89
+ : {
90
+ mode: 'binary',
91
+ metadata: schemaOf(entry, input.metadata),
92
+ maximumBytes: input.maximumBytes,
93
+ },
81
94
  output: loadOutput(entry, output),
82
95
  });
83
96
  }
@@ -98,7 +111,7 @@ function schemaOf(entry, index) {
98
111
  }
99
112
  function callableProgram(value) {
100
113
  return {
101
- input: value.input,
114
+ input: typeof value.input === 'number' ? value.input : value.input.metadata,
102
115
  ...(value.fields === undefined ? {} : { fields: value.fields }),
103
116
  ...(value.output.mode === 'binary' ? {} : { output: value.output.value }),
104
117
  };
@@ -112,6 +125,7 @@ function programValidation(programs, properties, propertyOrdering, callables) {
112
125
  propertyValidation.set(key, Object.freeze({
113
126
  ordering: propertyOrdering.get(key),
114
127
  validate: (value) => validateValueProgram(program, value),
128
+ program: () => program,
115
129
  }));
116
130
  }
117
131
  const callableValidation = new Map();
@@ -1,15 +1,15 @@
1
1
  import type { Key } from '../../addressing/index.js';
2
- import type { DomainDependency, DomainDependencyMap, Revision } from '../../addressing/index.js';
2
+ import type { DomainDependency, DomainDependencyMap, Revision, ViewRef } from '../../addressing/index.js';
3
3
  import type { Domain } from '../../domain/model/domain.js';
4
4
  import type { MethodDefinition } from '../../language/callable/model/callable.js';
5
5
  import type { ClassDefinition } from '../../language/class/model/class.js';
6
6
  import type { PropertyDefinition } from '../../language/class/model/property.js';
7
7
  import type { CoreDefinition, CoreEdge } from '../../language/core/model/core.js';
8
8
  import type { PolicyDefinition } from '../../language/policy/model/policy.js';
9
- import type { ValueProgram } from '../../language/value/compile/model.js';
9
+ import type { IndexedValueProgram, Pattern, RunPattern } from '../../language/value/compile/model.js';
10
10
  import type { OrderingKind } from '../../language/value/ordering.js';
11
11
  import type { ViewDefinition } from '../../language/view/model/view.js';
12
- export type { Pattern, PatternState, PatternTransition, ScalarRange, ValueNode, ValueProgram, } from '../../language/value/compile/model.js';
12
+ export type { Pattern, PatternState, PatternTransition, RunPattern, ScalarRun, ScalarRange, IndexedValueProgram, ValueNode, ValueProgram, } from '../../language/value/compile/model.js';
13
13
  export interface CompiledProperty extends Omit<PropertyDefinition, 'schema'> {
14
14
  readonly name: string;
15
15
  readonly value: number;
@@ -38,7 +38,11 @@ export type CompiledClass = (Omit<Extract<ClassDefinition, {
38
38
  readonly properties: readonly CompiledProperty[];
39
39
  });
40
40
  export interface CompiledFunction extends Omit<import('../../language/callable/model/callable.js').FunctionDefinition, 'input' | 'output'> {
41
- readonly input: number;
41
+ readonly input: number | {
42
+ readonly mode: 'binary';
43
+ readonly metadata: number;
44
+ readonly maximumBytes: number;
45
+ };
42
46
  readonly fields?: Readonly<Record<string, readonly number[]>>;
43
47
  readonly output: CompiledOutput;
44
48
  }
@@ -49,6 +53,10 @@ export type CompiledCoreEdge = CoreEdge;
49
53
  export interface CompiledSchemaEntry {
50
54
  readonly origin: Key.Origin;
51
55
  readonly revision: Revision;
56
+ /** The source Domain display name. */
57
+ readonly name: string;
58
+ /** The source Domain entrypoint View. */
59
+ readonly entrypoint?: ViewRef;
52
60
  readonly dependencies: DomainDependencyMap;
53
61
  readonly definitions: {
54
62
  readonly classes: readonly CompiledClass[];
@@ -60,14 +68,15 @@ export interface CompiledSchemaEntry {
60
68
  readonly facts: {
61
69
  readonly core: readonly CoreEdge[];
62
70
  };
63
- readonly values: readonly ValueProgram[];
71
+ readonly values: readonly IndexedValueProgram[];
72
+ readonly patterns: readonly (Pattern | RunPattern)[];
64
73
  }
65
74
  declare const COMPILED_DOMAIN: unique symbol;
66
75
  export interface CompiledSchema<Resolved = Domain> {
67
76
  readonly format: 'astrale.dsl.compiled-schema';
68
- readonly version: 1;
77
+ readonly version: 2;
69
78
  readonly root: DomainDependency;
70
79
  readonly closure: readonly CompiledSchemaEntry[];
71
- readonly [COMPILED_DOMAIN]?: Resolved;
80
+ readonly [COMPILED_DOMAIN]: Resolved;
72
81
  }
73
82
  export type DomainOfCompiled<Value extends CompiledSchema> = Value extends CompiledSchema<infer Resolved> ? Resolved : Domain;
@@ -1,4 +1,4 @@
1
- import { Key } from '../addressing/index.js';
1
+ import { Key, MethodKey } from '../addressing/index.js';
2
2
  import { frozenRecord } from './namespace/member-collection.js';
3
3
  import { createClasses } from './projection/classes.js';
4
4
  const admittedDomains = new WeakSet();
@@ -58,14 +58,13 @@ export function createDomain(input) {
58
58
  if (classValue?.kind !== 'edge') {
59
59
  throw new TypeError(`Core Edge has no Edge Class ${Key.of(edge.class)}.`);
60
60
  }
61
+ const endpoint = (ref) => ref.kind === 'domain'
62
+ ? domainEndpoint
63
+ : requiredCoreEndpoint(definitionsByKey, callables, ref);
61
64
  return Object.freeze({
62
65
  class: classValue,
63
- source: edge.source.kind === 'domain'
64
- ? domainEndpoint
65
- : requiredCore(definitionsByKey, edge.source),
66
- target: edge.target.kind === 'domain'
67
- ? domainEndpoint
68
- : requiredCore(definitionsByKey, edge.target),
66
+ source: endpoint(edge.source),
67
+ target: endpoint(edge.target),
69
68
  properties: edge.properties,
70
69
  });
71
70
  }));
@@ -105,24 +104,6 @@ export function createDomain(input) {
105
104
  definitions(kind) {
106
105
  return kind === undefined ? local : local.filter(({ ref }) => ref.kind === kind);
107
106
  },
108
- viewsFor(target) {
109
- return Object.freeze(Object.values(views).filter((view) => {
110
- if (view.target.kind === 'domain')
111
- return target === 'domain';
112
- if (target === 'domain')
113
- return false;
114
- return view.target.definitions.some((ref) => {
115
- const selected = classesByKey.get(Key.of(ref));
116
- if (target.kind === 'node' && selected?.kind === 'node') {
117
- return target.satisfies(selected);
118
- }
119
- if (target.kind === 'edge' && selected?.kind === 'edge') {
120
- return target.satisfies(selected);
121
- }
122
- return false;
123
- });
124
- }));
125
- },
126
107
  };
127
108
  const admitted = Object.freeze(domain);
128
109
  facades.set(entry.origin, admitted);
@@ -148,6 +129,7 @@ function createDefinitions(declarations, classesByKey, input) {
148
129
  description: definition.description,
149
130
  input: definition.input,
150
131
  output: definition.output,
132
+ ...(definition.execution === undefined ? {} : { execution: definition.execution }),
151
133
  auth: definition.auth,
152
134
  policy: definition.policy,
153
135
  ...(inputFields === undefined ? {} : { inputFields }),
@@ -175,7 +157,6 @@ function createDefinitions(declarations, classesByKey, input) {
175
157
  definitionsByKey.set(key, Object.freeze({
176
158
  ref: definition.ref,
177
159
  key,
178
- target: definition.target,
179
160
  description: definition.description,
180
161
  definition,
181
162
  }));
@@ -241,9 +222,18 @@ function namespace(definitions, kind) {
241
222
  .filter((value) => value.ref.kind === kind)
242
223
  .map((value) => [value.ref.name, value]));
243
224
  }
244
- function requiredCore(definitions, ref) {
225
+ /** Every non-Domain Core endpoint addresses one already-resolved local Definition or Method. */
226
+ function requiredCoreEndpoint(definitions, callables, ref) {
227
+ if (ref.kind === 'method') {
228
+ const key = MethodKey.of(ref.owner, ref.name);
229
+ const method = callables.get(key);
230
+ if (method === undefined || !('owner' in method)) {
231
+ throw new TypeError(`Core endpoint ${key} is absent.`);
232
+ }
233
+ return method;
234
+ }
245
235
  const value = definitions.get(Key.of(ref));
246
- if (value?.ref.kind !== 'core')
236
+ if (value === undefined)
247
237
  throw new TypeError(`Core endpoint ${Key.of(ref)} is absent.`);
248
238
  return value;
249
239
  }
@@ -36,7 +36,6 @@ export interface Domain<Classes extends Readonly<Record<string, unknown>> = Read
36
36
  callable(key: Key.Callable): ResolvedCallable | undefined;
37
37
  definitions(): readonly ResolvedDefinition[];
38
38
  definitions<const Kind extends DefinitionRef['kind']>(kind: Kind): readonly ResolvedDefinitionOf<Kind>[];
39
- viewsFor(target: 'domain' | AnyResolvedClass): readonly Views[keyof Views][];
40
39
  }
41
40
  declare const DOMAIN_SOURCE_RESOLVED: unique symbol;
42
41
  /** Type-only witness carried by a source that retains its exact resolved Domain. */
@@ -3,6 +3,7 @@ import type { DomainDependency, DomainDependencyMap } from '../../addressing/ind
3
3
  import type { CoreEdge } from '../../language/core/model/core.js';
4
4
  import type { Definition } from '../../language/definition.js';
5
5
  import type { Diagnostic } from '../../language/validation/diagnostic.js';
6
+ import type { ValueProgram } from '../../language/value/compile/model.js';
6
7
  import type { OrderingKind } from '../../language/value/ordering.js';
7
8
  /** One admitted Schema entry in a dependency-closed Domain universe. */
8
9
  export interface DomainEntryInput {
@@ -22,6 +23,8 @@ export interface DomainInput {
22
23
  export interface DomainValidation {
23
24
  propertyExists(key: PropertyKey): boolean;
24
25
  property(key: PropertyKey, input: unknown): readonly Diagnostic[];
26
+ /** The admitted program `property` evaluates. */
27
+ propertyProgram(key: PropertyKey): ValueProgram;
25
28
  propertyOrdering(key: PropertyKey): OrderingKind | undefined;
26
29
  callableExists(key: AddressKey.Callable): boolean;
27
30
  callableInput(key: AddressKey.Callable, input: unknown): readonly Diagnostic[];
@@ -1,4 +1,6 @@
1
- import { compareUnicode, Key, MethodKey as MethodKeyValue, PropertyKey as PropertyKeyValue, } from '../../addressing/index.js';
1
+ import { Key, MethodKey as MethodKeyValue, PropertyKey as PropertyKeyValue, } from '../../addressing/index.js';
2
+ import { isMethodExecutable } from '../../language/callable/executable.js';
3
+ import { classSatisfies } from '../../language/class/inheritance.js';
2
4
  import { acceptPropertyValues } from '../../language/class/property-values.js';
3
5
  import { appendPointer } from '../../language/value/syntax/pointer.js';
4
6
  import { createMethodCollection, createPropertyCollection } from '../namespace/member-collection.js';
@@ -24,29 +26,12 @@ export function createClasses(definitions, validation) {
24
26
  throw new TypeError(`Class ${key} extends a Class of another graph kind.`);
25
27
  }
26
28
  const shell = {};
27
- const policies = Object.freeze({
28
- read: Object.freeze(definition.kind === 'node'
29
- ? uniquePolicyRefs([
30
- ...parents.flatMap((parent) => parent.kind === 'node' ? [...parent.policies.read] : []),
31
- ...(definition.policies.read === undefined ? [] : [definition.policies.read]),
32
- ])
33
- : []),
34
- traverse: Object.freeze(uniquePolicyRefs([
35
- ...parents.flatMap((parent) => [...parent.policies.traverse]),
36
- ...(definition.policies.traverse === undefined ? [] : [definition.policies.traverse]),
37
- ])),
38
- });
39
29
  const effectiveProperties = new Map();
40
- const effectiveMethods = new Map();
41
30
  let inheritedData;
42
31
  for (const parent of parents) {
43
32
  for (const property of parent.properties) {
44
33
  effectiveProperties.set(property.key, property);
45
34
  }
46
- for (const method of [...parent.methods, ...parent.static.methods]) {
47
- if (!effectiveMethods.has(method.name))
48
- effectiveMethods.set(method.name, method);
49
- }
50
35
  if (parent.kind === 'node' && inheritedData === undefined)
51
36
  inheritedData = parent.data;
52
37
  }
@@ -61,6 +46,7 @@ export function createClasses(definitions, validation) {
61
46
  definition: propertyDefinition,
62
47
  ...(ordering === undefined ? {} : { ordering }),
63
48
  validate: (input) => validation.property(propertyKey, input),
49
+ program: () => validation.propertyProgram(propertyKey),
64
50
  });
65
51
  ownProperties.push(property);
66
52
  effectiveProperties.set(property.key, property);
@@ -81,22 +67,23 @@ export function createClasses(definitions, validation) {
81
67
  description: methodDefinition.description,
82
68
  input: methodDefinition.input,
83
69
  output: methodDefinition.output,
70
+ ...(methodDefinition.execution === undefined
71
+ ? {}
72
+ : { execution: methodDefinition.execution }),
84
73
  auth: methodDefinition.auth,
85
74
  policy: methodDefinition.policy,
86
75
  static: methodDefinition.static,
87
- inheritance: methodDefinition.inheritance,
76
+ abstract: methodDefinition.abstract,
77
+ executable: isMethodExecutable(definition, methodDefinition),
88
78
  ...(inputFields === undefined ? {} : { inputFields }),
89
79
  definition: methodDefinition,
90
80
  validateInput: (input) => validation.callableInput(methodKey, input),
91
81
  validateInputField: (field, input) => validation.callableInputField(methodKey, field, input),
92
82
  validateOutput: (output) => validation.callableOutput(methodKey, output),
93
83
  });
94
- effectiveMethods.set(name, method);
95
84
  (methodDefinition.static ? ownStaticMethods : ownInstanceMethods).push(method);
96
85
  }
97
86
  }
98
- const instanceMethods = [...effectiveMethods.values()].filter(({ definition }) => !definition.static);
99
- const staticMethods = [...effectiveMethods.values()].filter(({ definition }) => definition.static);
100
87
  Object.assign(shell, {
101
88
  ref: definition.ref,
102
89
  key,
@@ -104,28 +91,19 @@ export function createClasses(definitions, validation) {
104
91
  abstract: definition.abstract,
105
92
  definition,
106
93
  extends: Object.freeze(parents),
107
- policies,
94
+ policies: definition.policies,
108
95
  data: definition.kind === 'node' ? (ownData ?? inheritedData) : undefined,
109
96
  properties: createPropertyCollection(effectiveProperties.values()),
110
- methods: createMethodCollection(instanceMethods),
111
- static: Object.freeze({ methods: createMethodCollection(staticMethods) }),
97
+ methods: createMethodCollection(ownInstanceMethods),
98
+ static: Object.freeze({ methods: createMethodCollection(ownStaticMethods) }),
112
99
  self: Object.freeze({
113
100
  data: definition.kind === 'node' ? ownData : undefined,
114
101
  properties: createPropertyCollection(ownProperties),
115
- policies: definition.policies,
116
102
  methods: createMethodCollection(ownInstanceMethods),
117
103
  static: Object.freeze({ methods: createMethodCollection(ownStaticMethods) }),
118
104
  }),
119
105
  satisfies(selected) {
120
- if (key === selected.key)
121
- return true;
122
- return parents.some((parent) => {
123
- if (parent.kind === 'node' && selected.kind === 'node')
124
- return parent.satisfies(selected);
125
- if (parent.kind === 'edge' && selected.kind === 'edge')
126
- return parent.satisfies(selected);
127
- return false;
128
- });
106
+ return classSatisfies(definition, selected.definition, (ref) => declarations.get(Key.of(ref)));
129
107
  },
130
108
  validateProperties(input) {
131
109
  return validateProperties(definition.abstract, effectiveProperties, input);
@@ -140,12 +118,6 @@ export function createClasses(definitions, validation) {
140
118
  resolve(definition.ref);
141
119
  return resolved;
142
120
  }
143
- function uniquePolicyRefs(values) {
144
- const result = new Map();
145
- for (const value of values)
146
- result.set(Key.of(value), value);
147
- return [...result.values()].sort((left, right) => compareUnicode(Key.of(left), Key.of(right)));
148
- }
149
121
  function validateProperties(abstract, properties, input) {
150
122
  if (abstract) {
151
123
  return [
@@ -1,10 +1,12 @@
1
1
  import type { Key, PropertyKey } from '../../addressing/index.js';
2
2
  import type { Diagnostic } from '../../language/validation/diagnostic.js';
3
+ import type { ValueProgram } from '../../language/value/compile/model.js';
3
4
  import type { OrderingKind } from '../../language/value/ordering.js';
4
5
  import type { DomainValidation } from '../model/input.js';
5
6
  export interface PropertyValidation {
6
7
  readonly ordering?: OrderingKind;
7
8
  validate(input: unknown): readonly Diagnostic[];
9
+ program(): ValueProgram;
8
10
  }
9
11
  export interface CallableValidation {
10
12
  readonly fields?: readonly string[];
@@ -6,6 +6,12 @@ export function createDomainValidation(properties, callables) {
6
6
  const target = properties.get(key);
7
7
  return target === undefined ? unknownTarget('Property', key) : target.validate(input);
8
8
  },
9
+ propertyProgram(key) {
10
+ const target = properties.get(key);
11
+ if (target === undefined)
12
+ throw new TypeError(`Property ${key} is absent.`);
13
+ return target.program();
14
+ },
9
15
  propertyOrdering: (key) => properties.get(key)?.ordering,
10
16
  callableExists: (key) => callables.has(key),
11
17
  callableInput(key, input) {
@@ -33,6 +39,12 @@ export function combineDomainValidation(values) {
33
39
  const owner = values.find((value) => value.propertyExists(key));
34
40
  return owner === undefined ? unknownTarget('Property', key) : owner.property(key, input);
35
41
  },
42
+ propertyProgram(key) {
43
+ const owner = values.find((value) => value.propertyExists(key));
44
+ if (owner === undefined)
45
+ throw new TypeError(`Property ${key} is absent.`);
46
+ return owner.propertyProgram(key);
47
+ },
36
48
  propertyOrdering: (key) => values.find((value) => value.propertyExists(key))?.propertyOrdering(key),
37
49
  callableExists: (key) => values.some((value) => value.callableExists(key)),
38
50
  callableInput(key, input) {
@@ -1,8 +1,11 @@
1
1
  /** Stable aggregate facade for the V1 language. */
2
- export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, method, nodeClass, output, path, policy, property, valueSchema, view, } from './builder/index.js';
2
+ export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
3
+ export { stateMachine } from './language/state/index.js';
4
+ export { isBinaryInput } from './language/callable/model/callable.js';
5
+ export type { EventOf, StateMachine, StateOf } from './language/state/index.js';
3
6
  export { PropertyValues } from './language/index.js';
4
7
  export * as metadata from './language/definition/metadata.js';
5
- export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, MethodDefinition, MethodInheritance, MethodOwnerKeyOf, PolicyCheckExpression, PolicyDefinition, PropertyInputOf, PropertyAccessOf, PropertyOutputOf, PropertyShortcutsOf, PropertyValuesOf, ResolvedClass, ResolvedCoreDefinition, ResolvedData, ResolvedFunction, ResolvedMethod, ResolvedMethodCollection, ResolvedPolicy, ResolvedProperty, ResolvedView, MethodAccessOf, SelfMethodsOf, SelfPropertiesOf, SelfStaticMethodsOf, StaticMethodsOf, ViewDefinition, } from './language/index.js';
8
+ export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableInputModeOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, BinaryInput, BinaryInputProjection, CallableInputContract, MethodDefinition, MethodOwnerKeyOf, CallablePolicy, ClassPolicy, ClassRuleChecks, ClassRuleObject, NodeClassPolicy, PolicyCheckExpression, PolicyDefinition, PropertyImmutability, PropertyInputOf, PropertyAccessOf, PropertyOutputOf, PropertyShortcutsOf, PropertyValuesOf, ResolvedClass, ResolvedCoreDefinition, ResolvedCoreEndpoint, ResolvedData, ResolvedFunction, ExecutableMethod, ResolvedMethod, ResolvedMethodCollection, ResolvedPolicy, ResolvedProperty, ResolvedView, MethodAccessOf, SelfMethodsOf, SelfPropertiesOf, SelfStaticMethodsOf, StaticMethodsOf, ViewDefinition, } from './language/index.js';
6
9
  export { acceptDefinitionRef, callableAddress, ClassKey, equalDefinitionRefs, isDefinitionRef, Key, MethodKey, PropertyKey, } from './addressing/index.js';
7
10
  export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodAddress, PolicyRef, Revision, ViewRef, } from './addressing/index.js';
8
11
  export type { Definition } from './language/index.js';
package/dist/v1/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  /** Stable aggregate facade for the V1 language. */
2
- export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, method, nodeClass, output, path, policy, property, valueSchema, view, } from './builder/index.js';
2
+ export { auto, core, defineClass, defineSchema, edgeClass, func, fullMatch, input, method, nodeClass, output, path, policy, property, stateProperty, valueSchema, view, } from './builder/index.js';
3
+ export { stateMachine } from './language/state/index.js';
4
+ export { isBinaryInput } from './language/callable/model/callable.js';
3
5
  export { PropertyValues } from './language/index.js';
4
6
  export * as metadata from './language/definition/metadata.js';
5
7
  export { acceptDefinitionRef, callableAddress, ClassKey, equalDefinitionRefs, isDefinitionRef, Key, MethodKey, PropertyKey, } from './addressing/index.js';
@@ -0,0 +1,27 @@
1
+ interface MethodMember {
2
+ readonly key: string;
3
+ readonly name: string;
4
+ readonly declaration: {
5
+ readonly abstract: boolean;
6
+ };
7
+ }
8
+ export interface MethodComposition<Method> {
9
+ readonly requirements: ReadonlyMap<string, Method>;
10
+ readonly frontier: ReadonlyMap<string, Method>;
11
+ readonly methods: ReadonlyMap<string, Method>;
12
+ }
13
+ /** Structured failure facts; human diagnostic wording is not compatibility evidence. */
14
+ export type MethodCompositionIssue = {
15
+ readonly kind: 'signature';
16
+ readonly local: string;
17
+ readonly required: string;
18
+ } | {
19
+ readonly kind: 'ambiguous';
20
+ readonly methods: readonly [string, string];
21
+ } | {
22
+ readonly kind: 'missing';
23
+ readonly required: string;
24
+ };
25
+ /** Concrete implementations never discharge a descendant's abstract obligations. */
26
+ export declare function composeMethods<Method extends MethodMember>(parents: readonly MethodComposition<Method>[], own: ReadonlyMap<string, Method>, abstract: boolean, sameSignature: (left: Method, right: Method) => boolean, report: (message: string, issue: MethodCompositionIssue) => void): MethodComposition<Method>;
27
+ export {};
@@ -0,0 +1,52 @@
1
+ /** Concrete implementations never discharge a descendant's abstract obligations. */
2
+ export function composeMethods(parents, own, abstract, sameSignature, report) {
3
+ const requirements = new Map(parents.flatMap((parent) => [...parent.requirements]));
4
+ const frontier = new Map(parents.flatMap((parent) => [...parent.frontier]));
5
+ for (const required of requirements.values()) {
6
+ const local = own.get(required.name);
7
+ if (local !== undefined && !sameSignature(local, required)) {
8
+ report(`Method ${local.key} does not exactly preserve abstract signature ${required.key}.`, {
9
+ kind: 'signature',
10
+ local: local.key,
11
+ required: required.key,
12
+ });
13
+ }
14
+ }
15
+ for (const local of own.values()) {
16
+ if (!local.declaration.abstract)
17
+ continue;
18
+ requirements.set(local.key, local);
19
+ for (const [key, inherited] of frontier) {
20
+ if (inherited.name === local.name)
21
+ frontier.delete(key);
22
+ }
23
+ frontier.set(local.key, local);
24
+ }
25
+ const methods = new Map();
26
+ for (const inherited of frontier.values()) {
27
+ const prior = methods.get(inherited.name);
28
+ if (prior !== undefined && !own.has(inherited.name)) {
29
+ report(`Inherited Method ${inherited.name} is ambiguous: ${prior.key}, ${inherited.key}.`, {
30
+ kind: 'ambiguous',
31
+ methods: [prior.key, inherited.key],
32
+ });
33
+ }
34
+ methods.set(inherited.name, inherited);
35
+ }
36
+ for (const [name, local] of own)
37
+ methods.set(name, local);
38
+ if (!abstract) {
39
+ const missing = new Set();
40
+ for (const required of requirements.values()) {
41
+ const local = own.get(required.name);
42
+ if (local === undefined && !missing.has(required.name)) {
43
+ missing.add(required.name);
44
+ report(`Concrete Class requires a local Method declaration of ${required.key}.`, {
45
+ kind: 'missing',
46
+ required: required.key,
47
+ });
48
+ }
49
+ }
50
+ }
51
+ return { requirements, frontier, methods };
52
+ }
@@ -0,0 +1,6 @@
1
+ /** A local Method is executable unless both its contract and its owner are abstract. */
2
+ export declare function isMethodExecutable(owner: {
3
+ readonly abstract: boolean;
4
+ }, method: {
5
+ readonly abstract: boolean;
6
+ }): boolean;
@@ -0,0 +1,4 @@
1
+ /** A local Method is executable unless both its contract and its owner are abstract. */
2
+ export function isMethodExecutable(owner, method) {
3
+ return !method.abstract || !owner.abstract;
4
+ }
@@ -1,7 +1,6 @@
1
1
  import type { DefinitionBase, FunctionRef } from '../../../addressing/index.js';
2
- import type { PolicyCheckExpression } from '../../policy/model/policy.js';
2
+ import type { CallablePolicy } from '../../policy/model/policy.js';
3
3
  import type { JsonSchema } from '../../value/model/schema.js';
4
- export type MethodInheritance = 'abstract' | 'default' | 'sealed';
5
4
  export type FunctionAuth = 'anonymous' | 'authenticated' | 'authorized';
6
5
  export type CallableOutput = {
7
6
  readonly mode: 'value';
@@ -13,21 +12,47 @@ export type CallableOutput = {
13
12
  readonly mode: 'binary';
14
13
  };
15
14
  export type OutputMode = CallableOutput['mode'];
16
- export interface CallableDefinitionBase {
15
+ /**
16
+ * Execution modifier of a callable. Absent or `durable: false` means ordinary execution, and an
17
+ * accepted Schema keeps only `durable: true`. A durable invocation returns an Execution reference;
18
+ * the handler still returns `output`. Retry, retention and endpoint are never callable meaning. A
19
+ * durable callable takes a value input, which its Execution records so the run can be resubmitted.
20
+ */
21
+ export interface CallableExecution {
22
+ readonly durable: boolean;
23
+ }
24
+ /** A binary Function receives portable metadata and one required byte stream. */
25
+ export interface BinaryInput {
26
+ readonly mode: 'binary';
27
+ readonly metadata: JsonSchema;
28
+ readonly maximumBytes: number;
29
+ }
30
+ export type CallableInputContract = JsonSchema | BinaryInput;
31
+ declare const BINARY_INPUT_PROJECTION: unique symbol;
32
+ /** Type-only witness retained by authored Functions; never serialized as an input Value. */
33
+ export interface BinaryInputProjection<out Metadata = unknown> {
34
+ readonly [BINARY_INPUT_PROJECTION]: Metadata;
35
+ }
36
+ export declare function isBinaryInput(input: CallableInputContract): input is BinaryInput;
37
+ export interface CallableDefinitionBase<Input extends CallableInputContract = CallableInputContract> {
17
38
  readonly description?: string;
18
- readonly input: JsonSchema;
39
+ readonly input: Input;
19
40
  readonly output: CallableOutput;
41
+ readonly execution?: CallableExecution;
20
42
  }
21
- export type CallableDefinition = CallableDefinitionBase & ({
43
+ export type CallableDefinition<Input extends CallableInputContract = CallableInputContract> = CallableDefinitionBase<Input> & ({
22
44
  readonly auth: 'anonymous' | 'authenticated';
23
45
  readonly policy?: never;
24
- } | {
46
+ }
47
+ /** An absent Policy admits no caller beyond Kernel Root and exact Function ownership. */
48
+ | {
25
49
  readonly auth: 'authorized';
26
- readonly policy?: PolicyCheckExpression;
50
+ readonly policy?: CallablePolicy;
27
51
  });
28
52
  export type FunctionDefinition = DefinitionBase<FunctionRef> & CallableDefinition;
29
- export type MethodDefinition = CallableDefinition & {
53
+ export type MethodDefinition = CallableDefinition<JsonSchema> & {
30
54
  readonly static: boolean;
31
- readonly inheritance: MethodInheritance;
55
+ readonly abstract: boolean;
32
56
  };
33
57
  export type MethodRecord = Readonly<Record<string, MethodDefinition>>;
58
+ export {};
@@ -1 +1,3 @@
1
- export {};
1
+ export function isBinaryInput(input) {
2
+ return typeof input === 'object' && input !== null && input.mode === 'binary';
3
+ }