@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,18 +1,25 @@
1
1
  const IDENTITY = Object.freeze({ excluded: 'identity' });
2
2
  const ANNOTATION = Object.freeze({ excluded: 'annotation' });
3
3
  const AUTHORIZATION = Object.freeze({ excluded: 'authorization' });
4
+ /** Who may extend a Class is no meaning a dependent compiles against. */
5
+ const EXTENSION = Object.freeze({ excluded: 'extension' });
4
6
  const PRESENTATION = Object.freeze({ excluded: 'presentation' });
5
7
  /** The coordinate Key already names the declaration; its `ref` is never repeated in the meaning. */
6
8
  export const CLASS_FIELDS = Object.freeze({
7
9
  ref: IDENTITY,
8
10
  kind: 'always',
9
11
  abstract: 'always',
12
+ inheritance: EXTENSION,
10
13
  orientation: 'always',
11
14
  extends: 'inherit',
12
15
  policies: 'inherit',
13
16
  data: 'inherit',
14
17
  endpoints: 'inherit',
15
18
  constraints: 'inherit',
19
+ // A uniqueness tuple bounds every write of the Classes it covers and what a step through them
20
+ // reaches, so every dependent that names the Class relies on it, not only one that extends it.
21
+ // The meaning holds every tuple covering the Class, an ancestor's included (`classMeaning`).
22
+ unique: 'always',
16
23
  properties: 'members',
17
24
  methods: 'members',
18
25
  description: ANNOTATION,
@@ -27,9 +34,11 @@ export const PROPERTY_FIELDS = Object.freeze({
27
34
  description: ANNOTATION,
28
35
  });
29
36
  /**
30
- * The auth level and Policy check are decided by the Runtime at invocation, never compiled against.
31
- * The execution modifier decides what an invocation returns; an accepted Schema carries it only
32
- * when durable, so ordinary callables keep their meaning unchanged.
37
+ * The auth level, the Policy check and the admission age are authorization: decided by the Runtime
38
+ * at invocation, never compiled against. The admission age only bounds how old the admission a
39
+ * destination decides a call under may be. The execution modifier decides what an invocation
40
+ * returns; an accepted Schema carries it only when durable, so ordinary callables keep their meaning
41
+ * unchanged.
33
42
  */
34
43
  export const CALLABLE_FIELDS = Object.freeze({
35
44
  ref: IDENTITY,
@@ -38,6 +47,7 @@ export const CALLABLE_FIELDS = Object.freeze({
38
47
  static: 'always',
39
48
  abstract: 'always',
40
49
  execution: 'always',
50
+ admission: AUTHORIZATION,
41
51
  auth: AUTHORIZATION,
42
52
  policy: AUTHORIZATION,
43
53
  description: ANNOTATION,
@@ -1,59 +1,25 @@
1
- import { Key } from '../../../addressing/index.js';
2
- import { compareAddedProperties, compareLostProperties } from '../comparators/classes.js';
3
- import { compareFacet } from '../comparators/index.js';
4
- import { contextInvalid } from '../context.js';
5
1
  import { callableReferences, classReferences, inherits, memberReferences, valueReferences, } from '../references.js';
2
+ import { walkReferences } from '../walk.js';
6
3
  /** Meaning follows complete callable contracts through the exact authored reference closure. */
7
4
  export function compareFootprint({ context, report, }) {
8
- const queue = [...context.roots];
9
- const visited = new Set();
10
- for (const reference of queue) {
11
- report.note(reference);
12
- const { coordinate, usage } = reference;
13
- const visit = `${coordinate.key}:${usage.relation}`;
14
- if (visited.has(visit))
15
- continue;
16
- visited.add(visit);
17
- const pair = context.pair(coordinate);
18
- const subject = pair.source;
19
- if (subject === undefined)
20
- throw contextInvalid(`Retained acceptance context has no meaning for ${coordinate.key}.`, coordinate.key);
21
- let facet;
5
+ walkReferences({ context, report }, (subject, { usage }, reach) => {
22
6
  switch (subject.kind) {
23
- case 'class': {
24
- facet = inherits(usage) ? 'class.inherit' : 'class.reference';
25
- queue.push(...classReferences(subject, false));
7
+ case 'class':
8
+ reach(...classReferences(subject, false));
26
9
  if (inherits(usage))
27
- queue.push(...classReferences(subject, true));
28
- break;
29
- }
10
+ reach(...classReferences(subject, true));
11
+ return inherits(usage) ? 'class.inherit' : 'class.reference';
30
12
  case 'property':
31
- facet = 'property';
32
- queue.push(...valueReferences(subject));
33
- break;
13
+ reach(...valueReferences(subject));
14
+ return 'property';
34
15
  case 'method':
35
- facet = 'method.signature';
36
- queue.push(...callableReferences(subject));
37
- break;
38
- case 'member': {
39
- facet =
40
- subject.coordinate.ref.kind === 'function'
41
- ? 'function.signature'
42
- : subject.coordinate.ref.kind;
43
- queue.push(...memberReferences(subject));
44
- }
16
+ reach(...callableReferences(subject));
17
+ return 'method.signature';
18
+ case 'member':
19
+ reach(...memberReferences(subject));
20
+ return subject.coordinate.ref.kind === 'function'
21
+ ? 'function.signature'
22
+ : subject.coordinate.ref.kind;
45
23
  }
46
- if (Key.origin(coordinate.key) !== context.source.origin)
47
- continue;
48
- report.record({
49
- pair,
50
- facet,
51
- ...compareFacet({ context, pair, facet }),
52
- requirement: { kind: facet },
53
- });
54
- if (facet === 'class.inherit')
55
- compareAddedProperties({ context, pair, report });
56
- if (subject.kind === 'class')
57
- compareLostProperties({ pair, report });
58
- }
24
+ });
59
25
  }
@@ -1,9 +1,13 @@
1
1
  import type { Value } from '@astrale-os/kernel-dsl/value';
2
2
  import type { Definition, Key, Revision } from '../../addressing/index.js';
3
3
  import type { DomainSchema } from '../model/schema.js';
4
- import type { ReferenceSite } from '../resolution/origins.js';
5
4
  import type { MeaningDifference } from './diff.js';
6
5
  export type Fingerprint = `sha256:${string}`;
6
+ /**
7
+ * The codes a comparison request is refused with: the request, not a Schema, is invalid. A
8
+ * `schema.Error` carries them beside the codes of a refused Schema document.
9
+ */
10
+ export type DiagnosticCode = 'DM_CAPABILITY_INVALID' | 'DM_DEPENDENCY_CONTEXT_INVALID' | 'DM_DEPENDENCY_NOT_RETAINED' | 'DM_MEMBER_ORIGIN_MISMATCH' | 'DM_MEMBER_ROOT_INVALID';
7
11
  /** Inputs carry accepted schemas; a dependency's source is always its retained exact context. */
8
12
  export interface ComparisonRequest {
9
13
  readonly scope: {
@@ -17,6 +21,13 @@ export interface ComparisonRequest {
17
21
  * unresolvable or unsupported Key of the target origin, is rejected with DM_CAPABILITY_INVALID.
18
22
  */
19
23
  readonly capabilities?: readonly Key[];
24
+ /**
25
+ * `true` when the dependent already holds its binding to the target, as the installer holds
26
+ * one a Domain was installed with: the Classes of the target origin it extends are then not
27
+ * judged for inheritance (DM-CLASS-INHERITANCE). Otherwise each must be `'open'` in the
28
+ * target. It enters no evidence: a held comparison has the facts of a compatible judged one.
29
+ */
30
+ readonly held?: boolean;
20
31
  } | {
21
32
  readonly kind: 'members';
22
33
  readonly source: DomainSchema;
@@ -44,9 +55,9 @@ export interface Subject {
44
55
  export interface Usage {
45
56
  readonly source: SchemaIdentity;
46
57
  readonly key?: Key;
47
- readonly relation: ReferenceSite | 'member' | 'abstract' | 'selection' | 'capability';
58
+ readonly relation: 'extends' | 'core' | 'endpoint' | 'value' | 'policy' | 'pattern' | 'member' | 'abstract' | 'selection' | 'capability';
48
59
  }
49
- export type Facet = 'class.reference' | 'class.inherit' | 'class.composition' | 'class.properties' | 'class.endpoints' | 'property' | 'property.required' | 'method.existence' | 'method.object' | 'method.inheritance' | 'method.signature' | 'function.existence' | 'function.signature' | 'policy' | 'view' | 'core';
60
+ export type Facet = 'class.reference' | 'class.inherit' | 'class.composition' | 'class.properties' | 'class.endpoints' | 'class.inheritance' | 'property' | 'property.required' | 'method.existence' | 'method.object' | 'method.inheritance' | 'method.signature' | 'function.existence' | 'function.signature' | 'policy' | 'view' | 'core';
50
61
  /** A fact about a compared facet, including unchanged facets. No admission decision is implied. */
51
62
  export interface Observation {
52
63
  readonly id: string;
@@ -81,8 +92,9 @@ export interface Assessment {
81
92
  * meaning evidence never records whether capabilities were declared. A referenced or inherited Class
82
93
  * that loses an effective Property (`class.properties`) raises structure to version 4 and meaning to
83
94
  * version 2, and structure is version 4 too when it records that a dependent Policy lost what it
84
- * relies on (`method.object`, `class.endpoints`). Those facts are recorded only on such a loss, so
85
- * every other comparison, every compatible one included, keeps its bytes.
95
+ * relies on (`method.object`, `class.endpoints`) or that a Class the dependent extends became final
96
+ * (`class.inheritance`). Those facts are recorded only on such a loss, so every other comparison,
97
+ * every compatible one included, keeps its bytes.
86
98
  */
87
99
  export interface ComparisonEvidence {
88
100
  readonly kind: 'structure' | 'meaning';
@@ -1,6 +1,6 @@
1
1
  import { json } from '@astrale-os/kernel-dsl/value';
2
2
  import { compareUnicode } from '../../addressing/ordering.js';
3
- import { deepFreeze } from '../canonical/freeze.js';
3
+ import { deepFreeze } from '../../language/freeze.js';
4
4
  import { fingerprintMeaning } from './comparators/values.js';
5
5
  import { differences } from './diff.js';
6
6
  import { schemaIdentity } from './references.js';
@@ -25,6 +25,8 @@ export interface ComparisonContext {
25
25
  * structure records them only when they fail, so a compatible comparison keeps its bytes.
26
26
  */
27
27
  readonly reliance: readonly Reference[];
28
+ /** Whether the dependent holds its binding to the target, so its extensions are not judged. */
29
+ readonly held: boolean;
28
30
  pair(coordinate: Coordinate): SubjectPair;
29
31
  }
30
32
  export declare function prepare(request: ComparisonRequest): ComparisonContext;
@@ -42,6 +42,7 @@ export function prepare(request) {
42
42
  roots: [...rootReferences(dependent), ...capabilities],
43
43
  capabilities,
44
44
  reliance: policyReliance(dependent, source.origin),
45
+ held: scope.held === true,
45
46
  });
46
47
  }
47
48
  /**
@@ -63,9 +64,10 @@ export function selectMembers(source, target, keys) {
63
64
  })),
64
65
  capabilities: [],
65
66
  reliance: [],
67
+ held: false,
66
68
  });
67
69
  }
68
- function comparisonContext({ kind, source, target, dependent, before, roots, capabilities, reliance, }) {
70
+ function comparisonContext({ kind, source, target, dependent, before, roots, capabilities, reliance, held, }) {
69
71
  resolve(target);
70
72
  const after = contextOf(target);
71
73
  const pairs = new Map();
@@ -78,6 +80,7 @@ function comparisonContext({ kind, source, target, dependent, before, roots, cap
78
80
  roots,
79
81
  capabilities,
80
82
  reliance,
83
+ held,
81
84
  scope: Object.freeze({
82
85
  kind,
83
86
  source: schemaIdentity(source),
@@ -12,8 +12,9 @@ export function analyzeStructure(context) {
12
12
  ...result,
13
13
  compatible: result.assessments.every(({ satisfied }) => satisfied),
14
14
  // Each version adds one requirement policy and applies only when its fact is present: 3 a
15
- // declared capability root, 4 a lost effective Property of a reached Class or a failed Policy
16
- // reliance, facts recorded only when they fail. Without one, evidence keeps its version-2 bytes.
15
+ // declared capability root, 4 a lost effective Property of a reached Class, a failed Policy
16
+ // reliance or a refused extension, facts recorded only when they fail. Without one, evidence
17
+ // keeps its version-2 bytes.
17
18
  evidence: evidenceOf({
18
19
  kind: 'structure',
19
20
  version: recordsFailureOnlyFact(result.assessments)
@@ -27,13 +28,14 @@ export function analyzeStructure(context) {
27
28
  }
28
29
  /**
29
30
  * The facts structure records only when they fail: a referenced or inherited Class that lost an
30
- * effective Property, and what a dependent Policy relies on (a Method object, a matched Edge's
31
- * endpoints).
31
+ * effective Property, what a dependent Policy relies on (a Method object, a matched Edge's
32
+ * endpoints), and a Class the dependent extends that became final.
32
33
  */
33
34
  const FAILURE_ONLY_FACETS = new Set([
34
35
  'class.properties',
35
36
  'method.object',
36
37
  'class.endpoints',
38
+ 'class.inheritance',
37
39
  ]);
38
40
  function recordsFailureOnlyFact(assessments) {
39
41
  return assessments.some(({ requirement }) => FAILURE_ONLY_FACETS.has(requirement.kind));
@@ -1,78 +1,49 @@
1
- import { Key } from '../../../addressing/index.js';
2
- import { compareAddedProperties, compareLostProperties } from '../comparators/classes.js';
1
+ import { inheritanceOf } from '../../../language/class/inheritance.js';
2
+ import { inheritanceMeaning } from '../comparators/classes.js';
3
3
  import { compareFacet } from '../comparators/index.js';
4
4
  import { fingerprintMeaning } from '../comparators/values.js';
5
5
  import { contextInvalid } from '../context.js';
6
6
  import { methodCoordinate } from '../coordinate.js';
7
+ import { closedParents } from '../extension.js';
7
8
  import { callableReferences, classReferences, inherits, memberReferences, usageOf, valueReferences, } from '../references.js';
9
+ import { walkReferences } from '../walk.js';
8
10
  /** Structure follows data and abstract obligations; concrete IO never expands its requirements. */
9
11
  export function compareRequirements({ context, report, }) {
10
- const queue = [...context.roots];
11
- const visited = new Set();
12
- for (const reference of queue) {
13
- report.note(reference);
14
- const { coordinate, usage } = reference;
15
- const visit = `${coordinate.key}:${usage.relation}`;
16
- if (visited.has(visit))
17
- continue;
18
- visited.add(visit);
19
- const pair = context.pair(coordinate);
20
- const subject = pair.source;
21
- if (subject === undefined)
22
- throw contextInvalid(`Retained acceptance context has no meaning for ${coordinate.key}.`, coordinate.key);
23
- let facet;
12
+ walkReferences({ context, report }, (subject, { coordinate, usage }, reach) => {
24
13
  switch (subject.kind) {
25
- case 'class': {
26
- facet = inherits(usage) ? 'class.inherit' : 'class.reference';
27
- queue.push(...classReferences(subject, false));
14
+ case 'class':
15
+ reach(...classReferences(subject, false));
28
16
  if (inherits(usage)) {
29
- queue.push(...classReferences(subject, true));
17
+ reach(...classReferences(subject, true));
30
18
  for (const method of subject.analysis.requirements.values())
31
- queue.push({
19
+ reach({
32
20
  coordinate: methodCoordinate(method.owner, method.name),
33
21
  usage: usageOf(subject.schema, 'abstract', coordinate.key),
34
22
  });
35
23
  }
36
- break;
37
- }
24
+ return inherits(usage) ? 'class.inherit' : 'class.reference';
38
25
  case 'property':
39
- facet = 'property';
40
- queue.push(...valueReferences(subject));
41
- break;
42
- case 'method': {
43
- facet = usage.relation === 'abstract' ? 'method.inheritance' : 'method.existence';
44
- if (facet === 'method.inheritance')
45
- queue.push(...callableReferences(subject));
46
- break;
47
- }
48
- case 'member': {
49
- facet =
50
- subject.coordinate.ref.kind === 'function'
51
- ? 'function.existence'
52
- : subject.coordinate.ref.kind;
53
- if (facet !== 'function.existence')
54
- queue.push(...memberReferences(subject));
55
- }
26
+ reach(...valueReferences(subject));
27
+ return 'property';
28
+ case 'method':
29
+ if (usage.relation !== 'abstract')
30
+ return 'method.existence';
31
+ reach(...callableReferences(subject));
32
+ return 'method.inheritance';
33
+ case 'member':
34
+ if (subject.coordinate.ref.kind === 'function')
35
+ return 'function.existence';
36
+ reach(...memberReferences(subject));
37
+ return subject.coordinate.ref.kind;
56
38
  }
57
- if (Key.origin(coordinate.key) !== context.source.origin)
58
- continue;
59
- // Class membership does not establish an invocation dependency. Explicit member selection,
60
- // a Method the dependent declares as a capability, and inherited abstract obligations do.
61
- const required = facet !== 'method.existence' ||
62
- usage.relation === 'selection' ||
63
- usage.relation === 'capability';
64
- report.record({
65
- pair,
66
- facet,
67
- ...compareFacet({ context, pair, facet }),
68
- ...(required ? { requirement: { kind: facet } } : {}),
69
- });
70
- if (facet === 'class.inherit')
71
- compareAddedProperties({ context, pair, report });
72
- if (subject.kind === 'class')
73
- compareLostProperties({ pair, report });
74
- }
39
+ },
40
+ // Class membership does not establish an invocation dependency. Explicit member selection,
41
+ // a Method the dependent declares as a capability, and inherited abstract obligations do.
42
+ (facet, usage) => facet !== 'method.existence' ||
43
+ usage.relation === 'selection' ||
44
+ usage.relation === 'capability');
75
45
  compareReliance({ context, report });
46
+ compareExtension({ context, report });
76
47
  }
77
48
  /**
78
49
  * What a dependent Policy relies on is recorded only when it fails: a Method it names that is gone
@@ -95,3 +66,31 @@ function compareReliance({ context, report, }) {
95
66
  report.record({ pair, facet, before, after, requirement: { kind: facet } });
96
67
  }
97
68
  }
69
+ /**
70
+ * A Class of the compared origin one of the dependent's own Classes extends must be `'open'` in the
71
+ * target, unless the dependent holds its binding to that target. The fact is recorded only when it
72
+ * fails, like a Policy reliance, so a compatible comparison keeps its evidence bytes: `'open'`, what
73
+ * a subclass of another Domain requires, before, and the target's inheritance after.
74
+ */
75
+ function compareExtension({ context, report, }) {
76
+ if (context.held || context.dependent === undefined)
77
+ return;
78
+ const closed = new Set(closedParents({ dependent: context.dependent, target: context.target }));
79
+ if (closed.size === 0)
80
+ return;
81
+ for (const reference of context.roots) {
82
+ if (reference.usage.relation !== 'extends' || !closed.has(reference.coordinate.key))
83
+ continue;
84
+ const pair = context.pair(reference.coordinate);
85
+ if (pair.target?.kind !== 'class')
86
+ continue;
87
+ report.note(reference);
88
+ report.record({
89
+ pair,
90
+ facet: 'class.inheritance',
91
+ before: inheritanceMeaning('open'),
92
+ after: inheritanceMeaning(inheritanceOf(pair.target.analysis.declaration)),
93
+ requirement: { kind: 'class.inheritance' },
94
+ });
95
+ }
96
+ }
@@ -1,4 +1,4 @@
1
- import { deepFreeze } from '../../canonical/freeze.js';
1
+ import { deepFreeze } from '../../../language/freeze.js';
2
2
  import { SchemaError, diagnostic } from '../../diagnostic.js';
3
3
  import { compareFootprint } from '../meaning/footprint.js';
4
4
  import { schemaIdentity } from '../references.js';
@@ -1,7 +1,7 @@
1
1
  import type { Report } from '../report.js';
2
2
  import type { ComparisonContext } from '../scope.js';
3
3
  /**
4
- * Compare inherited contracts and newly imposed obligations on existing Classes.
4
+ * Compare inherited contracts, newly imposed obligations and who may extend existing Classes.
5
5
  * Obligations are reported at their declaring Method: changed signatures retain their comparison;
6
6
  * an unchanged obligation newly inherited by a Class is added and unsatisfied.
7
7
  */
@@ -1,10 +1,11 @@
1
+ import { admitsForeignSubclass, inheritanceOf } from '../../../language/class/inheritance.js';
1
2
  import { methodInheritance } from '../comparators/callables.js';
2
- import { compareAddedProperties } from '../comparators/classes.js';
3
+ import { compareAddedProperties, inheritanceMeaning } from '../comparators/classes.js';
3
4
  import { compareFacet } from '../comparators/index.js';
4
5
  import { fingerprintMeaning } from '../comparators/values.js';
5
6
  import { classCoordinate, methodCoordinate } from '../coordinate.js';
6
7
  /**
7
- * Compare inherited contracts and newly imposed obligations on existing Classes.
8
+ * Compare inherited contracts, newly imposed obligations and who may extend existing Classes.
8
9
  * Obligations are reported at their declaring Method: changed signatures retain their comparison;
9
10
  * an unchanged obligation newly inherited by a Class is added and unsatisfied.
10
11
  */
@@ -25,6 +26,7 @@ export function compareSurface({ context, report, }) {
25
26
  requirement: { kind: 'class.inherit' },
26
27
  });
27
28
  compareAddedProperties({ context, pair, report });
29
+ compareExtension({ pair, report });
28
30
  for (const [key, method] of source.analysis.requirements)
29
31
  if (!established.has(key))
30
32
  established.set(key, method);
@@ -54,6 +56,32 @@ export function compareSurface({ context, report, }) {
54
56
  });
55
57
  }
56
58
  }
59
+ /**
60
+ * A changed inheritance is observed on its Class, and is major when an `'open'` Class stops being
61
+ * open: only an `'open'` Class admits a subclass of another Domain (DM-CLASS-INHERITANCE). Closing
62
+ * or finalizing a Class no other Domain may extend takes nothing from a dependent; opening one
63
+ * grants an extension, which the floor, counting added members only, leaves at a patch.
64
+ */
65
+ function compareExtension({ pair, report, }) {
66
+ if (pair.source?.kind !== 'class' || pair.target?.kind !== 'class')
67
+ return;
68
+ const source = pair.source.analysis.declaration;
69
+ const target = pair.target.analysis.declaration;
70
+ const before = inheritanceOf(source);
71
+ const after = inheritanceOf(target);
72
+ if (before === after)
73
+ return;
74
+ report.record({
75
+ pair,
76
+ facet: 'class.inheritance',
77
+ before: inheritanceMeaning(before),
78
+ after: inheritanceMeaning(after),
79
+ requirement: {
80
+ kind: 'class.inheritance',
81
+ satisfied: !admitsForeignSubclass(source) || admitsForeignSubclass(target),
82
+ },
83
+ });
84
+ }
57
85
  function changed({ before, after }) {
58
86
  return (before === undefined ||
59
87
  after === undefined ||
@@ -0,0 +1,17 @@
1
+ import type { Usage } from './model.js';
2
+ import type { Reference } from './references.js';
3
+ import type { Report } from './report.js';
4
+ import type { ComparisonContext } from './scope.js';
5
+ import type { ResolvedSubject } from './subjects.js';
6
+ import { compareFacet } from './comparators/index.js';
7
+ type WalkedFacet = Parameters<typeof compareFacet>[0]['facet'];
8
+ /**
9
+ * Follow the reference closure from the roots once per coordinate and usage relation. `expand`
10
+ * names the facet a reached subject is compared under and `reach`es what it references; a subject
11
+ * of the compared origin is then recorded, as a requirement when `required` says so.
12
+ */
13
+ export declare function walkReferences({ context, report }: {
14
+ readonly context: ComparisonContext;
15
+ readonly report: Report;
16
+ }, expand: (subject: ResolvedSubject, reference: Reference, reach: (...references: readonly Reference[]) => void) => WalkedFacet, required?: (facet: WalkedFacet, usage: Usage) => boolean): void;
17
+ export {};
@@ -0,0 +1,41 @@
1
+ import { Key } from '../../addressing/index.js';
2
+ import { compareAddedProperties, compareLostProperties } from './comparators/classes.js';
3
+ import { compareFacet } from './comparators/index.js';
4
+ import { contextInvalid } from './context.js';
5
+ /**
6
+ * Follow the reference closure from the roots once per coordinate and usage relation. `expand`
7
+ * names the facet a reached subject is compared under and `reach`es what it references; a subject
8
+ * of the compared origin is then recorded, as a requirement when `required` says so.
9
+ */
10
+ export function walkReferences({ context, report }, expand, required = () => true) {
11
+ const queue = [...context.roots];
12
+ const reach = (...references) => {
13
+ queue.push(...references);
14
+ };
15
+ const visited = new Set();
16
+ for (const reference of queue) {
17
+ report.note(reference);
18
+ const { coordinate, usage } = reference;
19
+ const visit = `${coordinate.key}:${usage.relation}`;
20
+ if (visited.has(visit))
21
+ continue;
22
+ visited.add(visit);
23
+ const pair = context.pair(coordinate);
24
+ const subject = pair.source;
25
+ if (subject === undefined)
26
+ throw contextInvalid(`Retained acceptance context has no meaning for ${coordinate.key}.`, coordinate.key);
27
+ const facet = expand(subject, reference, reach);
28
+ if (Key.origin(coordinate.key) !== context.source.origin)
29
+ continue;
30
+ report.record({
31
+ pair,
32
+ facet,
33
+ ...compareFacet({ context, pair, facet }),
34
+ ...(required(facet, usage) ? { requirement: { kind: facet } } : {}),
35
+ });
36
+ if (facet === 'class.inherit')
37
+ compareAddedProperties({ context, pair, report });
38
+ if (subject.kind === 'class')
39
+ compareLostProperties({ pair, report });
40
+ }
41
+ }
@@ -1,11 +1,25 @@
1
- export type SchemaDiagnosticCode = 'DM_CAPABILITY_INVALID' | 'DM_MEMBER_ROOT_INVALID' | 'DM_DEPENDENCY_CONTEXT_INVALID' | 'DM_DEPENDENCY_NOT_RETAINED' | 'DM_MEANING_INCONSISTENT' | 'DM_MEMBER_ORIGIN_MISMATCH' | 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CALLABLE_POLICY_AUTH' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_CONSTRAINT' | 'DV_EDGE_FOREIGN_MINIMUM' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNDIRECTED' | 'DV_ENTRYPOINT' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_COMPOSITION' | 'DV_PROPERTY_IMMUTABLE' | 'DV_PROPERTY_STATE' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_ABSTRACT_POLICY' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_INVALID' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_MULTIPLE' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
2
- export interface SchemaDiagnostic<out Code extends SchemaDiagnosticCode = SchemaDiagnosticCode> {
1
+ import type { DiagnosticCode as LanguageDiagnosticCode } from '../language/validation/diagnostic.js';
2
+ import type { Diagnostic as LanguageDiagnostic } from '../language/validation/diagnostic.js';
3
+ import type { DiagnosticCode as CompatibilityDiagnosticCode } from './compatibility/model.js';
4
+ /** The codes a Schema document is refused with, one per rule of `RULES`. */
5
+ export type SchemaDiagnosticCode = 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_ADMISSION' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_INHERITANCE' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_EDGE_UNIQUE' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_NODE_UNIQUE' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_FOREIGN_MINIMUM' | 'DV_EDGE_LIFETIME' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNIQUE' | 'DV_ENTRYPOINT' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_NODE_UNIQUE' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_IMMUTABLE' | 'DV_PROPERTY_STATE' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_BINARY_INPUT' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DEPENDENCY_ALIAS' | 'STRUCTURE_DOMAIN_NAME' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_BLOB' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_PROPERTY_KEY' | 'STRUCTURE_PROTO_KEY' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_STATE_TRANSITIONS' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
6
+ /**
7
+ * A Schema refuses a document with its own codes, and a comparison request with the
8
+ * compatibility codes. `pointer` names the position the refused rule applies to, in the document
9
+ * or in the request; it is empty, the root, only when text does not parse or the document is not
10
+ * an object.
11
+ */
12
+ export interface SchemaDiagnostic<out Code extends SchemaDiagnosticCode | CompatibilityDiagnosticCode = SchemaDiagnosticCode | CompatibilityDiagnosticCode> {
3
13
  readonly code: Code;
4
14
  readonly pointer: string;
5
15
  readonly message: string;
6
16
  readonly ref?: string;
17
+ /** The code of the value-language refusal the diagnostic carries; its message is the message. */
18
+ readonly valueCode?: LanguageDiagnosticCode;
7
19
  }
8
- export declare function diagnostic<const Code extends SchemaDiagnosticCode>(code: Code, pointer: string, message: string, ref?: string): SchemaDiagnostic<Code>;
20
+ export declare function diagnostic<const Code extends SchemaDiagnosticCode | CompatibilityDiagnosticCode>(code: Code, pointer: string, message: string, ref?: string): SchemaDiagnostic<Code>;
21
+ /** A Schema diagnostic carrying one value-language refusal, at its position and with its code. */
22
+ export declare function valueDiagnostic<const Code extends SchemaDiagnosticCode>(code: Code, refusal: LanguageDiagnostic): SchemaDiagnostic<Code>;
9
23
  export declare class SchemaError extends Error {
10
24
  readonly diagnostics: readonly SchemaDiagnostic[];
11
25
  constructor(diagnostics: readonly SchemaDiagnostic[]);
@@ -1,21 +1,24 @@
1
- import { compareUnicode } from '../addressing/ordering.js';
1
+ import { formatDiagnostics, orderDiagnostics } from '../language/validation/diagnostic.js';
2
2
  export function diagnostic(code, pointer, message, ref) {
3
3
  return Object.freeze({ code, pointer, message, ...(ref === undefined ? {} : { ref }) });
4
4
  }
5
+ /** A Schema diagnostic carrying one value-language refusal, at its position and with its code. */
6
+ export function valueDiagnostic(code, refusal) {
7
+ const { pointer, message, ref } = refusal;
8
+ return Object.freeze({
9
+ code,
10
+ pointer,
11
+ message,
12
+ ...(ref === undefined ? {} : { ref }),
13
+ valueCode: refusal.code,
14
+ });
15
+ }
5
16
  export class SchemaError extends Error {
6
17
  diagnostics;
7
18
  constructor(diagnostics) {
8
- const ordered = [...diagnostics].sort(compareDiagnostic);
9
- super(ordered.map(formatDiagnostic).join('\n'));
19
+ const ordered = orderDiagnostics(diagnostics);
20
+ super(formatDiagnostics(ordered));
10
21
  this.name = 'SchemaError';
11
22
  this.diagnostics = Object.freeze(ordered);
12
23
  }
13
24
  }
14
- function compareDiagnostic(left, right) {
15
- return (compareUnicode(left.pointer, right.pointer) ||
16
- compareUnicode(left.code, right.code) ||
17
- compareUnicode(left.message, right.message));
18
- }
19
- function formatDiagnostic(value) {
20
- return `${value.pointer || '/'} [${value.code}] ${value.message}`;
21
- }
@@ -1,7 +1,7 @@
1
1
  /** Admit, encode, inspect, and semantically resolve canonical V1 DomainSchemas. */
2
2
  import type { SourceDomain } from '../domain/index.js';
3
3
  import type { DomainSchema } from './model/schema.js';
4
- export type { DomainSchema, DomainSchemaIR, DomainOfSchema as DomainOf } from './model/schema.js';
4
+ export type { DomainSchema, DomainSchemaIR, DomainSchemaDocument as Document, DomainOfSchema as DomainOf, } from './model/schema.js';
5
5
  export type ResolvedDomainOf<Schema extends DomainSchema> = SourceDomain<Schema>;
6
6
  export interface Resolve {
7
7
  <const Schema extends DomainSchema>(schema: Schema): ResolvedDomainOf<Schema>;
@@ -9,6 +9,8 @@ export interface Resolve {
9
9
  export declare const resolve: Resolve;
10
10
  export type { SchemaDiagnosticCode as DiagnosticCode } from './diagnostic.js';
11
11
  export { acceptDomainSchema as accept } from './admission/accept.js';
12
+ export { acceptCallable } from './admission/callable.js';
13
+ export type { AcceptedCallable } from './admission/callable.js';
12
14
  export { decodeDomainSchema as decode, encodeDomainSchema as encode, serializeDomainSchema as serialize, } from './codec/schema.js';
13
15
  export { revisionOfDomainSchema as revision } from './canonical/revision.js';
14
16
  export { ANNOTATION_KEYWORDS, FIELD_ROLES, callableFingerprint } from './compatibility/index.js';
@@ -20,6 +22,13 @@ export { compile, load } from '../compiled/index.js';
20
22
  export type { CompiledSchema, DomainOfCompiled } from '../compiled/index.js';
21
23
  export { SchemaError as Error } from './diagnostic.js';
22
24
  export type { SchemaDiagnostic as Diagnostic } from './diagnostic.js';
25
+ export { RULES } from './rule.js';
26
+ export type { SchemaRule as Rule, SchemaRuleStage as RuleStage } from './rule.js';
27
+ export { limits } from '../language/limits.js';
28
+ export type { LimitKey } from '../language/limits.js';
29
+ export { measurePolicies } from './validation/policy/budgets.js';
30
+ export type { PolicyMeasures } from './validation/policy/budgets.js';
31
+ export type { CheckMeasure, PolicyMeasure } from '../language/policy/analysis/budgets.js';
23
32
  export type { DomainSchemaLookup as Lookup } from './dependency/lookup.js';
24
33
  export type { DomainSchemaHeader as Header } from './codec/header.js';
25
34
  export type { DomainDependency } from '../addressing/index.js';