@astrale-os/kernel-dsl 1.0.0-beta.2 → 1.0.0-beta.20

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 (307) hide show
  1. package/dist/v1/addressing/class-key.js +3 -3
  2. package/dist/v1/addressing/definition-ref.js +21 -37
  3. package/dist/v1/addressing/domain-dependency.d.ts +0 -6
  4. package/dist/v1/addressing/domain-dependency.js +1 -6
  5. package/dist/v1/addressing/key.d.ts +4 -1
  6. package/dist/v1/addressing/key.js +23 -3
  7. package/dist/v1/addressing/ordering.d.ts +2 -0
  8. package/dist/v1/addressing/ordering.js +4 -0
  9. package/dist/v1/addressing/patterns.d.ts +1 -1
  10. package/dist/v1/addressing/patterns.js +2 -6
  11. package/dist/v1/builder/callable/authoring.d.ts +11 -5
  12. package/dist/v1/builder/callable/authoring.js +2 -0
  13. package/dist/v1/builder/class/authoring.d.ts +94 -224
  14. package/dist/v1/builder/class/authoring.js +31 -33
  15. package/dist/v1/builder/class/handle.d.ts +27 -0
  16. package/dist/v1/builder/class/handle.js +1 -0
  17. package/dist/v1/builder/class/input.d.ts +159 -0
  18. package/dist/v1/builder/class/projection.d.ts +129 -0
  19. package/dist/v1/builder/class/projection.js +1 -0
  20. package/dist/v1/builder/class/property.d.ts +3 -9
  21. package/dist/v1/builder/class/property.js +1 -0
  22. package/dist/v1/builder/core/authoring.d.ts +1 -1
  23. package/dist/v1/builder/index.d.ts +5 -2
  24. package/dist/v1/builder/lowering/callable.js +1 -0
  25. package/dist/v1/builder/lowering/class.d.ts +9 -1
  26. package/dist/v1/builder/lowering/class.js +62 -17
  27. package/dist/v1/builder/lowering/policy.js +2 -0
  28. package/dist/v1/builder/lowering/property-keys.d.ts +27 -0
  29. package/dist/v1/builder/lowering/property-keys.js +108 -0
  30. package/dist/v1/builder/lowering/schema/compile.js +11 -6
  31. package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
  32. package/dist/v1/builder/lowering/schema/context.js +36 -4
  33. package/dist/v1/builder/lowering/schema/lifetime.d.ts +11 -0
  34. package/dist/v1/builder/lowering/schema/lifetime.js +55 -0
  35. package/dist/v1/builder/lowering/value/path.d.ts +1 -1
  36. package/dist/v1/builder/lowering/value/path.js +2 -4
  37. package/dist/v1/builder/lowering/value/zod.js +1 -3
  38. package/dist/v1/builder/policy/authoring.d.ts +85 -5
  39. package/dist/v1/builder/policy/authoring.js +107 -68
  40. package/dist/v1/builder/schema/define.d.ts +0 -1
  41. package/dist/v1/builder/schema/diagnostic.d.ts +3 -2
  42. package/dist/v1/builder/schema/diagnostic.js +5 -10
  43. package/dist/v1/builder/schema/input.d.ts +1 -1
  44. package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
  45. package/dist/v1/builder/schema/projection/class.d.ts +118 -15
  46. package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
  47. package/dist/v1/builder/schema/projection/identity.d.ts +2 -1
  48. package/dist/v1/builder/schema/projection/model.d.ts +4 -2
  49. package/dist/v1/builder/schema/projection/property.d.ts +1 -1
  50. package/dist/v1/builder/schema/projection/resolved-class.d.ts +2 -1
  51. package/dist/v1/builder/schema/projection.d.ts +1 -1
  52. package/dist/v1/builder/value/full-match.d.ts +0 -1
  53. package/dist/v1/builder/value/full-match.js +0 -1
  54. package/dist/v1/builder/value/path-metadata.d.ts +1 -1
  55. package/dist/v1/builder/value/path.d.ts +1 -1
  56. package/dist/v1/bundle/codec.js +11 -13
  57. package/dist/v1/bundle/diagnostic.d.ts +2 -0
  58. package/dist/v1/bundle/diagnostic.js +9 -7
  59. package/dist/v1/bundle/model.js +1 -1
  60. package/dist/v1/bundle/structure.js +4 -6
  61. package/dist/v1/compiled/admission/accept.js +4 -10
  62. package/dist/v1/compiled/admission/closure.js +2 -2
  63. package/dist/v1/compiled/admission/diagnostic.d.ts +1 -1
  64. package/dist/v1/compiled/admission/diagnostic.js +1 -3
  65. package/dist/v1/compiled/admission/revision.d.ts +9 -1
  66. package/dist/v1/compiled/admission/revision.js +6 -3
  67. package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
  68. package/dist/v1/compiled/admission/semantics/class.js +37 -12
  69. package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
  70. package/dist/v1/compiled/admission/semantics/core.js +56 -24
  71. package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
  72. package/dist/v1/compiled/admission/semantics/edge.js +6 -65
  73. package/dist/v1/compiled/admission/semantics/policy/callable.js +0 -2
  74. package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
  75. package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
  76. package/dist/v1/compiled/admission/semantics/policy/parity.js +40 -43
  77. package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
  78. package/dist/v1/compiled/admission/semantics/policy/pattern.js +4 -16
  79. package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
  80. package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
  81. package/dist/v1/compiled/admission/wire/callable.js +11 -1
  82. package/dist/v1/compiled/admission/wire/class.js +73 -21
  83. package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
  84. package/dist/v1/compiled/admission/wire/policy.js +8 -7
  85. package/dist/v1/compiled/compiler/compile.js +8 -8
  86. package/dist/v1/compiled/diagnostic.js +2 -3
  87. package/dist/v1/compiled/loader/load.d.ts +3 -2
  88. package/dist/v1/compiled/loader/load.js +11 -45
  89. package/dist/v1/domain/create.js +5 -6
  90. package/dist/v1/domain/model/domain.d.ts +2 -7
  91. package/dist/v1/domain/model/input.d.ts +2 -1
  92. package/dist/v1/domain/namespace/member-collection.js +4 -6
  93. package/dist/v1/domain/projection/classes.js +4 -1
  94. package/dist/v1/domain/validation/create.d.ts +6 -3
  95. package/dist/v1/domain/validation/create.js +21 -69
  96. package/dist/v1/index.d.ts +2 -1
  97. package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
  98. package/dist/v1/language/.spec/schemas/value-schema.schema.json +22 -0
  99. package/dist/v1/language/callable/admission.d.ts +15 -0
  100. package/dist/v1/language/callable/admission.js +43 -0
  101. package/dist/v1/language/callable/model/callable.d.ts +10 -0
  102. package/dist/v1/language/callable/resolved.d.ts +16 -3
  103. package/dist/v1/language/class/inheritance.d.ts +36 -5
  104. package/dist/v1/language/class/inheritance.js +87 -1
  105. package/dist/v1/language/class/lifetime.d.ts +50 -11
  106. package/dist/v1/language/class/lifetime.js +89 -20
  107. package/dist/v1/language/class/model/class.d.ts +45 -9
  108. package/dist/v1/language/class/model/edge.d.ts +31 -2
  109. package/dist/v1/language/class/model/property.d.ts +16 -7
  110. package/dist/v1/language/class/property-values.js +2 -4
  111. package/dist/v1/language/class/unique.d.ts +143 -0
  112. package/dist/v1/language/class/unique.js +264 -0
  113. package/dist/v1/language/core/facts.d.ts +85 -0
  114. package/dist/v1/language/core/facts.js +116 -0
  115. package/dist/v1/language/definition/metadata.d.ts +5 -0
  116. package/dist/v1/language/definition/metadata.js +7 -0
  117. package/dist/v1/language/freeze.d.ts +5 -0
  118. package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
  119. package/dist/v1/language/index.d.ts +7 -2
  120. package/dist/v1/language/index.js +5 -1
  121. package/dist/v1/language/limits.d.ts +64 -0
  122. package/dist/v1/language/limits.js +60 -0
  123. package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
  124. package/dist/v1/language/policy/analysis/branches.js +2 -1
  125. package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
  126. package/dist/v1/language/policy/analysis/budgets.js +133 -19
  127. package/dist/v1/language/policy/analysis/checks.js +3 -2
  128. package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
  129. package/dist/v1/language/policy/analysis/typing.js +455 -0
  130. package/dist/v1/language/policy/model/policy.d.ts +49 -9
  131. package/dist/v1/language/policy/model/policy.js +14 -0
  132. package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
  133. package/dist/v1/language/policy/normalization/normalize.js +22 -21
  134. package/dist/v1/language/validation/diagnostic.d.ts +15 -1
  135. package/dist/v1/language/validation/diagnostic.js +21 -0
  136. package/dist/v1/language/validation/rule.d.ts +45 -0
  137. package/dist/v1/language/validation/rule.js +109 -0
  138. package/dist/v1/language/value/compile/fields.js +4 -8
  139. package/dist/v1/language/value/evaluate/program.d.ts +2 -1
  140. package/dist/v1/language/value/evaluate/program.js +2 -2
  141. package/dist/v1/language/value/evaluate/validate.d.ts +2 -2
  142. package/dist/v1/language/value/evaluate/validate.js +6 -2
  143. package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
  144. package/dist/v1/language/value/evaluate/validity.optimization.js +342 -0
  145. package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
  146. package/dist/v1/language/value/inclusion/arrays.js +85 -0
  147. package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
  148. package/dist/v1/language/value/inclusion/assertions.js +29 -0
  149. package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
  150. package/dist/v1/language/value/inclusion/combinators.js +67 -0
  151. package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
  152. package/dist/v1/language/value/inclusion/equivalence.js +74 -0
  153. package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
  154. package/dist/v1/language/value/inclusion/evidence.js +138 -0
  155. package/dist/v1/language/value/inclusion/includes.d.ts +17 -0
  156. package/dist/v1/language/value/inclusion/includes.js +25 -719
  157. package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
  158. package/dist/v1/language/value/inclusion/keywords.js +31 -0
  159. package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
  160. package/dist/v1/language/value/inclusion/kinds.js +57 -0
  161. package/dist/v1/language/value/inclusion/location.d.ts +24 -0
  162. package/dist/v1/language/value/inclusion/location.js +63 -0
  163. package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
  164. package/dist/v1/language/value/inclusion/numbers.js +41 -0
  165. package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
  166. package/dist/v1/language/value/inclusion/objects.js +190 -0
  167. package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
  168. package/dist/v1/language/value/inclusion/strings.js +29 -0
  169. package/dist/v1/language/value/inclusion/types.d.ts +3 -0
  170. package/dist/v1/language/value/inclusion/types.js +11 -0
  171. package/dist/v1/language/value/ordering.d.ts +14 -0
  172. package/dist/v1/language/value/ordering.js +86 -9
  173. package/dist/v1/language/value/profile/canonicalize.js +6 -5
  174. package/dist/v1/language/value/profile/json.validate.d.ts +3 -1
  175. package/dist/v1/language/value/profile/json.validate.js +3 -2
  176. package/dist/v1/language/value/profile/meta-schema.compiled.js +4 -1
  177. package/dist/v1/language/value/profile/rules.js +17 -43
  178. package/dist/v1/language/value/profile/validate.js +1 -10
  179. package/dist/v1/language/value/profile/vocabulary.d.ts +35 -2
  180. package/dist/v1/language/value/profile/vocabulary.js +52 -5
  181. package/dist/v1/language/value/reference/closure.js +3 -4
  182. package/dist/v1/language/value/reference/recursion.js +2 -22
  183. package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
  184. package/dist/v1/language/value/reference/registry.index.js +33 -16
  185. package/dist/v1/language/value/regexp/ast.js +6 -7
  186. package/dist/v1/language/value/regexp/compile.d.ts +5 -11
  187. package/dist/v1/language/value/regexp/compile.js +14 -12
  188. package/dist/v1/language/value/regexp/syntax.js +3 -2
  189. package/dist/v1/language/value/syntax/keywords.d.ts +3 -3
  190. package/dist/v1/language/value/syntax/keywords.js +4 -20
  191. package/dist/v1/language/value/syntax/node-path/validate.js +2 -3
  192. package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
  193. package/dist/v1/language/value/syntax/pointer.js +5 -2
  194. package/dist/v1/language/value/syntax/walk.d.ts +2 -0
  195. package/dist/v1/language/value/syntax/walk.js +19 -20
  196. package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2519 -0
  197. package/dist/v1/schema/admission/accept.js +3 -14
  198. package/dist/v1/schema/admission/callable.d.ts +21 -0
  199. package/dist/v1/schema/admission/callable.js +96 -0
  200. package/dist/v1/schema/analysis/class.js +33 -15
  201. package/dist/v1/schema/canonical/revision.js +4 -4
  202. package/dist/v1/schema/compatibility/api.d.ts +2 -1
  203. package/dist/v1/schema/compatibility/api.js +1 -0
  204. package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
  205. package/dist/v1/schema/compatibility/comparators/classes.d.ts +9 -4
  206. package/dist/v1/schema/compatibility/comparators/classes.js +29 -8
  207. package/dist/v1/schema/compatibility/comparators/index.d.ts +1 -1
  208. package/dist/v1/schema/compatibility/comparators/members.js +1 -1
  209. package/dist/v1/schema/compatibility/comparators/values.js +2 -2
  210. package/dist/v1/schema/compatibility/coordinate.js +3 -3
  211. package/dist/v1/schema/compatibility/diff.js +2 -4
  212. package/dist/v1/schema/compatibility/extension.d.ts +11 -0
  213. package/dist/v1/schema/compatibility/extension.js +22 -0
  214. package/dist/v1/schema/compatibility/fields.d.ts +20 -4
  215. package/dist/v1/schema/compatibility/fields.js +13 -3
  216. package/dist/v1/schema/compatibility/meaning/footprint.js +16 -50
  217. package/dist/v1/schema/compatibility/model.d.ts +17 -5
  218. package/dist/v1/schema/compatibility/report.js +1 -1
  219. package/dist/v1/schema/compatibility/scope.d.ts +2 -0
  220. package/dist/v1/schema/compatibility/scope.js +4 -1
  221. package/dist/v1/schema/compatibility/structure/index.js +6 -4
  222. package/dist/v1/schema/compatibility/structure/requirements.js +57 -58
  223. package/dist/v1/schema/compatibility/versioning/index.js +1 -1
  224. package/dist/v1/schema/compatibility/versioning/surface.d.ts +1 -1
  225. package/dist/v1/schema/compatibility/versioning/surface.js +30 -2
  226. package/dist/v1/schema/compatibility/walk.d.ts +17 -0
  227. package/dist/v1/schema/compatibility/walk.js +41 -0
  228. package/dist/v1/schema/diagnostic.d.ts +17 -3
  229. package/dist/v1/schema/diagnostic.js +14 -11
  230. package/dist/v1/schema/index.d.ts +10 -1
  231. package/dist/v1/schema/index.js +4 -0
  232. package/dist/v1/schema/model/schema.d.ts +20 -1
  233. package/dist/v1/schema/model/schema.js +1 -1
  234. package/dist/v1/schema/normalization/domain.d.ts +2 -0
  235. package/dist/v1/schema/normalization/domain.js +29 -9
  236. package/dist/v1/schema/resolution/closure.js +2 -1
  237. package/dist/v1/schema/resolution/context.js +13 -13
  238. package/dist/v1/schema/resolution/domain.d.ts +5 -0
  239. package/dist/v1/schema/resolution/domain.js +2 -2
  240. package/dist/v1/schema/resolution/origins.js +3 -2
  241. package/dist/v1/schema/rule.d.ts +26 -0
  242. package/dist/v1/schema/rule.js +440 -0
  243. package/dist/v1/schema/validation/callable.d.ts +35 -2
  244. package/dist/v1/schema/validation/callable.js +65 -9
  245. package/dist/v1/schema/validation/class.d.ts +6 -2
  246. package/dist/v1/schema/validation/class.js +127 -104
  247. package/dist/v1/schema/validation/core.js +90 -168
  248. package/dist/v1/schema/validation/domain.js +4 -13
  249. package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
  250. package/dist/v1/schema/validation/domain.json-schema.js +197 -0
  251. package/dist/v1/schema/validation/domain.route.d.ts +6 -1
  252. package/dist/v1/schema/validation/domain.route.js +18 -0
  253. package/dist/v1/schema/validation/domain.structure.d.ts +7780 -0
  254. package/dist/v1/schema/validation/domain.structure.js +398 -147
  255. package/dist/v1/schema/validation/json.json-schema.d.ts +40 -0
  256. package/dist/v1/schema/validation/json.json-schema.js +46 -0
  257. package/dist/v1/schema/validation/policy/budgets.d.ts +33 -2
  258. package/dist/v1/schema/validation/policy/budgets.js +87 -121
  259. package/dist/v1/schema/validation/policy/context.d.ts +6 -5
  260. package/dist/v1/schema/validation/policy/context.js +7 -10
  261. package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
  262. package/dist/v1/schema/validation/policy/objects.js +6 -14
  263. package/dist/v1/schema/validation/policy/references.js +11 -27
  264. package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
  265. package/dist/v1/schema/validation/policy/typing.js +22 -356
  266. package/dist/v1/schema/validation/policy/uses.d.ts +40 -3
  267. package/dist/v1/schema/validation/policy/uses.js +66 -89
  268. package/dist/v1/schema/validation/policy/validate.js +5 -5
  269. package/dist/v1/schema/validation/value-api.d.ts +22 -0
  270. package/dist/v1/schema/validation/value-api.js +34 -1
  271. package/dist/v1/schema/validation/value.d.ts +3 -0
  272. package/dist/v1/schema/validation/value.js +9 -17
  273. package/dist/v1/schema/validation/value.json-schema.d.ts +49 -0
  274. package/dist/v1/schema/validation/value.json-schema.js +137 -0
  275. package/dist/v1/schema/validation/view.js +4 -8
  276. package/dist/value/canonical.d.ts +6 -0
  277. package/dist/value/canonical.js +36 -0
  278. package/dist/value/decode.d.ts +7 -0
  279. package/dist/value/decode.js +159 -9
  280. package/dist/value/index.d.ts +1 -1
  281. package/dist/value/json.d.ts +2 -2
  282. package/dist/value/json.js +2 -2
  283. package/dist/value/types.d.ts +6 -0
  284. package/dist/value/unicode.d.ts +2 -1
  285. package/dist/value/unicode.js +2 -0
  286. package/package.json +8 -1
  287. package/dist/v1/builder/lowering/core-properties.d.ts +0 -10
  288. package/dist/v1/builder/lowering/core-properties.js +0 -76
  289. package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
  290. package/dist/v1/compiled/admission/semantics/cardinality.js +0 -113
  291. package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
  292. package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
  293. package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
  294. package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
  295. package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
  296. package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
  297. package/dist/v1/language/class/index.d.ts +0 -8
  298. package/dist/v1/language/class/index.js +0 -1
  299. package/dist/v1/language/core/index.d.ts +0 -2
  300. package/dist/v1/language/value/index.d.ts +0 -11
  301. package/dist/v1/language/value/index.js +0 -8
  302. package/dist/v1/schema/canonical/domain.d.ts +0 -3
  303. package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
  304. package/dist/v1/schema/canonical/domain.digest.js +0 -5
  305. package/dist/v1/schema/canonical/domain.js +0 -5
  306. package/dist/v1/schema/canonical/freeze.d.ts +0 -1
  307. /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
