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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/dist/v1/addressing/class-key.js +5 -4
  2. package/dist/v1/addressing/method-key.js +3 -2
  3. package/dist/v1/addressing/patterns.d.ts +0 -5
  4. package/dist/v1/addressing/patterns.js +5 -5
  5. package/dist/v1/builder/callable/authoring.d.ts +87 -41
  6. package/dist/v1/builder/callable/authoring.js +29 -14
  7. package/dist/v1/builder/class/authoring.d.ts +311 -36
  8. package/dist/v1/builder/class/authoring.js +3 -4
  9. package/dist/v1/builder/class/property.d.ts +16 -8
  10. package/dist/v1/builder/class/property.js +21 -5
  11. package/dist/v1/builder/core/authoring.d.ts +28 -13
  12. package/dist/v1/builder/core/authoring.js +22 -2
  13. package/dist/v1/builder/index.d.ts +9 -8
  14. package/dist/v1/builder/index.js +2 -2
  15. package/dist/v1/builder/lowering/callable.d.ts +3 -1
  16. package/dist/v1/builder/lowering/callable.js +43 -51
  17. package/dist/v1/builder/lowering/class.d.ts +7 -0
  18. package/dist/v1/builder/lowering/class.js +79 -29
  19. package/dist/v1/builder/lowering/core.d.ts +3 -2
  20. package/dist/v1/builder/lowering/core.js +9 -6
  21. package/dist/v1/builder/lowering/policy.d.ts +8 -1
  22. package/dist/v1/builder/lowering/policy.js +35 -0
  23. package/dist/v1/builder/lowering/schema/capture.js +9 -4
  24. package/dist/v1/builder/lowering/schema/compile.d.ts +2 -2
  25. package/dist/v1/builder/lowering/schema/compile.js +15 -2
  26. package/dist/v1/builder/lowering/schema/context.d.ts +11 -8
  27. package/dist/v1/builder/lowering/schema/context.js +59 -29
  28. package/dist/v1/builder/lowering/schema/ownership.d.ts +3 -3
  29. package/dist/v1/builder/lowering/schema/ownership.js +2 -1
  30. package/dist/v1/builder/lowering/value/compile.js +14 -4
  31. package/dist/v1/builder/lowering/value/zod.d.ts +7 -6
  32. package/dist/v1/builder/lowering/value/zod.js +16 -7
  33. package/dist/v1/builder/lowering/view.d.ts +4 -3
  34. package/dist/v1/builder/lowering/view.js +2 -14
  35. package/dist/v1/builder/policy/authoring.d.ts +23 -6
  36. package/dist/v1/builder/policy/authoring.js +35 -8
  37. package/dist/v1/builder/schema/define.d.ts +8 -5
  38. package/dist/v1/builder/schema/diagnostic.d.ts +1 -1
  39. package/dist/v1/builder/schema/handle.d.ts +2 -1
  40. package/dist/v1/builder/schema/input.d.ts +9 -1
  41. package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
  42. package/dist/v1/builder/schema/projection/callable.js +1 -0
  43. package/dist/v1/builder/schema/projection/class.d.ts +89 -0
  44. package/dist/v1/builder/schema/projection/class.js +1 -0
  45. package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
  46. package/dist/v1/builder/schema/projection/core-input.js +1 -0
  47. package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
  48. package/dist/v1/builder/schema/projection/domain.js +1 -0
  49. package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
  50. package/dist/v1/builder/schema/projection/identity.js +1 -0
  51. package/dist/v1/builder/schema/projection/model.d.ts +59 -0
  52. package/dist/v1/builder/schema/projection/model.js +1 -0
  53. package/dist/v1/builder/schema/projection/property.d.ts +32 -0
  54. package/dist/v1/builder/schema/projection/property.js +1 -0
  55. package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
  56. package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
  57. package/dist/v1/builder/schema/projection.d.ts +4 -258
  58. package/dist/v1/builder/value/full-match.js +6 -3
  59. package/dist/v1/builder/value/path.d.ts +2 -2
  60. package/dist/v1/builder/value/path.js +2 -2
  61. package/dist/v1/builder/view/authoring.d.ts +6 -14
  62. package/dist/v1/builder/view/authoring.js +13 -5
  63. package/dist/v1/bundle/structure.d.ts +2 -1
  64. package/dist/v1/compiled/admission/accept.d.ts +1 -1
  65. package/dist/v1/compiled/admission/accept.js +11 -814
  66. package/dist/v1/compiled/admission/closure.d.ts +3 -0
  67. package/dist/v1/compiled/admission/closure.js +173 -0
  68. package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
  69. package/dist/v1/compiled/admission/diagnostic.js +13 -0
  70. package/dist/v1/compiled/admission/revision.js +9 -1
  71. package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
  72. package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
  73. package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
  74. package/dist/v1/compiled/admission/semantics/class.js +125 -0
  75. package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
  76. package/dist/v1/compiled/admission/semantics/context.js +81 -0
  77. package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
  78. package/dist/v1/compiled/admission/semantics/core.js +123 -0
  79. package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
  80. package/dist/v1/compiled/admission/semantics/edge.js +89 -0
  81. package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
  82. package/dist/v1/compiled/admission/semantics/policy/admit.js +63 -0
  83. package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
  84. package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
  85. package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
  86. package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
  87. package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
  88. package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
  89. package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
  90. package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
  91. package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
  92. package/dist/v1/compiled/admission/semantics/policy/parity.js +139 -0
  93. package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
  94. package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
  95. package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
  96. package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
  97. package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
  98. package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
  99. package/dist/v1/compiled/admission/semantics.d.ts +1 -1
  100. package/dist/v1/compiled/admission/semantics.js +8 -1078
  101. package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
  102. package/dist/v1/compiled/admission/wire/callable.js +90 -0
  103. package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
  104. package/dist/v1/compiled/admission/wire/class.js +133 -0
  105. package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
  106. package/dist/v1/compiled/admission/wire/core.js +32 -0
  107. package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
  108. package/dist/v1/compiled/admission/wire/dependency.js +43 -0
  109. package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
  110. package/dist/v1/compiled/admission/wire/entry.js +100 -0
  111. package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
  112. package/dist/v1/compiled/admission/wire/pattern.js +111 -0
  113. package/dist/v1/compiled/admission/wire/policy.d.ts +10 -0
  114. package/dist/v1/compiled/admission/wire/policy.js +189 -0
  115. package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
  116. package/dist/v1/compiled/admission/wire/program.js +52 -0
  117. package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
  118. package/dist/v1/compiled/admission/wire/property.js +74 -0
  119. package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
  120. package/dist/v1/compiled/admission/wire/reference.js +33 -0
  121. package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
  122. package/dist/v1/compiled/admission/wire/value.js +98 -0
  123. package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
  124. package/dist/v1/compiled/admission/wire/view.js +17 -0
  125. package/dist/v1/compiled/compiler/compile.js +43 -11
  126. package/dist/v1/compiled/generated.d.ts +10 -0
  127. package/dist/v1/compiled/generated.js +15 -0
  128. package/dist/v1/compiled/loader/load.d.ts +5 -0
  129. package/dist/v1/compiled/loader/load.js +18 -4
  130. package/dist/v1/compiled/model/schema.d.ts +16 -7
  131. package/dist/v1/domain/create.js +18 -28
  132. package/dist/v1/domain/model/domain.d.ts +0 -1
  133. package/dist/v1/domain/model/input.d.ts +3 -0
  134. package/dist/v1/domain/projection/classes.js +13 -41
  135. package/dist/v1/domain/validation/create.d.ts +2 -0
  136. package/dist/v1/domain/validation/create.js +12 -0
  137. package/dist/v1/index.d.ts +5 -2
  138. package/dist/v1/index.js +3 -1
  139. package/dist/v1/language/callable/composition.d.ts +27 -0
  140. package/dist/v1/language/callable/composition.js +52 -0
  141. package/dist/v1/language/callable/executable.d.ts +6 -0
  142. package/dist/v1/language/callable/executable.js +4 -0
  143. package/dist/v1/language/callable/model/callable.d.ts +34 -9
  144. package/dist/v1/language/callable/model/callable.js +3 -1
  145. package/dist/v1/language/callable/resolved.d.ts +23 -8
  146. package/dist/v1/language/class/facets.d.ts +5 -2
  147. package/dist/v1/language/class/inheritance.d.ts +12 -0
  148. package/dist/v1/language/class/inheritance.js +25 -0
  149. package/dist/v1/language/class/lifetime.d.ts +17 -0
  150. package/dist/v1/language/class/lifetime.js +26 -0
  151. package/dist/v1/language/class/model/class.d.ts +8 -4
  152. package/dist/v1/language/class/model/property.d.ts +4 -2
  153. package/dist/v1/language/class/property-values.js +5 -2
  154. package/dist/v1/language/class/resolved.d.ts +25 -15
  155. package/dist/v1/language/core/model/core.d.ts +7 -1
  156. package/dist/v1/language/core/resolved.d.ts +6 -2
  157. package/dist/v1/language/definition/metadata.d.ts +8 -0
  158. package/dist/v1/language/definition/metadata.js +12 -0
  159. package/dist/v1/language/index.d.ts +9 -0
  160. package/dist/v1/language/index.js +6 -0
  161. package/dist/v1/language/policy/analysis/branches.d.ts +4 -3
  162. package/dist/v1/language/policy/analysis/branches.js +54 -12
  163. package/dist/v1/language/policy/analysis/budgets.js +1 -1
  164. package/dist/v1/language/policy/analysis/checks.d.ts +28 -0
  165. package/dist/v1/language/policy/analysis/checks.js +80 -0
  166. package/dist/v1/language/policy/index.d.ts +1 -0
  167. package/dist/v1/language/policy/index.js +1 -0
  168. package/dist/v1/language/policy/model/policy.d.ts +71 -5
  169. package/dist/v1/language/policy/model/policy.js +52 -1
  170. package/dist/v1/language/policy/normalization/normalize.d.ts +12 -1
  171. package/dist/v1/language/policy/normalization/normalize.js +178 -44
  172. package/dist/v1/language/state/index.d.ts +3 -0
  173. package/dist/v1/language/state/index.js +1 -0
  174. package/dist/v1/language/state/machine.d.ts +28 -0
  175. package/dist/v1/language/state/machine.js +40 -0
  176. package/dist/v1/language/state/topology.d.ts +14 -0
  177. package/dist/v1/language/state/topology.js +69 -0
  178. package/dist/v1/language/value/compile/fields.d.ts +1 -1
  179. package/dist/v1/language/value/compile/load.d.ts +4 -2
  180. package/dist/v1/language/value/compile/load.js +22 -1
  181. package/dist/v1/language/value/compile/model.d.ts +16 -1
  182. package/dist/v1/language/value/evaluate/assertions.d.ts +2 -0
  183. package/dist/v1/language/value/evaluate/assertions.js +13 -0
  184. package/dist/v1/language/value/evaluate/evaluator.js +111 -28
  185. package/dist/v1/language/value/evaluate/preparation.d.ts +10 -1
  186. package/dist/v1/language/value/evaluate/preparation.js +17 -26
  187. package/dist/v1/language/value/evaluate/program.js +1 -1
  188. package/dist/v1/language/value/evaluate/validate.d.ts +6 -2
  189. package/dist/v1/language/value/evaluate/validate.js +18 -11
  190. package/dist/v1/language/value/inclusion/includes.d.ts +9 -0
  191. package/dist/v1/language/value/inclusion/includes.js +777 -0
  192. package/dist/v1/language/value/model/blob.d.ts +31 -0
  193. package/dist/v1/language/value/model/blob.js +90 -0
  194. package/dist/v1/language/value/model/instant.d.ts +0 -2
  195. package/dist/v1/language/value/model/instant.js +1 -1
  196. package/dist/v1/language/value/model/schema.d.ts +2 -1
  197. package/dist/v1/language/value/model/schema.js +1 -5
  198. package/dist/v1/language/value/ordering.d.ts +2 -0
  199. package/dist/v1/language/value/ordering.js +4 -8
  200. package/dist/v1/language/value/profile/json.validate.js +1 -1
  201. package/dist/v1/language/value/profile/rules.js +48 -12
  202. package/dist/v1/language/value/reference/registry.d.ts +2 -1
  203. package/dist/v1/language/value/regexp/ast.js +3 -64
  204. package/dist/v1/language/value/regexp/compile.d.ts +32 -3
  205. package/dist/v1/language/value/regexp/compile.js +117 -21
  206. package/dist/v1/language/value/regexp/matcher.d.ts +6 -3
  207. package/dist/v1/language/value/regexp/matcher.js +185 -28
  208. package/dist/v1/language/value/regexp/syntax.d.ts +12 -1
  209. package/dist/v1/language/value/regexp/syntax.js +14 -2
  210. package/dist/v1/language/value/regexp/unicode.d.ts +32 -0
  211. package/dist/v1/language/value/regexp/unicode.js +139 -0
  212. package/dist/v1/language/value/syntax/full-match.js +8 -5
  213. package/dist/v1/language/value/syntax/node-path/validate.js +4 -6
  214. package/dist/v1/language/view/model/view.d.ts +2 -4
  215. package/dist/v1/language/view/resolved.d.ts +2 -2
  216. package/dist/v1/schema/analysis/class.d.ts +36 -6
  217. package/dist/v1/schema/analysis/class.js +31 -66
  218. package/dist/v1/schema/canonical/revision.d.ts +2 -1
  219. package/dist/v1/schema/canonical/revision.js +4 -1
  220. package/dist/v1/schema/compatibility/api.d.ts +3 -0
  221. package/dist/v1/schema/compatibility/api.js +2 -0
  222. package/dist/v1/schema/compatibility/comparators/callables.d.ts +39 -0
  223. package/dist/v1/schema/compatibility/comparators/callables.js +101 -0
  224. package/dist/v1/schema/compatibility/comparators/classes.d.ts +47 -0
  225. package/dist/v1/schema/compatibility/comparators/classes.js +160 -0
  226. package/dist/v1/schema/compatibility/comparators/index.d.ts +12 -0
  227. package/dist/v1/schema/compatibility/comparators/index.js +53 -0
  228. package/dist/v1/schema/compatibility/comparators/members.d.ts +4 -0
  229. package/dist/v1/schema/compatibility/comparators/members.js +49 -0
  230. package/dist/v1/schema/compatibility/comparators/values.d.ts +5 -0
  231. package/dist/v1/schema/compatibility/comparators/values.js +37 -0
  232. package/dist/v1/schema/compatibility/compare.d.ts +5 -0
  233. package/dist/v1/schema/compatibility/compare.js +23 -0
  234. package/dist/v1/schema/compatibility/context.d.ts +19 -0
  235. package/dist/v1/schema/compatibility/context.js +49 -0
  236. package/dist/v1/schema/compatibility/coordinate.d.ts +40 -0
  237. package/dist/v1/schema/compatibility/coordinate.js +38 -0
  238. package/dist/v1/schema/compatibility/diff.d.ts +12 -0
  239. package/dist/v1/schema/compatibility/diff.js +39 -0
  240. package/dist/v1/schema/compatibility/evidence.d.ts +16 -0
  241. package/dist/v1/schema/compatibility/evidence.js +62 -0
  242. package/dist/v1/schema/compatibility/fields.d.ts +194 -0
  243. package/dist/v1/schema/compatibility/fields.js +94 -0
  244. package/dist/v1/schema/compatibility/index.d.ts +6 -0
  245. package/dist/v1/schema/compatibility/index.js +3 -0
  246. package/dist/v1/schema/compatibility/meaning/footprint.d.ts +7 -0
  247. package/dist/v1/schema/compatibility/meaning/footprint.js +59 -0
  248. package/dist/v1/schema/compatibility/meaning/index.d.ts +3 -0
  249. package/dist/v1/schema/compatibility/meaning/index.js +16 -0
  250. package/dist/v1/schema/compatibility/model.d.ts +131 -0
  251. package/dist/v1/schema/compatibility/model.js +1 -0
  252. package/dist/v1/schema/compatibility/references.d.ts +38 -0
  253. package/dist/v1/schema/compatibility/references.js +149 -0
  254. package/dist/v1/schema/compatibility/report.d.ts +27 -0
  255. package/dist/v1/schema/compatibility/report.js +100 -0
  256. package/dist/v1/schema/compatibility/scope.d.ts +36 -0
  257. package/dist/v1/schema/compatibility/scope.js +110 -0
  258. package/dist/v1/schema/compatibility/structure/index.d.ts +3 -0
  259. package/dist/v1/schema/compatibility/structure/index.js +40 -0
  260. package/dist/v1/schema/compatibility/structure/inheritance.d.ts +7 -0
  261. package/dist/v1/schema/compatibility/structure/inheritance.js +68 -0
  262. package/dist/v1/schema/compatibility/structure/requirements.d.ts +7 -0
  263. package/dist/v1/schema/compatibility/structure/requirements.js +97 -0
  264. package/dist/v1/schema/compatibility/subjects.d.ts +39 -0
  265. package/dist/v1/schema/compatibility/subjects.js +143 -0
  266. package/dist/v1/schema/compatibility/versioning/index.d.ts +8 -0
  267. package/dist/v1/schema/compatibility/versioning/index.js +50 -0
  268. package/dist/v1/schema/compatibility/versioning/members.d.ts +12 -0
  269. package/dist/v1/schema/compatibility/versioning/members.js +47 -0
  270. package/dist/v1/schema/compatibility/versioning/surface.d.ts +11 -0
  271. package/dist/v1/schema/compatibility/versioning/surface.js +61 -0
  272. package/dist/v1/schema/diagnostic.d.ts +1 -1
  273. package/dist/v1/schema/fingerprint.d.ts +2 -0
  274. package/dist/v1/schema/fingerprint.js +1 -0
  275. package/dist/v1/schema/index.d.ts +4 -3
  276. package/dist/v1/schema/index.js +2 -1
  277. package/dist/v1/schema/model/schema.d.ts +8 -11
  278. package/dist/v1/schema/normalization/domain.js +57 -13
  279. package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
  280. package/dist/v1/schema/resolution/definition.index.js +0 -3
  281. package/dist/v1/schema/resolution/domain.d.ts +4 -1
  282. package/dist/v1/schema/resolution/domain.js +26 -18
  283. package/dist/v1/schema/resolution/origins.d.ts +28 -5
  284. package/dist/v1/schema/resolution/origins.js +68 -31
  285. package/dist/v1/schema/validation/callable.d.ts +4 -0
  286. package/dist/v1/schema/validation/callable.js +39 -0
  287. package/dist/v1/schema/validation/class.d.ts +10 -0
  288. package/dist/v1/schema/validation/class.js +79 -60
  289. package/dist/v1/schema/validation/core.js +83 -55
  290. package/dist/v1/schema/validation/domain.d.ts +2 -1
  291. package/dist/v1/schema/validation/domain.js +2 -0
  292. package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
  293. package/dist/v1/schema/validation/domain.structure.js +214 -171
  294. package/dist/v1/schema/validation/policy/budgets.js +36 -6
  295. package/dist/v1/schema/validation/policy/context.js +5 -16
  296. package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
  297. package/dist/v1/schema/validation/policy/objects.js +71 -0
  298. package/dist/v1/schema/validation/policy/references.js +16 -4
  299. package/dist/v1/schema/validation/policy/typing.d.ts +2 -0
  300. package/dist/v1/schema/validation/policy/typing.js +55 -7
  301. package/dist/v1/schema/validation/policy/uses.js +73 -99
  302. package/dist/v1/schema/validation/value-api.d.ts +2 -0
  303. package/dist/v1/schema/validation/value-api.js +1 -0
  304. package/dist/v1/schema/validation/value.js +7 -1
  305. package/dist/v1/schema/validation/view.js +14 -9
  306. package/dist/value/accept.d.ts +9 -0
  307. package/dist/value/accept.js +106 -7
  308. package/dist/value/canonical.d.ts +3 -0
  309. package/dist/value/canonical.js +22 -6
  310. package/dist/value/immutable.optimization.d.ts +15 -0
  311. package/dist/value/immutable.optimization.js +34 -0
  312. package/dist/value/index.d.ts +1 -1
  313. package/dist/value/index.js +1 -1
  314. package/dist/value/json.d.ts +1 -1
  315. package/dist/value/json.js +1 -1
  316. package/dist/value/limits.d.ts +1 -1
  317. package/dist/value/unicode.d.ts +4 -1
  318. package/dist/value/unicode.js +28 -0
  319. package/package.json +20 -5
  320. package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
  321. package/dist/v1/schema/compatibility/meaning.js +0 -605
