@astrale-os/kernel-dsl 1.0.0-beta.3 → 1.0.0-beta.30

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 (413) 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 +2 -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 +30 -35
  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 +10 -2
  24. package/dist/v1/builder/index.js +2 -0
  25. package/dist/v1/builder/lowering/callable.js +1 -0
  26. package/dist/v1/builder/lowering/class.d.ts +9 -1
  27. package/dist/v1/builder/lowering/class.js +62 -17
  28. package/dist/v1/builder/lowering/policy.js +6 -24
  29. package/dist/v1/builder/lowering/property-keys.d.ts +27 -0
  30. package/dist/v1/builder/lowering/property-keys.js +108 -0
  31. package/dist/v1/builder/lowering/schema/compile.js +13 -6
  32. package/dist/v1/builder/lowering/schema/context.d.ts +9 -1
  33. package/dist/v1/builder/lowering/schema/context.js +36 -7
  34. package/dist/v1/builder/lowering/schema/lifetime.d.ts +11 -0
  35. package/dist/v1/builder/lowering/schema/lifetime.js +55 -0
  36. package/dist/v1/builder/lowering/value/compile.js +29 -22
  37. package/dist/v1/builder/lowering/value/file.d.ts +7 -0
  38. package/dist/v1/builder/lowering/value/file.js +14 -0
  39. package/dist/v1/builder/lowering/value/path.d.ts +1 -1
  40. package/dist/v1/builder/lowering/value/path.js +2 -4
  41. package/dist/v1/builder/lowering/value/zod.js +41 -7
  42. package/dist/v1/builder/policy/authoring.d.ts +80 -9
  43. package/dist/v1/builder/policy/authoring.js +99 -68
  44. package/dist/v1/builder/policy/legacy/edge.d.ts +28 -0
  45. package/dist/v1/builder/policy/legacy/edge.js +16 -0
  46. package/dist/v1/builder/schema/define.d.ts +0 -1
  47. package/dist/v1/builder/schema/diagnostic.d.ts +3 -2
  48. package/dist/v1/builder/schema/diagnostic.js +5 -10
  49. package/dist/v1/builder/schema/input.d.ts +4 -1
  50. package/dist/v1/builder/schema/projection/callable.d.ts +7 -5
  51. package/dist/v1/builder/schema/projection/class.d.ts +78 -16
  52. package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
  53. package/dist/v1/builder/schema/projection/domain.d.ts +13 -2
  54. package/dist/v1/builder/schema/projection/identity.d.ts +74 -9
  55. package/dist/v1/builder/schema/projection/model.d.ts +4 -2
  56. package/dist/v1/builder/schema/projection/property.d.ts +38 -4
  57. package/dist/v1/builder/schema/projection/resolved-class.d.ts +5 -4
  58. package/dist/v1/builder/schema/projection.d.ts +1 -1
  59. package/dist/v1/builder/schema/rule.d.ts +316 -0
  60. package/dist/v1/builder/schema/rule.js +192 -0
  61. package/dist/v1/builder/value/file.d.ts +34 -0
  62. package/dist/v1/builder/value/file.js +77 -0
  63. package/dist/v1/builder/value/full-match.d.ts +0 -1
  64. package/dist/v1/builder/value/full-match.js +0 -1
  65. package/dist/v1/builder/value/path-metadata.d.ts +1 -1
  66. package/dist/v1/builder/value/path.d.ts +1 -1
  67. package/dist/v1/bundle/codec.js +55 -74
  68. package/dist/v1/bundle/diagnostic.d.ts +3 -1
  69. package/dist/v1/bundle/diagnostic.js +9 -7
  70. package/dist/v1/bundle/index.d.ts +2 -0
  71. package/dist/v1/bundle/index.js +1 -0
  72. package/dist/v1/bundle/model.js +1 -1
  73. package/dist/v1/bundle/rule.d.ts +14 -0
  74. package/dist/v1/bundle/rule.js +41 -0
  75. package/dist/v1/bundle/structure.js +6 -8
  76. package/dist/v1/compiled/admission/accept.js +9 -15
  77. package/dist/v1/compiled/admission/closure.js +17 -34
  78. package/dist/v1/compiled/admission/diagnostic.d.ts +23 -1
  79. package/dist/v1/compiled/admission/diagnostic.js +40 -3
  80. package/dist/v1/compiled/admission/revision.d.ts +9 -1
  81. package/dist/v1/compiled/admission/revision.js +7 -3
  82. package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
  83. package/dist/v1/compiled/admission/semantics/class.js +48 -19
  84. package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
  85. package/dist/v1/compiled/admission/semantics/core.js +56 -24
  86. package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
  87. package/dist/v1/compiled/admission/semantics/edge.js +6 -65
  88. package/dist/v1/compiled/admission/semantics/policy/admit.js +4 -19
  89. package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -5
  90. package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
  91. package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
  92. package/dist/v1/compiled/admission/semantics/policy/parity.js +44 -53
  93. package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
  94. package/dist/v1/compiled/admission/semantics/policy/pattern.js +7 -21
  95. package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
  96. package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
  97. package/dist/v1/compiled/admission/wire/callable.d.ts +5 -2
  98. package/dist/v1/compiled/admission/wire/callable.js +24 -20
  99. package/dist/v1/compiled/admission/wire/class.js +79 -30
  100. package/dist/v1/compiled/admission/wire/entry.d.ts +1 -1
  101. package/dist/v1/compiled/admission/wire/entry.js +36 -13
  102. package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
  103. package/dist/v1/compiled/admission/wire/policy.js +27 -20
  104. package/dist/v1/compiled/admission/wire/program.d.ts +13 -3
  105. package/dist/v1/compiled/admission/wire/program.js +39 -44
  106. package/dist/v1/compiled/admission/wire/property.d.ts +4 -1
  107. package/dist/v1/compiled/admission/wire/property.js +8 -5
  108. package/dist/v1/compiled/admission/wire/value.d.ts +0 -2
  109. package/dist/v1/compiled/admission/wire/value.js +0 -7
  110. package/dist/v1/compiled/codec/json.js +4 -3
  111. package/dist/v1/compiled/compiler/compile.js +15 -33
  112. package/dist/v1/compiled/diagnostic.d.ts +1 -1
  113. package/dist/v1/compiled/diagnostic.js +2 -3
  114. package/dist/v1/compiled/index.d.ts +2 -0
  115. package/dist/v1/compiled/index.js +1 -0
  116. package/dist/v1/compiled/loader/load.d.ts +3 -2
  117. package/dist/v1/compiled/loader/load.js +12 -51
  118. package/dist/v1/compiled/model/schema.d.ts +3 -0
  119. package/dist/v1/compiled/rule.d.ts +49 -0
  120. package/dist/v1/compiled/rule.js +169 -0
  121. package/dist/v1/domain/create.js +9 -10
  122. package/dist/v1/domain/model/domain.d.ts +2 -7
  123. package/dist/v1/domain/model/input.d.ts +15 -10
  124. package/dist/v1/domain/namespace/member-collection.js +8 -7
  125. package/dist/v1/domain/projection/classes.js +11 -8
  126. package/dist/v1/domain/validation/create.d.ts +7 -16
  127. package/dist/v1/domain/validation/create.js +35 -81
  128. package/dist/v1/index.d.ts +5 -3
  129. package/dist/v1/index.js +1 -1
  130. package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
  131. package/dist/v1/language/.spec/schemas/value-schema.schema.json +23 -0
  132. package/dist/v1/language/callable/admission.d.ts +15 -0
  133. package/dist/v1/language/callable/admission.js +44 -0
  134. package/dist/v1/language/callable/model/callable.d.ts +10 -0
  135. package/dist/v1/language/callable/resolved.d.ts +16 -3
  136. package/dist/v1/language/chain.d.ts +7 -0
  137. package/dist/v1/language/chain.js +24 -0
  138. package/dist/v1/language/class/inheritance.d.ts +36 -5
  139. package/dist/v1/language/class/inheritance.js +85 -1
  140. package/dist/v1/language/class/lifetime.d.ts +50 -11
  141. package/dist/v1/language/class/lifetime.js +89 -20
  142. package/dist/v1/language/class/model/class.d.ts +45 -9
  143. package/dist/v1/language/class/model/edge.d.ts +31 -2
  144. package/dist/v1/language/class/model/property.d.ts +16 -7
  145. package/dist/v1/language/class/property-values.js +2 -4
  146. package/dist/v1/language/class/resolved.d.ts +9 -4
  147. package/dist/v1/language/class/unique.d.ts +143 -0
  148. package/dist/v1/language/class/unique.js +264 -0
  149. package/dist/v1/language/core/facts.d.ts +85 -0
  150. package/dist/v1/language/core/facts.js +116 -0
  151. package/dist/v1/language/cycle.d.ts +10 -0
  152. package/dist/v1/language/cycle.js +30 -0
  153. package/dist/v1/language/definition/metadata.d.ts +38 -0
  154. package/dist/v1/language/definition/metadata.js +51 -0
  155. package/dist/v1/language/freeze.d.ts +5 -0
  156. package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
  157. package/dist/v1/language/index.d.ts +7 -2
  158. package/dist/v1/language/index.js +5 -1
  159. package/dist/v1/language/limits.d.ts +83 -0
  160. package/dist/v1/language/limits.js +77 -0
  161. package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
  162. package/dist/v1/language/policy/analysis/branches.js +8 -8
  163. package/dist/v1/language/policy/analysis/budgets.d.ts +45 -12
  164. package/dist/v1/language/policy/analysis/budgets.js +140 -20
  165. package/dist/v1/language/policy/analysis/checks.js +8 -6
  166. package/dist/v1/language/policy/analysis/composition.d.ts +4 -0
  167. package/dist/v1/language/policy/analysis/composition.js +11 -0
  168. package/dist/v1/language/policy/analysis/typing.d.ts +51 -0
  169. package/dist/v1/language/policy/analysis/typing.js +456 -0
  170. package/dist/v1/language/policy/model/policy.d.ts +71 -9
  171. package/dist/v1/language/policy/model/policy.js +42 -4
  172. package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
  173. package/dist/v1/language/policy/normalization/normalize.js +46 -68
  174. package/dist/v1/language/suspended.d.ts +7 -0
  175. package/dist/v1/language/suspended.js +23 -0
  176. package/dist/v1/language/validation/diagnostic.d.ts +15 -1
  177. package/dist/v1/language/validation/diagnostic.js +21 -0
  178. package/dist/v1/language/validation/rule.d.ts +45 -0
  179. package/dist/v1/language/validation/rule.js +109 -0
  180. package/dist/v1/language/value/compile/fields.js +16 -16
  181. package/dist/v1/language/value/compile/load.d.ts +5 -0
  182. package/dist/v1/language/value/compile/load.js +13 -0
  183. package/dist/v1/language/value/evaluate/assertions.d.ts +5 -1
  184. package/dist/v1/language/value/evaluate/assertions.js +19 -8
  185. package/dist/v1/language/value/evaluate/evaluator.js +117 -120
  186. package/dist/v1/language/value/evaluate/preparation.d.ts +16 -0
  187. package/dist/v1/language/value/evaluate/preparation.js +100 -47
  188. package/dist/v1/language/value/evaluate/program.d.ts +2 -1
  189. package/dist/v1/language/value/evaluate/program.js +6 -6
  190. package/dist/v1/language/value/evaluate/validate.d.ts +3 -3
  191. package/dist/v1/language/value/evaluate/validate.js +14 -10
  192. package/dist/v1/language/value/evaluate/validity.optimization.d.ts +14 -0
  193. package/dist/v1/language/value/evaluate/validity.optimization.js +338 -0
  194. package/dist/v1/language/value/files.d.ts +44 -0
  195. package/dist/v1/language/value/files.js +151 -0
  196. package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
  197. package/dist/v1/language/value/inclusion/arrays.js +85 -0
  198. package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
  199. package/dist/v1/language/value/inclusion/assertions.js +28 -0
  200. package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
  201. package/dist/v1/language/value/inclusion/combinators.js +67 -0
  202. package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
  203. package/dist/v1/language/value/inclusion/equivalence.js +76 -0
  204. package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
  205. package/dist/v1/language/value/inclusion/evidence.js +140 -0
  206. package/dist/v1/language/value/inclusion/includes.d.ts +29 -3
  207. package/dist/v1/language/value/inclusion/includes.js +58 -723
  208. package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
  209. package/dist/v1/language/value/inclusion/keywords.js +31 -0
  210. package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
  211. package/dist/v1/language/value/inclusion/kinds.js +57 -0
  212. package/dist/v1/language/value/inclusion/location.d.ts +24 -0
  213. package/dist/v1/language/value/inclusion/location.js +66 -0
  214. package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
  215. package/dist/v1/language/value/inclusion/numbers.js +41 -0
  216. package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
  217. package/dist/v1/language/value/inclusion/objects.js +190 -0
  218. package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
  219. package/dist/v1/language/value/inclusion/strings.js +29 -0
  220. package/dist/v1/language/value/inclusion/types.d.ts +3 -0
  221. package/dist/v1/language/value/inclusion/types.js +34 -0
  222. package/dist/v1/language/value/model/blob.d.ts +6 -0
  223. package/dist/v1/language/value/model/blob.js +8 -0
  224. package/dist/v1/language/value/model/file.d.ts +41 -0
  225. package/dist/v1/language/value/model/file.js +122 -0
  226. package/dist/v1/language/value/ordering.d.ts +14 -0
  227. package/dist/v1/language/value/ordering.js +144 -77
  228. package/dist/v1/language/value/profile/canonicalize.d.ts +6 -1
  229. package/dist/v1/language/value/profile/canonicalize.js +67 -87
  230. package/dist/v1/language/value/profile/json.validate.d.ts +12 -0
  231. package/dist/v1/language/value/profile/json.validate.js +18 -5
  232. package/dist/v1/language/value/profile/meta-schema.compiled.d.ts +1 -0
  233. package/dist/v1/language/value/profile/meta-schema.compiled.js +21 -5
  234. package/dist/v1/language/value/profile/rules.js +27 -44
  235. package/dist/v1/language/value/profile/validate.js +1 -10
  236. package/dist/v1/language/value/profile/vocabulary.d.ts +36 -2
  237. package/dist/v1/language/value/profile/vocabulary.js +58 -5
  238. package/dist/v1/language/value/reference/closure.js +6 -6
  239. package/dist/v1/language/value/reference/recursion.js +9 -48
  240. package/dist/v1/language/value/reference/references.d.ts +3 -1
  241. package/dist/v1/language/value/reference/references.js +7 -7
  242. package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
  243. package/dist/v1/language/value/reference/registry.index.js +33 -16
  244. package/dist/v1/language/value/regexp/ast.js +6 -7
  245. package/dist/v1/language/value/regexp/compile.d.ts +5 -11
  246. package/dist/v1/language/value/regexp/compile.js +14 -12
  247. package/dist/v1/language/value/regexp/syntax.js +3 -2
  248. package/dist/v1/language/value/regexp/unicode.d.ts +1 -1
  249. package/dist/v1/language/value/regexp/unicode.js +1 -1
  250. package/dist/v1/language/value/syntax/keywords.d.ts +3 -3
  251. package/dist/v1/language/value/syntax/keywords.js +4 -20
  252. package/dist/v1/language/value/syntax/node-path/validate.js +2 -3
  253. package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
  254. package/dist/v1/language/value/syntax/pointer.js +5 -2
  255. package/dist/v1/language/value/syntax/walk.d.ts +9 -0
  256. package/dist/v1/language/value/syntax/walk.js +37 -20
  257. package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +2596 -0
  258. package/dist/v1/schema/admission/accept.d.ts +3 -1
  259. package/dist/v1/schema/admission/accept.js +6 -14
  260. package/dist/v1/schema/admission/callable.d.ts +21 -0
  261. package/dist/v1/schema/admission/callable.js +96 -0
  262. package/dist/v1/schema/analysis/class.d.ts +4 -0
  263. package/dist/v1/schema/analysis/class.js +57 -17
  264. package/dist/v1/schema/canonical/revision.d.ts +4 -1
  265. package/dist/v1/schema/canonical/revision.js +8 -5
  266. package/dist/v1/schema/compatibility/api.d.ts +4 -1
  267. package/dist/v1/schema/compatibility/api.js +2 -0
  268. package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
  269. package/dist/v1/schema/compatibility/comparators/classes.d.ts +9 -4
  270. package/dist/v1/schema/compatibility/comparators/classes.js +50 -29
  271. package/dist/v1/schema/compatibility/comparators/index.d.ts +1 -1
  272. package/dist/v1/schema/compatibility/comparators/members.js +1 -1
  273. package/dist/v1/schema/compatibility/comparators/values.js +2 -2
  274. package/dist/v1/schema/compatibility/context.d.ts +5 -2
  275. package/dist/v1/schema/compatibility/context.js +8 -6
  276. package/dist/v1/schema/compatibility/coordinate.js +3 -3
  277. package/dist/v1/schema/compatibility/diff.js +2 -4
  278. package/dist/v1/schema/compatibility/extension.d.ts +11 -0
  279. package/dist/v1/schema/compatibility/extension.js +22 -0
  280. package/dist/v1/schema/compatibility/fields.d.ts +20 -4
  281. package/dist/v1/schema/compatibility/fields.js +13 -3
  282. package/dist/v1/schema/compatibility/meaning/footprint.js +16 -51
  283. package/dist/v1/schema/compatibility/model.d.ts +17 -5
  284. package/dist/v1/schema/compatibility/references.d.ts +0 -3
  285. package/dist/v1/schema/compatibility/references.js +1 -9
  286. package/dist/v1/schema/compatibility/report.js +1 -1
  287. package/dist/v1/schema/compatibility/rule.d.ts +13 -0
  288. package/dist/v1/schema/compatibility/rule.js +23 -0
  289. package/dist/v1/schema/compatibility/scope.d.ts +2 -0
  290. package/dist/v1/schema/compatibility/scope.js +4 -1
  291. package/dist/v1/schema/compatibility/structure/index.js +6 -4
  292. package/dist/v1/schema/compatibility/structure/requirements.js +58 -61
  293. package/dist/v1/schema/compatibility/versioning/index.js +1 -1
  294. package/dist/v1/schema/compatibility/versioning/surface.d.ts +1 -1
  295. package/dist/v1/schema/compatibility/versioning/surface.js +30 -2
  296. package/dist/v1/schema/compatibility/walk.d.ts +17 -0
  297. package/dist/v1/schema/compatibility/walk.js +41 -0
  298. package/dist/v1/schema/diagnostic.d.ts +17 -3
  299. package/dist/v1/schema/diagnostic.js +14 -11
  300. package/dist/v1/schema/enforcement/changes.d.ts +590 -0
  301. package/dist/v1/schema/enforcement/changes.js +566 -0
  302. package/dist/v1/schema/enforcement/derived.d.ts +236 -0
  303. package/dist/v1/schema/enforcement/derived.js +243 -0
  304. package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
  305. package/dist/v1/schema/enforcement/dispose.js +275 -0
  306. package/dist/v1/schema/enforcement/facts.d.ts +89 -0
  307. package/dist/v1/schema/enforcement/facts.js +70 -0
  308. package/dist/v1/schema/enforcement/fields.d.ts +65 -0
  309. package/dist/v1/schema/enforcement/fields.js +36 -0
  310. package/dist/v1/schema/enforcement/index.d.ts +39 -0
  311. package/dist/v1/schema/enforcement/index.js +10 -0
  312. package/dist/v1/schema/enforcement/install.d.ts +1634 -0
  313. package/dist/v1/schema/enforcement/install.js +1223 -0
  314. package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
  315. package/dist/v1/schema/enforcement/lifecycle.js +91 -0
  316. package/dist/v1/schema/enforcement/model.d.ts +253 -0
  317. package/dist/v1/schema/enforcement/model.js +1 -0
  318. package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
  319. package/dist/v1/schema/enforcement/obligations.js +240 -0
  320. package/dist/v1/schema/enforcement/write.d.ts +1314 -0
  321. package/dist/v1/schema/enforcement/write.js +1017 -0
  322. package/dist/v1/schema/index.d.ts +11 -1
  323. package/dist/v1/schema/index.js +5 -0
  324. package/dist/v1/schema/model/schema.d.ts +23 -1
  325. package/dist/v1/schema/model/schema.js +1 -1
  326. package/dist/v1/schema/normalization/domain.d.ts +2 -0
  327. package/dist/v1/schema/normalization/domain.js +50 -13
  328. package/dist/v1/schema/resolution/closure.js +2 -1
  329. package/dist/v1/schema/resolution/context.js +17 -18
  330. package/dist/v1/schema/resolution/domain.d.ts +5 -0
  331. package/dist/v1/schema/resolution/domain.js +5 -13
  332. package/dist/v1/schema/resolution/origins.js +6 -8
  333. package/dist/v1/schema/rule.d.ts +25 -0
  334. package/dist/v1/schema/rule.js +459 -0
  335. package/dist/v1/schema/validation/callable.d.ts +35 -2
  336. package/dist/v1/schema/validation/callable.js +65 -9
  337. package/dist/v1/schema/validation/class.d.ts +6 -2
  338. package/dist/v1/schema/validation/class.js +128 -105
  339. package/dist/v1/schema/validation/core.js +103 -173
  340. package/dist/v1/schema/validation/domain.js +25 -15
  341. package/dist/v1/schema/validation/domain.json-schema.d.ts +15 -0
  342. package/dist/v1/schema/validation/domain.json-schema.js +222 -0
  343. package/dist/v1/schema/validation/domain.route.d.ts +6 -1
  344. package/dist/v1/schema/validation/domain.route.js +18 -0
  345. package/dist/v1/schema/validation/domain.structure.d.ts +7797 -0
  346. package/dist/v1/schema/validation/domain.structure.js +516 -160
  347. package/dist/v1/schema/validation/icon.d.ts +4 -0
  348. package/dist/v1/schema/validation/icon.js +29 -0
  349. package/dist/v1/schema/validation/json.json-schema.d.ts +40 -0
  350. package/dist/v1/schema/validation/json.json-schema.js +46 -0
  351. package/dist/v1/schema/validation/policy/budgets.d.ts +37 -2
  352. package/dist/v1/schema/validation/policy/budgets.js +94 -121
  353. package/dist/v1/schema/validation/policy/context.d.ts +6 -5
  354. package/dist/v1/schema/validation/policy/context.js +7 -10
  355. package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
  356. package/dist/v1/schema/validation/policy/objects.js +6 -14
  357. package/dist/v1/schema/validation/policy/references.js +20 -62
  358. package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
  359. package/dist/v1/schema/validation/policy/typing.js +22 -356
  360. package/dist/v1/schema/validation/policy/uses.d.ts +40 -3
  361. package/dist/v1/schema/validation/policy/uses.js +63 -91
  362. package/dist/v1/schema/validation/policy/validate.js +5 -5
  363. package/dist/v1/schema/validation/value-api.d.ts +27 -1
  364. package/dist/v1/schema/validation/value-api.js +37 -2
  365. package/dist/v1/schema/validation/value.d.ts +3 -0
  366. package/dist/v1/schema/validation/value.js +9 -17
  367. package/dist/v1/schema/validation/value.json-schema.d.ts +54 -0
  368. package/dist/v1/schema/validation/value.json-schema.js +163 -0
  369. package/dist/v1/schema/validation/view.js +4 -8
  370. package/dist/value/accept.d.ts +9 -3
  371. package/dist/value/accept.js +25 -1
  372. package/dist/value/canonical.d.ts +22 -1
  373. package/dist/value/canonical.js +114 -21
  374. package/dist/value/decode.d.ts +7 -0
  375. package/dist/value/decode.js +159 -9
  376. package/dist/value/equal.d.ts +9 -1
  377. package/dist/value/equal.js +37 -3
  378. package/dist/value/immutable.optimization.d.ts +2 -0
  379. package/dist/value/immutable.optimization.js +4 -0
  380. package/dist/value/index.d.ts +5 -3
  381. package/dist/value/index.js +2 -1
  382. package/dist/value/json.d.ts +2 -2
  383. package/dist/value/json.js +2 -2
  384. package/dist/value/limits.d.ts +11 -0
  385. package/dist/value/rule.d.ts +12 -0
  386. package/dist/value/rule.js +50 -0
  387. package/dist/value/types.d.ts +6 -0
  388. package/dist/value/unicode.d.ts +2 -1
  389. package/dist/value/unicode.js +2 -0
  390. package/package.json +15 -4
  391. package/dist/v1/builder/lowering/core-properties.d.ts +0 -10
  392. package/dist/v1/builder/lowering/core-properties.js +0 -76
  393. package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
  394. package/dist/v1/compiled/admission/semantics/cardinality.js +0 -113
  395. package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
  396. package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
  397. package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
  398. package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
  399. package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
  400. package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
  401. package/dist/v1/compiled/admission/wire/pattern.d.ts +0 -12
  402. package/dist/v1/compiled/admission/wire/pattern.js +0 -111
  403. package/dist/v1/language/class/index.d.ts +0 -8
  404. package/dist/v1/language/class/index.js +0 -1
  405. package/dist/v1/language/core/index.d.ts +0 -2
  406. package/dist/v1/language/value/index.d.ts +0 -11
  407. package/dist/v1/language/value/index.js +0 -8
  408. package/dist/v1/schema/canonical/domain.d.ts +0 -3
  409. package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
  410. package/dist/v1/schema/canonical/domain.digest.js +0 -5
  411. package/dist/v1/schema/canonical/domain.js +0 -5
  412. package/dist/v1/schema/canonical/freeze.d.ts +0 -1
  413. /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { compareUnicode } from '../../addressing/ordering.js';
