@fuzdev/fuz_app 0.55.0 → 0.57.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 (333) hide show
  1. package/dist/actions/CLAUDE.md +211 -155
  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 +19 -0
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +20 -14
  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 +110 -44
  11. package/dist/actions/action_rpc.d.ts.map +1 -1
  12. package/dist/actions/action_rpc.js +92 -287
  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 +44 -38
  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 +2 -10
  34. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  35. package/dist/actions/register_ws_endpoint.js +32 -10
  36. package/dist/actions/transports_ws_auth_guard.d.ts +1 -1
  37. package/dist/actions/transports_ws_auth_guard.js +1 -1
  38. package/dist/actions/transports_ws_backend.d.ts +1 -1
  39. package/dist/actions/transports_ws_backend.js +1 -1
  40. package/dist/auth/CLAUDE.md +673 -442
  41. package/dist/auth/account_action_specs.d.ts +28 -7
  42. package/dist/auth/account_action_specs.d.ts.map +1 -1
  43. package/dist/auth/account_action_specs.js +7 -7
  44. package/dist/auth/account_actions.d.ts +8 -14
  45. package/dist/auth/account_actions.d.ts.map +1 -1
  46. package/dist/auth/account_actions.js +26 -32
  47. package/dist/auth/account_queries.d.ts +46 -13
  48. package/dist/auth/account_queries.d.ts.map +1 -1
  49. package/dist/auth/account_queries.js +73 -33
  50. package/dist/auth/account_routes.d.ts +4 -3
  51. package/dist/auth/account_routes.d.ts.map +1 -1
  52. package/dist/auth/account_routes.js +58 -33
  53. package/dist/auth/account_schema.d.ts +46 -54
  54. package/dist/auth/account_schema.d.ts.map +1 -1
  55. package/dist/auth/account_schema.js +21 -48
  56. package/dist/auth/admin_action_specs.d.ts +55 -21
  57. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  58. package/dist/auth/admin_action_specs.js +42 -26
  59. package/dist/auth/admin_actions.d.ts +14 -21
  60. package/dist/auth/admin_actions.d.ts.map +1 -1
  61. package/dist/auth/admin_actions.js +47 -44
  62. package/dist/auth/audit_emitter.d.ts +160 -0
  63. package/dist/auth/audit_emitter.d.ts.map +1 -0
  64. package/dist/auth/audit_emitter.js +83 -0
  65. package/dist/auth/audit_log_queries.d.ts +17 -87
  66. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  67. package/dist/auth/audit_log_queries.js +17 -96
  68. package/dist/auth/audit_log_routes.d.ts +1 -1
  69. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  70. package/dist/auth/audit_log_routes.js +7 -3
  71. package/dist/auth/audit_log_schema.d.ts +48 -42
  72. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  73. package/dist/auth/audit_log_schema.js +56 -43
  74. package/dist/auth/auth_guard_resolver.d.ts +44 -0
  75. package/dist/auth/auth_guard_resolver.d.ts.map +1 -0
  76. package/dist/auth/auth_guard_resolver.js +56 -0
  77. package/dist/auth/bootstrap_account.d.ts +7 -7
  78. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  79. package/dist/auth/bootstrap_account.js +7 -7
  80. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  81. package/dist/auth/bootstrap_routes.js +11 -10
  82. package/dist/auth/cleanup.d.ts +20 -26
  83. package/dist/auth/cleanup.d.ts.map +1 -1
  84. package/dist/auth/cleanup.js +33 -47
  85. package/dist/auth/credential_type_schema.d.ts +115 -0
  86. package/dist/auth/credential_type_schema.d.ts.map +1 -0
  87. package/dist/auth/credential_type_schema.js +127 -0
  88. package/dist/auth/daemon_token_middleware.d.ts +1 -1
  89. package/dist/auth/daemon_token_middleware.js +3 -3
  90. package/dist/auth/ddl.d.ts +2 -2
  91. package/dist/auth/ddl.d.ts.map +1 -1
  92. package/dist/auth/ddl.js +6 -6
  93. package/dist/auth/deps.d.ts +7 -32
  94. package/dist/auth/deps.d.ts.map +1 -1
  95. package/dist/auth/grant_path_schema.d.ts +117 -0
  96. package/dist/auth/grant_path_schema.d.ts.map +1 -0
  97. package/dist/auth/grant_path_schema.js +137 -0
  98. package/dist/auth/invite_queries.d.ts +12 -1
  99. package/dist/auth/invite_queries.d.ts.map +1 -1
  100. package/dist/auth/invite_queries.js +12 -1
  101. package/dist/auth/invite_schema.d.ts +1 -1
  102. package/dist/auth/invite_schema.d.ts.map +1 -1
  103. package/dist/auth/invite_schema.js +1 -1
  104. package/dist/auth/middleware.d.ts.map +1 -1
  105. package/dist/auth/middleware.js +5 -2
  106. package/dist/auth/migrations.d.ts +22 -7
  107. package/dist/auth/migrations.d.ts.map +1 -1
  108. package/dist/auth/migrations.js +64 -25
  109. package/dist/auth/request_context.d.ts +157 -170
  110. package/dist/auth/request_context.d.ts.map +1 -1
  111. package/dist/auth/request_context.js +224 -268
  112. package/dist/auth/{permit_offer_action_specs.d.ts → role_grant_offer_action_specs.d.ts} +130 -100
  113. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -0
  114. package/dist/auth/role_grant_offer_action_specs.js +262 -0
  115. package/dist/auth/role_grant_offer_actions.d.ts +104 -0
  116. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -0
  117. package/dist/auth/{permit_offer_actions.js → role_grant_offer_actions.js} +153 -140
  118. package/dist/auth/{permit_offer_notifications.d.ts → role_grant_offer_notifications.d.ts} +80 -70
  119. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -0
  120. package/dist/auth/role_grant_offer_notifications.js +182 -0
  121. package/dist/auth/{permit_offer_queries.d.ts → role_grant_offer_queries.d.ts} +64 -64
  122. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -0
  123. package/dist/auth/{permit_offer_queries.js → role_grant_offer_queries.js} +136 -123
  124. package/dist/auth/role_grant_offer_schema.d.ts +150 -0
  125. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -0
  126. package/dist/auth/{permit_offer_schema.js → role_grant_offer_schema.js} +55 -36
  127. package/dist/auth/role_grant_queries.d.ts +231 -0
  128. package/dist/auth/role_grant_queries.d.ts.map +1 -0
  129. package/dist/auth/role_grant_queries.js +320 -0
  130. package/dist/auth/role_schema.d.ts +150 -40
  131. package/dist/auth/role_schema.d.ts.map +1 -1
  132. package/dist/auth/role_schema.js +144 -45
  133. package/dist/auth/scope_kind_schema.d.ts +96 -0
  134. package/dist/auth/scope_kind_schema.d.ts.map +1 -0
  135. package/dist/auth/scope_kind_schema.js +94 -0
  136. package/dist/auth/self_service_role_action_specs.d.ts +4 -1
  137. package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
  138. package/dist/auth/self_service_role_action_specs.js +2 -2
  139. package/dist/auth/self_service_role_actions.d.ts +35 -29
  140. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  141. package/dist/auth/self_service_role_actions.js +58 -48
  142. package/dist/auth/session_cookie.d.ts +43 -6
  143. package/dist/auth/session_cookie.d.ts.map +1 -1
  144. package/dist/auth/session_cookie.js +31 -5
  145. package/dist/auth/session_middleware.d.ts +37 -3
  146. package/dist/auth/session_middleware.d.ts.map +1 -1
  147. package/dist/auth/session_middleware.js +33 -7
  148. package/dist/auth/signup_routes.d.ts.map +1 -1
  149. package/dist/auth/signup_routes.js +48 -19
  150. package/dist/auth/standard_action_specs.d.ts +2 -2
  151. package/dist/auth/standard_action_specs.js +4 -4
  152. package/dist/auth/standard_rpc_actions.d.ts +23 -19
  153. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  154. package/dist/auth/standard_rpc_actions.js +12 -12
  155. package/dist/db/migrate.d.ts +1 -1
  156. package/dist/db/migrate.js +1 -1
  157. package/dist/dev/setup.d.ts +2 -2
  158. package/dist/dev/setup.d.ts.map +1 -1
  159. package/dist/dev/setup.js +4 -4
  160. package/dist/env/load.d.ts +1 -1
  161. package/dist/env/load.js +1 -1
  162. package/dist/hono_context.d.ts +27 -45
  163. package/dist/hono_context.d.ts.map +1 -1
  164. package/dist/hono_context.js +14 -28
  165. package/dist/http/CLAUDE.md +235 -121
  166. package/dist/http/auth_shape.d.ts +191 -0
  167. package/dist/http/auth_shape.d.ts.map +1 -0
  168. package/dist/http/auth_shape.js +237 -0
  169. package/dist/http/common_routes.js +3 -3
  170. package/dist/http/db_routes.d.ts +4 -0
  171. package/dist/http/db_routes.d.ts.map +1 -1
  172. package/dist/http/db_routes.js +44 -7
  173. package/dist/http/error_schemas.d.ts +72 -39
  174. package/dist/http/error_schemas.d.ts.map +1 -1
  175. package/dist/http/error_schemas.js +81 -33
  176. package/dist/http/pending_effects.d.ts +71 -18
  177. package/dist/http/pending_effects.d.ts.map +1 -1
  178. package/dist/http/pending_effects.js +87 -18
  179. package/dist/http/proxy.d.ts +52 -5
  180. package/dist/http/proxy.d.ts.map +1 -1
  181. package/dist/http/proxy.js +92 -14
  182. package/dist/http/route_spec.d.ts +89 -75
  183. package/dist/http/route_spec.d.ts.map +1 -1
  184. package/dist/http/route_spec.js +54 -72
  185. package/dist/http/schema_helpers.d.ts +3 -14
  186. package/dist/http/schema_helpers.d.ts.map +1 -1
  187. package/dist/http/schema_helpers.js +2 -14
  188. package/dist/http/surface.d.ts +2 -10
  189. package/dist/http/surface.d.ts.map +1 -1
  190. package/dist/http/surface.js +3 -4
  191. package/dist/http/surface_query.d.ts +39 -35
  192. package/dist/http/surface_query.d.ts.map +1 -1
  193. package/dist/http/surface_query.js +79 -36
  194. package/dist/primitive_schemas.d.ts +39 -0
  195. package/dist/primitive_schemas.d.ts.map +1 -0
  196. package/dist/primitive_schemas.js +40 -0
  197. package/dist/realtime/sse_auth_guard.d.ts +5 -5
  198. package/dist/realtime/sse_auth_guard.js +9 -9
  199. package/dist/runtime/mock.d.ts +1 -1
  200. package/dist/runtime/mock.js +1 -1
  201. package/dist/server/app_backend.d.ts +14 -11
  202. package/dist/server/app_backend.d.ts.map +1 -1
  203. package/dist/server/app_backend.js +12 -8
  204. package/dist/server/app_server.d.ts +7 -7
  205. package/dist/server/app_server.d.ts.map +1 -1
  206. package/dist/server/app_server.js +35 -40
  207. package/dist/server/validate_nginx.d.ts +1 -1
  208. package/dist/server/validate_nginx.js +1 -1
  209. package/dist/testing/CLAUDE.md +50 -38
  210. package/dist/testing/admin_integration.d.ts +5 -6
  211. package/dist/testing/admin_integration.d.ts.map +1 -1
  212. package/dist/testing/admin_integration.js +87 -85
  213. package/dist/testing/app_server.d.ts +11 -14
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +16 -15
  216. package/dist/testing/assertions.d.ts.map +1 -1
  217. package/dist/testing/assertions.js +2 -1
  218. package/dist/testing/attack_surface.d.ts.map +1 -1
  219. package/dist/testing/attack_surface.js +15 -9
  220. package/dist/testing/audit_completeness.d.ts +2 -2
  221. package/dist/testing/audit_completeness.d.ts.map +1 -1
  222. package/dist/testing/audit_completeness.js +36 -36
  223. package/dist/testing/auth_apps.d.ts +5 -4
  224. package/dist/testing/auth_apps.d.ts.map +1 -1
  225. package/dist/testing/auth_apps.js +22 -19
  226. package/dist/testing/data_exposure.d.ts.map +1 -1
  227. package/dist/testing/data_exposure.js +5 -5
  228. package/dist/testing/db.d.ts +1 -1
  229. package/dist/testing/db.d.ts.map +1 -1
  230. package/dist/testing/db.js +4 -4
  231. package/dist/testing/db_entities.d.ts +22 -0
  232. package/dist/testing/db_entities.d.ts.map +1 -0
  233. package/dist/testing/db_entities.js +28 -0
  234. package/dist/testing/entities.d.ts +8 -7
  235. package/dist/testing/entities.d.ts.map +1 -1
  236. package/dist/testing/entities.js +21 -18
  237. package/dist/testing/integration.d.ts.map +1 -1
  238. package/dist/testing/integration.js +13 -14
  239. package/dist/testing/integration_helpers.d.ts +4 -4
  240. package/dist/testing/integration_helpers.d.ts.map +1 -1
  241. package/dist/testing/integration_helpers.js +20 -18
  242. package/dist/testing/middleware.d.ts +4 -4
  243. package/dist/testing/middleware.d.ts.map +1 -1
  244. package/dist/testing/middleware.js +12 -11
  245. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  246. package/dist/testing/rpc_attack_surface.js +40 -24
  247. package/dist/testing/rpc_round_trip.d.ts +1 -1
  248. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  249. package/dist/testing/rpc_round_trip.js +14 -13
  250. package/dist/testing/sse_round_trip.d.ts +3 -4
  251. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  252. package/dist/testing/sse_round_trip.js +7 -11
  253. package/dist/testing/standard.d.ts +1 -1
  254. package/dist/testing/stubs.d.ts +25 -0
  255. package/dist/testing/stubs.d.ts.map +1 -1
  256. package/dist/testing/stubs.js +43 -2
  257. package/dist/testing/surface_invariants.d.ts +14 -6
  258. package/dist/testing/surface_invariants.d.ts.map +1 -1
  259. package/dist/testing/surface_invariants.js +119 -43
  260. package/dist/testing/ws_round_trip.d.ts +12 -13
  261. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  262. package/dist/testing/ws_round_trip.js +19 -11
  263. package/dist/ui/AdminAccounts.svelte +23 -20
  264. package/dist/ui/AdminOverview.svelte +15 -13
  265. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  266. package/dist/ui/{AdminPermitHistory.svelte → AdminRoleGrantHistory.svelte} +12 -12
  267. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts +4 -0
  268. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -0
  269. package/dist/ui/BootstrapForm.svelte +1 -1
  270. package/dist/ui/CLAUDE.md +60 -60
  271. package/dist/ui/{PermitOfferForm.svelte → RoleGrantOfferForm.svelte} +27 -26
  272. package/dist/ui/{PermitOfferForm.svelte.d.ts → RoleGrantOfferForm.svelte.d.ts} +7 -7
  273. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -0
  274. package/dist/ui/{PermitOfferHistory.svelte → RoleGrantOfferHistory.svelte} +12 -12
  275. package/dist/ui/{PermitOfferHistory.svelte.d.ts → RoleGrantOfferHistory.svelte.d.ts} +4 -4
  276. package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -0
  277. package/dist/ui/{PermitOfferInbox.svelte → RoleGrantOfferInbox.svelte} +14 -14
  278. package/dist/ui/{PermitOfferInbox.svelte.d.ts → RoleGrantOfferInbox.svelte.d.ts} +4 -4
  279. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -0
  280. package/dist/ui/SignupForm.svelte +1 -1
  281. package/dist/ui/SurfaceExplorer.svelte +35 -15
  282. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  283. package/dist/ui/account_sessions_state.svelte.d.ts +2 -3
  284. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  285. package/dist/ui/account_sessions_state.svelte.js +2 -3
  286. package/dist/ui/admin_accounts_state.svelte.d.ts +18 -18
  287. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  288. package/dist/ui/admin_accounts_state.svelte.js +16 -16
  289. package/dist/ui/admin_rpc_adapters.d.ts +20 -20
  290. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  291. package/dist/ui/admin_rpc_adapters.js +17 -17
  292. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  293. package/dist/ui/admin_sessions_state.svelte.js +2 -2
  294. package/dist/ui/audit_log_state.svelte.d.ts +7 -7
  295. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  296. package/dist/ui/audit_log_state.svelte.js +6 -6
  297. package/dist/ui/auth_state.svelte.d.ts +3 -3
  298. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  299. package/dist/ui/auth_state.svelte.js +6 -6
  300. package/dist/ui/format_scope.d.ts +2 -2
  301. package/dist/ui/format_scope.js +2 -2
  302. package/dist/ui/{permit_offers_state.svelte.d.ts → role_grant_offers_state.svelte.d.ts} +30 -30
  303. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -0
  304. package/dist/ui/{permit_offers_state.svelte.js → role_grant_offers_state.svelte.js} +18 -18
  305. package/dist/ui/ui_format.js +2 -2
  306. package/package.json +3 -3
  307. package/dist/auth/permit_offer_action_specs.d.ts.map +0 -1
  308. package/dist/auth/permit_offer_action_specs.js +0 -258
  309. package/dist/auth/permit_offer_actions.d.ts +0 -110
  310. package/dist/auth/permit_offer_actions.d.ts.map +0 -1
  311. package/dist/auth/permit_offer_notifications.d.ts.map +0 -1
  312. package/dist/auth/permit_offer_notifications.js +0 -182
  313. package/dist/auth/permit_offer_queries.d.ts.map +0 -1
  314. package/dist/auth/permit_offer_schema.d.ts +0 -125
  315. package/dist/auth/permit_offer_schema.d.ts.map +0 -1
  316. package/dist/auth/permit_queries.d.ts +0 -222
  317. package/dist/auth/permit_queries.d.ts.map +0 -1
  318. package/dist/auth/permit_queries.js +0 -305
  319. package/dist/auth/require_keeper.d.ts +0 -20
  320. package/dist/auth/require_keeper.d.ts.map +0 -1
  321. package/dist/auth/require_keeper.js +0 -35
  322. package/dist/auth/route_guards.d.ts +0 -27
  323. package/dist/auth/route_guards.d.ts.map +0 -1
  324. package/dist/auth/route_guards.js +0 -38
  325. package/dist/auth/session_lifecycle.d.ts +0 -37
  326. package/dist/auth/session_lifecycle.d.ts.map +0 -1
  327. package/dist/auth/session_lifecycle.js +0 -29
  328. package/dist/ui/AdminPermitHistory.svelte.d.ts +0 -4
  329. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +0 -1
  330. package/dist/ui/PermitOfferForm.svelte.d.ts.map +0 -1
  331. package/dist/ui/PermitOfferHistory.svelte.d.ts.map +0 -1
  332. package/dist/ui/PermitOfferInbox.svelte.d.ts.map +0 -1
  333. package/dist/ui/permit_offers_state.svelte.d.ts.map +0 -1