@@ -1,13 +1,13 @@
1
- import type { CoreRef, ClassRef, DefinitionRef, FunctionRef, PolicyRef, ViewRef } from '../../../addressing/index.js';
1
+ import type { ClassRef, DefinitionRef, FunctionRef, PolicyRef, ViewRef } from '../../../addressing/index.js';
2
2
  import type { DomainDependency } from '../../../addressing/index.js';
3
3
  import type { ClassKind } from '../../../language/class/model/class.js';
4
4
  import type { CoreEndpointRef } from '../../../language/core/model/core.js';
5
- import type { PolicyObjectRef } from '../../../language/policy/model/policy.js';
5
+ import type { PolicyObjectRef } from '../../../language/index.js';
6
6
  import type { ValueSchemaRegistry } from '../../../language/value/reference/registry.js';
7
7
  import type { DomainSchema, DomainSchemaIR } from '../../../schema/model/schema.js';
8
8
  import type { Function, PolicyObjectInput } from '../../callable/authoring.js';
9
9
  import type { Class, ClassReferenceInput } from '../../class/authoring.js';
10
- import type { CoreNode } from '../../core/authoring.js';
10
+ import type { CoreEndpoint, CoreNode } from '../../core/authoring.js';
11
11
  import type { Policy } from '../../policy/authoring.js';
