@astram/core 0.1.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 (259) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/dist/admin/admin-service.d.ts +221 -0
  4. package/dist/admin/admin-service.d.ts.map +1 -0
  5. package/dist/admin/admin-service.js +155 -0
  6. package/dist/admin/admin-service.js.map +1 -0
  7. package/dist/admin/command/grants.d.ts +40 -0
  8. package/dist/admin/command/grants.d.ts.map +1 -0
  9. package/dist/admin/command/grants.js +196 -0
  10. package/dist/admin/command/grants.js.map +1 -0
  11. package/dist/admin/command/index.d.ts +23 -0
  12. package/dist/admin/command/index.d.ts.map +1 -0
  13. package/dist/admin/command/index.js +23 -0
  14. package/dist/admin/command/index.js.map +1 -0
  15. package/dist/admin/command/invitations.d.ts +72 -0
  16. package/dist/admin/command/invitations.d.ts.map +1 -0
  17. package/dist/admin/command/invitations.js +241 -0
  18. package/dist/admin/command/invitations.js.map +1 -0
  19. package/dist/admin/command/permissions.d.ts +33 -0
  20. package/dist/admin/command/permissions.d.ts.map +1 -0
  21. package/dist/admin/command/permissions.js +67 -0
  22. package/dist/admin/command/permissions.js.map +1 -0
  23. package/dist/admin/command/pipeline.d.ts +79 -0
  24. package/dist/admin/command/pipeline.d.ts.map +1 -0
  25. package/dist/admin/command/pipeline.js +106 -0
  26. package/dist/admin/command/pipeline.js.map +1 -0
  27. package/dist/admin/command/policies.d.ts +50 -0
  28. package/dist/admin/command/policies.d.ts.map +1 -0
  29. package/dist/admin/command/policies.js +219 -0
  30. package/dist/admin/command/policies.js.map +1 -0
  31. package/dist/admin/command/service-accounts.d.ts +58 -0
  32. package/dist/admin/command/service-accounts.d.ts.map +1 -0
  33. package/dist/admin/command/service-accounts.js +272 -0
  34. package/dist/admin/command/service-accounts.js.map +1 -0
  35. package/dist/admin/command/service.d.ts +65 -0
  36. package/dist/admin/command/service.d.ts.map +1 -0
  37. package/dist/admin/command/service.js +128 -0
  38. package/dist/admin/command/service.js.map +1 -0
  39. package/dist/admin/command/tiers.d.ts +40 -0
  40. package/dist/admin/command/tiers.d.ts.map +1 -0
  41. package/dist/admin/command/tiers.js +79 -0
  42. package/dist/admin/command/tiers.js.map +1 -0
  43. package/dist/admin/index.d.ts +36 -0
  44. package/dist/admin/index.d.ts.map +1 -0
  45. package/dist/admin/index.js +63 -0
  46. package/dist/admin/index.js.map +1 -0
  47. package/dist/admin/ports.d.ts +288 -0
  48. package/dist/admin/ports.d.ts.map +1 -0
  49. package/dist/admin/ports.js +39 -0
  50. package/dist/admin/ports.js.map +1 -0
  51. package/dist/admin/query/audit-view.d.ts +52 -0
  52. package/dist/admin/query/audit-view.d.ts.map +1 -0
  53. package/dist/admin/query/audit-view.js +84 -0
  54. package/dist/admin/query/audit-view.js.map +1 -0
  55. package/dist/admin/query/catalog.d.ts +70 -0
  56. package/dist/admin/query/catalog.d.ts.map +1 -0
  57. package/dist/admin/query/catalog.js +169 -0
  58. package/dist/admin/query/catalog.js.map +1 -0
  59. package/dist/admin/query/explain.d.ts +52 -0
  60. package/dist/admin/query/explain.d.ts.map +1 -0
  61. package/dist/admin/query/explain.js +145 -0
  62. package/dist/admin/query/explain.js.map +1 -0
  63. package/dist/admin/query/index.d.ts +45 -0
  64. package/dist/admin/query/index.d.ts.map +1 -0
  65. package/dist/admin/query/index.js +58 -0
  66. package/dist/admin/query/index.js.map +1 -0
  67. package/dist/admin/query/simulate.d.ts +42 -0
  68. package/dist/admin/query/simulate.d.ts.map +1 -0
  69. package/dist/admin/query/simulate.js +91 -0
  70. package/dist/admin/query/simulate.js.map +1 -0
  71. package/dist/admin/safeguards-impl.d.ts +67 -0
  72. package/dist/admin/safeguards-impl.d.ts.map +1 -0
  73. package/dist/admin/safeguards-impl.js +318 -0
  74. package/dist/admin/safeguards-impl.js.map +1 -0
  75. package/dist/admin/safeguards.d.ts +89 -0
  76. package/dist/admin/safeguards.d.ts.map +1 -0
  77. package/dist/admin/safeguards.js +91 -0
  78. package/dist/admin/safeguards.js.map +1 -0
  79. package/dist/admin/types.d.ts +485 -0
  80. package/dist/admin/types.d.ts.map +1 -0
  81. package/dist/admin/types.js +38 -0
  82. package/dist/admin/types.js.map +1 -0
  83. package/dist/audit/audit-recorder.d.ts +129 -0
  84. package/dist/audit/audit-recorder.d.ts.map +1 -0
  85. package/dist/audit/audit-recorder.js +265 -0
  86. package/dist/audit/audit-recorder.js.map +1 -0
  87. package/dist/audit/canonicalize.d.ts +38 -0
  88. package/dist/audit/canonicalize.d.ts.map +1 -0
  89. package/dist/audit/canonicalize.js +174 -0
  90. package/dist/audit/canonicalize.js.map +1 -0
  91. package/dist/audit/errors.d.ts +56 -0
  92. package/dist/audit/errors.d.ts.map +1 -0
  93. package/dist/audit/errors.js +41 -0
  94. package/dist/audit/errors.js.map +1 -0
  95. package/dist/audit/index.d.ts +45 -0
  96. package/dist/audit/index.d.ts.map +1 -0
  97. package/dist/audit/index.js +24 -0
  98. package/dist/audit/index.js.map +1 -0
  99. package/dist/audit/ports.d.ts +131 -0
  100. package/dist/audit/ports.d.ts.map +1 -0
  101. package/dist/audit/ports.js +27 -0
  102. package/dist/audit/ports.js.map +1 -0
  103. package/dist/audit/sensitive.d.ts +68 -0
  104. package/dist/audit/sensitive.d.ts.map +1 -0
  105. package/dist/audit/sensitive.js +159 -0
  106. package/dist/audit/sensitive.js.map +1 -0
  107. package/dist/audit/walk.d.ts +109 -0
  108. package/dist/audit/walk.d.ts.map +1 -0
  109. package/dist/audit/walk.js +117 -0
  110. package/dist/audit/walk.js.map +1 -0
  111. package/dist/authentication/authenticator.d.ts +74 -0
  112. package/dist/authentication/authenticator.d.ts.map +1 -0
  113. package/dist/authentication/authenticator.js +208 -0
  114. package/dist/authentication/authenticator.js.map +1 -0
  115. package/dist/authentication/credential-resolver.d.ts +76 -0
  116. package/dist/authentication/credential-resolver.d.ts.map +1 -0
  117. package/dist/authentication/credential-resolver.js +21 -0
  118. package/dist/authentication/credential-resolver.js.map +1 -0
  119. package/dist/authentication/index.d.ts +52 -0
  120. package/dist/authentication/index.d.ts.map +1 -0
  121. package/dist/authentication/index.js +27 -0
  122. package/dist/authentication/index.js.map +1 -0
  123. package/dist/authentication/password-hasher.d.ts +41 -0
  124. package/dist/authentication/password-hasher.d.ts.map +1 -0
  125. package/dist/authentication/password-hasher.js +21 -0
  126. package/dist/authentication/password-hasher.js.map +1 -0
  127. package/dist/authentication/totp.d.ts +101 -0
  128. package/dist/authentication/totp.d.ts.map +1 -0
  129. package/dist/authentication/totp.js +151 -0
  130. package/dist/authentication/totp.js.map +1 -0
  131. package/dist/authorization/cross-tenant/grant-evaluator.d.ts +90 -0
  132. package/dist/authorization/cross-tenant/grant-evaluator.d.ts.map +1 -0
  133. package/dist/authorization/cross-tenant/grant-evaluator.js +165 -0
  134. package/dist/authorization/cross-tenant/grant-evaluator.js.map +1 -0
  135. package/dist/authorization/decision-authority.d.ts +212 -0
  136. package/dist/authorization/decision-authority.d.ts.map +1 -0
  137. package/dist/authorization/decision-authority.js +200 -0
  138. package/dist/authorization/decision-authority.js.map +1 -0
  139. package/dist/authorization/default-gates.d.ts +41 -0
  140. package/dist/authorization/default-gates.d.ts.map +1 -0
  141. package/dist/authorization/default-gates.js +47 -0
  142. package/dist/authorization/default-gates.js.map +1 -0
  143. package/dist/authorization/delegation/operation-identity.d.ts +132 -0
  144. package/dist/authorization/delegation/operation-identity.d.ts.map +1 -0
  145. package/dist/authorization/delegation/operation-identity.js +220 -0
  146. package/dist/authorization/delegation/operation-identity.js.map +1 -0
  147. package/dist/authorization/errors.d.ts +54 -0
  148. package/dist/authorization/errors.d.ts.map +1 -0
  149. package/dist/authorization/errors.js +63 -0
  150. package/dist/authorization/errors.js.map +1 -0
  151. package/dist/authorization/gates/object-type.d.ts +63 -0
  152. package/dist/authorization/gates/object-type.d.ts.map +1 -0
  153. package/dist/authorization/gates/object-type.js +177 -0
  154. package/dist/authorization/gates/object-type.js.map +1 -0
  155. package/dist/authorization/gates/tenant.d.ts +50 -0
  156. package/dist/authorization/gates/tenant.d.ts.map +1 -0
  157. package/dist/authorization/gates/tenant.js +87 -0
  158. package/dist/authorization/gates/tenant.js.map +1 -0
  159. package/dist/authorization/gates/wiring.d.ts +57 -0
  160. package/dist/authorization/gates/wiring.d.ts.map +1 -0
  161. package/dist/authorization/gates/wiring.js +56 -0
  162. package/dist/authorization/gates/wiring.js.map +1 -0
  163. package/dist/authorization/index.d.ts +136 -0
  164. package/dist/authorization/index.d.ts.map +1 -0
  165. package/dist/authorization/index.js +82 -0
  166. package/dist/authorization/index.js.map +1 -0
  167. package/dist/authorization/ports.d.ts +271 -0
  168. package/dist/authorization/ports.d.ts.map +1 -0
  169. package/dist/authorization/ports.js +36 -0
  170. package/dist/authorization/ports.js.map +1 -0
  171. package/dist/authorization/reason-codes.d.ts +75 -0
  172. package/dist/authorization/reason-codes.d.ts.map +1 -0
  173. package/dist/authorization/reason-codes.js +98 -0
  174. package/dist/authorization/reason-codes.js.map +1 -0
  175. package/dist/authorization/record/permit-tier.d.ts +57 -0
  176. package/dist/authorization/record/permit-tier.d.ts.map +1 -0
  177. package/dist/authorization/record/permit-tier.js +79 -0
  178. package/dist/authorization/record/permit-tier.js.map +1 -0
  179. package/dist/authorization/record/rule-evaluator.d.ts +116 -0
  180. package/dist/authorization/record/rule-evaluator.d.ts.map +1 -0
  181. package/dist/authorization/record/rule-evaluator.js +125 -0
  182. package/dist/authorization/record/rule-evaluator.js.map +1 -0
  183. package/dist/authorization/record/shares.d.ts +70 -0
  184. package/dist/authorization/record/shares.d.ts.map +1 -0
  185. package/dist/authorization/record/shares.js +107 -0
  186. package/dist/authorization/record/shares.js.map +1 -0
  187. package/dist/identity/broker.d.ts +59 -0
  188. package/dist/identity/broker.d.ts.map +1 -0
  189. package/dist/identity/broker.js +135 -0
  190. package/dist/identity/broker.js.map +1 -0
  191. package/dist/identity/claim-mapper.d.ts +84 -0
  192. package/dist/identity/claim-mapper.d.ts.map +1 -0
  193. package/dist/identity/claim-mapper.js +48 -0
  194. package/dist/identity/claim-mapper.js.map +1 -0
  195. package/dist/identity/index.d.ts +60 -0
  196. package/dist/identity/index.d.ts.map +1 -0
  197. package/dist/identity/index.js +24 -0
  198. package/dist/identity/index.js.map +1 -0
  199. package/dist/identity/internal-adapter.d.ts +54 -0
  200. package/dist/identity/internal-adapter.d.ts.map +1 -0
  201. package/dist/identity/internal-adapter.js +88 -0
  202. package/dist/identity/internal-adapter.js.map +1 -0
  203. package/dist/index.d.ts +43 -0
  204. package/dist/index.d.ts.map +1 -0
  205. package/dist/index.js +48 -0
  206. package/dist/index.js.map +1 -0
  207. package/dist/metadata/completeness.d.ts +136 -0
  208. package/dist/metadata/completeness.d.ts.map +1 -0
  209. package/dist/metadata/completeness.js +106 -0
  210. package/dist/metadata/completeness.js.map +1 -0
  211. package/dist/metadata/dependencies.d.ts +114 -0
  212. package/dist/metadata/dependencies.d.ts.map +1 -0
  213. package/dist/metadata/dependencies.js +105 -0
  214. package/dist/metadata/dependencies.js.map +1 -0
  215. package/dist/metadata/index.d.ts +153 -0
  216. package/dist/metadata/index.d.ts.map +1 -0
  217. package/dist/metadata/index.js +51 -0
  218. package/dist/metadata/index.js.map +1 -0
  219. package/dist/metadata/registry.d.ts +23 -0
  220. package/dist/metadata/registry.d.ts.map +1 -0
  221. package/dist/metadata/registry.js +204 -0
  222. package/dist/metadata/registry.js.map +1 -0
  223. package/dist/risk/evaluator.d.ts +76 -0
  224. package/dist/risk/evaluator.d.ts.map +1 -0
  225. package/dist/risk/evaluator.js +59 -0
  226. package/dist/risk/evaluator.js.map +1 -0
  227. package/dist/risk/index.d.ts +40 -0
  228. package/dist/risk/index.d.ts.map +1 -0
  229. package/dist/risk/index.js +20 -0
  230. package/dist/risk/index.js.map +1 -0
  231. package/dist/risk/risk-engine.d.ts +76 -0
  232. package/dist/risk/risk-engine.d.ts.map +1 -0
  233. package/dist/risk/risk-engine.js +287 -0
  234. package/dist/risk/risk-engine.js.map +1 -0
  235. package/dist/risk/signals.d.ts +60 -0
  236. package/dist/risk/signals.d.ts.map +1 -0
  237. package/dist/risk/signals.js +104 -0
  238. package/dist/risk/signals.js.map +1 -0
  239. package/dist/risk/thresholds.d.ts +54 -0
  240. package/dist/risk/thresholds.d.ts.map +1 -0
  241. package/dist/risk/thresholds.js +60 -0
  242. package/dist/risk/thresholds.js.map +1 -0
  243. package/dist/session/index.d.ts +47 -0
  244. package/dist/session/index.d.ts.map +1 -0
  245. package/dist/session/index.js +20 -0
  246. package/dist/session/index.js.map +1 -0
  247. package/dist/session/lifetimes.d.ts +50 -0
  248. package/dist/session/lifetimes.d.ts.map +1 -0
  249. package/dist/session/lifetimes.js +67 -0
  250. package/dist/session/lifetimes.js.map +1 -0
  251. package/dist/session/ports.d.ts +266 -0
  252. package/dist/session/ports.d.ts.map +1 -0
  253. package/dist/session/ports.js +23 -0
  254. package/dist/session/ports.js.map +1 -0
  255. package/dist/session/session-authority.d.ts +97 -0
  256. package/dist/session/session-authority.d.ts.map +1 -0
  257. package/dist/session/session-authority.js +393 -0
  258. package/dist/session/session-authority.js.map +1 -0
  259. package/package.json +32 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Admin QUERY engine — the **catalog read-model** (Team A, AC 1 / AC 6, §2 / §5.4).
