@fuzdev/fuz_app 0.54.0 → 0.56.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 (348) hide show
  1. package/dist/actions/CLAUDE.md +214 -103
  2. package/dist/actions/action_bridge.d.ts +8 -5
  3. package/dist/actions/action_bridge.d.ts.map +1 -1
  4. package/dist/actions/action_bridge.js +1 -11
  5. package/dist/actions/action_codegen.d.ts +32 -0
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +35 -15
  8. package/dist/actions/action_registry.d.ts.map +1 -1
  9. package/dist/actions/action_registry.js +5 -2
  10. package/dist/actions/action_rpc.d.ts +141 -22
  11. package/dist/actions/action_rpc.d.ts.map +1 -1
  12. package/dist/actions/action_rpc.js +106 -187
  13. package/dist/actions/action_spec.d.ts +55 -16
  14. package/dist/actions/action_spec.d.ts.map +1 -1
  15. package/dist/actions/action_spec.js +16 -11
  16. package/dist/actions/action_types.d.ts +28 -60
  17. package/dist/actions/action_types.d.ts.map +1 -1
  18. package/dist/actions/action_types.js +13 -5
  19. package/dist/actions/broadcast_api.d.ts +2 -2
  20. package/dist/actions/broadcast_api.js +2 -2
  21. package/dist/actions/compile_action_registry.d.ts +50 -0
  22. package/dist/actions/compile_action_registry.d.ts.map +1 -0
  23. package/dist/actions/compile_action_registry.js +69 -0
  24. package/dist/actions/heartbeat.d.ts +8 -4
  25. package/dist/actions/heartbeat.d.ts.map +1 -1
  26. package/dist/actions/heartbeat.js +5 -4
  27. package/dist/actions/perform_action.d.ts +145 -0
  28. package/dist/actions/perform_action.d.ts.map +1 -0
  29. package/dist/actions/perform_action.js +258 -0
  30. package/dist/actions/register_action_ws.d.ts +46 -40
  31. package/dist/actions/register_action_ws.d.ts.map +1 -1
  32. package/dist/actions/register_action_ws.js +101 -159
  33. package/dist/actions/register_ws_endpoint.d.ts +15 -10
  34. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  35. package/dist/actions/register_ws_endpoint.js +54 -7
  36. package/dist/actions/transports.d.ts.map +1 -1
  37. package/dist/actions/transports.js +0 -4
  38. package/dist/actions/transports_ws_auth_guard.d.ts +1 -1
  39. package/dist/actions/transports_ws_auth_guard.js +1 -1
  40. package/dist/actions/transports_ws_backend.d.ts +1 -1
  41. package/dist/actions/transports_ws_backend.js +1 -1
  42. package/dist/auth/CLAUDE.md +794 -410
  43. package/dist/auth/account_action_specs.d.ts +28 -7
  44. package/dist/auth/account_action_specs.d.ts.map +1 -1
  45. package/dist/auth/account_action_specs.js +7 -7
  46. package/dist/auth/account_actions.d.ts +7 -13
  47. package/dist/auth/account_actions.d.ts.map +1 -1
  48. package/dist/auth/account_actions.js +26 -35
  49. package/dist/auth/account_queries.d.ts +52 -16
  50. package/dist/auth/account_queries.d.ts.map +1 -1
  51. package/dist/auth/account_queries.js +87 -38
  52. package/dist/auth/account_routes.d.ts +9 -11
  53. package/dist/auth/account_routes.d.ts.map +1 -1
  54. package/dist/auth/account_routes.js +118 -46
  55. package/dist/auth/account_schema.d.ts +46 -35
  56. package/dist/auth/account_schema.d.ts.map +1 -1
  57. package/dist/auth/account_schema.js +21 -28
  58. package/dist/auth/admin_action_specs.d.ts +100 -32
  59. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  60. package/dist/auth/admin_action_specs.js +64 -33
  61. package/dist/auth/admin_actions.d.ts +13 -19
  62. package/dist/auth/admin_actions.d.ts.map +1 -1
  63. package/dist/auth/admin_actions.js +37 -41
  64. package/dist/auth/audit_emitter.d.ts +160 -0
  65. package/dist/auth/audit_emitter.d.ts.map +1 -0
  66. package/dist/auth/audit_emitter.js +83 -0
  67. package/dist/auth/audit_log_queries.d.ts +17 -48
  68. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  69. package/dist/auth/audit_log_queries.js +20 -56
  70. package/dist/auth/audit_log_routes.d.ts +1 -1
  71. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  72. package/dist/auth/audit_log_routes.js +7 -3
  73. package/dist/auth/audit_log_schema.d.ts +92 -32
  74. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  75. package/dist/auth/audit_log_schema.js +75 -46
  76. package/dist/auth/auth_guard_resolver.d.ts +44 -0
  77. package/dist/auth/auth_guard_resolver.d.ts.map +1 -0
  78. package/dist/auth/auth_guard_resolver.js +56 -0
  79. package/dist/auth/bearer_auth.d.ts +9 -7
  80. package/dist/auth/bearer_auth.d.ts.map +1 -1
  81. package/dist/auth/bearer_auth.js +13 -21
  82. package/dist/auth/bootstrap_account.d.ts +7 -7
  83. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  84. package/dist/auth/bootstrap_account.js +7 -7
  85. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  86. package/dist/auth/bootstrap_routes.js +11 -10
  87. package/dist/auth/cleanup.d.ts +20 -26
  88. package/dist/auth/cleanup.d.ts.map +1 -1
  89. package/dist/auth/cleanup.js +33 -42
  90. package/dist/auth/credential_type_schema.d.ts +115 -0
  91. package/dist/auth/credential_type_schema.d.ts.map +1 -0
  92. package/dist/auth/credential_type_schema.js +127 -0
  93. package/dist/auth/daemon_token_middleware.d.ts +23 -11
  94. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  95. package/dist/auth/daemon_token_middleware.js +28 -22
  96. package/dist/auth/ddl.d.ts +2 -2
  97. package/dist/auth/ddl.d.ts.map +1 -1
  98. package/dist/auth/ddl.js +6 -6
  99. package/dist/auth/deps.d.ts +7 -18
  100. package/dist/auth/deps.d.ts.map +1 -1
  101. package/dist/auth/grant_path_schema.d.ts +117 -0
  102. package/dist/auth/grant_path_schema.d.ts.map +1 -0
  103. package/dist/auth/grant_path_schema.js +137 -0
  104. package/dist/auth/invite_queries.d.ts +12 -1
  105. package/dist/auth/invite_queries.d.ts.map +1 -1
  106. package/dist/auth/invite_queries.js +12 -1
  107. package/dist/auth/invite_schema.d.ts +1 -1
  108. package/dist/auth/invite_schema.d.ts.map +1 -1
  109. package/dist/auth/invite_schema.js +1 -1
  110. package/dist/auth/middleware.d.ts.map +1 -1
  111. package/dist/auth/middleware.js +9 -4
  112. package/dist/auth/migrations.d.ts +37 -14
  113. package/dist/auth/migrations.d.ts.map +1 -1
  114. package/dist/auth/migrations.js +79 -32
  115. package/dist/auth/request_context.d.ts +331 -61
  116. package/dist/auth/request_context.d.ts.map +1 -1
  117. package/dist/auth/request_context.js +378 -95
  118. package/dist/auth/{permit_offer_action_specs.d.ts → role_grant_offer_action_specs.d.ts} +163 -94
  119. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -0
  120. package/dist/auth/role_grant_offer_action_specs.js +262 -0
  121. package/dist/auth/role_grant_offer_actions.d.ts +104 -0
  122. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -0
  123. package/dist/auth/role_grant_offer_actions.js +473 -0
  124. package/dist/auth/{permit_offer_notifications.d.ts → role_grant_offer_notifications.d.ts} +90 -70
  125. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -0
  126. package/dist/auth/role_grant_offer_notifications.js +182 -0
  127. package/dist/auth/role_grant_offer_queries.d.ts +242 -0
  128. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -0
  129. package/dist/auth/role_grant_offer_queries.js +533 -0
  130. package/dist/auth/role_grant_offer_schema.d.ts +150 -0
  131. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -0
  132. package/dist/auth/{permit_offer_schema.js → role_grant_offer_schema.js} +60 -36
  133. package/dist/auth/role_grant_queries.d.ts +231 -0
  134. package/dist/auth/role_grant_queries.d.ts.map +1 -0
  135. package/dist/auth/role_grant_queries.js +320 -0
  136. package/dist/auth/role_schema.d.ts +150 -40
  137. package/dist/auth/role_schema.d.ts.map +1 -1
  138. package/dist/auth/role_schema.js +144 -45
  139. package/dist/auth/scope_kind_schema.d.ts +96 -0
  140. package/dist/auth/scope_kind_schema.d.ts.map +1 -0
  141. package/dist/auth/scope_kind_schema.js +94 -0
  142. package/dist/auth/self_service_role_action_specs.d.ts +6 -1
  143. package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
  144. package/dist/auth/self_service_role_action_specs.js +3 -1
  145. package/dist/auth/self_service_role_actions.d.ts +34 -27
  146. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  147. package/dist/auth/self_service_role_actions.js +68 -48
  148. package/dist/auth/session_cookie.d.ts +43 -6
  149. package/dist/auth/session_cookie.d.ts.map +1 -1
  150. package/dist/auth/session_cookie.js +31 -5
  151. package/dist/auth/session_middleware.d.ts +37 -3
  152. package/dist/auth/session_middleware.d.ts.map +1 -1
  153. package/dist/auth/session_middleware.js +33 -7
  154. package/dist/auth/signup_routes.d.ts.map +1 -1
  155. package/dist/auth/signup_routes.js +48 -19
  156. package/dist/auth/standard_action_specs.d.ts +2 -2
  157. package/dist/auth/standard_action_specs.js +4 -4
  158. package/dist/auth/standard_rpc_actions.d.ts +23 -19
  159. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  160. package/dist/auth/standard_rpc_actions.js +12 -12
  161. package/dist/db/migrate.d.ts +12 -8
  162. package/dist/db/migrate.d.ts.map +1 -1
  163. package/dist/db/migrate.js +10 -7
  164. package/dist/dev/setup.d.ts +2 -2
  165. package/dist/dev/setup.d.ts.map +1 -1
  166. package/dist/dev/setup.js +9 -7
  167. package/dist/env/load.d.ts +1 -1
  168. package/dist/env/load.js +1 -1
  169. package/dist/hono_context.d.ts +64 -5
  170. package/dist/hono_context.d.ts.map +1 -1
  171. package/dist/hono_context.js +38 -2
  172. package/dist/http/CLAUDE.md +264 -87
  173. package/dist/http/auth_shape.d.ts +191 -0
  174. package/dist/http/auth_shape.d.ts.map +1 -0
  175. package/dist/http/auth_shape.js +237 -0
  176. package/dist/http/common_routes.js +3 -3
  177. package/dist/http/db_routes.d.ts +4 -0
  178. package/dist/http/db_routes.d.ts.map +1 -1
  179. package/dist/http/db_routes.js +44 -7
  180. package/dist/http/error_schemas.d.ts +132 -19
  181. package/dist/http/error_schemas.d.ts.map +1 -1
  182. package/dist/http/error_schemas.js +132 -40
  183. package/dist/http/jsonrpc_errors.d.ts +27 -2
  184. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  185. package/dist/http/jsonrpc_errors.js +26 -2
  186. package/dist/http/pending_effects.d.ts +71 -18
  187. package/dist/http/pending_effects.d.ts.map +1 -1
  188. package/dist/http/pending_effects.js +87 -18
  189. package/dist/http/proxy.d.ts +52 -5
  190. package/dist/http/proxy.d.ts.map +1 -1
  191. package/dist/http/proxy.js +92 -14
  192. package/dist/http/route_spec.d.ts +113 -41
  193. package/dist/http/route_spec.d.ts.map +1 -1
  194. package/dist/http/route_spec.js +130 -52
  195. package/dist/http/schema_helpers.d.ts +3 -2
  196. package/dist/http/schema_helpers.d.ts.map +1 -1
  197. package/dist/http/schema_helpers.js +9 -2
  198. package/dist/http/surface.d.ts +2 -1
  199. package/dist/http/surface.d.ts.map +1 -1
  200. package/dist/http/surface.js +1 -2
  201. package/dist/http/surface_query.d.ts +39 -35
  202. package/dist/http/surface_query.d.ts.map +1 -1
  203. package/dist/http/surface_query.js +79 -36
  204. package/dist/primitive_schemas.d.ts +39 -0
  205. package/dist/primitive_schemas.d.ts.map +1 -0
  206. package/dist/primitive_schemas.js +40 -0
  207. package/dist/realtime/sse_auth_guard.d.ts +5 -5
  208. package/dist/realtime/sse_auth_guard.js +9 -9
  209. package/dist/runtime/mock.d.ts +1 -1
  210. package/dist/runtime/mock.js +1 -1
  211. package/dist/server/app_backend.d.ts +14 -11
  212. package/dist/server/app_backend.d.ts.map +1 -1
  213. package/dist/server/app_backend.js +12 -8
  214. package/dist/server/app_server.d.ts +7 -7
  215. package/dist/server/app_server.d.ts.map +1 -1
  216. package/dist/server/app_server.js +36 -31
  217. package/dist/server/validate_nginx.d.ts +1 -1
  218. package/dist/server/validate_nginx.js +1 -1
  219. package/dist/testing/CLAUDE.md +73 -55
  220. package/dist/testing/admin_integration.d.ts +5 -6
  221. package/dist/testing/admin_integration.d.ts.map +1 -1
  222. package/dist/testing/admin_integration.js +100 -96
  223. package/dist/testing/adversarial_headers.js +1 -1
  224. package/dist/testing/app_server.d.ts +11 -14
  225. package/dist/testing/app_server.d.ts.map +1 -1
  226. package/dist/testing/app_server.js +18 -17
  227. package/dist/testing/assertions.d.ts.map +1 -1
  228. package/dist/testing/assertions.js +2 -1
  229. package/dist/testing/attack_surface.d.ts.map +1 -1
  230. package/dist/testing/attack_surface.js +15 -9
  231. package/dist/testing/audit_completeness.d.ts +2 -2
  232. package/dist/testing/audit_completeness.d.ts.map +1 -1
  233. package/dist/testing/audit_completeness.js +53 -39
  234. package/dist/testing/auth_apps.d.ts +5 -4
  235. package/dist/testing/auth_apps.d.ts.map +1 -1
  236. package/dist/testing/auth_apps.js +28 -22
  237. package/dist/testing/data_exposure.d.ts.map +1 -1
  238. package/dist/testing/data_exposure.js +5 -5
  239. package/dist/testing/db.d.ts +1 -1
  240. package/dist/testing/db.d.ts.map +1 -1
  241. package/dist/testing/db.js +4 -4
  242. package/dist/testing/db_entities.d.ts +22 -0
  243. package/dist/testing/db_entities.d.ts.map +1 -0
  244. package/dist/testing/db_entities.js +28 -0
  245. package/dist/testing/entities.d.ts +10 -8
  246. package/dist/testing/entities.d.ts.map +1 -1
  247. package/dist/testing/entities.js +22 -18
  248. package/dist/testing/integration.d.ts.map +1 -1
  249. package/dist/testing/integration.js +13 -14
  250. package/dist/testing/integration_helpers.d.ts +8 -6
  251. package/dist/testing/integration_helpers.d.ts.map +1 -1
  252. package/dist/testing/integration_helpers.js +29 -23
  253. package/dist/testing/middleware.d.ts +15 -11
  254. package/dist/testing/middleware.d.ts.map +1 -1
  255. package/dist/testing/middleware.js +75 -32
  256. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  257. package/dist/testing/rpc_attack_surface.js +40 -24
  258. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  259. package/dist/testing/rpc_helpers.js +3 -1
  260. package/dist/testing/rpc_round_trip.d.ts +1 -1
  261. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  262. package/dist/testing/rpc_round_trip.js +14 -13
  263. package/dist/testing/sse_round_trip.d.ts +3 -4
  264. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  265. package/dist/testing/sse_round_trip.js +7 -11
  266. package/dist/testing/standard.d.ts +1 -1
  267. package/dist/testing/stubs.d.ts +25 -0
  268. package/dist/testing/stubs.d.ts.map +1 -1
  269. package/dist/testing/stubs.js +43 -2
  270. package/dist/testing/surface_invariants.d.ts +2 -2
  271. package/dist/testing/ws_round_trip.d.ts +12 -13
  272. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  273. package/dist/testing/ws_round_trip.js +24 -12
  274. package/dist/ui/AdminAccounts.svelte +23 -20
  275. package/dist/ui/AdminOverview.svelte +15 -13
  276. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  277. package/dist/ui/{AdminPermitHistory.svelte → AdminRoleGrantHistory.svelte} +12 -12
  278. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts +4 -0
  279. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -0
  280. package/dist/ui/BootstrapForm.svelte +1 -1
  281. package/dist/ui/CLAUDE.md +65 -59
  282. package/dist/ui/{PermitOfferForm.svelte → RoleGrantOfferForm.svelte} +37 -22
  283. package/dist/ui/RoleGrantOfferForm.svelte.d.ts +20 -0
  284. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -0
  285. package/dist/ui/{PermitOfferHistory.svelte → RoleGrantOfferHistory.svelte} +12 -12
  286. package/dist/ui/{PermitOfferHistory.svelte.d.ts → RoleGrantOfferHistory.svelte.d.ts} +4 -4
  287. package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -0
  288. package/dist/ui/{PermitOfferInbox.svelte → RoleGrantOfferInbox.svelte} +14 -14
  289. package/dist/ui/{PermitOfferInbox.svelte.d.ts → RoleGrantOfferInbox.svelte.d.ts} +4 -4
  290. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -0
  291. package/dist/ui/SignupForm.svelte +1 -1
  292. package/dist/ui/SurfaceExplorer.svelte +35 -15
  293. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  294. package/dist/ui/account_sessions_state.svelte.d.ts +2 -3
  295. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  296. package/dist/ui/account_sessions_state.svelte.js +2 -3
  297. package/dist/ui/admin_accounts_state.svelte.d.ts +25 -18
  298. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  299. package/dist/ui/admin_accounts_state.svelte.js +28 -17
  300. package/dist/ui/admin_rpc_adapters.d.ts +20 -20
  301. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  302. package/dist/ui/admin_rpc_adapters.js +17 -17
  303. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  304. package/dist/ui/admin_sessions_state.svelte.js +2 -2
  305. package/dist/ui/audit_log_state.svelte.d.ts +7 -7
  306. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  307. package/dist/ui/audit_log_state.svelte.js +6 -6
  308. package/dist/ui/auth_state.svelte.d.ts +3 -3
  309. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  310. package/dist/ui/auth_state.svelte.js +6 -6
  311. package/dist/ui/format_scope.d.ts +2 -2
  312. package/dist/ui/format_scope.js +2 -2
  313. package/dist/ui/{permit_offers_state.svelte.d.ts → role_grant_offers_state.svelte.d.ts} +39 -31
  314. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -0
  315. package/dist/ui/{permit_offers_state.svelte.js → role_grant_offers_state.svelte.js} +25 -19
  316. package/dist/ui/ui_format.js +2 -2
  317. package/package.json +3 -3
  318. package/dist/auth/permit_offer_action_specs.d.ts.map +0 -1
  319. package/dist/auth/permit_offer_action_specs.js +0 -227
  320. package/dist/auth/permit_offer_actions.d.ts +0 -110
  321. package/dist/auth/permit_offer_actions.d.ts.map +0 -1
  322. package/dist/auth/permit_offer_actions.js +0 -452
  323. package/dist/auth/permit_offer_notifications.d.ts.map +0 -1
  324. package/dist/auth/permit_offer_notifications.js +0 -182
  325. package/dist/auth/permit_offer_queries.d.ts +0 -183
  326. package/dist/auth/permit_offer_queries.d.ts.map +0 -1
  327. package/dist/auth/permit_offer_queries.js +0 -408
  328. package/dist/auth/permit_offer_schema.d.ts +0 -103
  329. package/dist/auth/permit_offer_schema.d.ts.map +0 -1
  330. package/dist/auth/permit_queries.d.ts +0 -210
  331. package/dist/auth/permit_queries.d.ts.map +0 -1
  332. package/dist/auth/permit_queries.js +0 -294
  333. package/dist/auth/require_keeper.d.ts +0 -20
  334. package/dist/auth/require_keeper.d.ts.map +0 -1
  335. package/dist/auth/require_keeper.js +0 -35
  336. package/dist/auth/route_guards.d.ts +0 -21
  337. package/dist/auth/route_guards.d.ts.map +0 -1
  338. package/dist/auth/route_guards.js +0 -32
  339. package/dist/auth/session_lifecycle.d.ts +0 -37
  340. package/dist/auth/session_lifecycle.d.ts.map +0 -1
  341. package/dist/auth/session_lifecycle.js +0 -29
  342. package/dist/ui/AdminPermitHistory.svelte.d.ts +0 -4
  343. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +0 -1
  344. package/dist/ui/PermitOfferForm.svelte.d.ts +0 -14
  345. package/dist/ui/PermitOfferForm.svelte.d.ts.map +0 -1
  346. package/dist/ui/PermitOfferHistory.svelte.d.ts.map +0 -1
  347. package/dist/ui/PermitOfferInbox.svelte.d.ts.map +0 -1
  348. package/dist/ui/permit_offers_state.svelte.d.ts.map +0 -1