2
2
  import { isValueObject as isJsonObject } from '../../language/value/model/object.js';
3
+ import { escapePointerToken } from '../../language/value/syntax/pointer.js';
3
4
  /** Structural differences between two portable values, leaf by leaf, in JSON Pointer order. */
4
5
  export function differences(before, after) {
5
6
  const found = [];
@@ -17,7 +18,7 @@ function collect(before, after, path, found) {
17
18
  if (isJsonObject(before) && isJsonObject(after)) {
18
19
  const keys = [...new Set([...Object.keys(before), ...Object.keys(after)])].sort(compareUnicode);
19
20
  for (const key of keys) {
20
- collect(before[key], after[key], `${path}/${escape(key)}`, found);
21
+ collect(before[key], after[key], `${path}/${escapePointerToken(key)}`, found);
21
22
  }
22
23
  return;
23
24
  }
@@ -34,6 +35,3 @@ function collect(before, after, path, found) {
34
35
  ...(after === undefined ? {} : { after }),
35
36
  }));
36
37
  }
37
- function escape(segment) {
38
- return segment.replaceAll('~', '~0').replaceAll('/', '~1');
39
- }
@@ -0,0 +1,11 @@
1
+ import type { Key } from '../../addressing/index.js';
2
+ import type { DomainSchema } from '../model/schema.js';
3
+ /**
4
+ * The Classes of the target's origin that a Class of the dependent extends and the target does not
5
+ * open to it, as Keys in order (DM-CLASS-INHERITANCE). A parent the target no longer declares is
6
+ * not closed: losing it is an ancestry change.
7
+ */
8
+ export declare function closedParents({ dependent, target, }: {
9
+ readonly dependent: DomainSchema;
10
+ readonly target: DomainSchema;
11
+ }): readonly Key[];
@@ -0,0 +1,22 @@
1
+ import { compareUnicode } from '../../addressing/ordering.js';
2
+ import { admitsForeignSubclass } from '../../language/class/inheritance.js';
3
+ import { keyForDefinitionRef } from './coordinate.js';
4
+ /**
5
+ * The Classes of the target's origin that a Class of the dependent extends and the target does not
6
+ * open to it, as Keys in order (DM-CLASS-INHERITANCE). A parent the target no longer declares is
7
+ * not closed: losing it is an ancestry change.
8
+ */
9
+ export function closedParents({ dependent, target, }) {
10
+ const closed = new Set();
11
+ if (dependent.origin === target.origin)
12
+ return [];
13
+ for (const declaration of Object.values(dependent.classes))
14
+ for (const parent of declaration.extends) {
15
+ if (parent.origin !== target.origin)
16
+ continue;
17
+ const declared = target.classes[parent.name];
18
+ if (declared !== undefined && !admitsForeignSubclass(declared))
19
+ closed.add(keyForDefinitionRef(parent));
20
+ }
21
+ return Object.freeze([...closed].sort(compareUnicode));
22
+ }
@@ -15,7 +15,7 @@ export type DependencyMeaningLevel = 'reference' | 'inherit';
15
15
  * compile until it is classified, so meaning can only be narrowed by an explicit decision.