@@ -1,10 +1,11 @@
1
1
  import { Key, MethodKey, PropertyKey as PropertyKeyValue } from '../../addressing/index.js';
2
2
  import { compareUnicode } from '../../addressing/ordering.js';
3
3
  import { createDomain } from '../../domain/create.js';
4
- import { combineDomainValidation, createDomainValidation, unknownInputField, } from '../../domain/validation/create.js';
4
+ import { createDomainValidation, unknownInputField } from '../../domain/validation/create.js';
5
5
  import { bindValueProgram } from '../../language/value/compile/load.js';
6
6
  import { validateValueProgram } from '../../language/value/evaluate/program.js';
7
7
  import { acceptCompiledSchema } from '../admission/accept.js';
8
+ import { schemaOf, sourceFunction, sourceMethod } from '../admission/revision.js';
8
9
  export function load(input) {
9
10
  return realize(acceptCompiledSchema(input));
10
11
  }
@@ -14,13 +15,14 @@ export function load(input) {
14
15
  */
15
16
  export function realize(compiled) {
16
17
  const entries = new Map(compiled.closure.map((entry) => [entry.origin, loadEntry(entry)]));
18
+ const loaded = [...entries.values()];
17
19
  const root = entries.get(compiled.root.origin);
18
20
  if (root === undefined || root.entry.revision !== compiled.root.revision) {
19
21
  throw new TypeError('Compiled root is absent or has the wrong revision.');
20
22
  }
21
23
  return createDomain({
22
24
  root: compiled.root,
23
- entries: Object.freeze([...entries.values()]
25
+ entries: Object.freeze(loaded
24
26
  .map(({ entry, definitions }) => Object.freeze({
25
27
  origin: entry.origin,
26
28
  revision: entry.revision,
@@ -29,7 +31,8 @@ export function realize(compiled) {
29
31
  coreEdges: entry.facts.core,
30
32
  }))
31
33
  .sort((left, right) => compareUnicode(left.origin, right.origin))),
32
- validation: combineDomainValidation([...entries.values()].map(({ validation }) => validation)),
34
+ // Closure admission refuses a duplicate Definition, so no two entries share a key.
35
+ validation: createDomainValidation(new Map(loaded.flatMap(({ properties }) => [...properties])), new Map(loaded.flatMap(({ callables }) => [...callables]))),
33
36
  });
34
37
  }
35
38
  function loadEntry(entry) {
@@ -52,13 +55,13 @@ function loadEntry(entry) {
52
55
  const methods = Object.fromEntries(compiled.methods.map((method) => {
53
56
  const key = MethodKey.of(compiled.ref, method.name);
54
57
  callablePrograms.set(key, callableProgram(method));
55
- return [method.name, loadMethod(entry, method)];
58
+ return [method.name, Object.freeze(sourceMethod(entry, method))];
56
59
  }));
57
60
  return Object.freeze({ ...definition, properties, methods });
58
61
  });
59
62
  const functions = entry.definitions.functions.map((compiled) => {
60
63
  callablePrograms.set(Key.of(compiled.ref), callableProgram(compiled));
61
- return loadFunction(entry, compiled);
64
+ return Object.freeze(sourceFunction(entry, compiled));
62
65
  });
63
66
  return {
64
67
  entry,
@@ -69,46 +72,9 @@ function loadEntry(entry) {
69
72
  ...entry.definitions.views,
70
73
  ...entry.definitions.core,
71
74
  ]),
72
- validation: programValidation(entry.values.map((value) => bindValueProgram(value, entry.patterns)), propertyPrograms, propertyOrdering, callablePrograms),
75
+ ...programValidation(entry.values.map((value) => bindValueProgram(value, entry.patterns)), propertyPrograms, propertyOrdering, callablePrograms),
73
76
  };
74
77
  }
75
- function loadMethod(entry, value) {
76
- const { name: _, input, fields: __, output, ...definition } = value;
77
- return Object.freeze({
78
- ...definition,
79
- input: schemaOf(entry, input),
80
- output: loadOutput(entry, output),
81
- });
82
- }
83
- function loadFunction(entry, value) {
84
- const { input, fields: _, output, ...definition } = value;
85
- return Object.freeze({
86
- ...definition,
87
- input: typeof input === 'number'
88
- ? schemaOf(entry, input)
89
- : {
90
- mode: 'binary',
91
- metadata: schemaOf(entry, input.metadata),
92
- maximumBytes: input.maximumBytes,
93
- },
94
- output: loadOutput(entry, output),
95
- });
96
- }
97
- function loadOutput(entry, output) {
98
- if (output.mode === 'binary')
99
- return output;
100
- const schema = schemaOf(entry, output.value);
101
- return output.mode === 'value'
102
- ? { mode: 'value', schema }
103
- : { mode: 'stream', item: schema };
104
- }
105
- function schemaOf(entry, index) {
106
- const program = entry.values[index];
107
- const root = program?.nodes[program.root];
108
- if (root === undefined)
109
- throw new TypeError(`Compiled Value program ${index} is absent.`);
110
- return root.schema;
111
- }
112
78
  function callableProgram(value) {
113
79
  return {
114
80
  input: typeof value.input === 'number' ? value.input : value.input.metadata,
@@ -141,7 +107,7 @@ function programValidation(programs, properties, propertyOrdering, callables) {
141
107
  ...(callable.fields === undefined
142
108
  ? {}
143
109
  : { fields: Object.freeze(Object.keys(callable.fields)) }),
144
- validateInput: (value) => validateValueProgram(input, value),
110
+ validateInput: (value, options) => validateValueProgram(input, value, [input.root], options),
145
111
  validateInputField(field, value) {
146
112
  const nodes = callable.fields?.[field];
147
113
  return nodes === undefined
@@ -151,5 +117,5 @@ function programValidation(programs, properties, propertyOrdering, callables) {
151
117
  validateOutput: (value) => output === undefined ? [] : validateValueProgram(output, value),
152
118
  }));
153
119
  }
154
- return createDomainValidation(propertyValidation, callableValidation);
120
+ return { properties: propertyValidation, callables: callableValidation };
155
121
  }
@@ -1,4 +1,5 @@
1
1
  import { Key, MethodKey } from '../addressing/index.js';
2
+ import { compareCodeUnits } from '../addressing/ordering.js';
2
3
  import { frozenRecord } from './namespace/member-collection.js';
3
4
  import { createClasses } from './projection/classes.js';
4
5
  const admittedDomains = new WeakSet();
@@ -43,7 +44,7 @@ export function createDomain(input) {
43
44
  const visibleOrigins = new Set(visibleEntries.map(({ origin }) => origin));
44
45
  const local = [...definitionsByKey.values()]
45
46
  .filter(({ ref }) => ref.origin === entry.origin)
46
- .sort((left, right) => compare(left.key, right.key));
47
+ .sort((left, right) => compareCodeUnits(left.key, right.key));
47
48
  const classes = namespace(local, 'class');
48
49
  const functions = namespace(local, 'function');
49
50
  const policies = namespace(local, 'policy');
@@ -86,7 +87,7 @@ export function createDomain(input) {
86
87
  revision: entry.revision,
87
88
  closure: Object.freeze(visibleEntries
88
89
  .map(({ origin, revision }) => Object.freeze({ origin, revision }))
89
- .sort((left, right) => compare(left.origin, right.origin))),
90
+ .sort((left, right) => compareCodeUnits(left.origin, right.origin))),
90
91
  dependencies,
91
92
  classes,
92
93
  functions,
@@ -130,11 +131,12 @@ function createDefinitions(declarations, classesByKey, input) {
130
131
  input: definition.input,
131
132
  output: definition.output,
132
133
  ...(definition.execution === undefined ? {} : { execution: definition.execution }),
134
+ ...(definition.admission === undefined ? {} : { admission: definition.admission }),
133
135
  auth: definition.auth,
134
136
  policy: definition.policy,
135
137
  ...(inputFields === undefined ? {} : { inputFields }),
136
138
  definition,
137
- validateInput: (value) => input.validation.callableInput(key, value),
139
+ validateInput: (value, options) => input.validation.callableInput(key, value, options),
138
140
  validateInputField: (field, value) => input.validation.callableInputField(key, field, value),
139
141
  validateOutput: (value) => input.validation.callableOutput(key, value),
140
142
  });
@@ -249,6 +251,3 @@ function isViewDefinition(value) {
249
251
  function isCoreDefinition(value) {
250
252
  return value.ref.kind === 'core';
251
253
  }
252
- function compare(left, right) {
253
- return left < right ? -1 : left > right ? 1 : 0;
254
- }
@@ -1,11 +1,6 @@
1
1
  import type { DefinitionKey, DefinitionRef, Key, Revision } from '../../addressing/index.js';
2
2
  import type { DomainDependency } from '../../addressing/index.js';
3
- import type { MethodOwnerKeyOf, ResolvedCallable, ResolvedFunction } from '../../language/callable/resolved.js';
4
- import type { AnyResolvedClass } from '../../language/class/resolved.js';
5
- import type { ResolvedCoreDefinition, ResolvedCoreEdge } from '../../language/core/resolved.js';
6
- import type { ResolvedPolicy } from '../../language/policy/resolved.js';
7
- import type { ResolvedDefinition, ResolvedDefinitionOf } from '../../language/resolved.js';
8
- import type { ResolvedView } from '../../language/view/resolved.js';
3
+ import type { AnyResolvedClass, MethodOwnerKeyOf, PropertyInputOf, ResolvedCallable, ResolvedCoreDefinition, ResolvedCoreEdge, ResolvedDefinition, ResolvedDefinitionOf, ResolvedFunction, ResolvedPolicy, ResolvedView } from '../../language/index.js';
9
4
  export type ClassNamespace<Classes extends Readonly<Record<string, unknown>> = Readonly<Record<string, AnyResolvedClass>>> = Readonly<Classes>;
10
5
  export type FunctionNamespace<Functions extends Readonly<Record<string, unknown>> = Readonly<Record<string, ResolvedFunction>>> = Readonly<Functions>;
11
6
  export type PolicyNamespace<Policies extends Readonly<Record<string, unknown>> = Readonly<Record<string, ResolvedPolicy>>> = Readonly<Policies>;
@@ -53,6 +48,6 @@ export type MethodOwnerOf<Work extends Domain, Method> = Extract<ClassesOf<Work>
53
48
  export type FunctionsOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, infer Functions> ? Functions : never;
54
49
  export type PoliciesOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, infer Policies> ? Policies : never;
55
50
  export type ViewsOf<Value> = Value extends Domain<Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>, infer Views> ? Views : never;
56
- export type PropertyInputFor<Class extends AnyResolvedClass> = import('../../language/class/resolved.js').PropertyInputOf<Class>;
51
+ export type PropertyInputFor<Class extends AnyResolvedClass> = PropertyInputOf<Class>;
57
52
  export type PropertyValuesFor<Class extends AnyResolvedClass> = ReturnType<Class['properties']['from']>;
58
53
  export {};
@@ -1,3 +1,4 @@
1
+ import type { Options } from '@astrale-os/kernel-dsl/value';
1
2
  import type { Key as AddressKey, PropertyKey, Revision } from '../../addressing/index.js';
2
3
  import type { DomainDependency, DomainDependencyMap } from '../../addressing/index.js';
3
4
  import type { CoreEdge } from '../../language/core/model/core.js';
@@ -27,7 +28,7 @@ export interface DomainValidation {
27
28
  propertyProgram(key: PropertyKey): ValueProgram;
28
29
  propertyOrdering(key: PropertyKey): OrderingKind | undefined;
29
30
  callableExists(key: AddressKey.Callable): boolean;
30
- callableInput(key: AddressKey.Callable, input: unknown): readonly Diagnostic[];
31
+ callableInput(key: AddressKey.Callable, input: unknown, options?: Options): readonly Diagnostic[];
31
32
  callableFields(key: AddressKey.Callable): readonly string[] | undefined;
32
33
  callableInputField(key: AddressKey.Callable, field: string, input: unknown): readonly Diagnostic[];
33
34
  callableOutput(key: AddressKey.Callable, output: unknown): readonly Diagnostic[];
@@ -1,9 +1,10 @@
1
1
  import { PropertyKey as PropertyKeyValue } from '../../addressing/index.js';
2
+ import { compareCodeUnits } from '../../addressing/ordering.js';
2
3
  import { createPropertyValues } from '../../language/class/property-values.js';
3
4
  const PROPERTY_OPERATIONS = new Set(['byKey', 'get', 'from']);
4
5
  const METHOD_OPERATIONS = new Set(['byKey', 'get']);
5
6
  export function createPropertyCollection(values) {
6
- const ordered = [...values].sort((left, right) => compare(left.key, right.key));
7
+ const ordered = [...values].sort((left, right) => compareCodeUnits(left.key, right.key));
7
8
  const byKey = frozenRecord(ordered.map((value) => [value.key, value]));
8
9
  const named = uniqueNames(ordered);
9
10
  const collection = {
@@ -39,7 +40,7 @@ export function createPropertyCollection(values) {
39
40
  return Object.freeze(collection);
40
41
  }
41
42
  export function createMethodCollection(values) {
42
- const ordered = [...values].sort((left, right) => compare(left.key, right.key));
43
+ const ordered = [...values].sort((left, right) => compareCodeUnits(left.key, right.key));
43
44
  const byKey = frozenRecord(ordered.map((value) => [value.key, value]));
44
45
  const named = uniqueNames(ordered);
45
46
  const collection = {
@@ -71,11 +72,8 @@ function installShortcuts(target, named, reserved) {
71
72
  }
72
73
  export function frozenRecord(entries) {
73
74
  const output = Object.create(null);
74
- for (const [key, value] of [...entries].sort(([left], [right]) => compare(left, right))) {
75
+ for (const [key, value] of [...entries].sort(([left], [right]) => compareCodeUnits(left, right))) {
75
76
  Object.defineProperty(output, key, { enumerable: true, value });
76
77
  }
77
78
  return Object.freeze(output);
78
79
  }
79
- function compare(left, right) {
80
- return left < right ? -1 : left > right ? 1 : 0;
81
- }
@@ -70,6 +70,9 @@ export function createClasses(definitions, validation) {
70
70
  ...(methodDefinition.execution === undefined
71
71
  ? {}
72
72
  : { execution: methodDefinition.execution }),
73
+ ...(methodDefinition.admission === undefined
74
+ ? {}
75
+ : { admission: methodDefinition.admission }),
73
76
  auth: methodDefinition.auth,
74
77
  policy: methodDefinition.policy,
75
78
  static: methodDefinition.static,
@@ -77,7 +80,7 @@ export function createClasses(definitions, validation) {
77
80
  executable: isMethodExecutable(definition, methodDefinition),
78
81
  ...(inputFields === undefined ? {} : { inputFields }),
79
82
  definition: methodDefinition,
80
- validateInput: (input) => validation.callableInput(methodKey, input),
83
+ validateInput: (input, options) => validation.callableInput(methodKey, input, options),
81
84
  validateInputField: (field, input) => validation.callableInputField(methodKey, field, input),
82
85
  validateOutput: (output) => validation.callableOutput(methodKey, output),
83
86
  });
@@ -1,3 +1,4 @@
1
+ import type { Options } from '@astrale-os/kernel-dsl/value';
1
2
  import type { Key, PropertyKey } from '../../addressing/index.js';
2
3
  import type { Diagnostic } from '../../language/validation/diagnostic.js';
3
4
  import type { ValueProgram } from '../../language/value/compile/model.js';
@@ -10,11 +11,13 @@ export interface PropertyValidation {
10
11
  }
11
12
  export interface CallableValidation {
12
13
  readonly fields?: readonly string[];
13
- validateInput(input: unknown): readonly Diagnostic[];
14
+ validateInput(input: unknown, options?: Options): readonly Diagnostic[];
14
15
  validateInputField(field: string, input: unknown): readonly Diagnostic[];
15
16
  validateOutput(output: unknown): readonly Diagnostic[];
16
17
  }
17
- /** Build the one Domain-level router shared by source resolution and compiled loading. */
18
+ /**
19
+ * Build the one Domain-level router shared by source resolution and compiled loading. The Domain
20
+ * built from the same entries asks only for the Properties and Callables they declare.
21
+ */
18
22
  export declare function createDomainValidation(properties: ReadonlyMap<PropertyKey, PropertyValidation>, callables: ReadonlyMap<Key.Callable, CallableValidation>): DomainValidation;
19
- export declare function combineDomainValidation(values: readonly DomainValidation[]): DomainValidation;
20
23
  export declare function unknownInputField(field: string): readonly Diagnostic[];
@@ -1,69 +1,30 @@
1
- /** Build the one Domain-level router shared by source resolution and compiled loading. */
1
+ /**
2
+ * Build the one Domain-level router shared by source resolution and compiled loading. The Domain
3
+ * built from the same entries asks only for the Properties and Callables they declare.
4
+ */
2
5
  export function createDomainValidation(properties, callables) {
6
+ const propertyOf = (key) => {
7
+ const target = properties.get(key);
8
+ if (target === undefined)
9
+ throw new TypeError(`Property ${key} is absent.`);
10
+ return target;
11
+ };
12
+ const callableOf = (key) => {
13
+ const target = callables.get(key);
14
+ if (target === undefined)
15
+ throw new TypeError(`Callable ${key} is absent.`);
16
+ return target;
17
+ };
3
18
  const validation = {
4
19
  propertyExists: (key) => properties.has(key),
5
- property(key, input) {
6
- const target = properties.get(key);
7
- return target === undefined ? unknownTarget('Property', key) : target.validate(input);
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
- },
20
+ property: (key, input) => propertyOf(key).validate(input),
21
+ propertyProgram: (key) => propertyOf(key).program(),
15
22
  propertyOrdering: (key) => properties.get(key)?.ordering,
16
23
  callableExists: (key) => callables.has(key),
17
- callableInput(key, input) {
18
- const target = callables.get(key);
19
- return target === undefined ? unknownTarget('Callable', key) : target.validateInput(input);
20
- },
24
+ callableInput: (key, input, options) => callableOf(key).validateInput(input, options),
21
25
  callableFields: (key) => callables.get(key)?.fields,
22
- callableInputField(key, field, input) {
23
- const target = callables.get(key);
24
- return target === undefined
25
- ? unknownTarget('Callable', key)
26
- : target.validateInputField(field, input);
27
- },
28
- callableOutput(key, output) {
29
- const target = callables.get(key);
30
- return target === undefined ? unknownTarget('Callable', key) : target.validateOutput(output);
31
- },
32
- };
33
- return Object.freeze(validation);
34
- }
35
- export function combineDomainValidation(values) {
36
- const validation = {
37
- propertyExists: (key) => values.some((value) => value.propertyExists(key)),
38
- property(key, input) {
39
- const owner = values.find((value) => value.propertyExists(key));
40
- return owner === undefined ? unknownTarget('Property', key) : owner.property(key, input);
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
- },
48
- propertyOrdering: (key) => values.find((value) => value.propertyExists(key))?.propertyOrdering(key),
49
- callableExists: (key) => values.some((value) => value.callableExists(key)),
50
- callableInput(key, input) {
51
- const owner = values.find((value) => value.callableExists(key));
52
- return owner === undefined ? unknownTarget('Callable', key) : owner.callableInput(key, input);
53
- },
54
- callableFields: (key) => values.find((value) => value.callableExists(key))?.callableFields(key),
55
- callableInputField(key, field, input) {
56
- const owner = values.find((value) => value.callableExists(key));
57
- return owner === undefined
58
- ? unknownTarget('Callable', key)
59
- : owner.callableInputField(key, field, input);
60
- },
61
- callableOutput(key, output) {
62
- const owner = values.find((value) => value.callableExists(key));
63
- return owner === undefined
64
- ? unknownTarget('Callable', key)
65
- : owner.callableOutput(key, output);
66
- },
26
+ callableInputField: (key, field, input) => callableOf(key).validateInputField(field, input),
27
+ callableOutput: (key, output) => callableOf(key).validateOutput(output),
67
28
  };
68
29
  return Object.freeze(validation);
69
30
  }
@@ -76,12 +37,3 @@ export function unknownInputField(field) {
76
37
  }),
77
38
  ];
78
39
  }
79
- function unknownTarget(kind, key) {
80
- return [
81
- Object.freeze({
82
- code: 'DOMAIN_VALIDATION_TARGET_UNKNOWN',
83
- pointer: '',
84
- message: `${kind} ${key} is absent.`,
85
- }),
86
- ];
87
- }
@@ -5,7 +5,7 @@ export { isBinaryInput } from './language/callable/model/callable.js';
5
5
  export type { EventOf, StateMachine, StateOf } from './language/state/index.js';
6
6
  export { PropertyValues } from './language/index.js';
7
7
  export * as metadata from './language/definition/metadata.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';
8
+ export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableInputModeOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, Inheritance, BinaryInput, BinaryInputProjection, CallableInputContract, MethodDefinition, MethodOwnerKeyOf, CallablePolicy, ClassPolicy, ClassRuleChecks, ClassRuleObject, ClassWritePolicy, CreateRuleChecks, EdgeClassPolicy, EdgeClassWritePolicy, EdgeRuleChecks, NodeClassCreatePolicy, NodeClassPolicy, NodeClassWritePolicy, 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';
9
9
  export { acceptDefinitionRef, callableAddress, ClassKey, equalDefinitionRefs, isDefinitionRef, Key, MethodKey, PropertyKey, } from './addressing/index.js';
10
10
  export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodAddress, PolicyRef, Revision, ViewRef, } from './addressing/index.js';
11
11
  export type { Definition } from './language/index.js';
@@ -14,6 +14,7 @@ export { isDomain } from './domain/index.js';
14
14
  export type * as builder from './builder/index.js';
15
15
  export type { PathAuthoring, TypedValueSchema } from './builder/index.js';
16
16
  export type { PropertyValues as PropertyValuesValue } from './language/index.js';
17
+ export type { BlobReceipt, BlobRef } from './language/value/model/blob.js';
17
18
  export type { CompiledSchema } from './compiled/index.js';
18
19
  export * as schema from './schema/index.js';
19
20
  export * as bundle from './bundle/index.js';