@@ -32,14 +32,11 @@ export type AccountStatusInput = z.infer<typeof AccountStatusInput>;
32
32
  /**
33
33
  * Output for `GET /api/account/status` on the authenticated path.
34
34
  *
35
- * `account` and `actor` are the caller's own identity entities (v1 is 1:1
36
- * account/actor, but `actor` is first-class so consumers don't have to
37
- * derive `actor_id` from the permit list). Permits are already
38
- * active-filtered by `build_request_context` via
39
- * `query_permit_find_active_for_actor` `revoked_at` / `revoked_by` /
40
- * `revoked_reason` are never populated here, so `PermitSummaryJson`
41
- * carries the fields a client actually needs (including `scope_id` for
42
- * per-scope auth decisions).
35
+ * `account` is always populated for authenticated callers. `actor` and
36
+ * `role_grants` are populated when the caller's account has a unique actor or
37
+ * the request supplies `?acting=<actor_id>`; on multi-actor accounts
38
+ * without an `acting` query, `actor` is `null` and `role_grants` is empty so
39
+ * the frontend can show a persona picker without a separate roundtrip.
43
40
  */
44
41
  export declare const AccountStatusOutput: z.ZodObject<{
45
42
  account: z.ZodObject<{
@@ -49,13 +46,14 @@ export declare const AccountStatusOutput: z.ZodObject<{
49
46
  email_verified: z.ZodBoolean;
50
47
  created_at: z.ZodString;
51
48
  }, z.core.$strict>;
52
- actor: z.ZodObject<{
49
+ actor: z.ZodNullable<z.ZodObject<{
53
50
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
54
51
  name: z.ZodString;
55
- }, z.core.$strict>;
56
- permits: z.ZodArray<z.ZodObject<{
52
+ }, z.core.$strict>>;
53
+ role_grants: z.ZodArray<z.ZodObject<{
57
54
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
58
55
  role: z.ZodString;
56
+ scope_kind: z.ZodNullable<z.ZodString>;
59
57
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
60
58
  created_at: z.ZodString;
61
59
  expires_at: z.ZodNullable<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"account_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAsBxD,OAAO,EAAkB,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAA+B,KAAK,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAElF,OAAO,KAAK,EAAC,gBAAgB,EAAC,M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,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,GACtC,MAAM,gBAAgB,EACtB,SAAS,mBAAmB,KAC1B,KAAK,CAAC,SAAS,CA0PjB,CAAC"}
@@ -22,14 +22,14 @@
22
22
  * @module
23
23
  */
24
24
  import { z } from 'zod';
25
- import { clear_session_cookie } from './session_middleware.js';
26
- import { create_session_and_set_cookie } from './session_lifecycle.js';
27
- import { ActorSummaryJson, PermitSummaryJson, SessionAccountJson, to_session_account, UsernameProvided, } from './account_schema.js';
25
+ import { clear_session_cookie, create_session_and_set_cookie } from './session_middleware.js';
26
+ import { ActorSummaryJson, RoleGrantSummaryJson, SessionAccountJson, to_session_account, } from './account_schema.js';
27
+ import { UsernameProvided } from '../primitive_schemas.js';
28
28
  import { hash_session_token, query_session_revoke_all_for_account, query_session_revoke_by_hash_unscoped, } from './session_queries.js';
29
29
  import { query_account_by_username_or_email, query_update_account_password, } from './account_queries.js';
30
30
  import { query_revoke_all_api_tokens_for_account } from './api_token_queries.js';
31
- import { audit_log_fire_and_forget } from './audit_log_queries.js';
32
- import { get_request_context, require_request_context } from './request_context.js';
31
+ import { build_account_context, build_request_context, get_request_context, require_request_context, resolve_acting_actor, } from './request_context.js';
32
+ import { ACCOUNT_ID_KEY } from '../hono_context.js';
33
33
  import { get_route_input } from '../http/route_spec.js';
34
34
  import { get_client_ip } from '../http/proxy.js';
35
35
  import { rate_limit_exceeded_response } from '../rate_limiter.js';
@@ -40,19 +40,16 @@ export const AccountStatusInput = z.null();
40
40
  /**
41
41
  * Output for `GET /api/account/status` on the authenticated path.
42
42
  *
43
- * `account` and `actor` are the caller's own identity entities (v1 is 1:1
44
- * account/actor, but `actor` is first-class so consumers don't have to
45
- * derive `actor_id` from the permit list). Permits are already
46
- * active-filtered by `build_request_context` via
47
- * `query_permit_find_active_for_actor` `revoked_at` / `revoked_by` /
48
- * `revoked_reason` are never populated here, so `PermitSummaryJson`
49
- * carries the fields a client actually needs (including `scope_id` for
50
- * per-scope auth decisions).
43
+ * `account` is always populated for authenticated callers. `actor` and
44
+ * `role_grants` are populated when the caller's account has a unique actor or
45
+ * the request supplies `?acting=<actor_id>`; on multi-actor accounts
46
+ * without an `acting` query, `actor` is `null` and `role_grants` is empty so
47
+ * the frontend can show a persona picker without a separate roundtrip.
51
48
  */
52
49
  export const AccountStatusOutput = z.strictObject({
53
50
  account: SessionAccountJson,
54
- actor: ActorSummaryJson,
55
- permits: z.array(PermitSummaryJson),
51
+ actor: ActorSummaryJson.nullable(),
52
+ role_grants: z.array(RoleGrantSummaryJson),
56
53
  });
57
54
  /** Error body for `GET /api/account/status` on the unauthenticated path. */
58
55
  export const AccountStatusUnauthenticatedError = z.looseObject({
@@ -75,34 +72,79 @@ export const AccountStatusUnauthenticatedError = z.looseObject({
75
72
  export const create_account_status_route_spec = (options) => ({
76
73
  method: 'GET',
77
74
  path: options?.path ?? '/api/account/status',
78
- auth: { type: 'none' },
75
+ auth: { account: 'none', actor: 'none' },
79
76
  description: 'Current account info (unauthenticated: 401 with bootstrap status)',
80
77
  input: AccountStatusInput,
81
78
  output: AccountStatusOutput,
82
79
  errors: {
83
80
  401: AccountStatusUnauthenticatedError,
84
81
  },
85
- handler: (c) => {
86
- const ctx = get_request_context(c);
87
- if (ctx) {
88
- const permits = ctx.permits.map((p) => ({
82
+ handler: async (c, route) => {
83
+ const account_id = c.get(ACCOUNT_ID_KEY) ?? null;
84
+ if (!account_id) {
85
+ return c.json({
86
+ error: ERROR_AUTHENTICATION_REQUIRED,
87
+ ...(options?.bootstrap_status?.available ? { bootstrap_available: true } : {}),
88
+ }, 401);
89
+ }
90
+ // Honor a pre-populated request context. The dispatcher's authorization
91
+ // phase doesn't run for `auth: 'none'` routes, but a caller (test
92
+ // harness, or future middleware) may still populate the context — use
93
+ // it directly to avoid redundant lookups.
94
+ const existing = get_request_context(c);
95
+ if (existing && existing.account.id === account_id) {
96
+ const role_grants = existing.role_grants.map((p) => ({
89
97
  id: p.id,
90
98
  role: p.role,
99
+ scope_kind: p.scope_kind,
91
100
  scope_id: p.scope_id,
92
101
  created_at: p.created_at,
93
102
  expires_at: p.expires_at,
94
103
  granted_by: p.granted_by,
95
104
  }));
96
105
  return c.json({
97
- account: to_session_account(ctx.account),
98
- actor: { id: ctx.actor.id, name: ctx.actor.name },
99
- permits,
106
+ account: to_session_account(existing.account),
107
+ actor: existing.actor ? { id: existing.actor.id, name: existing.actor.name } : null,
108
+ role_grants,
100
109
  });
101
110
  }
111
+ // Resolve actor + role_grants when the caller is unambiguous (single-actor
112
+ // account, or supplied `?acting=<uuid>`). On multi-actor accounts
113
+ // without `acting`, fall back to account-only so the frontend can
114
+ // surface a persona picker.
115
+ const acting = c.req.query('acting') ?? undefined;
116
+ const acting_result = await resolve_acting_actor(route, account_id, acting);
117
+ if (acting_result.ok) {
118
+ const ctx = await build_request_context(route, account_id, acting_result.actor_id);
119
+ if (ctx) {
120
+ const role_grants = ctx.role_grants.map((p) => ({
121
+ id: p.id,
122
+ role: p.role,
123
+ scope_kind: p.scope_kind,
124
+ scope_id: p.scope_id,
125
+ created_at: p.created_at,
126
+ expires_at: p.expires_at,
127
+ granted_by: p.granted_by,
128
+ }));
129
+ return c.json({
130
+ account: to_session_account(ctx.account),
131
+ actor: { id: ctx.actor.id, name: ctx.actor.name },
132
+ role_grants,
133
+ });
134
+ }
135
+ }
136
+ const account_ctx = await build_account_context(route, account_id);
137
+ if (!account_ctx) {
138
+ return c.json({
139
+ error: ERROR_AUTHENTICATION_REQUIRED,
140
+ ...(options?.bootstrap_status?.available ? { bootstrap_available: true } : {}),
141
+ }, 401);
142
+ }
102
143
  return c.json({
103
- error: ERROR_AUTHENTICATION_REQUIRED,
104
- ...(options?.bootstrap_status?.available ? { bootstrap_available: true } : {}),
105
- }, 401);
144
+ account: to_session_account(account_ctx.account),
145
+ actor: null,
146
+ role_grants: [],
147
+ });
106
148
  },
107
149
  });
108
150
  /** Default maximum sessions per account. */
@@ -180,7 +222,7 @@ export const create_account_route_specs = (deps, options) => {
180
222
  {
181
223
  method: 'GET',
182
224
  path: '/verify',
183
- auth: { type: 'authenticated' },
225
+ auth: { account: 'required', actor: 'none' },
184
226
  description: 'Session-validity probe for nginx auth_request (empty body, 200 or 401)',
185
227
  input: z.null(),
186
228
  output: z.null(),
@@ -192,7 +234,7 @@ export const create_account_route_specs = (deps, options) => {
192
234
  {
193
235
  method: 'POST',
194
236
  path: '/login',
195
- auth: { type: 'none' },
237
+ auth: { account: 'none', actor: 'none' },
196
238
  description: 'Exchange credentials for session',
197
239
  input: LoginInput,
198
240
  output: LoginOutput,
@@ -238,12 +280,12 @@ export const create_account_route_specs = (deps, options) => {
238
280
  ip_rate_limiter.record(ip);
239
281
  if (login_account_rate_limiter)
240
282
  login_account_rate_limiter.record(account_rate_key);
241
- void audit_log_fire_and_forget(route, {
283
+ deps.audit.emit(route, {
242
284
  event_type: 'login',
243
285
  outcome: 'failure',
244
286
  ip: get_client_ip(c),
245
287
  metadata: { username },
246
- }, deps);
288
+ });
247
289
  await delay;
248
290
  return c.json({ error: ERROR_INVALID_CREDENTIALS }, 401);
249
291
  }
@@ -253,13 +295,13 @@ export const create_account_route_specs = (deps, options) => {
253
295
  ip_rate_limiter.record(ip);
254
296
  if (login_account_rate_limiter)
255
297
  login_account_rate_limiter.record(account_rate_key);
256
- void audit_log_fire_and_forget(route, {
298
+ deps.audit.emit(route, {
257
299
  event_type: 'login',
258
300
  outcome: 'failure',
259
301
  account_id: account.id,
260
302
  ip: get_client_ip(c),
261
303
  metadata: { username },
262
- }, deps);
304
+ });
263
305
  await delay;
264
306
  return c.json({ error: ERROR_INVALID_CREDENTIALS }, 401);
265
307
  }
@@ -276,18 +318,18 @@ export const create_account_route_specs = (deps, options) => {
276
318
  session_options,
277
319
  max_sessions,
278
320
  });
279
- void audit_log_fire_and_forget(route, {
321
+ deps.audit.emit(route, {
280
322
  event_type: 'login',
281
323
  account_id: account.id,
282
324
  ip: get_client_ip(c),
283
- }, deps);
325
+ });
284
326
  return c.json({ ok: true });
285
327
  },
286
328
  },
287
329
  {
288
330
  method: 'POST',
289
331
  path: '/logout',
290
- auth: { type: 'authenticated' },
332
+ auth: { account: 'required', actor: 'none' },
291
333
  description: 'Revoke current session and clear cookie',
292
334
  input: LogoutInput,
293
335
  output: LogoutOutput,
@@ -299,19 +341,21 @@ export const create_account_route_specs = (deps, options) => {
299
341
  await query_session_revoke_by_hash_unscoped(route, token_hash);
300
342
  }
301
343
  clear_session_cookie(c, session_options);
302
- void audit_log_fire_and_forget(route, {
344
+ // Account-grain operation — no `actor_id` (which actor was
345
+ // resolved per-request is incidental to "this account ended
346
+ // its session"). Mirrors `login`.
347
+ deps.audit.emit(route, {
303
348
  event_type: 'logout',
304
- actor_id: ctx.actor.id,
305
349
  account_id: ctx.account.id,
306
350
  ip: get_client_ip(c),
307
- }, deps);
351
+ });
308
352
  return c.json({ ok: true, username: ctx.account.username });
309
353
  },
310
354
  },
311
355
  {
312
356
  method: 'POST',
313
357
  path: '/password',
314
- auth: { type: 'authenticated' },
358
+ auth: { account: 'required', actor: 'none' },
315
359
  description: 'Change password (revokes all sessions and API tokens)',
316
360
  input: PasswordChangeInput,
317
361
  output: PasswordChangeOutput,
@@ -345,13 +389,12 @@ export const create_account_route_specs = (deps, options) => {
345
389
  ip_rate_limiter.record(ip);
346
390
  if (login_account_rate_limiter)
347
391
  login_account_rate_limiter.record(ctx.account.id);
348
- void audit_log_fire_and_forget(route, {
392
+ deps.audit.emit(route, {
349
393
  event_type: 'password_change',
350
394
  outcome: 'failure',
351
- actor_id: ctx.actor.id,
352
395
  account_id: ctx.account.id,
353
396
  ip: get_client_ip(c),
354
- }, deps);
397
+ });
355
398
  return c.json({ error: ERROR_INVALID_CREDENTIALS }, 401);
356
399
  }
357
400
  // successful verification — reset rate limiters
@@ -360,18 +403,47 @@ export const create_account_route_specs = (deps, options) => {
360
403
  if (login_account_rate_limiter)
361
404
  login_account_rate_limiter.reset(ctx.account.id);
362
405
  const new_hash = await password.hash_password(new_password);
363
- await query_update_account_password(route, ctx.account.id, new_hash, ctx.actor.id);
406
+ // Conditional UPDATE keyed on the verified hash: closes the
407
+ // verify-write race with a concurrent password change that
408
+ // already committed against the same starting hash. Account-grain
409
+ // operation — `updated_by` stays null (the per-request actor is
410
+ // incidental; password is account-level state).
411
+ const updated = await query_update_account_password(route, ctx.account.id, new_hash, null, ctx.account.password_hash);
412
+ if (!updated) {
413
+ // A concurrent password change committed first — our
414
+ // `current_password` was correct at read-time but the row's
415
+ // `password_hash` no longer matches. Mirrors the wrong-password
416
+ // 401 shape; tag the failure metadata so admins reading the
417
+ // audit log can distinguish "user typoed" from "two clients
418
+ // raced." Sessions/tokens were already revoked by the winner;
419
+ // no cookie clear here either.
420
+ if (ip_rate_limiter && ip)
421
+ ip_rate_limiter.record(ip);
422
+ if (login_account_rate_limiter)
423
+ login_account_rate_limiter.record(ctx.account.id);
424
+ deps.audit.emit(route, {
425
+ event_type: 'password_change',
426
+ outcome: 'failure',
427
+ account_id: ctx.account.id,
428
+ ip: get_client_ip(c),
429
+ metadata: { reason: 'concurrent_change' },
430
+ });
431
+ return c.json({ error: ERROR_INVALID_CREDENTIALS }, 401);
432
+ }
364
433
  // revoke all sessions and API tokens (force re-auth everywhere)
365
434
  const sessions_revoked = await query_session_revoke_all_for_account(route, ctx.account.id);
366
435
  const tokens_revoked = await query_revoke_all_api_tokens_for_account(route, ctx.account.id);
367
436
  clear_session_cookie(c, session_options);
368
- void audit_log_fire_and_forget(route, {
437
+ // Account-grain operation — no `actor_id`. The password is
438
+ // account-level state; which per-request actor was resolved
439
+ // has no semantic bearing on "this account changed its
440
+ // password". Mirrors `login`/`logout`.
441
+ deps.audit.emit(route, {
369
442
  event_type: 'password_change',
370
- actor_id: ctx.actor.id,
371
443
  account_id: ctx.account.id,
372
444
  ip: get_client_ip(c),
373
445
  metadata: { sessions_revoked, tokens_revoked },
374
- }, deps);
446
+ });
375
447
  return c.json({ ok: true, sessions_revoked, tokens_revoked });
376
448
  },
377
449
  },
@@ -2,7 +2,14 @@
2
2
  * Auth entity types and client-safe schemas.
3
3
  *
4
4
  * Defines the runtime types for the fuz identity system:
5
- * `Account`, `Actor`, `Permit`, `AuthSession`, and `ApiToken`.
5
+ * `Account`, `Actor`, `RoleGrant`, `AuthSession`, and `ApiToken`.
6
+ *
7
+ * Identifier primitives (`Username`, `UsernameProvided`, `Email`) live
8
+ * in `../primitive_schemas.ts` — they're general validator shapes that
9
+ * don't depend on the auth domain. The auth-shape request-contract
10
+ * primitive `ActingActor` lives in `../http/auth_shape.ts` next to
11
+ * `RouteAuth` (the two pair: `auth.actor !== 'none'` ⟺ input declares
12
+ * `acting?: ActingActor`).
6
13
  *
7
14
  * DDL lives in `auth/ddl.ts`; role system in `auth/role_schema.ts`.
8
15
  * See docs/identity.md for design rationale.
@@ -11,21 +18,7 @@
11
18
  */
12
19
  import { z } from 'zod';
13
20
  import { Uuid } from '@fuzdev/fuz_util/id.js';
14
- /** Minimum username length (must have start + middle + end characters). */
15
- export declare const USERNAME_LENGTH_MIN = 3;
16
- /** Maximum username length (matches GitHub's limit). */
17
- export declare const USERNAME_LENGTH_MAX = 39;
18
- /** Maximum length for username input on login/lookup — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
19
- export declare const USERNAME_PROVIDED_LENGTH_MAX = 255;
20
- /** Username for account creation — starts with letter, alphanumeric/dash/underscore middle, ends with alphanumeric. No @ or . allowed. */
21
- export declare const Username: z.ZodString;
22
- export type Username = z.infer<typeof Username>;
23
- /** Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change. */
24
- export declare const UsernameProvided: z.ZodString;
25
- export type UsernameProvided = z.infer<typeof UsernameProvided>;
26
- /** Email validation. */
27
- export declare const Email: z.ZodEmail;
28
- export type Email = z.infer<typeof Email>;
21
+ import { Username, Email } from '../primitive_schemas.js';
29
22
  /** Account — authentication identity. You log in as an account. */
30
23
  export interface Account {
31
24
  id: Uuid;
@@ -46,7 +39,7 @@ export interface SessionAccount {
46
39
  email_verified: boolean;
47
40
  created_at: string;
48
41
  }
49
- /** Actor — the entity that acts. Owns cells, holds permits, appears in audit trails. */
42
+ /** Actor — the entity that acts. Owns cells, holds role_grants, appears in audit trails. */
50
43
  export interface Actor {
51
44
  id: Uuid;
52
45
  account_id: Uuid;
@@ -57,17 +50,25 @@ export interface Actor {
57
50
  }
58
51
  /**
59
52
  * Maximum length of the optional free-form `revoked_reason` attached to a
60
- * revoked permit. Bounds the value at the schema layer so both the admin
53
+ * revoked role_grant. Bounds the value at the schema layer so both the admin
61
54
  * input (when the route surfaces a reason field) and the revokee-facing
62
- * `permit_revoke` WS notification validate against the same ceiling.
55
+ * `role_grant_revoke` WS notification validate against the same ceiling.
63
56
  */
64
- export declare const PERMIT_REVOKED_REASON_LENGTH_MAX = 500;
65
- /** Permit — time-bounded, revocable grant of a role to an actor. */
66
- export interface Permit {
57
+ export declare const ROLE_GRANT_REVOKED_REASON_LENGTH_MAX = 500;
58
+ /** Role grant — time-bounded, revocable grant of a role to an actor. */
59
+ export interface RoleGrant {
67
60
  id: Uuid;
68
61
  actor_id: Uuid;
69
62
  role: string;
70
- /** Resource scope this grant applies to (e.g. a classroom id). `null` for global permits. */
63
+ /**
64
+ * Machine-readable kind tag for the polymorphic `scope_id`. Paired-null
65
+ * with `scope_id` per the `role_grant_scope_kind_paired` CHECK: both null
66
+ * (global) or both non-null (scoped). Consumer-declared via
67
+ * `create_scope_kind_schema(...)`; v1 keeps validation registry-membership
68
+ * only, with no INSERT-time `(role, scope_kind)` enforcement.
69
+ */
70
+ scope_kind: string | null;
71
+ /** Resource scope this grant applies to (e.g. a classroom id). `null` for global role_grants. */
71
72
  scope_id: Uuid | null;
72
73
  created_at: string;
73
74
  expires_at: string | null;
@@ -76,10 +77,10 @@ export interface Permit {
76
77
  /** Optional free-form reason attached on revoke (surfaced in the revokee WS notification once it lands). */
77
78
  revoked_reason: string | null;
78
79
  granted_by: Uuid | null;
79
- /** Offer that produced this permit (set by `query_accept_offer`). `null` for direct grants. */
80
+ /** Offer that produced this role_grant (set by `query_accept_offer`). `null` for direct grants. */
80
81
  source_offer_id: Uuid | null;
81
82
  }
82
- export declare const is_permit_active: (p: {
83
+ export declare const is_role_grant_active: (p: {
83
84
  revoked_at?: string | null;
84
85
  expires_at: string | null;
85
86
  }, now?: Date) => boolean;
@@ -131,16 +132,17 @@ export declare const ClientApiTokenJson: z.ZodObject<{
131
132
  created_at: z.ZodString;
132
133
  }, z.core.$strict>;
133
134
  export type ClientApiTokenJson = z.infer<typeof ClientApiTokenJson>;
134
- /** Zod schema for the permit summary returned in admin account listings. */
135
- export declare const PermitSummaryJson: z.ZodObject<{
135
+ /** Zod schema for the role_grant summary returned in admin account listings. */
136
+ export declare const RoleGrantSummaryJson: z.ZodObject<{
136
137
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
137
138
  role: z.ZodString;
139
+ scope_kind: z.ZodNullable<z.ZodString>;
138
140
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
139
141
  created_at: z.ZodString;
140
142
  expires_at: z.ZodNullable<z.ZodString>;
141
143
  granted_by: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
142
144
  }, z.core.$strict>;
143
- export type PermitSummaryJson = z.infer<typeof PermitSummaryJson>;
145
+ export type RoleGrantSummaryJson = z.infer<typeof RoleGrantSummaryJson>;
144
146
  /** Zod schema for the actor summary returned in admin account listings. */
145
147
  export declare const ActorSummaryJson: z.ZodObject<{
146
148
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
@@ -159,9 +161,9 @@ export declare const AdminAccountJson: z.ZodObject<{
159
161
  }, z.core.$strict>;
160
162
  export type AdminAccountJson = z.infer<typeof AdminAccountJson>;
161
163
  /**
162
- * Zod schema for a pending permit offer surfaced in admin account listings.
164
+ * Zod schema for a pending role_grant offer surfaced in admin account listings.
163
165
  *
164
- * Deliberately narrower than `PermitOfferJson`: omits `message` and
166
+ * Deliberately narrower than `RoleGrantOfferJson`: omits `message` and
165
167
  * `decline_reason` so cross-admin visibility of the listing does not expose
166
168
  * grantor-authored text that the audit log also withholds. Full offer
167
169
  * payloads remain available through the offer-specific RPC surface and the
@@ -174,6 +176,7 @@ export type AdminAccountJson = z.infer<typeof AdminAccountJson>;
174
176
  export declare const PendingOfferSummaryJson: z.ZodObject<{
175
177
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
176
178
  role: z.ZodString;
179
+ scope_kind: z.ZodNullable<z.ZodString>;
177
180
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
178
181
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
179
182
  from_username: z.ZodString;
@@ -181,7 +184,7 @@ export declare const PendingOfferSummaryJson: z.ZodObject<{
181
184
  expires_at: z.ZodString;
182
185
  }, z.core.$strict>;
183
186
  export type PendingOfferSummaryJson = z.infer<typeof PendingOfferSummaryJson>;
184
- /** Zod schema for an admin account listing entry (account + actor + permits + pending offers). */
187
+ /** Zod schema for an admin account listing entry (account + actor + role_grants + pending offers). */
185
188
  export declare const AdminAccountEntryJson: z.ZodObject<{
186
189
  account: z.ZodObject<{
187
190
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
@@ -196,9 +199,10 @@ export declare const AdminAccountEntryJson: z.ZodObject<{
196
199
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
197
200
  name: z.ZodString;
198
201
  }, z.core.$strict>>;
199
- permits: z.ZodArray<z.ZodObject<{
202
+ role_grants: z.ZodArray<z.ZodObject<{
200
203
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
201
204
  role: z.ZodString;
205
+ scope_kind: z.ZodNullable<z.ZodString>;
202
206
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
203
207
  created_at: z.ZodString;
204
208
  expires_at: z.ZodNullable<z.ZodString>;
@@ -207,6 +211,7 @@ export declare const AdminAccountEntryJson: z.ZodObject<{
207
211
  pending_offers: z.ZodArray<z.ZodObject<{
208
212
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
209
213
  role: z.ZodString;
214
+ scope_kind: z.ZodNullable<z.ZodString>;
210
215
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
211
216
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
212
217
  from_username: z.ZodString;
@@ -220,14 +225,20 @@ export interface CreateAccountInput {
220
225
  password_hash: string;
221
226
  email?: Email | null;
222
227
  }
223
- export interface GrantPermitInput {
228
+ export interface CreateRoleGrantInput {
224
229
  actor_id: Uuid;
225
230
  role: string;
226
- /** Scope the grant applies to. `null` / omitted grants a global permit. */
231
+ /**
232
+ * Machine-readable kind for the `scope_id`. Required iff `scope_id` is
233
+ * set; must be null/omitted when `scope_id` is null. The DB-level
234
+ * `role_grant_scope_kind_paired` CHECK rejects mismatched pairs.
235
+ */
236
+ scope_kind?: string | null;
237
+ /** Scope the grant applies to. `null` / omitted grants a global role_grant. */
227
238
  scope_id?: Uuid | null;
228
239
  expires_at?: Date | null;
229
240
  granted_by: Uuid | null;
230
- /** Offer id that produced this permit. Set by `query_accept_offer`; leave unset for direct grants. */
241
+ /** Offer id that produced this role_grant. Set by `query_accept_offer`; leave unset for direct grants. */
231
242
  source_offer_id?: Uuid | null;
232
243
  }
233
244
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAI5C,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,wDAAwD;AACxD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