16
16
  */
17
17
  export type FieldRole = 'always' | 'inherit' | 'members' | {
18
- readonly excluded: 'identity' | 'annotation' | 'authorization' | 'presentation';
18
+ readonly excluded: 'identity' | 'annotation' | 'authorization' | 'extension' | 'presentation';
19
19
  };
20
20
  /** The coordinate Key already names the declaration; its `ref` is never repeated in the meaning. */
21
21
  export declare const CLASS_FIELDS: Readonly<{
@@ -24,12 +24,16 @@ export declare const CLASS_FIELDS: Readonly<{
24
24
  }>;
25
25
  kind: "always";
26
26
  abstract: "always";
27
+ inheritance: Readonly<{
28
+ excluded: 'extension';
29
+ }>;
27
30
  orientation: "always";
28
31
  extends: "inherit";
29
32
  policies: "inherit";
30
33
  data: "inherit";
31
34
  endpoints: "inherit";
32
35
  constraints: "inherit";
36
+ unique: "always";
33
37
  properties: "members";
34
38
  methods: "members";
35
39
  description: Readonly<{
@@ -50,9 +54,11 @@ export declare const PROPERTY_FIELDS: Readonly<{
50
54
  }>;
51
55
  }>;
52
56
  /**
53
- * The auth level and Policy check are decided by the Runtime at invocation, never compiled against.
54
- * The execution modifier decides what an invocation returns; an accepted Schema carries it only
55
- * when durable, so ordinary callables keep their meaning unchanged.
57
+ * The auth level, the Policy check and the admission age are authorization: decided by the Runtime
58
+ * at invocation, never compiled against. The admission age only bounds how old the admission a
59
+ * destination decides a call under may be. The execution modifier decides what an invocation
60
+ * returns; an accepted Schema carries it only when durable, so ordinary callables keep their meaning
61
+ * unchanged.
56
62
  */
57
63
  export declare const CALLABLE_FIELDS: Readonly<{
58
64
  ref: Readonly<{
@@ -63,6 +69,9 @@ export declare const CALLABLE_FIELDS: Readonly<{
63
69
  static: "always";
64
70
  abstract: "always";
65
71
  execution: "always";
72
+ admission: Readonly<{
73
+ excluded: 'authorization';
74
+ }>;
66
75
  auth: Readonly<{
67
76
  excluded: 'authorization';
68
77
  }>;
@@ -114,12 +123,16 @@ export declare const FIELD_ROLES: Readonly<{
114
123
  }>;
115
124
  kind: "always";
116
125
  abstract: "always";
126
+ inheritance: Readonly<{
127
+ excluded: 'extension';
128
+ }>;
117
129
  orientation: "always";
118
130
  extends: "inherit";
119
131
  policies: "inherit";
120
132
  data: "inherit";
121
133
  endpoints: "inherit";
122
134
  constraints: "inherit";
135
+ unique: "always";
123
136
  properties: "members";
124
137
  methods: "members";
125
138
  description: Readonly<{
@@ -148,6 +161,9 @@ export declare const FIELD_ROLES: Readonly<{
148
161
  static: "always";
149
162
  abstract: "always";
150
163
  execution: "always";
164
+ admission: Readonly<{
165
+ excluded: 'authorization';
166
+ }>;
151
167
  auth: Readonly<{
152
168
  excluded: 'authorization';
153
169
  }>;
@@ -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,24 @@
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
- import { callableReferences, classReferences, inherits, memberReferences, valueReferences, } from '../references.js';
1
+ import { callableReferences, classReferences, inherits, memberReferences } 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
+ return 'property';
34
14
  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
- }
15
+ reach(...callableReferences(subject));
16
+ return 'method.signature';
17
+ case 'member':
18
+ reach(...memberReferences(subject));
19
+ return subject.coordinate.ref.kind === 'function'
20
+ ? 'function.signature'
21
+ : subject.coordinate.ref.kind;
45
22
  }
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
- }
23
+ });
59
24
  }