@@ -7,16 +7,6 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- /** Map an `ActionAuth` value to a `RouteAuth`. */
11
- export const map_action_auth = (auth) => {
12
- if (auth === 'public')
13
- return { type: 'none' };
14
- if (auth === 'authenticated')
15
- return { type: 'authenticated' };
16
- if (auth === 'keeper')
17
- return { type: 'keeper' };
18
- return { type: 'role', role: auth.role };
19
- };
20
10
  /** Derive the default HTTP method from side effects. */
21
11
  export const derive_http_method = (side_effects) => {
22
12
  return side_effects ? 'POST' : 'GET';
@@ -45,7 +35,7 @@ export const create_action_route_spec = (spec, options) => {
45
35
  return {
46
36
  method: options.http_method ?? derive_http_method(spec.side_effects),
47
37
  path: options.path,
48
- auth: options.auth ?? map_action_auth(spec.auth),
38
+ auth: options.auth ?? spec.auth,
49
39
  handler: options.handler,
50
40
  description: spec.description,
51
41
  ...(options.params ? { params: options.params } : {}),
@@ -183,6 +183,25 @@ export declare const generate_actions_api_method_signature: (spec: ActionSpecUni
183
183
  export type ActionMethodEnumKind = 'all' | 'request_response' | 'remote_notification' | 'local_call' | 'frontend' | 'backend' | 'frontend_handled' | 'backend_handled' | 'broadcast';
184
184
  /** Default emit set — every enum kind. */
185
185
  export declare const ACTION_METHOD_ENUM_KINDS_ALL: ReadonlySet<ActionMethodEnumKind>;
186
+ /**
187
+ * Resolve a per-spec identifier qualifier with the standard default-vs-callback
188
+ * dance. When `qualify_spec` is set, returns the caller's callback verbatim
189
+ * and registers no imports — the caller owns its namespace setup (the
190
+ * multi-source case where specs come from several modules). Otherwise,
191
+ * registers `* as specs from specs_module` (defaulting to
192
+ * `'./action_specs.js'`) on `imports` and returns
193
+ * `(spec) => 'specs.' + to_action_spec_identifier(spec.method)`.
194
+ *
195
+ * Used internally by every multi-source-aware helper in this module
196
+ * (`generate_action_specs_record`, `generate_action_inputs_outputs`,
197
+ * `generate_backend_actions_api`); exported so consumers writing their own
198
+ * codegen helpers can reuse the same defaulting + import-registration
199
+ * behavior instead of reimplementing it.
200
+ */
201
+ export declare const resolve_spec_qualifier: (imports: ImportBuilder, options?: {
202
+ specs_module?: string;
203
+ qualify_spec?: (spec: ActionSpecUnion) => string;
204
+ }) => ((spec: ActionSpecUnion) => string);
186
205
  /**
187
206
  * Emit one or more `z.enum([...])` declarations for action method names —
188
207
  * `ActionMethod`, `RequestResponseActionMethod`, `RemoteNotificationActionMethod`,
@@ -1 +1 @@
1
- {"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGxE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,kCAAmC,CAAC;AAExE,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,oBACrC,CAAC;AAEjC,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG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,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,KACC,MAqBF,CAAC;AAMF;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,0BAA0B,GACtC,SAAS,aAAa,CAAC,UAAU,CAAC,EAClC,SAAS,aAAa,KACpB;IACF,YAAY,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CA6B1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAYH,CAAC"}
@@ -197,10 +197,11 @@ export const get_executor_phases = (spec, executor) => {
197
197
  }
198
198
  if (can_receive) {
199
199
  phases.push('receive_request', 'send_response');
200
- // TODO consolidate `send_error` is added redundantly when
201
- // initiator:'both' (already pushed above); the trailing Set dedup
202
- // handles it.
203
- phases.push('send_error');
200
+ // Backend's receive branch needs `send_error` for the failure
201
+ // path on incoming requests; only push when the send branch
202
+ // hasn't already added it (`initiator: 'both'`).
203
+ if (!can_send)
204
+ phases.push('send_error');
204
205
  }
205
206
  break;
206
207
  default:
@@ -226,8 +227,7 @@ export const get_executor_phases = (spec, executor) => {
226
227
  default:
227
228
  throw new UnreachableError(kind);
228
229
  }
229
- // Deduplicate phases (e.g., send_error added twice for initiator:'both' backend actions)
230
- return Array.from(new Set(phases));
230
+ return phases;
231
231
  };
232
232
  /** Default `collections_path` — every consumer's gen producers point at the sibling `action_collections.js`. */
233
233
  export const DEFAULT_COLLECTIONS_PATH = './action_collections.js';
@@ -394,7 +394,7 @@ export const generate_actions_api_method_signature = (spec, imports, options) =>
394
394
  // `qualify_spec?: (spec) => string` to emit a per-spec qualified identifier
395
395
  // (e.g. `admin_specs.account_list_action_spec`) for consumers stitching local
396
396
  // specs together with multiple upstream sources (`all_admin_action_specs` /
397
- // `all_permit_offer_action_specs` / `all_account_action_specs` /
397
+ // `all_role_grant_offer_action_specs` / `all_account_action_specs` /
398
398
  // `all_self_service_role_action_specs` from fuz_app). When `qualify_spec` is
399
399
  // set, the helper does NOT add a `* as specs` import — the consumer manages
400
400
  // the multiple `* as ns` imports itself — and `specs_module` is ignored.
@@ -437,15 +437,21 @@ export const ACTION_METHOD_ENUM_KINDS_ALL = new Set([
437
437
  */
438
438
  const filter_protocol_actions = (specs, include_protocol_actions) => include_protocol_actions ? specs : specs.filter((s) => !is_protocol_action_method(s.method));
439
439
  /**
440
- * Resolve the per-spec identifier qualifier used by the multi-source helpers
440
+ * Resolve a per-spec identifier qualifier with the standard default-vs-callback
441
+ * dance. When `qualify_spec` is set, returns the caller's callback verbatim
442
+ * and registers no imports — the caller owns its namespace setup (the
443
+ * multi-source case where specs come from several modules). Otherwise,
444
+ * registers `* as specs from specs_module` (defaulting to
445
+ * `'./action_specs.js'`) on `imports` and returns
446
+ * `(spec) => 'specs.' + to_action_spec_identifier(spec.method)`.
447
+ *
448
+ * Used internally by every multi-source-aware helper in this module
441
449
  * (`generate_action_specs_record`, `generate_action_inputs_outputs`,
442
- * `generate_backend_actions_api`). When `qualify_spec` is set, returns the
443
- * caller's callback verbatim the consumer is managing its own namespace
444
- * imports. Otherwise, registers the default `* as specs from specs_module`
445
- * import (defaulting to `'./action_specs.js'`) and returns the matching
446
- * `specs.${method}_action_spec` qualifier.
450
+ * `generate_backend_actions_api`); exported so consumers writing their own
451
+ * codegen helpers can reuse the same defaulting + import-registration
452
+ * behavior instead of reimplementing it.
447
453
  */
448
- const resolve_spec_qualifier = (imports, options) => {
454
+ export const resolve_spec_qualifier = (imports, options) => {
449
455
  if (options?.qualify_spec)
450
456
  return options.qualify_spec;
451
457
  const specs_module = options?.specs_module ?? DEFAULT_SPECS_MODULE;
@@ -1 +1 @@
1
- {"version":3,"file":"action_registry.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EACX,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC5B,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAO1B,qBAAa,cAAc;;IAC1B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;gBAE3B,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC;IAKzC,IAAI,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAEjD;IAED,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAE3B;IAID,IAAI,sBAAsB,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAE7D;IAED,IAAI,yBAAyB,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAEnE;IAED,IAAI,gBAAgB,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAEjD;IAED,IAAI,wBAAwB,IAAI,KAAK,CAAC,MAAM,CAAC,CAE5C;IAED,IAAI,2BAA2B,IAAI,KAAK,CAAC,MAAM,CAAC,CAE/C;IAED,IAAI,kBAAkB,IAAI,KAAK,CAAC,MAAM,CAAC,CAEtC;IAOD,IAAI,0BAA0B,IAAI,KAAK,CAAC,eAAe,CAAC,CAEvD;IAED,IAAI,yBAAyB,IAAI,KAAK,CAAC,eAAe,CAAC,CAEtD;IAED,IAAI,4BAA4B,IAAI,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AAI,yBAAyB,IAAI,KAAK,CAAC,MAAM,CAAC,CAE7C;IAID,IAAI,yBAAyB,IAAI,KAAK,CAAC,eAAe,CAAC,CAEtD;IAED,IAAI,yBAAyB,IAAI,KAAK,CAAC,eAAe,CAAC,CAEtD;IAED,IAAI,2BAA2B,IAAI,KAAK,CAAC,MAAM,CAAC,CAE/C;IAED,IAAI,2BAA2B,IAAI,KAAK,CAAC,MAAM,CAAC,CAE/C;IAID,IAAI,YAAY,IAAI,KAAK,CAAC,eAAe,CAAC,CAEzC;IAED,IAAI,mBAAmB,IAAI,KAAK,CAAC,eAAe,CAAC,CAOhD;IAED,IAAI,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC,CAElC;IAED,IAAI,qBAAqB,IAAI,KAAK,CAAC,MAAM,CAAC,CAEzC;CAaD"}
@@ -26,6 +26,7 @@
26
26
  *
27
27
  * @module
28
28
  */
29
+ import { is_public_auth } from '../http/auth_shape.js';
29
30
  // The auth (`public_*`, `authenticated_*`) and initiator-direction
30
31
  // (`backend_to_frontend_*`, `frontend_to_backend_*`) getters are pre-built
31
32
  // API surface unused by codegen today; kept low-cost for future filtering
@@ -128,10 +129,12 @@ export class ActionRegistry {
128
129
  }
129
130
  // --- Auth (pre-built, unused by codegen today) ---
130
131
  get public_specs() {
131
- return this.specs.filter((spec) => spec.auth === 'public');
132
+ return this.specs.filter((spec) => spec.auth !== null && is_public_auth(spec.auth));
132
133
  }
133
134
  get authenticated_specs() {
134
- return this.specs.filter((spec) => spec.auth === 'authenticated');
135
+ return this.specs.filter((spec) => spec.auth?.account === 'required' &&
136
+ !spec.auth.roles?.length &&
137
+ !spec.auth.credential_types?.length);
135
138
  }
136
139
  get public_methods() {
137
140
  return this.public_specs.map((spec) => spec.method);
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import { z } from 'zod';
15
15
  import type { Logger } from '@fuzdev/fuz_util/log.js';
16
+ import type { Uuid } from '@fuzdev/fuz_util/id.js';
16
17
  import type { RequestResponseActionSpec } from './action_spec.js';
17
18
  import { type RouteSpec } from '../http/route_spec.js';
18
19
  import { type RequestActorContext, type RequestContext } from '../auth/request_context.js';
@@ -20,30 +21,55 @@ import type { Db } from '../db/db.js';
20
21
  import { type JsonrpcRequestId } from '../http/jsonrpc.js';
21
22
  import type { RateLimiter } from '../rate_limiter.js';
22
23
  /**
23
- * Per-request context provided to RPC action handlers.
24
+ * Per-request context provided to action handlers across every transport
25
+ * (HTTP RPC, WebSocket, REST bridge). Built once per dispatched action by
26
+ * `perform_action` and threaded into the handler.
24
27
  *
25
- * Extends `RouteContext` with auth identity and logger.
26
- * `auth` is `RequestContext | null` handlers for authenticated
27
- * actions can narrow via the auth middleware guarantee.
28
+ * `auth` is `RequestContext | null` handlers for authenticated actions
29
+ * can narrow via the dispatcher's authorization-phase guarantee.
30
+ *
31
+ * Single handler context shape across every transport. Consumers inject
32
+ * domain deps via factory closures the same way HTTP RPC factories do.
28
33
  */
29
34
  export interface ActionContext {
30
35
  /** The authenticated identity, or `null` for public routes. */
31
36
  auth: RequestContext | null;
32
37
  /** The JSON-RPC request ID from the envelope. */
33
38
  request_id: JsonrpcRequestId;
34
- /** Transaction-scoped for mutations, pool-level for reads. */
39
+ /**
40
+ * Stable per-socket connection id on WebSocket transport; `undefined`
41
+ * on HTTP RPC. Consumers key per-connection domain state on this
42
+ * directly; HTTP handlers ignore it.
43
+ */
44
+ connection_id?: Uuid;
45
+ /**
46
+ * Transaction-scoped when `spec.side_effects` is true (the dispatcher
47
+ * wraps in `db.transaction`); pool-level otherwise. Handlers that
48
+ * need rollback-resilient writes call `deps.audit.emit(ctx, input)`,
49
+ * which captures the pool inside its closure.
50
+ */
35
51
  db: Db;
36
- /** Always pool-level — for fire-and-forget effects that outlive the transaction. */
37
- background_db: Db;
38
- /** Fire-and-forget side effects push here for post-response flushing. */
52
+ /**
53
+ * Eager fire-and-forget queue — push the in-flight `Promise<void>` for
54
+ * pool writes already running (audit emits, session touch, api-token
55
+ * usage tracking). Drained via `flush_pending_effects` after the
56
+ * handler returns.
57
+ */
39
58
  pending_effects: Array<Promise<void>>;
59
+ /**
60
+ * Deferred post-commit thunks — do not push directly; reach for
61
+ * `emit_after_commit(ctx, fn)` from `pending_effects.ts`. The flush
62
+ * site invokes each thunk after the handler (and any wrapping
63
+ * `db.transaction`) returns.
64
+ */
65
+ post_commit_effects: Array<() => void | Promise<void>>;
40
66
  /**
41
67
  * Resolved client IP from the trusted-proxy middleware — `'unknown'` if the
42
68
  * middleware wasn't in the stack (e.g. WS dispatch) or couldn't resolve.
43
- * Thread into `audit_log_fire_and_forget` as `ip: ctx.client_ip` for every
69
+ * Thread into `deps.audit.emit` as `ip: ctx.client_ip` for every
44
70
  * user-initiated action so RPC audit rows match the REST convention. Pass
45
71
  * `null` only for rows written outside a request (e.g. the
46
- * `permit_offer_expire` cleanup sweep in `auth/cleanup.ts`).
72
+ * `role_grant_offer_expire` cleanup sweep in `auth/cleanup.ts`).
47
73
  */
48
74
  client_ip: string;
49
75
  /** Logger instance. */
@@ -60,8 +86,9 @@ export interface ActionContext {
60
86
  notify: (method: string, params: unknown) => void;
61
87
  /**
62
88
  * AbortSignal that fires when the originating request is cancelled
63
- * (client disconnect on HTTP, socket close on WebSocket). Streaming
64
- * handlers should check this for early termination.
89
+ * (client disconnect on HTTP, socket close or per-request cancel
90
+ * notification on WebSocket). Streaming handlers should check this
91
+ * for early termination.
65
92
  */
66
93
  signal: AbortSignal;
67
94
  }
@@ -72,22 +99,41 @@ export interface ActionContext {
72
99
  * Returns the output value (serialized to JSON by the wrapper).
73
100
  */
74
101
  export type ActionHandler<TInput = any, TOutput = any> = (input: TInput, ctx: ActionContext) => TOutput | Promise<TOutput>;
102
+ /**
103
+ * `ActionContext` narrowed to a non-null `RequestContext`.
104
+ *
105
+ * Used by handlers whose spec declares `auth.account === 'required'`
106
+ * (with `auth.actor === 'none'`) — the dispatcher's pre-validation 401
107
+ * gate guarantees `request_context` is populated before the handler
108
+ * runs, but the actor slot stays null because no `acting` resolution
109
+ * happened. Selected automatically by `rpc_action`'s conditional return
110
+ * type for the account-grain tier.
111
+ */
112
+ export interface ActionAuthContext extends Omit<ActionContext, 'auth'> {
113
+ auth: RequestContext;
114
+ }
115
+ /**
116
+ * Handler signature for an account-grain RPC action — `auth.account === 'required'`
117
+ * and `auth.actor === 'none'`. Mirrors `ActionHandler` but tightens the
118
+ * `ctx.auth` slot to the non-null `RequestContext` (with `actor: null`).
119
+ */
120
+ export type AuthActionHandler<TInput = any, TOutput = any> = (input: TInput, ctx: ActionAuthContext) => TOutput | Promise<TOutput>;
75
121
  /**
76
122
  * `ActionContext` narrowed to a resolved acting actor.
77
123
  *
78
- * Returned to handlers bound via `rpc_actor_action` — the dispatcher's
79
- * authorization phase has already run for actor-implying auth or
80
- * `acting`-declaring inputs, so `ctx.auth.actor` is non-null and the
81
- * handler skips the `require_request_actor(ctx.auth)` narrowing call.
124
+ * Used by handlers whose spec declares `auth.actor === 'required'` —
125
+ * the dispatcher's authorization phase resolves an actor (per
126
+ * registry-time invariant 2 the input declares `acting?: ActingActor`),
127
+ * so `ctx.auth.actor` is non-null. Selected automatically by
128
+ * `rpc_action`'s conditional return type for the actor-implying tier.
82
129
  */
83
130
  export interface ActionActorContext extends Omit<ActionContext, 'auth'> {
84
131
  auth: RequestActorContext;
85
132
  }
86
133
  /**
87
- * Handler function for an RPC action whose dispatcher always resolves an
88
- * acting actor (`auth: 'keeper' | {role}` or input declaring
89
- * `acting?: ActingActor`). Mirrors `ActionHandler` but tightens the
90
- * `ctx.auth` slot to the non-null `RequestActorContext`.
134
+ * Handler signature for an actor-implying RPC action `auth.actor === 'required'`.
135
+ * Mirrors `ActionHandler` but tightens the `ctx.auth` slot to the
136
+ * non-null `RequestActorContext` (with non-null `actor`).
91
137
  */
92
138
  export type ActorActionHandler<TInput = any, TOutput = any> = (input: TInput, ctx: ActionActorContext) => TOutput | Promise<TOutput>;
93
139
  /**
@@ -101,7 +147,24 @@ export interface RpcAction {
101
147
  handler: ActionHandler;
102
148
  }
103
149
  /**
104
- * Pair a spec with a handler while preserving per-method input/output types.
150
+ * Conditional handler shape for `rpc_action` picks the narrowest
151
+ * `ctx.auth` type the dispatcher's runtime guarantee allows:
152
+ *
153
+ * - `auth.actor === 'required'` → `ActorActionHandler` (`ctx.auth: RequestActorContext`).
154
+ * - `auth.account === 'required' && auth.actor === 'none'` → `AuthActionHandler` (`ctx.auth: RequestContext`).
155
+ * - else (public, optional axes) → `ActionHandler` (`ctx.auth: RequestContext | null`).
156
+ *
157
+ * The bracketed form `[T] extends ['required']` defeats distributive
158
+ * conditionals so a degraded `AuthAxisState` union (when the spec was
159
+ * typed without preserving its literal) falls through to the loosest
160
+ * tier instead of collapsing to the narrowest.
161
+ */
162
+ export type HandlerForSpec<TSpec extends RequestResponseActionSpec> = [
163
+ TSpec['auth']['actor']
164
+ ] extends ['required'] ? ActorActionHandler<z.infer<TSpec['input']>, z.infer<TSpec['output']>> : [TSpec['auth']['account']] extends ['required'] ? AuthActionHandler<z.infer<TSpec['input']>, z.infer<TSpec['output']>> : ActionHandler<z.infer<TSpec['input']>, z.infer<TSpec['output']>>;
165
+ /**
166
+ * Pair a spec with a handler while preserving per-method input/output types
167
+ * and selecting the narrowest `ctx.auth` shape the spec literal admits.
105
168
  *
106
169
  * Constructing `{spec, handler}` literals widens `handler` to
107
170
  * `ActionHandler<any, any>`, so spec/handler drift (renamed Zod schema,
@@ -110,39 +173,42 @@ export interface RpcAction {
110
173
  * `(input: z.infer<spec.input>, ctx) => z.infer<spec.output>` via the
111
174
  * generic spec parameter — drift surfaces at the call site.
112
175
  *
176
+ * The `ctx.auth` narrowing follows the spec's `auth.account` /
177
+ * `auth.actor` literals (see `HandlerForSpec`): an actor-implying spec
178
+ * gets `ctx.auth: RequestActorContext`; an account-grain spec gets
179
+ * `ctx.auth: RequestContext`; everything else stays `ctx.auth:
180
+ * RequestContext | null`. Handlers can rely on the dispatcher's
181
+ * runtime guarantee without a manual narrowing call.
182
+ *
113
183
  * Fits fuz_app's factory-closure pattern (handlers close over
114
184
  * `grantable_roles`, `app_settings` ref, `notification_sender`, etc.).
115
185
  * zzz uses a different shape — a codegen-keyed `Record<Method, Handler>`
116
186
  * map typed via generated `ActionInputs`/`ActionOutputs` — which works when
117
187
  * handlers are pure (no closure state) and specs are codegen-enumerated.
118
- * fuz_app's admin + permit-offer actions have neither, so per-pair typing
188
+ * fuz_app's admin + role-grant-offer actions have neither, so per-pair typing
119
189
  * at the registration site is the right fit.
120
- */
121
- export declare const rpc_action: <TSpec extends RequestResponseActionSpec>(spec: TSpec, handler: ActionHandler<z.infer<TSpec["input"]>, z.infer<TSpec["output"]>>) => RpcAction;
122
- /**
123
- * Variant of `rpc_action` for handlers whose spec always resolves an
124
- * acting actor — actions with `auth: 'keeper' | {role}` or inputs that
125
- * declare `acting?: ActingActor`. The dispatcher's authorization phase
126
- * runs before the handler, populates `ctx.auth` with a non-null
127
- * `RequestActorContext`, and `rpc_actor_action` reflects that
128
- * guarantee in the handler signature so the handler body skips the
129
- * `require_request_actor(ctx.auth)` narrowing call (and the bug class
130
- * where forgetting that call fails open against a `null` actor).
131
- *
132
- * The runtime binding is identical to `rpc_action` — both register the
133
- * same `RpcAction` shape on the action map. Only the compile-time
134
- * handler signature differs.
190
+ *
191
+ * Spec-literal preservation is load-bearing: declare specs with
192
+ * `satisfies RequestResponseActionSpec` (canonical) so `auth.actor`
193
+ * keeps its `'required'` / `'none'` literal type. A spec typed
194
+ * directly as `RequestResponseActionSpec` widens the axes to
195
+ * `AuthAxisState` and the handler defaults to the loosest tier — sound,
196
+ * but loses the ergonomic narrowing.
135
197
  *
136
198
  * @example
137
199
  * ```ts
138
- * rpc_actor_action(permit_revoke_action_spec, async (input, ctx) => {
139
- * // ctx.auth is RequestActorContext no require_request_actor() needed.
140
- * const revoker_id = ctx.auth.actor.id;
141
- * // ...
200
+ * // actor-implying spec ctx.auth: RequestActorContext
201
+ * rpc_action(role_grant_revoke_action_spec, async (input, ctx) => {
202
+ * const revoker_id = ctx.auth.actor.id; // no narrowing needed
203
+ * });
204
+ *
205
+ * // account-grain spec → ctx.auth: RequestContext (actor: null)
206
+ * rpc_action(account_verify_action_spec, (_input, ctx) => {
207
+ * return to_session_account(ctx.auth.account); // no narrowing needed
142
208
  * });
143
209
  * ```
144
210
  */
145
- export declare const rpc_actor_action: <TSpec extends RequestResponseActionSpec>(spec: TSpec, handler: ActorActionHandler<z.infer<TSpec["input"]>, z.infer<TSpec["output"]>>) => RpcAction;
211
+ export declare const rpc_action: <TSpec extends RequestResponseActionSpec>(spec: TSpec, handler: HandlerForSpec<TSpec>) => RpcAction;
146
212
  /** Options for `create_rpc_endpoint`. */
147
213
  export interface CreateRpcEndpointOptions {
148
214
  /** Mount path for the endpoint (e.g., `/api/rpc`). */
@@ -181,9 +247,9 @@ export interface CreateRpcEndpointOptions {
181
247
  * 3. **Pre-validation auth** — short-circuit `unauthenticated` when no
182
248
  * account is on the request, before input validation runs.
183
249
  * 4. **Authorization phase** — resolve the acting actor (when the action's
184
- * auth requires permits or its input declares `acting?: ActingActor`)
250
+ * auth requires role_grants or its input declares `acting?: ActingActor`)
185
251
  * and build the request context. Runs before input validation so
186
- * permit-grain auth checks return 403 before 400 invalid_params;
252
+ * role-grant-grain auth checks return 403 before 400 invalid_params;
187
253
  * `acting` is read from raw params via a string typeguard.
188
254
  * 5. **Post-authorization auth** — enforce role / keeper requirements
189
255
  * against the request context.
@@ -1 +1 @@
1
- {"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAa,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAA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