3
+ *
4
+ * The human-readable permission catalog: the registry (`listActions()`) is the
5
+ * BASE; the {@link import('../ports.js').CatalogStore} curation overlay layers
6
+ * custom labels/groups on top; every entry is classified for the completeness
7
+ * view (§5.4):
8
+ * - `classified` — a live registry action (optionally curated).
9
+ * - `unclassified` — a live registry action the admin has NOT yet curated
10
+ * (newly-discovered → "needs attention," never silently open, AC 1).
11
+ * - `orphaned` — a curation that references a permission key NO live action
12
+ * derives (the operation was removed — drift to clean up, §5.4).
13
+ *
14
+ * ⛔ NO RAW IDENTIFIERS (ADR-0012). A display label is, in order of preference:
15
+ * 1. the curation's custom label (admin-authored human text), else
16
+ * 2. the {@link import('../ports.js').LabelResolver} label for the permission, else
17
+ * 3. a humanized form derived from the registry business keys.
18
+ * A raw route/path/uuid is NEVER emitted as display text. `permissionKey` is the
19
+ * stable identity carried for command inputs/correlation, not for display.
20
+ *
21
+ * ⛔ DATA-ABSENCE vs TRANSIENT: `catalogStore.getCuration` / `listGroups` return
22
+ * `null`/`[]` for a NORMAL miss (→ registry-derived label / no groups). A store
23
+ * that THROWS (genuinely unavailable) propagates — a fail-closed read (ADR-0016);
24
+ * we never swallow "down" into "no curation".
25
+ *
26
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
27
+ */
28
+ import type { PermissionKey } from '../../authorization/index.js';
29
+ import type { RegisteredAction } from '../../metadata/index.js';
30
+ import type { AdminQueryDeps } from '../admin-service.js';
31
+ import type { LabelResolver } from '../ports.js';
32
+ import type { CatalogCuration } from '../types.js';
33
+ import type { CatalogEntry } from '../types.js';
34
+ /**
35
+ * Humanize a stable business key (e.g. `create`, `work_order`, `assign_reviewer`)
36
+ * into human-readable display text (`Create`, `Work Order`, `Assign Reviewer`).
37
+ * PURE. Splits on `_`/`-`/`:` and camelCase boundaries, then Title-Cases. Used
38
+ * ONLY as the last-resort label when neither a curation nor a resolver label is
39
+ * available — it is human text derived from the key, NEVER a raw route/uuid.
40
+ */
41
+ export declare function humanizeKey(key: string): string;
42
+ /**
43
+ * The FULL catalog (AC 1 / §2): every live registry permission (classified or
44
+ * unclassified) PLUS any orphaned curations (drift), each label-resolved and
45
+ * classified. Ordered deterministically by permission key so the viewer paginates
46
+ * stably.
47
+ *
48
+ * ⛔ Reuses the registry as the base + the curation overlay; resolves every
49
+ * user-facing label via {@link LabelResolver}; emits NO raw route/uuid.
50
+ */
51
+ export declare function getCatalog(deps: AdminQueryDeps, tenantId: string): Promise<readonly CatalogEntry[]>;
52
+ /**
53
+ * Build one {@link CatalogEntry} for a permission key. `action` is the live
54
+ * registry action (or `undefined` for an orphaned key). Classification:
55
+ * - live action + curation present → `classified`
56
+ * - live action + NO curation → `unclassified` (needs attention)
57
+ * - NO live action (curation only) → `orphaned` (drift)
58
+ */
59
+ export declare function buildEntry(permissionKey: PermissionKey, action: RegisteredAction | undefined, curation: CatalogCuration | null, labels: LabelResolver, tenantId: string): Promise<CatalogEntry>;
60
+ /**
61
+ * Classify an explicit set of permission keys (e.g. the keys a set of grants
62
+ * references) against the live registry + curation overlay — the ORPHAN-detection
63
+ * path (§5.4). A key with NO live action is `orphaned` (drift); a live key with a
64
+ * curation is `classified`; a live uncurated key is `unclassified`. Returns one
65
+ * label-resolved {@link CatalogEntry} per key, deterministically ordered. Used by
66
+ * {@link import('./index.js')}'s `listUnclassified` to surface grant-referenced
67
+ * orphans the registry-only pass can't see.
68
+ */
69
+ export declare function classifyKnownKeys(deps: AdminQueryDeps, keys: readonly PermissionKey[], tenantId: string): Promise<readonly CatalogEntry[]>;
70
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/admin/query/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAEV,YAAY,EAEb,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa/C;AAiDD;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAwBlC;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,QAAQ,EAAE,eAAe,GAAG,IAAI,EAChC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CA+BvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAelC"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Admin QUERY engine — the **catalog read-model** (Team A, AC 1 / AC 6, §2 / §5.4).
3
+ *
4
+ * The human-readable permission catalog: the registry (`listActions()`) is the
5
+ * BASE; the {@link import('../ports.js').CatalogStore} curation overlay layers
6
+ * custom labels/groups on top; every entry is classified for the completeness
7
+ * view (§5.4):
8
+ * - `classified` — a live registry action (optionally curated).
9
+ * - `unclassified` — a live registry action the admin has NOT yet curated
10
+ * (newly-discovered → "needs attention," never silently open, AC 1).
11
+ * - `orphaned` — a curation that references a permission key NO live action
12
+ * derives (the operation was removed — drift to clean up, §5.4).
13
+ *
14
+ * ⛔ NO RAW IDENTIFIERS (ADR-0012). A display label is, in order of preference:
15
+ * 1. the curation's custom label (admin-authored human text), else
16
+ * 2. the {@link import('../ports.js').LabelResolver} label for the permission, else
17
+ * 3. a humanized form derived from the registry business keys.
18
+ * A raw route/path/uuid is NEVER emitted as display text. `permissionKey` is the
19
+ * stable identity carried for command inputs/correlation, not for display.
20
+ *
21
+ * ⛔ DATA-ABSENCE vs TRANSIENT: `catalogStore.getCuration` / `listGroups` return
22
+ * `null`/`[]` for a NORMAL miss (→ registry-derived label / no groups). A store
23
+ * that THROWS (genuinely unavailable) propagates — a fail-closed read (ADR-0016);
24
+ * we never swallow "down" into "no curation".
25
+ *
26
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
27
+ */
28
+ /**
29
+ * Humanize a stable business key (e.g. `create`, `work_order`, `assign_reviewer`)
30
+ * into human-readable display text (`Create`, `Work Order`, `Assign Reviewer`).
31
+ * PURE. Splits on `_`/`-`/`:` and camelCase boundaries, then Title-Cases. Used
32
+ * ONLY as the last-resort label when neither a curation nor a resolver label is
33
+ * available — it is human text derived from the key, NEVER a raw route/uuid.
34
+ */
35
+ export function humanizeKey(key) {
36
+ const words = key
37
+ // split camelCase / PascalCase boundaries
38
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
39
+ // treat separators as spaces
40
+ .split(/[\s_:-]+/u)
41
+ .filter((w) => w.length > 0);
42
+ if (words.length === 0) {
43
+ return key;
44
+ }
45
+ return words
46
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
47
+ .join(' ');
48
+ }
49
+ /**
50
+ * Resolve a permission's human display label. Preference order (no raw ids):
51
+ * curation label → {@link LabelResolver} → humanized registry action key. The
52
+ * resolver may THROW when the directory is unavailable — that propagates
53
+ * (fail-closed). A resolver that returns a value (including its own deleted/
54
+ * unknown FALLBACK) is used as-is; the resolver never returns a raw id.
55
+ */
56
+ async function resolvePermissionLabel(permissionKey, action, curation, labels, tenantId) {
57
+ if (curation?.label !== undefined && curation.label.length > 0) {
58
+ return curation.label;
59
+ }
60
+ // Ask the label chokepoint (ADR-0012). It ALWAYS returns a human label
61
+ // (a fallback for deleted/unknown), never the raw id; it THROWS only when the
62
+ // directory is genuinely unavailable (→ propagate, fail-closed).
63
+ const resolved = await labels.resolve('permission', permissionKey, tenantId);
64
+ if (resolved.length > 0 && resolved !== permissionKey) {
65
+ return resolved;
66
+ }
67
+ // Last resort: humanize the registry business keys (never the raw permissionKey
68
+ // string). An orphaned curation (no live action) has no keys to humanize → we
69
+ // fall back to the curation's own group text or a neutral placeholder.
70
+ if (action !== undefined) {
71
+ return `${humanizeKey(action.action.actionKey)} ${humanizeKey(action.action.typeKey)}`;
72
+ }
73
+ return '(unknown permission)';
74
+ }
75
+ /**
76
+ * Build the single {@link ActionEntry} for a registered action — its stable key
77
+ * (for command inputs), a humanized label, and its resolved tier. Since a
78
+ * permission key derives from `module:type:action`, each permission spans exactly
79
+ * one action; the entry's label is the humanized action verb.
80
+ */
81
+ function toActionEntry(action) {
82
+ return {
83
+ actionKey: action.action.actionKey,
84
+ label: humanizeKey(action.action.actionKey),
85
+ tier: action.tier,
86
+ };
87
+ }
88
+ /**
89
+ * The FULL catalog (AC 1 / §2): every live registry permission (classified or
90
+ * unclassified) PLUS any orphaned curations (drift), each label-resolved and
91
+ * classified. Ordered deterministically by permission key so the viewer paginates
92
+ * stably.
93
+ *
94
+ * ⛔ Reuses the registry as the base + the curation overlay; resolves every
95
+ * user-facing label via {@link LabelResolver}; emits NO raw route/uuid.
96
+ */
97
+ export async function getCatalog(deps, tenantId) {
98
+ const { registry, catalogStore, labels } = deps;
99
+ const actions = registry.listActions();
100
+ const entries = [];
101
+ // Live registry permissions — classified when curated, else unclassified
102
+ // ("needs attention," never silently open). ORPHAN drift (a curation/grant for
103
+ // a permission key the registry no longer derives) is reported via
104
+ // {@link classifyKnownKeys} — the read-side ports (CatalogStore/GrantStore)
105
+ // expose no "enumerate every curation" API, so an orphan is classified when a
106
+ // caller presents a specific dead key (e.g. from a grant enumeration). The full
107
+ // catalog here is the live registry surface + its curation overlay.
108
+ for (const action of actions) {
109
+ const curation = await catalogStore.getCuration(action.permissionKey);
110
+ entries.push(await buildEntry(action.permissionKey, action, curation, labels, tenantId));
111
+ }
112
+ // Deterministic ordering by the stable permission key.
113
+ entries.sort((x, y) => (x.permissionKey < y.permissionKey ? -1 : x.permissionKey > y.permissionKey ? 1 : 0));
114
+ return entries;
115
+ }
116
+ /**
117
+ * Build one {@link CatalogEntry} for a permission key. `action` is the live
118
+ * registry action (or `undefined` for an orphaned key). Classification:
119
+ * - live action + curation present → `classified`
120
+ * - live action + NO curation → `unclassified` (needs attention)
121
+ * - NO live action (curation only) → `orphaned` (drift)
122
+ */
123
+ export async function buildEntry(permissionKey, action, curation, labels, tenantId) {
124
+ const classification = action === undefined
125
+ ? 'orphaned'
126
+ : curation !== null
127
+ ? 'classified'
128
+ : 'unclassified';
129
+ const label = await resolvePermissionLabel(permissionKey, action, curation, labels, tenantId);
130
+ const tier = action?.tier ?? 'gated';
131
+ const actionEntries = action !== undefined ? [toActionEntry(action)] : [];
132
+ const group = curation?.group;
133
+ const base = {
134
+ permissionKey,
135
+ label,
136
+ tier,
137
+ actions: actionEntries,
138
+ classification,
139
+ };
140
+ return group !== undefined && group.length > 0
141
+ ? { ...base, group }
142
+ : base;
143
+ }
144
+ /**
145
+ * Classify an explicit set of permission keys (e.g. the keys a set of grants
146
+ * references) against the live registry + curation overlay — the ORPHAN-detection
147
+ * path (§5.4). A key with NO live action is `orphaned` (drift); a live key with a
148
+ * curation is `classified`; a live uncurated key is `unclassified`. Returns one
149
+ * label-resolved {@link CatalogEntry} per key, deterministically ordered. Used by
150
+ * {@link import('./index.js')}'s `listUnclassified` to surface grant-referenced
151
+ * orphans the registry-only pass can't see.
152
+ */
153
+ export async function classifyKnownKeys(deps, keys, tenantId) {
154
+ const { registry, catalogStore, labels } = deps;
155
+ const seen = new Set();
156
+ const entries = [];
157
+ for (const key of keys) {
158
+ if (seen.has(key)) {
159
+ continue;
160
+ }
161
+ seen.add(key);
162
+ const action = registry.resolveByPermissionKey(key);
163
+ const curation = await catalogStore.getCuration(key);
164
+ entries.push(await buildEntry(key, action, curation, labels, tenantId));
165
+ }
166
+ entries.sort((x, y) => (x.permissionKey < y.permissionKey ? -1 : x.permissionKey > y.permissionKey ? 1 : 0));
167
+ return entries;
168
+ }
169
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/admin/query/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAaH;;;;;;GAM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AE,CAAC;IACnC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,MAAM,MAAM,GAAG,QAAQ,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7G,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Admin QUERY engine — **effective-access explain** (Team A, AC 3 / AC 6, §2).
3
+ *
4
+ * "What can principal P do, and why." Enumerates P's effective grants (via
5
+ * {@link import('../ports.js').GrantStore.listGrants}) into human-readable
6
+ * {@link EffectiveGrant}s: a resolved permission label + the granted action subset
7
+ * + a PROSE conditions summary (never a raw expression). The principal is resolved
8
+ * to a label (never their raw id).
9
+ *
10
+ * ⛔ TRUTHFULNESS (AC 3 / ADR-0001): the explanation enumerates the grant FACTS —
11
+ * it does not fabricate a verdict. `decide()` remains the ONE decision path
12
+ * (simulate delegates to it); explain and simulate must never diverge. Explain
13
+ * reports what is granted; it does not re-derive access.
14
+ *
15
+ * ⛔ NO RAW IDENTIFIERS (ADR-0012): `principalLabel` + every grant `label` pass
16
+ * through {@link import('../ports.js').LabelResolver}; a deleted entity resolves to
17
+ * the resolver's fallback ("Deleted user"/"(unknown)"), NEVER the raw id. The
18
+ * conditions summary is guided-structure prose — no ids, no raw expression.
19
+ *
20
+ * ⛔ NO-LEAK (§7.5 / §13): explain reports the principal's OWN grants; it does not
21
+ * enumerate resources P cannot see. A grant names a permission + an action subset,
22
+ * not the existence of specific records.
23
+ *
24
+ * ⛔ DATA-ABSENCE vs TRANSIENT: `listGrants` → `[]` means "no grants" (a NORMAL
25
+ * empty explanation). A store that THROWS (unavailable) propagates — fail-closed.
26
+ *
27
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
28
+ */
29
+ import type { AdminQueryDeps } from '../admin-service.js';
30
+ import type { EffectiveAccess, PolicyCondition } from '../types.js';
31
+ /**
32
+ * Summarize a single guided condition into human prose. PURE. Never emits a raw
33
+ * expression or an id — it names the field + a phrasing + (for operand operators)
34
+ * a rendered value. `is_owner` → "records they own"; `status in [...]` →
35
+ * "status is one of open, closed".
36
+ */
37
+ export declare function summarizeCondition(condition: PolicyCondition): string;
38
+ /**
39
+ * Compose the prose conditions summary for a grant's conditions. Returns
40
+ * `undefined` when the grant is unconditional (so the type's optional field is
41
+ * omitted). Multiple conditions are AND-composed ("only where …, and …").
42
+ */
43
+ export declare function summarizeConditions(conditions: readonly PolicyCondition[] | undefined): string | undefined;
44
+ /**
45
+ * Effective-access explain for a principal (AC 3): enumerate P's grants in
46
+ * `tenantId` into human terms + the "why," with the principal resolved to a label.
47
+ *
48
+ * ⛔ Truthful by construction — reports the grant facts; the verdict path is
49
+ * `decide()` (simulate), never re-derived here.
50
+ */
51
+ export declare function explain(deps: AdminQueryDeps, principalId: string, tenantId: string): Promise<EffectiveAccess>;
52
+ //# sourceMappingURL=explain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../../src/admin/query/explain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EACV,eAAe,EAGf,eAAe,EAEhB,MAAM,aAAa,CAAC;AAgCrB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAarE;AAaD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,GACjD,MAAM,GAAG,SAAS,CAMpB;AAmCD;;;;;;GAMG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,cAAc,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CAmB1B"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Admin QUERY engine — **effective-access explain** (Team A, AC 3 / AC 6, §2).
3
+ *
4
+ * "What can principal P do, and why." Enumerates P's effective grants (via
5
+ * {@link import('../ports.js').GrantStore.listGrants}) into human-readable
6
+ * {@link EffectiveGrant}s: a resolved permission label + the granted action subset
7
+ * + a PROSE conditions summary (never a raw expression). The principal is resolved
8
+ * to a label (never their raw id).
9
+ *
10
+ * ⛔ TRUTHFULNESS (AC 3 / ADR-0001): the explanation enumerates the grant FACTS —
11
+ * it does not fabricate a verdict. `decide()` remains the ONE decision path
12
+ * (simulate delegates to it); explain and simulate must never diverge. Explain
13
+ * reports what is granted; it does not re-derive access.
14
+ *
15
+ * ⛔ NO RAW IDENTIFIERS (ADR-0012): `principalLabel` + every grant `label` pass
16
+ * through {@link import('../ports.js').LabelResolver}; a deleted entity resolves to
17
+ * the resolver's fallback ("Deleted user"/"(unknown)"), NEVER the raw id. The
18
+ * conditions summary is guided-structure prose — no ids, no raw expression.
19
+ *
20
+ * ⛔ NO-LEAK (§7.5 / §13): explain reports the principal's OWN grants; it does not
21
+ * enumerate resources P cannot see. A grant names a permission + an action subset,
22
+ * not the existence of specific records.
23
+ *
24
+ * ⛔ DATA-ABSENCE vs TRANSIENT: `listGrants` → `[]` means "no grants" (a NORMAL
25
+ * empty explanation). A store that THROWS (unavailable) propagates — fail-closed.
26
+ *
27
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
28
+ */
29
+ /**
30
+ * Human phrasings for each guided operator (prose, never a raw expression). A
31
+ * TOTAL record over the closed {@link PolicyOperator} union — adding a new
32
+ * operator to the union is a compile error here until it gets a phrasing.
33
+ */
34
+ const OPERATOR_PHRASE = {
35
+ eq: 'equals',
36
+ ne: 'is not',
37
+ in: 'is one of',
38
+ not_in: 'is not one of',
39
+ gt: 'is greater than',
40
+ lt: 'is less than',
41
+ gte: 'is at least',
42
+ lte: 'is at most',
43
+ contains: 'contains',
44
+ not_contains: 'does not contain',
45
+ is_null: 'is empty',
46
+ is_not_null: 'is set',
47
+ is_owner: 'they own',
48
+ is_not_owner: 'they do not own',
49
+ };
50
+ /** Operators that take NO operand — their prose omits the value. */
51
+ const OPERAND_LESS = new Set([
52
+ 'is_null',
53
+ 'is_not_null',
54
+ 'is_owner',
55
+ 'is_not_owner',
56
+ ]);
57
+ /**
58
+ * Summarize a single guided condition into human prose. PURE. Never emits a raw
59
+ * expression or an id — it names the field + a phrasing + (for operand operators)
60
+ * a rendered value. `is_owner` → "records they own"; `status in [...]` →
61
+ * "status is one of open, closed".
62
+ */
63
+ export function summarizeCondition(condition) {
64
+ const { field, operator, value } = condition;
65
+ const phrase = OPERATOR_PHRASE[operator] ?? String(operator);
66
+ if (operator === 'is_owner') {
67
+ return `records ${field} they own`;
68
+ }
69
+ if (operator === 'is_not_owner') {
70
+ return `records ${field} they do not own`;
71
+ }
72
+ if (OPERAND_LESS.has(operator)) {
73
+ return `${field} ${phrase}`;
74
+ }
75
+ return `${field} ${phrase} ${renderValue(value)}`;
76
+ }
77
+ /** Render a condition value as prose (arrays comma-joined; no ids leaked). */
78
+ function renderValue(value) {
79
+ if (Array.isArray(value)) {
80
+ return value.map((v) => String(v)).join(', ');
81
+ }
82
+ if (value === null || value === undefined) {
83
+ return '(none)';
84
+ }
85
+ return String(value);
86
+ }
87
+ /**
88
+ * Compose the prose conditions summary for a grant's conditions. Returns
89
+ * `undefined` when the grant is unconditional (so the type's optional field is
90
+ * omitted). Multiple conditions are AND-composed ("only where …, and …").
91
+ */
92
+ export function summarizeConditions(conditions) {
93
+ if (conditions === undefined || conditions.length === 0) {
94
+ return undefined;
95
+ }
96
+ const parts = conditions.map(summarizeCondition);
97
+ return `Only where ${parts.join(', and ')}`;
98
+ }
99
+ /**
100
+ * Resolve one {@link Grant} into a human-readable {@link EffectiveGrant}: the
101
+ * permission label (via the label chokepoint), the granted action subset, and the
102
+ * prose conditions summary. The resolver may THROW (unavailable) → propagate.
103
+ */
104
+ async function toEffectiveGrant(grant, labels, tenantId) {
105
+ const label = await resolvePermissionLabel(grant.permissionKey, labels, tenantId);
106
+ const summary = summarizeConditions(grant.conditions);
107
+ const base = {
108
+ label,
109
+ actions: [...grant.actions],
110
+ };
111
+ return summary !== undefined ? { ...base, conditionsSummary: summary } : base;
112
+ }
113
+ /**
114
+ * Resolve a permission key to its human label via the chokepoint. Always returns
115
+ * a label (the resolver's fallback for deleted/unknown), NEVER the raw key; throws
116
+ * only on a transient directory failure (→ propagate, fail-closed).
117
+ */
118
+ async function resolvePermissionLabel(permissionKey, labels, tenantId) {
119
+ const resolved = await labels.resolve('permission', permissionKey, tenantId);
120
+ return resolved.length > 0 ? resolved : '(unknown permission)';
121
+ }
122
+ /**
123
+ * Effective-access explain for a principal (AC 3): enumerate P's grants in
124
+ * `tenantId` into human terms + the "why," with the principal resolved to a label.
125
+ *
126
+ * ⛔ Truthful by construction — reports the grant facts; the verdict path is
127
+ * `decide()` (simulate), never re-derived here.
128
+ */
129
+ export async function explain(deps, principalId, tenantId) {
130
+ const { grantStore, labels } = deps;
131
+ // Resolve the principal to a human label (deleted → resolver fallback, never id).
132
+ const principalLabel = await labels.resolve('principal', principalId, tenantId);
133
+ // Enumerate the principal's grants ([] = no effective grants, a NORMAL result;
134
+ // a throw = unavailable → propagates fail-closed).
135
+ const grants = await grantStore.listGrants(principalId, tenantId);
136
+ const resolved = [];
137
+ for (const grant of grants) {
138
+ resolved.push(await toEffectiveGrant(grant, labels, tenantId));
139
+ }
140
+ return {
141
+ principalLabel: principalLabel.length > 0 ? principalLabel : '(unknown principal)',
142
+ grants: resolved,
143
+ };
144
+ }
145
+ //# sourceMappingURL=explain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explain.js","sourceRoot":"","sources":["../../../src/admin/query/explain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAaH;;;;GAIG;AACH,MAAM,eAAe,GAA6C;IAChE,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,WAAW;IACf,MAAM,EAAE,eAAe;IACvB,EAAE,EAAE,iBAAiB;IACrB,EAAE,EAAE,cAAc;IAClB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,kBAAkB;IAChC,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,iBAAiB;CAChC,CAAC;AAEF,oEAAoE;AACpE,MAAM,YAAY,GAAgC,IAAI,GAAG,CAAiB;IACxE,SAAS;IACT,aAAa;IACb,UAAU;IACV,cAAc;CACf,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA0B;IAC3D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;IAC7C,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7D,IAAI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IACjE,CAAC;IAED,OAAO;QACL,cAAc,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,qBAAqB;QAClF,MAAM,EAAE,QAAQ;KACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Admin QUERY engine — barrel (Team A, Layer 10).
3
+ *
4
+ * Re-exports the standalone query functions that back the frozen
5
+ * {@link import('../admin-service.js').AdminQueryService} interface. Each is a pure
6
+ * function of `(deps, …args)` — the integration owner composes them into
7
+ * `createAdminQueryService(deps)` (the prelude froze that factory; this team owns
8
+ * the bodies as standalone functions per the prelude instruction). Every function
9
+ * is read-only, label-resolved (no raw ids, ADR-0012), and — for `simulate` —
10
+ * routes through the ONE `decide()` (ADR-0001).
11
+ *
12
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
13
+ */
14
+ import type { AdminQueryService, AdminQueryDeps } from '../admin-service.js';
15
+ import type { CatalogEntry } from '../types.js';
16
+ export { getCatalog, buildEntry, classifyKnownKeys, humanizeKey, } from './catalog.js';
17
+ export { explain, summarizeCondition, summarizeConditions, } from './explain.js';
18
+ export { simulate, wrapDecision } from './simulate.js';
19
+ export { auditView, toViewEvent, deriveNextCursor } from './audit-view.js';
20
+ /**
21
+ * The catalog's "needs attention" subset (AC 1 / §5.4): the UNCLASSIFIED (live
22
+ * registry actions the admin has not curated) and ORPHANED (curation/grant drift)
23
+ * entries. A newly-discovered permission surfaces HERE, never silently open.
24
+ *
25
+ * ⛔ Ports scope: the read-side ports enumerate the registry (base) + per-key
26
+ * curation, so this reliably surfaces every UNCLASSIFIED live permission. ORPHAN
27
+ * drift (a curation/grant for a permission key the registry no longer derives)
28
+ * requires an enumeration API the frozen `CatalogStore`/`GrantStore` ports do NOT
29
+ * expose (no "list every curation" / tenant-wide grant sweep); such keys are
30
+ * classified on demand via `classifyKnownKeys(deps, keys, tenantId)` when a caller
31
+ * (e.g. the command side, over the keys it holds) presents them. This function
32
+ * returns the registry-derived unclassified subset — the portion the read ports
33
+ * can compute completely.
34
+ */
35
+ export declare function listUnclassified(deps: AdminQueryDeps, tenantId: string): Promise<readonly CatalogEntry[]>;
36
+ /**
37
+ * Assemble a concrete {@link AdminQueryService} from the standalone query
38
+ * functions. The prelude's `createAdminQueryService` returns a fail-closed
39
+ * skeleton it OWNS (frozen — Team A does not edit `admin-service.ts`); the
40
+ * integration owner wires THIS composition into that factory (or inlines these
41
+ * functions). Provided here so the wiring is a one-liner and the query bodies have
42
+ * a single composition point.
43
+ */
44
+ export declare function composeAdminQueryService(deps: AdminQueryDeps): AdminQueryService;
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/query/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,EACL,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAKlC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,cAAc,GACnB,iBAAiB,CAQnB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Admin QUERY engine — barrel (Team A, Layer 10).
3
+ *
4
+ * Re-exports the standalone query functions that back the frozen
5
+ * {@link import('../admin-service.js').AdminQueryService} interface. Each is a pure
6
+ * function of `(deps, …args)` — the integration owner composes them into
7
+ * `createAdminQueryService(deps)` (the prelude froze that factory; this team owns
8
+ * the bodies as standalone functions per the prelude instruction). Every function
9
+ * is read-only, label-resolved (no raw ids, ADR-0012), and — for `simulate` —
10
+ * routes through the ONE `decide()` (ADR-0001).
11
+ *
12
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
13
+ */
14
+ import { getCatalog } from './catalog.js';
15
+ import { explain } from './explain.js';
16
+ import { simulate } from './simulate.js';
17
+ import { auditView } from './audit-view.js';
18
+ export { getCatalog, buildEntry, classifyKnownKeys, humanizeKey, } from './catalog.js';
19
+ export { explain, summarizeCondition, summarizeConditions, } from './explain.js';
20
+ export { simulate, wrapDecision } from './simulate.js';
21
+ export { auditView, toViewEvent, deriveNextCursor } from './audit-view.js';
22
+ /**
23
+ * The catalog's "needs attention" subset (AC 1 / §5.4): the UNCLASSIFIED (live
24
+ * registry actions the admin has not curated) and ORPHANED (curation/grant drift)
25
+ * entries. A newly-discovered permission surfaces HERE, never silently open.
26
+ *
27
+ * ⛔ Ports scope: the read-side ports enumerate the registry (base) + per-key
28
+ * curation, so this reliably surfaces every UNCLASSIFIED live permission. ORPHAN
29
+ * drift (a curation/grant for a permission key the registry no longer derives)
30
+ * requires an enumeration API the frozen `CatalogStore`/`GrantStore` ports do NOT
31
+ * expose (no "list every curation" / tenant-wide grant sweep); such keys are
32
+ * classified on demand via `classifyKnownKeys(deps, keys, tenantId)` when a caller
33
+ * (e.g. the command side, over the keys it holds) presents them. This function
34
+ * returns the registry-derived unclassified subset — the portion the read ports
35
+ * can compute completely.
36
+ */
37
+ export async function listUnclassified(deps, tenantId) {
38
+ const catalog = await getCatalog(deps, tenantId);
39
+ return catalog.filter((e) => e.classification === 'unclassified' || e.classification === 'orphaned');
40
+ }
41
+ /**
42
+ * Assemble a concrete {@link AdminQueryService} from the standalone query
43
+ * functions. The prelude's `createAdminQueryService` returns a fail-closed
44
+ * skeleton it OWNS (frozen — Team A does not edit `admin-service.ts`); the
45
+ * integration owner wires THIS composition into that factory (or inlines these
46
+ * functions). Provided here so the wiring is a one-liner and the query bodies have
47
+ * a single composition point.
48
+ */
49
+ export function composeAdminQueryService(deps) {
50
+ return {
51
+ getCatalog: (tenantId) => getCatalog(deps, tenantId),
52
+ listUnclassified: (tenantId) => listUnclassified(deps, tenantId),
53
+ explain: (principalId, tenantId) => explain(deps, principalId, tenantId),
54
+ simulate: (request) => simulate(deps, request),
55
+ auditView: (query) => auditView(deps, query),
56
+ };
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/query/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAoB,EACpB,QAAgB;IAEhB,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,KAAK,cAAc,IAAI,CAAC,CAAC,cAAc,KAAK,UAAU,CAC9E,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAoB;IAEpB,OAAO;QACL,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC;QACpD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC;QAChE,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC;QACxE,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAC9C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC;KAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Admin QUERY engine — **simulate** (Team A, AC 2 — the one-decision-path AC).
3
+ *
4
+ * "Would principal P be allowed action A on resource R — and if not, which gate?"
5
+ *
6
+ * ⛔ THE ONE DECISION PATH (ADR-0001 / AC 2). `simulate` calls the injected
7
+ * {@link import('../../authorization/index.js').DecisionAuthority.decide} — the
8
+ * SINGLE real authority — and WRAPS the returned {@link Decision} into a
9
+ * {@link SimulateResult}. It NEVER re-implements, second-guesses, or overrides the
10
+ * verdict. The `effect`/`reason` mirror the decision verbatim; `decidingGate` +
11
+ * `explanation` are a human RENDERING of `decision.reason` for troubleshooting.
12
+ *
13
+ * ⛔ TRANSIENT: `decide()` THROWS `AuthorizationUnavailableError` when a downstream
14
+ * port is genuinely unavailable (ADR-0016). We DO NOT catch it — it propagates so
15
+ * the caller/SDK fails closed + retryable. Only a returned `Decision` is wrapped.
16
+ *
17
+ * ⛔ NO-LEAK (§7.5): the explanation is built from the frozen reason CODE, never
18
+ * from `decision.detail` (admin-only, may name a resource) and never from any raw
19
+ * id. It reveals only which gate settled the verdict, not resource existence.
20
+ *
21
+ * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
22
+ */
23
+ import type { Decision } from '../../authorization/index.js';
24
+ import type { AdminQueryDeps } from '../admin-service.js';
25
+ import type { SimulateRequest, SimulateResult } from '../types.js';
26
+ /**
27
+ * Wrap a verbatim {@link Decision} from `decide()` into a {@link SimulateResult}
28
+ * — mirroring effect/reason and adding the human deciding-gate + explanation
29
+ * derived from the reason code (no raw ids, no leak). PURE. Exported so the tester
30
+ * can assert the wrapping in isolation from the (spied) decision call.
31
+ */
32
+ export declare function wrapDecision(decision: Decision): SimulateResult;
33
+ /**
34
+ * Simulate a decision (AC 2). Forwards the EXACT request inputs to the ONE
35
+ * {@link import('../../authorization/index.js').DecisionAuthority.decide} and
36
+ * wraps its {@link Decision}. NEVER a second decision path.
37
+ *
38
+ * A thrown `AuthorizationUnavailableError` (transient) propagates unchanged
39
+ * (fail-closed + retryable); only a returned decision is wrapped.
40
+ */
41
+ export declare function simulate(deps: AdminQueryDeps, request: SimulateRequest): Promise<SimulateResult>;
42
+ //# sourceMappingURL=simulate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../../src/admin/query/simulate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,8BAA8B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoDnE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAS/D;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAQzB"}