@@ -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_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';
@@ -23,9 +23,6 @@ export declare function rootReferences(schema: DomainSchema): readonly Reference
23
23
  */
24
24
  export declare function policyReliance(schema: DomainSchema, origin: Key.Origin): readonly Reference[];
25
25
  /** Existing DSL collectors own reference syntax. These functions attach comparison provenance. */
26
- export declare function valueReferences(subject: Extract<ResolvedSubject, {
27
- kind: 'property';
28
- }>): readonly Reference[];
29
26
  export declare function callableReferences(subject: Extract<ResolvedSubject, {
30
27
  kind: 'method';
31
28
  }>): readonly Reference[];
@@ -1,6 +1,6 @@
1
1
  import { Key } from '../../addressing/index.js';
2
2
  import { revisionOfDomainSchema } from '../canonical/revision.js';
3
- import { collectCallableContractRefs, collectCallableRefs, collectClassPolicyRefs, collectCoreRefs, collectEndpointRefs, collectPolicyDefinitionRefs, collectValueDefinitionRefs, coreEndpointDefinitionRef, } from '../resolution/origins.js';
3
+ import { collectCallableContractRefs, collectCallableRefs, collectClassPolicyRefs, collectCoreRefs, collectEndpointRefs, collectPolicyDefinitionRefs, coreEndpointDefinitionRef, } from '../resolution/origins.js';
4
4
  import { classCoordinate, keyForDefinitionRef, memberCoordinate, methodCoordinate, propertyCoordinate, } from './coordinate.js';