12
12
  import type { View } from '../../view/authoring.js';
13
13
  import { type Lazy } from '../../schema/lazy.js';
@@ -19,9 +19,6 @@ export declare class BuilderContext {
19
19
  readonly localDefinitions: Map<string, DefinitionRef<import("../../../addressing/definition-ref.js").Definition.Kind, string>>;
20
20
  readonly localClassKinds: Map<string, ClassKind>;
21
21
  readonly policies: Map<object, PolicyRef>;
22
- readonly coreNodes: Map<CoreNode<Lazy<import("../../class/authoring.js").NodeClass<import("../../class/authoring.js").NodeClassInput>>, (Readonly<Record<`${string}:class.${string}.property.${string}`, import("../../../language/index.js").PropertyValue>> | Readonly<{} & {
23
- [x: string]: unknown;
24
- }>) & import("../../../../value/types.js").Object>, CoreRef>;
25
22
  readonly policyObjects: Map<object, PolicyObjectRef>;
26
23
  readonly policyObjectRefs: Set<string>;
27
24
  readonly usedForeignOrigins: Set<string>;
@@ -36,11 +33,17 @@ export declare class BuilderContext {
36
33
  resolveEdgeClass(input: ClassReferenceInput, pointer: string): ClassRef;
37
34
  resolvePolicy(input: Lazy<unknown>, pointer: string): PolicyRef;
38
35
  resolvePolicyObject(input: PolicyObjectInput | PolicyObjectRef, pointer: string): PolicyObjectRef;
39
- resolveCoreEndpoint(value: CoreNode | CoreEndpointRef, pointer: string): CoreEndpointRef;
36
+ /** A Core fact belongs to the Domain that declares it, so a dependency endpoint never resolves. */
37
+ resolveCoreEndpoint(input: CoreEndpoint, pointer: string): CoreEndpointRef;
38
+ /**
39
+ * The shared lookup from one already-resolved authoring value to its ref; each caller owns its
40
+ * own admission rule and diagnostic.
41
+ */
42
+ private policyObjectRef;
40
43
  dependencies(): Readonly<Record<string, DomainDependency>>;
41
44
  valueRegistry(): ValueSchemaRegistry;
42
45
  noteDomainEndpointReferences(schema: DomainSchemaIR): void;
43
46
  private assertVisible;
44
47
  private classKind;
45
- private capturePolicyObject;
48
+ capturePolicyObject(value: object, ref: PolicyObjectRef): void;
46
49
  }
@@ -1,5 +1,7 @@
1
1
  import { compareDefinitionRefs, compareUnicode, definitionRefIndex, } from '../../../addressing/ordering.js';
2
2
  import { DEPENDENCY_ALIAS_PATTERN } from '../../../addressing/patterns.js';
3
+ import { isMethodExecutable } from '../../../language/callable/executable.js';
4
+ import { policyObjectKey, policyObjectOrigin } from '../../../language/index.js';
3
5
  import { graphNodePathSchema } from '../../../language/value/syntax/node-path/schema.js';
4
6
  import { revisionOfDomainSchema } from '../../../schema/canonical/revision.js';
5
7
  import { requireDomainClosure } from '../../../schema/resolution/closure.js';
@@ -13,7 +15,6 @@ export class BuilderContext {
13
15
  localDefinitions = new Map();
14
16
  localClassKinds = new Map();
15
17
  policies = new Map();
16
- coreNodes = new Map();
17
18
  policyObjects = new Map();
18
19
  policyObjectRefs = new Set();
19
20
  usedForeignOrigins = new Set();
@@ -50,22 +51,21 @@ export class BuilderContext {
50
51
  this.capturePolicyObject(value, ref);
51
52
  }
52
53
  capturePolicy(value, ref, pointer) {
53
- this.ownership.capture(value, `${ref.origin}:policy.${ref.name}`, pointer);
54
+ this.ownership.captureDefinition(value, ref, pointer);
54
55
  this.policies.set(value, ref);
55
56
  this.capturePolicyObject(value, ref);
56
57
  }
57
58
  captureCoreNode(value, slug, pointer) {
58
- this.ownership.capture(value, `${this.origin}:core.${slug}`, pointer);
59
59
  const ref = { origin: this.origin, kind: 'core', name: slug };
60
- this.coreNodes.set(value, ref);
60
+ this.ownership.captureDefinition(value, ref, pointer);
61
61
  this.capturePolicyObject(value, ref);
62
62
  }
63
63
  captureFunction(value, ref, pointer) {
64
- this.ownership.capture(value, `${ref.origin}:function.${ref.name}`, pointer);
64
+ this.ownership.captureDefinition(value, ref, pointer);
65
65
  this.capturePolicyObject(value, ref);
66
66
  }
67
67
  captureView(value, ref, pointer) {
68
- this.ownership.capture(value, `${ref.origin}:view.${ref.name}`, pointer);
68
+ this.ownership.captureDefinition(value, ref, pointer);
69
69
  this.capturePolicyObject(value, ref);
70
70
  }
71
71
  resolveClass(input, kind, pointer) {
@@ -108,28 +108,45 @@ export class BuilderContext {
108
108
  return { ...ref };
109
109
  }
110
110
  resolvePolicyObject(input, pointer) {
111
- const value = resolveLazy(input, pointer);
112
- const ref = isPolicyObjectRef(value)
113
- ? value
114
- : typeof value === 'object' && value !== null
115
- ? this.policyObjects.get(value)
116
- : undefined;
117
- if (ref === undefined ||
118
- ref.origin !== this.origin ||
119
- !this.policyObjectRefs.has(definitionRefIndex(ref))) {
120
- fail('BUILDER_POLICY_REF', pointer, 'Policy ref(...) must name one registered local Definition, Function, Policy, View, or Core Node.');
111
+ const ref = this.policyObjectRef(resolveLazy(input, pointer));
112
+ const origin = ref === undefined ? undefined : policyObjectOrigin(ref);
113
+ const dependency = origin === undefined ? undefined : this.#dependencies.get(origin)?.schema;
114
+ const admitted = ref !== undefined &&
115
+ (origin === this.origin
116
+ ? this.policyObjectRefs.has(policyObjectKey(ref))
117
+ : dependency !== undefined && hasPolicyObject(dependency, ref));
118
+ if (!admitted || ref === undefined) {
119
+ fail('BUILDER_POLICY_REF', pointer, 'Policy ref(...) must name one registered local or direct-dependency Definition, Function, Method, Policy, View, or Core Node.');
121
120
  }
121
+ const admittedOrigin = policyObjectOrigin(ref);
122
+ if (admittedOrigin !== this.origin)
123
+ this.usedForeignOrigins.add(admittedOrigin);
122
124
  return { ...ref };
123
125
  }
124
- resolveCoreEndpoint(value, pointer) {
126
+ /** A Core fact belongs to the Domain that declares it, so a dependency endpoint never resolves. */
127
+ resolveCoreEndpoint(input, pointer) {
128
+ const value = resolveLazy(input, pointer);
125
129
  if (isDomainEndpointRef(value))
126
130
  return { kind: 'domain' };
127
- const ref = isCoreRef(value) ? value : this.coreNodes.get(value);
128
- if (ref === undefined || ref.origin !== this.origin) {
129
- fail('BUILDER_CORE_REF', pointer, 'A Core reference must name a registered local Core Node.');
131
+ const ref = this.policyObjectRef(value);
132
+ if (ref === undefined ||
133
+ policyObjectOrigin(ref) !== this.origin ||
134
+ !this.policyObjectRefs.has(policyObjectKey(ref))) {
135
+ fail('BUILDER_CORE_REF', pointer, 'A Core Edge endpoint must name one registered local Definition, Function, Method, Policy, View, or Core Node.');
130
136
  }
131
137
  return { ...ref };
132
138
  }
139
+ /**
140
+ * The shared lookup from one already-resolved authoring value to its ref; each caller owns its
141
+ * own admission rule and diagnostic.
142
+ */
143
+ policyObjectRef(value) {
144
+ if (isPolicyObjectRef(value))
145
+ return value;
146
+ return typeof value === 'object' && value !== null
147
+ ? (this.policyObjects.get(value) ?? this.ownership.definition(value))
148
+ : undefined;
149
+ }
133
150
  dependencies() {
134
151
  return Object.fromEntries([...this.#dependencies.values()]
135
152
  .sort((left, right) => compareUnicode(left.alias, right.alias))
@@ -191,7 +208,7 @@ export class BuilderContext {
191
208
  }
192
209
  capturePolicyObject(value, ref) {
193
210
  this.policyObjects.set(value, ref);
194
- this.policyObjectRefs.add(definitionRefIndex(ref));
211
+ this.policyObjectRefs.add(policyObjectKey(ref));
195
212
  }
196
213
  }
197
214
  function escapePointer(value) {
@@ -217,18 +234,12 @@ function isDefinitionRef(value) {
217
234
  typeof candidate.name === 'string' &&
218
235
  candidate.kind === 'class');
219
236
  }
220
- function isCoreRef(value) {
221
- if (typeof value !== 'object' || value === null)
222
- return false;
223
- const candidate = value;
224
- return (typeof candidate.origin === 'string' &&
225
- candidate.kind === 'core' &&
226
- typeof candidate.name === 'string');
227
- }
228
237
  function isPolicyObjectRef(value) {
229
238
  if (typeof value !== 'object' || value === null)
230
239
  return false;
231
240
  const candidate = value;
241
+ if (candidate.kind === 'method')
242
+ return isDefinitionRef(candidate.owner) && typeof candidate.name === 'string';
232
243
  return (typeof candidate.origin === 'string' &&
233
244
  typeof candidate.name === 'string' &&
234
245
  (candidate.kind === 'class' ||
@@ -245,3 +256,22 @@ function definitionRefsOf(schema) {
245
256
  }
246
257
  return refs.sort(compareDefinitionRefs);
247
258
  }
259
+ function hasPolicyObject(schema, ref) {
260
+ switch (ref.kind) {
261
+ case 'method': {
262
+ const owner = schema.classes[ref.owner.name];
263
+ const method = owner?.kind === 'node' ? owner.methods[ref.name] : undefined;
264
+ return method !== undefined && isMethodExecutable(owner, method);
265
+ }
266
+ case 'class':
267
+ return Object.hasOwn(schema.classes, ref.name);
268
+ case 'function':
269
+ return Object.hasOwn(schema.functions, ref.name);
270
+ case 'policy':
271
+ return Object.hasOwn(schema.policies, ref.name);
272
+ case 'view':
273
+ return Object.hasOwn(schema.views, ref.name);
274
+ case 'core':
275
+ return Object.hasOwn(schema.core.nodes, ref.name);
276
+ }
277
+ }
@@ -1,8 +1,8 @@
1
- import type { DefinitionRef } from '../../../addressing/index.js';
1
+ import type { PolicyObjectRef } from '../../../language/index.js';
2
2
  export declare class OwnershipCapture {
3
3
  #private;
4
- captureDefinition(value: object, ref: DefinitionRef, pointer: string): void;
4
+ captureDefinition(value: object, ref: PolicyObjectRef, pointer: string): void;
5
5
  capture(value: object, owner: string, pointer: string): void;
6
- definition(value: object): DefinitionRef | undefined;
6
+ definition(value: object): PolicyObjectRef | undefined;
7
7
  commit(): void;
8
8
  }
@@ -1,3 +1,4 @@
1
+ import { policyObjectKey } from '../../../language/index.js';
1
2
  import { fail } from '../../schema/diagnostic.js';
2
3
  const definitionOwners = new WeakMap();
3
4
  const semanticOwners = new WeakMap();
@@ -5,7 +6,7 @@ export class OwnershipCapture {
5
6
  #definitions = new Map();
6
7
  #owners = new Map();
7
8
  captureDefinition(value, ref, pointer) {
8
- this.capture(value, `${ref.origin}:${ref.kind}.${ref.name}`, pointer);
9
+ this.capture(value, policyObjectKey(ref), pointer);
9
10
  this.#definitions.set(value, ref);
10
11
  }
11
12
  capture(value, owner, pointer) {
@@ -1,5 +1,5 @@
1
1
  import { accept as acceptJsonValue } from '@astrale-os/kernel-dsl/value';
2
- import { z } from 'zod';
2
+ import { ZodType } from 'zod';
3
3
  import { compareDefinitionRefs } from '../../../addressing/ordering.js';
4
4
  import { canonicalizeValueSchema } from '../../../language/value/profile/canonicalize.js';
5
5
  import { validateValueSchema } from '../../../language/value/profile/validate.js';
@@ -36,18 +36,28 @@ export class BuilderValueSchemas {
36
36
  compiled[name] = {
37
37
  schema: canonicalizeValueSchema(schema, 'property-facet', this.registry),
38
38
  required: authoredInput?.options.required ?? isRequired(schemaInput),
39
- visibility: authoredInput?.options.visibility ?? 'public',
40
39
  ...(autoInput === undefined ? {} : { auto: autoInput.options }),
40
+ ...(authoredInput?.options.immutable === undefined
41
+ ? {}
42
+ : { immutable: authoredInput.options.immutable }),
41
43
  ...(authoredInput?.options.description === undefined
42
44
  ? {}
43
45
  : { description: authoredInput.options.description }),
46
+ ...(authoredInput?.machine === undefined
47
+ ? {}
48
+ : {
49
+ state: {
50
+ initial: authoredInput.machine.initial,
51
+ transitions: authoredInput.machine.transitions,
52
+ },
53
+ }),
44
54
  };
45
55
  }
46
56
  return compiled;
47
57
  }
48
58
  lower(input, conversionContext, pointer, zodPosition = 'value') {
49
59
  let schema;
50
- if (input instanceof z.ZodType) {
60
+ if (input instanceof ZodType) {
51
61
  const converted = convertZodToValueSchema(input, conversionContext, this.registry, pointer, {
52
62
  position: zodPosition,
53
63
  validate: false,
@@ -130,7 +140,7 @@ function isAutoProperty(value) {
130
140
  return isAuthoringValue(value, 'auto');
131
141
  }
132
142
  function isRequired(value) {
133
- if (!(value instanceof z.ZodType))
143
+ if (!(value instanceof ZodType))
134
144
  return true;
135
145
  return !zodObjectPropertyIsOptional(value);
136
146
  }
@@ -1,8 +1,8 @@
1
- import { z } from 'zod';
1
+ import { ZodType } from 'zod';
2
2
  import type { JsonSchema, ValueSchemaContext } from '../../../language/value/model/schema.js';
3
3
  import type { ValueSchemaRegistry } from '../../../language/value/reference/registry.js';
4
4
  import type { BuilderDiagnostic } from '../../schema/diagnostic.js';
5
- export type ZodValueSchemaConversion = {
5
+ type ZodValueSchemaConversion = {
6
6
  readonly ok: true;
7
7
  readonly schema: JsonSchema;
8
8
  readonly diagnostics: readonly [];
@@ -10,7 +10,7 @@ export type ZodValueSchemaConversion = {
10
10
  readonly ok: false;
11
11
  readonly diagnostics: readonly BuilderDiagnostic[];
12
12
  };
13
- export interface ZodValueSchemaConversionOptions {
13
+ interface ZodValueSchemaConversionOptions {
14
14
  /** Undefined is representable only as absence at a containing object-property boundary. */
15
15
  readonly position?: 'value' | 'object-property';
16
16
  /** Builder-only lowering hook keyed by the original Zod schema identity. */
@@ -19,7 +19,7 @@ export interface ZodValueSchemaConversionOptions {
19
19
  readonly validate?: boolean;
20
20
  }
21
21
  export interface ZodValueSchemaOverrideContext {
22
- readonly zodSchema: z.ZodType;
22
+ readonly zodSchema: ZodType;
23
23
  readonly jsonSchema: Record<string, unknown>;
24
24
  readonly path: readonly (string | number)[];
25
25
  }
@@ -27,6 +27,7 @@ export interface ZodValueSchemaOverrideContext {
27
27
  * Converts only Zod contracts whose JSON-value acceptance is represented
28
28
  * without coercion, effects, custom predicates, or format assertions.
29
29
  */
30
- export declare function convertZodToValueSchema(zodSchema: z.ZodType, context: ValueSchemaContext, registry: ValueSchemaRegistry, pointer?: string, options?: ZodValueSchemaConversionOptions): ZodValueSchemaConversion;
30
+ export declare function convertZodToValueSchema(zodSchema: ZodType, context: ValueSchemaContext, registry: ValueSchemaRegistry, pointer?: string, options?: ZodValueSchemaConversionOptions): ZodValueSchemaConversion;
31
31
  /** Whether explicit Zod optionality makes a containing object property absent-able. */
32
- export declare function zodObjectPropertyIsOptional(schema: z.ZodType): boolean;
32
+ export declare function zodObjectPropertyIsOptional(schema: ZodType): boolean;
33
+ export {};
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { ZodObject, ZodType, toJSONSchema } from 'zod';
2
2
  import { VALUE_SCHEMA_DIALECT } from '../../../language/value/model/schema.js';
3
3
  import { canonicalizeValueSchema } from '../../../language/value/profile/canonicalize.js';
4
4
  import { validateValueSchema } from '../../../language/value/profile/validate.js';
@@ -15,19 +15,19 @@ export function convertZodToValueSchema(zodSchema, context, registry, pointer =
15
15
  return { ok: false, diagnostics };
16
16
  let converted;
17
17
  try {
18
- const raw = z.toJSONSchema(zodSchema, {
18
+ const raw = toJSONSchema(zodSchema, {
19
19
  target: 'draft-2020-12',
20
20
  unrepresentable: 'throw',
21
21
  io: 'input',
22
22
  cycles: 'ref',
23
23
  reused: 'inline',
24
24
  override: ({ zodSchema: source, jsonSchema, path }) => {
25
- if (source instanceof z.ZodObject) {
25
+ if (source instanceof ZodObject) {
26
26
  jsonSchema.required = Object.entries(source.shape)
27
27
  .filter(([, property]) => !zodObjectPropertyIsOptional(property))
28
28
  .map(([name]) => name);
29
29
  }
30
- if (source instanceof z.ZodType) {
30
+ if (source instanceof ZodType) {
31
31
  lowerFullMatchChecks(source, jsonSchema);
32
32
  options.override?.({
33
33
  jsonSchema: jsonSchema,
@@ -161,7 +161,10 @@ function inspectCheck(def, pointer, diagnostics) {
161
161
  return;
162
162
  }
163
163
  if (def.check === 'string_format' && def.format === 'regex' && def.pattern instanceof RegExp) {
164
- if (!isLosslessRegexp(def.pattern)) {
164
+ if (def.pattern.flags === '') {
165
+ diagnostics.push(diagnostic('ZOD_SCHEMA_NOT_LOSSLESS', pointer, 'Zod RegExp without the u flag reads \\p{...} as literal text, and classes and quantifiers by UTF-16 code unit, unlike the V1 I-Regexp it would lower to; add the u flag.'));
166
+ }
167
+ else if (!isLosslessRegexp(def.pattern)) {
165
168
  diagnostics.push(diagnostic('ZOD_SCHEMA_NOT_LOSSLESS', pointer, 'Zod RegExp flags, anchors, dot semantics, or syntax cannot be preserved as a V1 I-Regexp substring pattern.'));
166
169
  }
167
170
  }
@@ -284,7 +287,7 @@ function getCheckDefinition(value) {
284
287
  return isPlainRecord(internals?.def) ? internals.def : undefined;
285
288
  }
286
289
  function isZodType(value) {
287
- return value instanceof z.ZodType;
290
+ return value instanceof ZodType;
288
291
  }
289
292
  function escapePointerToken(value) {
290
293
  return value.replaceAll('~', '~0').replaceAll('/', '~1');
@@ -292,8 +295,14 @@ function escapePointerToken(value) {
292
295
  function isPlainRecord(value) {
293
296
  return value !== null && typeof value === 'object' && !Array.isArray(value);
294
297
  }
298
+ /**
299
+ * Whether a Zod RegExp search means its source read as an I-Regexp. Only the u flag qualifies:
300
+ * without it, `\p{L}` matches the text `p{L}`, and classes and quantifiers apply to UTF-16 code
301
+ * units rather than scalars; `v` reads class syntax differently, and every other flag changes the
302
+ * match itself.
303
+ */
295
304
  function isLosslessRegexp(pattern) {
296
- if (pattern.flags !== '' && pattern.flags !== 'u')
305
+ if (pattern.flags !== 'u')
297
306
  return false;
298
307
  if (!isIRegexp(pattern.source))
299
308
  return false;
@@ -1,11 +1,12 @@
1
1
  import type { ViewDefinition } from '../../language/view/model/view.js';
2
2
  import type { View } from '../view/authoring.js';
3
3
  import type { BuilderContext } from './schema/context.js';
4
- export interface ViewCompiler {
5
- compile(value: View, name: string, pointer: string): ViewDefinition;
4
+ interface ViewCompiler {
5
+ compile(value: View, name: string): ViewDefinition;
6
6
  }
7
7
  export declare class V1ViewCompiler implements ViewCompiler {
8
8
  readonly context: BuilderContext;
9
9
  constructor(context: BuilderContext);
10
- compile(value: View, name: string, pointer: string): ViewDefinition;
10
+ compile(value: View, name: string): ViewDefinition;
11
11
  }
12
+ export {};
@@ -1,27 +1,15 @@
1
- import { compareDefinitionRefs } from '../../addressing/ordering.js';
2
1
  import { viewAuthoringInput } from '../view/authoring.js';
3
2
  export class V1ViewCompiler {
4
3
  context;
5
4
  constructor(context) {
6
5
  this.context = context;
7
6
  }
8
- compile(value, name, pointer) {
7
+ compile(value, name) {
9
8
  const config = viewAuthoringInput(value);
10
- const target = config.target;
11
9
  return {
12
10
  ref: { origin: this.context.origin, kind: 'view', name },
13
11
  ...(config.description === undefined ? {} : { description: config.description }),
14
- target: target === undefined || target === 'domain'
15
- ? { kind: 'domain' }
16
- : {
17
- kind: 'definition',
18
- definitions: (isTargetList(target) ? target : [target])
19
- .map((entry, index) => this.context.resolveNodeClass(entry, `${pointer}/target/definitions/${index}`))
20
- .sort(compareDefinitionRefs),
21
- },
12
+ target: { kind: 'domain' },
22
13
  };
23
14
  }
24
15
  }
25
- function isTargetList(input) {
26
- return Array.isArray(input);
27
- }
@@ -1,21 +1,37 @@
1
1
  import type { ClassRef } from '../../addressing/index.js';
2
- import type { PolicyCheckExpression, PolicyPatternExpression, PolicyPatternTerm as CanonicalPolicyPatternTerm } from '../../language/policy/model/policy.js';
3
- import type { EdgeClass, NodeClass } from '../class/authoring.js';
2
+ import type { PolicyCheckExpression, PolicyPatternExpression, PolicyPatternTerm as CanonicalPolicyPatternTerm, PolicyObjectRef } from '../../language/policy/model/policy.js';
3
+ import type { PolicyObjectInput } from '../callable/authoring.js';
4
+ import type { EdgeClassReferenceInput, NodeClassReferenceInput } from '../class/authoring.js';
4
5
  import type { AuthoringValue } from '../schema/handle.js';
5
6
  import type { Lazy } from '../schema/lazy.js';
6
7
  export interface PolicyEdgeInput {
7
8
  readonly source: CanonicalPolicyPatternTerm;
8
- readonly class: Lazy<EdgeClass>;
9
+ readonly class: EdgeClassReferenceInput;
9
10
  readonly target: CanonicalPolicyPatternTerm;
10
11
  readonly repeat?: {
11
12
  readonly min: number;
12
13
  readonly max: number;
13
14
  };
14
15
  }
16
+ export interface PolicyNodeBinder {
17
+ (): CanonicalPolicyPatternTerm;
18
+ (definition: NodeClassReferenceInput): CanonicalPolicyPatternTerm;
19
+ readonly exact: (definition: NodeClassReferenceInput) => CanonicalPolicyPatternTerm;
20
+ }
15
21
  export interface PolicyExistsContext {
16
- node(definition: Lazy<NodeClass>): CanonicalPolicyPatternTerm;
22
+ readonly node: PolicyNodeBinder;
17
23
  }
18
24
  export interface PolicyPatternContext {
25
+ ref(member: PolicyObjectInput): CanonicalPolicyPatternTerm;
26
+ sameNode(left: CanonicalPolicyPatternTerm, right: CanonicalPolicyPatternTerm): PolicyPatternExpression;
27
+ /**
28
+ * The caller, as each Identity of its live composition: a branch holds when the caller or a
29
+ * group it extends through `extends_with`, at any depth, satisfies it, each constraint holds and
30
+ * no exclusion denies it. A fact a group holds is one Edge from the subject: a walk over
31
+ * `extends_with` reads raw Edges and skips the constraints and exclusions of the groups it
32
+ * crosses. Membership in a group is `sameNode(subject, object)` checked against that group. One
33
+ * Identity satisfies a whole branch: facts that different groups supply are separate checks.
34
+ */
19
35
  readonly subject: CanonicalPolicyPatternTerm;
20
36
  readonly object: CanonicalPolicyPatternTerm;
21
37
  readonly source: CanonicalPolicyPatternTerm;
@@ -45,8 +61,9 @@ export interface PolicyBuilder {
45
61
  export declare function policyDeclaration(value: Policy): PolicyDeclaration;
46
62
  export declare const policy: PolicyBuilder;
47
63
  export declare function createPatternContext(options: {
48
- readonly resolveEdgeClass: (value: Lazy<EdgeClass>, pointer: string) => ClassRef;
49
- readonly resolveNodeClass: (value: Lazy<NodeClass>, pointer: string) => ClassRef;
64
+ readonly resolveObject: (value: PolicyObjectInput, pointer: string) => PolicyObjectRef;
65
+ readonly resolveEdgeClass: (value: EdgeClassReferenceInput, pointer: string) => ClassRef;
66
+ readonly resolveNodeClass: (value: NodeClassReferenceInput, pointer: string) => ClassRef;
50
67
  readonly pointer: string;
51
68
  }): PolicyPatternContext;
52
69
  export type { PolicyCheckExpression };
@@ -32,6 +32,11 @@ export function createPatternContext(options) {
32
32
  const source = Object.freeze({ kind: 'source' });
33
33
  const target = Object.freeze({ kind: 'target' });
34
34
  const context = {
35
+ ref: (member) => ({
36
+ kind: 'ref',
37
+ ref: options.resolveObject(member, `${options.pointer}/match/ref`),
38
+ }),
39
+ sameNode: (left, right) => ({ sameNode: { left, right } }),
35
40
  subject,
36
41
  object,
37
42
  source,
@@ -49,16 +54,38 @@ export function createPatternContext(options) {
49
54
  },
50
55
  exists(build) {
51
56
  const nodes = [];
52
- const where = build({
53
- node(definition) {
54
- const variable = Object.freeze({ kind: 'variable', id: nextVariable++ });
55
- nodes.push({
56
- variable,
57
- class: options.resolveNodeClass(definition, `${options.pointer}/match/exists/nodes`),
58
- });
59
- return variable;
57
+ const bind = (selector, definition) => {
58
+ const variable = Object.freeze({ kind: 'variable', id: nextVariable++ });
59
+ if (selector === 'any') {
60
+ nodes.push({ variable, selector: Object.freeze({ kind: 'any' }) });
61
+ }
62
+ else {
63
+ const classRef = options.resolveNodeClass(definition, `${options.pointer}/match/exists/nodes`);
64
+ nodes.push(selector === 'exact'
65
+ ? { variable, class: classRef }
66
+ : { variable, selector: Object.freeze({ kind: 'satisfies', class: classRef }) });
67
+ }
68
+ return variable;
69
+ };
70
+ const node = function (...args) {
71
+ if (args.length > 1 || (args.length === 1 && args[0] === undefined)) {
72
+ fail('BUILDER_POLICY', `${options.pointer}/match/exists/nodes`, 'node(...) accepts either no arguments or one Node Class.');
73
+ }
74
+ return args.length === 0
75
+ ? bind('any')
76
+ : bind('satisfies', args[0]);
77
+ };
78
+ Object.defineProperty(node, 'exact', {
79
+ enumerable: true,
80
+ value(definition) {
81
+ if (arguments.length !== 1 || definition === undefined) {
82
+ fail('BUILDER_POLICY', `${options.pointer}/match/exists/nodes`, 'node.exact(...) requires exactly one Node Class.');
83
+ }
84
+ return bind('exact', definition);
60
85
  },
61
86
  });
87
+ Object.freeze(node);
88
+ const where = build({ node });
62
89
  if (nodes.length === 0) {
63
90
  fail('BUILDER_POLICY_EMPTY_EXISTS', `${options.pointer}/match/exists/nodes`, 'exists(...) must declare at least one variable Node.');
64
91
  }
@@ -1,10 +1,13 @@
1
+ import type { Domain } from '../../domain/model/domain.js';
1
2
  import type { DomainSchema } from '../../schema/model/schema.js';
2
- import type { DomainSchemaInput } from './input.js';
3
- import type { DomainOfInput } from './projection.js';
3
+ import type { DomainSchemaInput, EntrypointOf } from './input.js';
4
+ import type { ResolvedDomainOfInput } from './projection.js';
4
5
  export type { DomainSchemaInput } from './input.js';
5
6
  /** Exact named Schema produced from one authored input. */
6
- export interface DefinedSchema<Origin extends string, Input extends DomainSchemaInput> extends DomainSchema<Origin, Input, DomainOfInput<Origin, Input>> {
7
+ export interface DefinedSchema<Origin extends string, Resolved extends Domain> extends DomainSchema<Origin, Resolved> {
7
8
  }
8
9
  /** Build and semantically accept one immutable V1 DomainSchema. */
9
- export declare function defineSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input): DefinedSchema<Origin, Input>;
10
- export type { DirectDependenciesOf, DomainOfInput } from './projection.js';
10
+ export declare function defineSchema<const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input & {
11
+ readonly entrypoint?: EntrypointOf<Input>;
12
+ }): DefinedSchema<Origin, ResolvedDomainOfInput<Origin, Input>>;
13
+ export type { ResolvedDomainOfInput } from './projection.js';
@@ -1,5 +1,5 @@
1
1
  import type { DiagnosticCode as LanguageDiagnosticCode } from '../../language/validation/diagnostic.js';
2
- export type BuilderDiagnosticCode = LanguageDiagnosticCode | 'BUILDER_ABSTRACT_POLICY' | 'BUILDER_AMBIGUOUS_OWNERSHIP' | 'BUILDER_AUTO_EVENT_INVALID' | 'BUILDER_AUTO_NESTED' | 'BUILDER_AUTO_SET_INVALID' | 'BUILDER_CALLABLE_AUTH' | 'BUILDER_CALLABLE_PLACEMENT' | 'BUILDER_CALLABLE_POLICY_AUTH' | 'BUILDER_CORE_CLASS' | 'BUILDER_CORE_EDGE' | 'BUILDER_CORE_NODE' | 'BUILDER_CORE_PROPERTY' | 'BUILDER_CORE_REF' | 'BUILDER_DEFINITION' | 'BUILDER_DEPENDENCY_CONFLICT' | 'BUILDER_DEPENDENCY_ALIAS' | 'BUILDER_DEPENDENCY_DIRECT' | 'BUILDER_DUPLICATE_MEMBER' | 'BUILDER_FOREIGN_POLICY' | 'BUILDER_FULL_MATCH_INVALID' | 'BUILDER_FUNCTION' | 'BUILDER_METHOD' | 'BUILDER_PATH_DUPLICATE' | 'BUILDER_PATH_EMPTY' | 'BUILDER_POLICY' | 'BUILDER_POLICY_COMPOSITION' | 'BUILDER_POLICY_CYCLE' | 'BUILDER_POLICY_EMPTY_COMPOSITION' | 'BUILDER_POLICY_EMPTY_EXISTS' | 'BUILDER_POLICY_INPUT' | 'BUILDER_POLICY_REF' | 'BUILDER_POLICY_SELF' | 'BUILDER_REFERENCE_CYCLE' | 'BUILDER_REFERENCE_KIND' | 'BUILDER_REFERENCE_MISSING' | 'BUILDER_UNKNOWN_FIELD' | 'BUILDER_UNOWNED_REFERENCE' | 'BUILDER_VIEW' | 'ZOD_SCHEMA_NOT_LOSSLESS';
2
+ export type BuilderDiagnosticCode = LanguageDiagnosticCode | 'BUILDER_ABSTRACT_POLICY' | 'BUILDER_AMBIGUOUS_OWNERSHIP' | 'BUILDER_AUTO_EVENT_INVALID' | 'BUILDER_AUTO_IMMUTABLE' | 'BUILDER_AUTO_NESTED' | 'BUILDER_AUTO_SET_INVALID' | 'BUILDER_CALLABLE_AUTH' | 'BUILDER_CALLABLE_PLACEMENT' | 'BUILDER_CALLABLE_POLICY_AUTH' | 'BUILDER_CORE_CLASS' | 'BUILDER_CORE_EDGE' | 'BUILDER_CORE_NODE' | 'BUILDER_CORE_PROPERTY' | 'BUILDER_CORE_REF' | 'BUILDER_DEFINITION' | 'BUILDER_DEPENDENCY_CONFLICT' | 'BUILDER_DEPENDENCY_ALIAS' | 'BUILDER_DEPENDENCY_DIRECT' | 'BUILDER_DUPLICATE_MEMBER' | 'BUILDER_FOREIGN_POLICY' | 'BUILDER_FULL_MATCH_INVALID' | 'BUILDER_FUNCTION' | 'BUILDER_METHOD' | 'BUILDER_PATH_DUPLICATE' | 'BUILDER_PATH_EMPTY' | 'BUILDER_POLICY' | 'BUILDER_POLICY_COMPOSITION' | 'BUILDER_POLICY_CYCLE' | 'BUILDER_POLICY_EMPTY_COMPOSITION' | 'BUILDER_POLICY_EMPTY_EXISTS' | 'BUILDER_POLICY_INPUT' | 'BUILDER_POLICY_REF' | 'BUILDER_POLICY_SELF' | 'BUILDER_PROPERTY_IMMUTABLE_INVALID' | 'BUILDER_REFERENCE_CYCLE' | 'BUILDER_REFERENCE_KIND' | 'BUILDER_REFERENCE_MISSING' | 'BUILDER_UNKNOWN_FIELD' | 'BUILDER_UNOWNED_REFERENCE' | 'BUILDER_VIEW' | 'ZOD_SCHEMA_NOT_LOSSLESS';
3
3
  export interface BuilderDiagnostic<out Code extends BuilderDiagnosticCode = BuilderDiagnosticCode> {
4
4
  readonly code: Code;
5
5
  readonly pointer: string;
@@ -1,7 +1,8 @@
1
1
  export declare const AUTHORING: unique symbol;
2
- export type AuthoringKind = 'definition' | 'function' | 'method' | 'callable-output' | 'policy' | 'view' | 'core-node' | 'core-edge' | 'property' | 'auto';
2
+ type AuthoringKind = 'definition' | 'function' | 'method' | 'callable-input' | 'callable-output' | 'policy' | 'view' | 'core-node' | 'core-edge' | 'property' | 'auto';
3
3
  export interface AuthoringValue<Kind extends AuthoringKind> {
4
4
  readonly [AUTHORING]: Kind;
5
5
  }
6
6
  export declare function authoringValue<Kind extends AuthoringKind, Value extends object>(kind: Kind, value: Value): Readonly<Value & AuthoringValue<Kind>>;
7
7
  export declare function isAuthoringValue<Kind extends AuthoringKind>(value: unknown, kind: Kind): value is AuthoringValue<Kind> & object;
8
+ export {};
@@ -6,10 +6,18 @@ import type { Policy } from '../policy/authoring.js';
6
6
  import type { View } from '../view/authoring.js';
7
7
  /** Complete authoring input accepted by defineSchema. */
8
8
  export interface DomainSchemaInput {
9
- readonly dependencies?: Readonly<Record<string, DomainSchema<string, unknown>>>;
9
+ /** Display name of the Domain, one trimmed line of 1 to 100 characters. */
10
+ readonly name: string;
11
+ /** Name of the one declared View this Domain opens by default. */
12
+ readonly entrypoint?: string;
13
+ readonly dependencies?: Readonly<Record<string, DomainSchema<string>>>;
10
14
  readonly classes?: Readonly<Record<string, Class>>;
11
15
  readonly functions?: Readonly<Record<string, Function>>;
12
16
  readonly policies?: Readonly<Record<string, Policy>>;
13
17
  readonly views?: Readonly<Record<string, View>>;
14
18
  readonly core?: CoreInput;
15
19
  }
20
+ /** An entrypoint can only name one of the Views the same input declares. */
21
+ export type EntrypointOf<Input extends DomainSchemaInput> = Input extends {
22
+ readonly views: infer Views;
23
+ } ? Extract<keyof Views, string> : never;