5
5
  export function schemaIdentity(schema) {
6
6
  return Object.freeze({ origin: schema.origin, revision: revisionOfDomainSchema(schema) });
@@ -31,9 +31,6 @@ export function rootReferences(schema) {
31
31
  const key = keyForDefinitionRef(declaration.ref);
32
32
  const add = collector(schema, result, key);
33
33
  declaration.extends.forEach((ref) => add(ref, 'extends'));
34
- for (const [name, field] of Object.entries(declaration.properties)) {
35
- collectValueDefinitionRefs(field.schema, collector(schema, result, propertyCoordinate(declaration.ref, name).key));
36
- }
37
34
  collectClassPolicyRefs(declaration, add);
38
35
  if (declaration.kind === 'edge')
39
36
  collectEndpointRefs(declaration, add);
@@ -81,11 +78,6 @@ export function policyReliance(schema, origin) {
81
78
  return [...result.values()];
82
79
  }
83
80
  /** Existing DSL collectors own reference syntax. These functions attach comparison provenance. */
84
- export function valueReferences(subject) {
85
- const result = [];
86
- collectValueDefinitionRefs(subject.field.schema, collector(subject.schema, result, subject.coordinate.key));
87
- return result;
88
- }
89
81
  export function callableReferences(subject) {
90
82
  const result = [];
91
83
  collectCallableContractRefs(subject.method.declaration, collector(subject.schema, result, subject.coordinate.key));
@@ -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';
@@ -0,0 +1,13 @@
1
+ import type { DiagnosticCode } from './model.js';
2
+ /** The rule one code of a refused comparison request reports. */
3
+ export interface ComparisonRule {
4
+ /** The positions its diagnostics point at, in the request, as the positions of `schema.Rule`. */
5
+ readonly positions: readonly [string, ...string[]];
6
+ /** The rule, in one plain sentence. */
7
+ readonly statement: string;
8
+ }
9
+ /**
10
+ * Every code a comparison request is refused with and the rule it reports, frozen. A code added
11
+ * here does not compile until it is described.
12
+ */
13
+ export declare const COMPARISON_RULES: Readonly<Record<DiagnosticCode, ComparisonRule>>;
@@ -0,0 +1,23 @@
1
+ import { deepFreeze } from '../../language/freeze.js';
2
+ /**
3
+ * Every code a comparison request is refused with and the rule it reports, frozen. A code added
4
+ * here does not compile until it is described.
5
+ */
6
+ export const COMPARISON_RULES = deepFreeze({
7
+ DM_MEMBER_ORIGIN_MISMATCH: {
8
+ positions: ['/target/origin', '/next/origin'],
9
+ statement: 'A member comparison and a required bump compare two versions of one origin.',
10
+ },
11
+ DM_MEMBER_ROOT_INVALID: {
12
+ positions: ['/roots', '/roots/{index}'],
13
+ statement: "The roots of a member comparison are a non-empty list without duplicates of canonical Keys of the source's origin, each of a shape V1 supports and naming a definition of the source under its exact owner.",
14
+ },
15
+ DM_CAPABILITY_INVALID: {
16
+ positions: ['/capabilities', '/capabilities/{index}'],
17
+ statement: 'The capabilities a dependency comparison declares are a list of canonical Keys, each of the target origin naming a Function, Method or Class of the retained source; a Key of another origin is ignored.',
18
+ },
19
+ DM_DEPENDENCY_NOT_RETAINED: {
20
+ positions: ['/target/origin', '/origin'],
21
+ statement: 'A dependency comparison has a target whose origin is in the closure the dependent was accepted with.',
22
+ },
23
+ });
@@ -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,48 @@
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
- import { contextInvalid } from '../context.js';
5
+ import { retainedContextDefect } from '../context.js';
6
6
  import { methodCoordinate } from '../coordinate.js';
7
- import { callableReferences, classReferences, inherits, memberReferences, usageOf, valueReferences, } from '../references.js';
7
+ import { closedParents } from '../extension.js';
8
+ import { callableReferences, classReferences, inherits, memberReferences, usageOf, } 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
+ return 'property';
27
+ case 'method':
28
+ if (usage.relation !== 'abstract')
29
+ return 'method.existence';
30
+ reach(...callableReferences(subject));
31
+ return 'method.inheritance';
32
+ case 'member':
33
+ if (subject.coordinate.ref.kind === 'function')
34
+ return 'function.existence';
35
+ reach(...memberReferences(subject));
36
+ return subject.coordinate.ref.kind;
56
37
  }
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
- }
38
+ },
39
+ // Class membership does not establish an invocation dependency. Explicit member selection,
40
+ // a Method the dependent declares as a capability, and inherited abstract obligations do.
41
+ (facet, usage) => facet !== 'method.existence' ||
42
+ usage.relation === 'selection' ||
43
+ usage.relation === 'capability');
75
44
  compareReliance({ context, report });
45
+ compareExtension({ context, report });
76
46
  }
77
47
  /**
78
48
  * What a dependent Policy relies on is recorded only when it fails: a Method it names that is gone
@@ -84,7 +54,7 @@ function compareReliance({ context, report, }) {
84
54
  for (const reference of context.reliance) {
85
55
  const pair = context.pair(reference.coordinate);
86
56
  if (pair.source === undefined)
87
- throw contextInvalid(`Retained acceptance context has no meaning for ${reference.coordinate.key}.`, reference.coordinate.key);
57
+ throw retainedContextDefect(reference.coordinate.key);
88
58
  const facet = reference.coordinate.kind === 'method' ? 'method.object' : 'class.endpoints';
89
59
  const { before, after } = compareFacet({ context, pair, facet });
90
60
  if (before !== undefined &&
@@ -95,3 +65,30 @@ function compareReliance({ context, report, }) {
95
65
  report.record({ pair, facet, before, after, requirement: { kind: facet } });
96
66
  }
97
67
  }
68
+ /**
69
+ * A Class of the compared origin one of the dependent's own Classes extends must be `'open'` in the
70
+ * target, unless the dependent holds its binding to that target. The fact is recorded only when it
71
+ * fails, like a Policy reliance, so a compatible comparison keeps its evidence bytes: `'open'`, what
72
+ * a subclass of another Domain requires, before, and the target's inheritance after.
73
+ */
74
+ function compareExtension({ context, report, }) {
75
+ if (context.held || context.dependent === undefined)
76
+ return;
77
+ const closed = new Set(closedParents({ dependent: context.dependent, target: context.target }));
78
+ if (closed.size === 0)
79
+ return;
80
+ for (const reference of context.roots) {
81
+ if (!closed.has(reference.coordinate.key))
82
+ continue;
83
+ const pair = context.pair(reference.coordinate);
84
+ if (pair.target?.kind !== 'class')
85
+ continue;
86
+ report.record({
87
+ pair,
88
+ facet: 'class.inheritance',
89
+ before: inheritanceMeaning('open'),
90
+ after: inheritanceMeaning(inheritanceOf(pair.target.analysis.declaration)),
91
+ requirement: { kind: 'class.inheritance' },
92
+ });
93
+ }
94
+ }
@@ -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
  */