@fuzdev/fuz_app 0.180.0 → 0.182.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 (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -15,12 +15,13 @@
15
15
  * schema declared `acting?: ActingActor` (reference equality with the
16
16
  * canonical `ActingActor` schema) or the auth requires role_grants
17
17
  * (`role` / `keeper`), `apply_authorization_phase` resolves the actor
18
- * against the resolved account id plus the validated `acting` value via
18
+ * against the resolved account plus the validated `acting` value via
19
19
  * `resolve_acting_actor`, builds the `{account, actor, role_grants}`
20
20
  * context via `build_request_context`, and sets it on
21
21
  * `REQUEST_CONTEXT_KEY` before auth guards fire. Authenticated routes
22
- * that don't need an actor still get an account-only context via
23
- * `build_account_context` so handler signatures stay uniform.
22
+ * that don't need an actor still get an account-only context, so handler
23
+ * signatures stay uniform. The account is the row the credential leg
24
+ * read (`ResolvedAuth.account`) — the phase does not read it again.
24
25
  *
25
26
  * Account-grain operations (logout, password_change, account_verify,
26
27
  * etc.) declare neither `acting` nor role_grant-requiring auth, so no actor
@@ -29,15 +30,15 @@
29
30
  * which is what makes multi-actor logout work without first picking a
30
31
  * persona.
31
32
  *
32
- * `build_request_context` loads `account → actor → role_grants` and verifies
33
- * the `actor.account_id === account.id` binding. `refresh_role_grants`
34
- * reloads role_grants on an existing context.
33
+ * `build_request_context` loads the acting actor's role_grants onto the
34
+ * account and the actor `resolve_acting_actor` read off that account.
35
+ * `refresh_role_grants` reloads role_grants on an existing context.
35
36
  *
36
37
  * @module
37
38
  */
38
39
  import { is_role_grant_active } from './account_schema.js';
39
40
  import { hash_session_token, query_session_get_valid } from './session_queries.js';
40
- import { query_account_by_id, query_actor_by_id, query_active_actors_by_account } from './account_queries.js';
41
+ import { query_account_by_id, query_active_actors_by_account } from './account_queries.js';
41
42
  import { query_role_grant_find_active_for_actor } from './role_grant_queries.js';
42
43
  import { has_test_context_preset, RESOLVED_AUTH_KEY, SESSION_COOKIE_EXPIRES_AT_KEY, SESSION_TOKEN_KEY } from '../hono_context.js';
43
44
  import { credential_deadline_after } from './credential_deadline.js';
@@ -46,7 +47,7 @@ import { get_resolved_auth, resolved_auth_scope } from './resolved_auth.js';
46
47
  import { is_route_scope_capability, token_scope_admits_non_rpc, token_scope_denied_body } from './token_scope.js';
47
48
  import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
48
49
  import { is_null_schema } from '../http/schema_helpers.js';
49
- import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT, ERROR_ACCOUNT_VANISHED } from '../http/error_schemas.js';
50
+ import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT } from '../http/error_schemas.js';
50
51
  import { read_json_body } from '../http/json_text.js';
51
52
  /** Hono context variable name for the request context. */
52
53
  export const REQUEST_CONTEXT_KEY = 'request_context';
@@ -144,9 +145,10 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
144
145
  * (from the request payload). Applies the uniform resolution rules:
145
146
  *
146
147
  * - `acting_actor_id` omitted + 1 actor → use it.
147
- * - `acting_actor_id` omitted + 0 actors → `no_actors` (defensive —
148
+ * - 0 actors → `no_actors` when the account is still live (defensive —
148
149
  * signup / bootstrap always create an actor in the same tx, so this
149
- * is a server error).
150
+ * is a server error), `account_removed` when it is tombstoned or gone:
151
+ * removed since its credential was read, its actors with it.
150
152
  * - `acting_actor_id` omitted + multiple actors → `actor_required` with
151
153
  * the available list so the client can prompt; never pick silently.
152
154
  * - `acting_actor_id` present + matches an actor on the account → use it.
@@ -154,6 +156,10 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
154
156
  * The available list is intentionally not echoed in this branch (treat
155
157
  * as opaque rejection).
156
158
  *
159
+ * The actor comes back as the row the account's actor list read, so the
160
+ * caller builds on it without reading it again — one read, as on the Rust
161
+ * spine, which leaves no window for the actor to vanish between two.
162
+ *
157
163
  * `acting_actor_id` is compared lowercased, the form actor ids are stored and
158
164
  * read back in, so a caller passing an id that skipped the `Uuid` schema
159
165
  * still matches its actor whatever its case.
@@ -164,11 +170,16 @@ export const has_any_scoped_role = (ctx, roles, scope_id, now = new Date()) => {
164
170
  */
165
171
  export const resolve_acting_actor = async (deps, account_id, acting_actor_id) => {
166
172
  const actors = await query_active_actors_by_account(deps, account_id);
167
- if (actors.length === 0)
168
- return { ok: false, reason: 'no_actors' };
173
+ if (actors.length === 0) {
174
+ // a live account with no actor, or one removed since its credential was
175
+ // read — one read, on this path alone, tells them apart
176
+ return (await query_account_by_id(deps, account_id))
177
+ ? { ok: false, reason: 'no_actors' }
178
+ : { ok: false, reason: 'account_removed' };
179
+ }
169
180
  if (acting_actor_id == null) {
170
181
  if (actors.length === 1)
171
- return { ok: true, actor_id: actors[0].id };
182
+ return { ok: true, actor: actors[0] };
172
183
  return {
173
184
  ok: false,
174
185
  reason: 'actor_required',
@@ -179,7 +190,7 @@ export const resolve_acting_actor = async (deps, account_id, acting_actor_id) =>
179
190
  const match = actors.find((a) => a.id === acting);
180
191
  if (!match)
181
192
  return { ok: false, reason: 'actor_not_on_account' };
182
- return { ok: true, actor_id: match.id };
193
+ return { ok: true, actor: match };
183
194
  };
184
195
  /**
185
196
  * Create middleware that authenticates the account from a session cookie —
@@ -232,12 +243,19 @@ export const create_request_context_middleware = (deps, options = {}) => {
232
243
  await next();
233
244
  return;
234
245
  }
246
+ // a tombstoned account authenticates nothing — its session resolves as
247
+ // no credential, the anonymous caller, as on the Rust spine
248
+ const account = await query_account_by_id(deps, session.account_id);
249
+ if (!account) {
250
+ await next();
251
+ return;
252
+ }
235
253
  // The earlier of the signed cookie's expiry (this server's wall clock,
236
254
  // which signed it) and the row's (read on the database clock).
237
255
  const cookie_expires_at = c.get(SESSION_COOKIE_EXPIRES_AT_KEY) ?? null;
238
256
  c.set(RESOLVED_AUTH_KEY, {
239
257
  credential_type: 'session',
240
- account_id: session.account_id,
258
+ account,
241
259
  session_hash,
242
260
  credential_deadline: credential_deadline_after([
243
261
  cookie_expires_at === null ? null : cookie_expires_at * 1000 - Date.now(),
@@ -282,10 +300,10 @@ export const token_scope_surface_denial = (c, capability) => {
282
300
  return null;
283
301
  };
284
302
  /**
285
- * The account id a public route — one that answers anonymous callers and reads
286
- * the credential (`reads_credential`) — may act on: `null` for the anonymous
287
- * caller **and for a scope-narrowed API token**. Rule 3 in its
288
- * anonymous-admitting disposition — the downgrade the Rust
303
+ * The account a public route — one that answers anonymous callers and reads
304
+ * the credential (`reads_credential`) — may act on, as the credential leg read
305
+ * it: `null` for the anonymous caller **and for a scope-narrowed API token**.
306
+ * Rule 3 in its anonymous-admitting disposition — the downgrade the Rust
289
307
  * `AuthGate::public_request_context` applies.
290
308
  *
291
309
  * A narrowed token reaches no non-RPC surface that reads account data
@@ -293,23 +311,23 @@ export const token_scope_surface_denial = (c, capability) => {
293
311
  * that is a 403 (`auth.required_scope`); on one that answers them, a 403
294
312
  * would enforce nothing — the holder drops the `Authorization` header and
295
313
  * reads the anonymous answer anyway — so the narrowed token *is* the
296
- * anonymous caller there. Read the credential through this on any
297
- * `reads_credential` route instead of `get_resolved_auth` directly, so the
298
- * downgrade is one decision rather than an `&&` hand-rolled per handler.
314
+ * anonymous caller there. A `reads_credential` handler reads the account
315
+ * through this, never off `route.credential` directly, so the downgrade is
316
+ * one decision rather than an `&&` hand-rolled per handler.
299
317
  *
300
318
  * The RPC endpoint is the exception: its dispatcher gates each method against
301
319
  * the scope, so it reads the full credential.
302
320
  *
303
- * @param c - the request context, after the auth middleware chain
304
- * @returns the account id, or `null` for an anonymous caller or a narrowed token
321
+ * @param route - the handler's `RouteContext`, or anything carrying its `credential`
322
+ * @returns the account the credential resolved, or `null` for an anonymous caller or a narrowed token
305
323
  */
306
- export const get_public_account_id = (c) => {
307
- const auth = get_resolved_auth(c);
324
+ export const get_public_account = (route) => {
325
+ const auth = route.credential;
308
326
  if (auth === null)
309
327
  return null;
310
328
  if (!token_scope_admits_non_rpc(resolved_auth_scope(auth)))
311
329
  return null;
312
- return auth.account_id;
330
+ return auth.account;
313
331
  };
314
332
  /**
315
333
  * Create middleware refusing a route to a credential whose scope does not admit
@@ -448,60 +466,29 @@ export const refresh_role_grants = async (ctx, deps) => {
448
466
  return { ...ctx, role_grants };
449
467
  };
450
468
  /**
451
- * Build a full `RequestContext` from an account id and an explicit
452
- * actor id (already resolved via `resolve_acting_actor`).
469
+ * Build an actor-bound `RequestContext` from the account the credential
470
+ * resolved and the actor `resolve_acting_actor` read off it, loading the
471
+ * actor's active role_grants.
453
472
  *
454
- * Loads `account` + the named `actor` + the actor's active role_grants.
455
- * Verifies the `actor.account_id === account.id` binding so downstream
456
- * handlers can trust `ctx.actor.account_id === ctx.account.id`. Returns
457
- * `null` when the account is missing, the actor is missing, or the
458
- * actor doesn't belong to the supplied account.
473
+ * Reads only the grants: the account is the credential leg's row
474
+ * (`ResolvedAuth.account`) and the actor the account's own actor list read,
475
+ * so neither is read twice in a request and there is no torn read between
476
+ * the reads — a delete landing after them is the handler's to meet, as on
477
+ * the Rust spine.
459
478
  *
460
- * Called by the route-spec / RPC dispatcher's authorization phase for
461
- * routes that need an acting actor; account-grain routes use
462
- * `build_account_context` instead.
479
+ * Called by the dispatcher's authorization phase for routes that need an
480
+ * acting actor; account-grain routes get `{account, actor: null,
481
+ * role_grants: []}` with no read at all.
463
482
  *
464
483
  * @param deps - query dependencies
465
- * @param account_id - the account to build context for
466
- * @param actor_id - the actor this request acts as
467
- * @returns a request context, or `null` if account/actor not found or mismatched
484
+ * @param account - the account the credential resolved
485
+ * @param actor - the acting actor, one of `account`'s active actors
486
+ * @returns the actor-bound request context
468
487
  */
469
- export const build_request_context = async (deps, account_id, actor_id) => {
470
- const account = await query_account_by_id(deps, account_id);
471
- if (!account)
472
- return null;
473
- const actor = await query_actor_by_id(deps, actor_id);
474
- if (!actor)
475
- return null;
476
- if (actor.account_id !== account.id)
477
- return null;
488
+ export const build_request_context = async (deps, account, actor) => {
478
489
  const role_grants = await query_role_grant_find_active_for_actor(deps, actor.id);
479
490
  return { account, actor, role_grants };
480
491
  };
481
- /**
482
- * Build an account-only `RequestContext` (no actor, no role_grants) from
483
- * an account id.
484
- *
485
- * Used by the dispatcher's authorization phase for authenticated routes
486
- * that don't need an acting actor — account-grain operations (logout,
487
- * password change, account self-service). Lets handlers read
488
- * `auth.account.id` / `auth.account.username` uniformly with role_grant-bound
489
- * routes; the cost is one extra `query_account_by_id` per request.
490
- *
491
- * Returns `null` when the account row is missing (e.g. deleted between
492
- * the auth middleware's session lookup and the dispatcher) — caller
493
- * surfaces that as a 500 since it represents a torn read.
494
- *
495
- * @param deps - query dependencies
496
- * @param account_id - the account to build context for
497
- * @returns an account-only request context, or `null` if the account is missing
498
- */
499
- export const build_account_context = async (deps, account_id) => {
500
- const account = await query_account_by_id(deps, account_id);
501
- if (!account)
502
- return null;
503
- return { account, actor: null, role_grants: [] };
504
- };
505
492
  /**
506
493
  * Apply the dispatcher's authorization phase against the flat-record
507
494
  * `RouteAuth` shape. Shared by the route-spec wrapper, the HTTP RPC
@@ -510,57 +497,57 @@ export const build_account_context = async (deps, account_id) => {
510
497
  * input validation 400.
511
498
  *
512
499
  * Pure data — the function does not touch a Hono context. Each transport
513
- * passes `account_id` (extracted from its own credential surface) and
500
+ * passes the account its credential resolved (`ResolvedAuth.account`) and
514
501
  * binds the returned `AuthorizationResult` to its wire shape. The REST
515
502
  * pipeline additionally writes `REQUEST_CONTEXT_KEY` on `c` for downstream
516
503
  * `require_role` / `require_credential_types` middleware that still reads
517
504
  * the resolved context off the Hono context.
518
505
  *
506
+ * The account is never read here: the context is built on the credential
507
+ * leg's row, so a request reads its account once, as on the Rust spine,
508
+ * whose `apply_authorization_phase` takes the resolved account the same way.
509
+ *
519
510
  * Branching by `auth.account` × `auth.actor`:
520
511
  *
521
512
  * - Both `'none'` → `{ok: true, request_context: null}`. Public actions
522
513
  * never see a `RequestContext`.
523
- * - `account_id == null` on any non-public route → same null
514
+ * - `account == null` on any non-public route → same null
524
515
  * `request_context`. The `'required'` callers were already rejected at
525
516
  * the pre-authorization gate in the dispatcher; only genuine anonymous
526
517
  * access on an `'optional'` axis lands here.
527
- * - `actor === 'none'` → builds account-only context via
528
- * `build_account_context`. Null lookup → `account_vanished` 500 failure.
518
+ * - `actor === 'none'` → an account-only context, `{account, actor: null,
519
+ * role_grants: []}`.
529
520
  * - `actor === 'required'` → resolves the actor from `acting_value` (or
530
- * single-actor account); failures map to 400 / 500.
521
+ * single-actor account); failures map to 400 / 401 / 500.
531
522
  * - `actor === 'optional'` → same as `'required'` except multi-actor
532
523
  * accounts without an `acting` value fall back to account-only context
533
524
  * (no `actor_required` 400). Bad `acting` ids still 400.
534
525
  *
535
- * 500 branches stay distinct: `ERROR_NO_ACTORS_ON_ACCOUNT` (signup
536
- * invariant violation), `ERROR_ACCOUNT_VANISHED` (torn read after
537
- * resolve).
526
+ * An account removed since the credential leg read it takes its actors with
527
+ * it: an actor-grain route then finds none, and answers the dead credential's
528
+ * 401 `ERROR_AUTHENTICATION_REQUIRED`, as a request that arrived after the
529
+ * removal does. The one 500 is `ERROR_NO_ACTORS_ON_ACCOUNT`: a live account
530
+ * with no active actor, a signup invariant violation.
538
531
  */
539
- export const apply_authorization_phase = async (deps, account_id, auth, acting_value) => {
532
+ export const apply_authorization_phase = async (deps, account, auth, acting_value) => {
540
533
  if (is_public_auth(auth))
541
534
  return { ok: true, request_context: null };
542
- if (account_id == null) {
535
+ if (account === null) {
543
536
  // Optional-auth route hit without a credential — leave `RequestContext`
544
537
  // null so the handler can branch on it. `'required'` callers already
545
538
  // got rejected at the pre-authorization gate.
546
539
  return { ok: true, request_context: null };
547
540
  }
548
541
  if (!needs_actor(auth)) {
549
- const ctx = await build_account_context(deps, account_id);
550
- if (!ctx)
551
- return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
552
- return { ok: true, request_context: ctx };
542
+ return { ok: true, request_context: { account, actor: null, role_grants: [] } };
553
543
  }
554
544
  // actor 'required' or 'optional' — resolve.
555
- const acting = await resolve_acting_actor(deps, account_id, acting_value);
545
+ const acting = await resolve_acting_actor(deps, account.id, acting_value);
556
546
  if (!acting.ok) {
557
547
  if (acting.reason === 'actor_required') {
558
548
  if (auth.actor === 'optional') {
559
549
  // Multi-actor account, no pick — fall back to account-only context.
560
- const ctx = await build_account_context(deps, account_id);
561
- if (!ctx)
562
- return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
563
- return { ok: true, request_context: ctx };
550
+ return { ok: true, request_context: { account, actor: null, role_grants: [] } };
564
551
  }
565
552
  return {
566
553
  ok: false,
@@ -571,12 +558,12 @@ export const apply_authorization_phase = async (deps, account_id, auth, acting_v
571
558
  if (acting.reason === 'actor_not_on_account') {
572
559
  return { ok: false, status: 400, body: { error: ERROR_ACTOR_NOT_ON_ACCOUNT } };
573
560
  }
561
+ if (acting.reason === 'account_removed') {
562
+ return { ok: false, status: 401, body: { error: ERROR_AUTHENTICATION_REQUIRED } };
563
+ }
574
564
  return { ok: false, status: 500, body: { error: ERROR_NO_ACTORS_ON_ACCOUNT } };
575
565
  }
576
- const ctx = await build_request_context(deps, account_id, acting.actor_id);
577
- if (!ctx)
578
- return { ok: false, status: 500, body: { error: ERROR_ACCOUNT_VANISHED } };
579
- return { ok: true, request_context: ctx };
566
+ return { ok: true, request_context: await build_request_context(deps, account, acting.actor) };
580
567
  };
581
568
  /**
582
569
  * Run the authorization phase on a Hono request: resolve the acting actor from
@@ -600,16 +587,17 @@ export const apply_authorization_phase = async (deps, account_id, auth, acting_v
600
587
  * @param deps - query deps for actor resolution
601
588
  * @param auth - the route's auth shape
602
589
  * @param acting - the `acting` selector, already through `parse_acting`; `undefined` when absent
603
- * @returns the refusal to answer (`400` actor selection, `500` a vanished
604
- * account), or nothing when the request may proceed
590
+ * @returns the refusal to answer (`400` actor selection, `401` an account
591
+ * removed since its credential was read, `500` a live account with no active
592
+ * actor), or nothing when the request may proceed
605
593
  */
606
594
  export const run_authorization_phase = async (c, deps, auth, acting) => {
607
595
  if (has_test_context_preset(c))
608
596
  return;
609
597
  if (is_public_auth(auth))
610
598
  return;
611
- const account_id = get_resolved_auth(c)?.account_id ?? null;
612
- const result = await apply_authorization_phase(deps, account_id, auth, acting);
599
+ const account = get_resolved_auth(c)?.account ?? null;
600
+ const result = await apply_authorization_phase(deps, account, auth, acting);
613
601
  if (!result.ok)
614
602
  return c.json(result.body, result.status);
615
603
  if (result.request_context !== null) {
@@ -656,9 +644,10 @@ export const create_fuz_authorization_handler = (deps) => {
656
644
  * authority gates (nothing about a route's body shape reaches a caller those
657
645
  * gates refuse), so the mutation half reads the raw body instead.
658
646
  *
659
- * The raw read mirrors `create_input_validation`'s own skip conditions exactly
660
- * — GETs and null-input specs — so this never parses a body the route itself
661
- * would have left alone. That matters for the routes carrying raw bytes rather
647
+ * The raw read mirrors `create_input_validation`'s own skip condition exactly
648
+ * — a null input, which every GET has (`apply_route_specs` refuses a GET with
649
+ * an input) — so this never parses a body the route itself would have left
650
+ * alone. That matters for the routes carrying raw bytes rather
662
651
  * than JSON (git smart-HTTP, binary uploads): they declare `input: literal(null)`,
663
652
  * so their stream reaches the handler untouched, and they carry `acting` on
664
653
  * `query` regardless.
@@ -674,7 +663,7 @@ const read_route_acting = async (c, spec) => {
674
663
  const validated_query = c.get('validated_query');
675
664
  if (validated_query && typeof validated_query.acting === 'string')
676
665
  return validated_query.acting;
677
- if (spec.method === 'GET' || is_null_schema(spec.input))
666
+ if (is_null_schema(spec.input))
678
667
  return undefined;
679
668
  const read = await read_json_body(c.req);
680
669
  // Malformed body — input validation answers with the 400.
@@ -15,17 +15,22 @@
15
15
  */
16
16
  import type { Context } from 'hono';
17
17
  import type { QueryDeps } from '../db/query_deps.js';
18
+ import type { Account } from './account_schema.js';
18
19
  import { type RequestContext } from './request_context.js';
19
20
  import { type TokenScope } from './token_scope.js';
20
21
  /** The fields every resolved credential carries. */
21
22
  interface ResolvedAuthBase {
22
23
  /**
23
- * The authenticated account. Its id, not its row — the twin of the Rust
24
- * spine's `ResolvedAuth::account`, which loads the row as it resolves. Here
25
- * the middleware stays one query per credential and the authorization phase
26
- * loads the account when a route needs it.
24
+ * The authenticated account, as the credential leg read it — live, not
25
+ * tombstoned. The authorization phase builds its request context on this
26
+ * row rather than reading the account again, so a request reads its account
27
+ * once, and an account removed after the leg is no torn read. On a
28
+ * long-lived connection it is the row read at the upgrade: a revocation
29
+ * closes the connection after its commit, and a re-read would race the
30
+ * revocation the same way. The twin of the Rust spine's
31
+ * `ResolvedAuth::account`.
27
32
  */
28
- readonly account_id: string;
33
+ readonly account: Account;
29
34
  /**
30
35
  * When the credential stops authenticating, as a monotonic
31
36
  * `performance.now()` timestamp — the moment a long-lived connection opened
@@ -1 +1 @@
1
- {"version":3,"file":"resolved_auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth/resolved_auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAErE,oDAAoD;AACpD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,GAAG,cAAc,CAAC;AAEvE,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACrC,2EAA2E;IAC3E,QAAQ,EAAE,YAAY,CAAC;IACvB,yFAAyF;IACzF,eAAe,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,OAAO,qBAAqB,KAC1B,OAAO,CAAC,gBAAgB,CAa1B,CAAC"}
@@ -110,7 +110,7 @@ export const get_resolved_auth = (c) => c.get(RESOLVED_AUTH_KEY) ?? null;
110
110
  * unchecked credential is not a valid one.
111
111
  */
112
112
  export const revalidate_resolved_auth = async (deps, resolved) => {
113
- const { account_id } = resolved;
113
+ const account_id = resolved.account.id;
114
114
  let credential_is_live;
115
115
  switch (resolved.credential_type) {
116
116
  case 'session': {
@@ -163,7 +163,7 @@ export const recheck_admission = async (deps, input) => {
163
163
  return 'credential_revoked';
164
164
  const acting_actor = request_context.actor;
165
165
  if (acting_actor) {
166
- const active = await query_active_actors_by_account(deps, resolved.account_id);
166
+ const active = await query_active_actors_by_account(deps, resolved.account.id);
167
167
  if (!active.some((a) => a.id === acting_actor.id))
168
168
  return 'actor_inactive';
169
169
  }
@@ -409,7 +409,7 @@ export declare const role_grant_offer_create_action_spec: {
409
409
  }>;
410
410
  async: true;
411
411
  description: string;
412
- error_reasons: ("role_grant_offer_self_target" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_account_mismatch" | "role_grant_builtin_scoped")[];
412
+ error_reasons: ("role_grant_offer_self_target" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_account_mismatch" | "role_grant_builtin_scoped" | "authentication_required")[];
413
413
  rate_limit: "account";
414
414
  };
415
415
  /**
@@ -465,7 +465,7 @@ export declare const role_grant_offer_accept_action_spec: {
465
465
  }>;
466
466
  async: true;
467
467
  description: string;
468
- error_reasons: ("role_grant_offer_terminal" | "role_grant_offer_expired" | "role_grant_offer_not_found" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_mismatch" | "role_grant_builtin_scoped")[];
468
+ error_reasons: ("role_grant_offer_terminal" | "role_grant_offer_expired" | "role_grant_offer_not_found" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_mismatch" | "role_grant_builtin_scoped" | "authentication_required")[];
469
469
  rate_limit: "account";
470
470
  };
471
471
  export declare const role_grant_offer_decline_action_spec: {
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_action_specs.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAiB3E,oEAAoE;AACpE,eAAO,MAAM,kCAAkC,EAAG,8BAAuC,CAAC;AAC1F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAClF,wGAAwG;AACxG,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF,uIAAuI;AACvI,eAAO,MAAM,yCAAyC,EACrD,qCAA8C,CAAC;AAChD,gKAAgK;AAChK,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,6FAA6F;AAC7F,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,wHAAwH;AACxH,eAAO,MAAM,6CAA6C,EACzD,yCAAkD,CAAC;AACpD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF;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;;;;;;;;;;;;;;;;;;;CAWT,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWZ,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;CAkBL,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBL,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,yBAAyB,CAS9E,CAAC"}
@@ -24,7 +24,7 @@
24
24
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
25
25
  import { array, check, integer, literal, max_value, message, min_value, nullable, number, object, optional, pipe, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
26
26
  import { ActingActor, Uuid, bounded_string } from '../primitive_schemas.js';
27
- import { ERROR_INSUFFICIENT_PERMISSIONS, ERROR_LIMIT_INVALID, ERROR_OFFSET_INVALID, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
27
+ import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_LIMIT_INVALID, ERROR_OFFSET_INVALID, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
28
28
  import { NAME_LENGTH_MAX } from './name_schema.js';
29
29
  import { RoleName } from './role_schema.js';
30
30
  import { ScopeKindName } from './scope_kind_schema.js';
@@ -275,7 +275,8 @@ export const role_grant_offer_create_action_spec = {
275
275
  ERROR_ROLE_GRANT_OFFER_ROLE_NOT_GRANTABLE,
276
276
  ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED,
277
277
  ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH,
278
- ERROR_ROLE_GRANT_BUILTIN_SCOPED
278
+ ERROR_ROLE_GRANT_BUILTIN_SCOPED,
279
+ ERROR_AUTHENTICATION_REQUIRED
279
280
  ],
280
281
  rate_limit: 'account'
281
282
  };
@@ -311,7 +312,8 @@ export const role_grant_offer_accept_action_spec = {
311
312
  ERROR_ROLE_GRANT_OFFER_ACTOR_MISMATCH,
312
313
  ERROR_ROLE_GRANT_OFFER_ROLE_NOT_GRANTABLE,
313
314
  ERROR_ROLE_GRANT_BUILTIN_SCOPED,
314
- ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED
315
+ ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED,
316
+ ERROR_AUTHENTICATION_REQUIRED
315
317
  ],
316
318
  rate_limit: 'account'
317
319
  };
@@ -44,13 +44,12 @@
44
44
  * transaction, a failure row on the pool). `audit.notify` (SSE/WS broadcast)
45
45
  * fires post-commit in both paths.
46
46
  *
47
- * WS notifications fan out post-commit via `emit_after_commit` when a
48
- * `notification_sender` is wired: offer lifecycle transitions notify the
47
+ * WS notifications go through the handler context's sender
48
+ * (`ctx.notification_sender`), queued post-commit (`queue_offer_notification`,
49
+ * `queue_supersede_notifications`): offer lifecycle transitions notify the
49
50
  * counterparty, `role_grant_revoke` notifies the revokee (`role_grant_revoked`)
50
- * plus each superseded
51
- * pending offer's grantor. Under DEV each notification's params are checked
52
- * against its spec's schema before it is sent, a mismatch logged
53
- * (`create_validated_notification_sender`). `role_grant_revoke` of a global
51
+ * plus both parties of each superseded pending offer, and an accept each
52
+ * superseded sibling's grantor. `role_grant_revoke` of a global
54
53
  * grant also closes the revokee's connections gated on the role through
55
54
  * `deps.connection_closer`, after the commit.
56
55
  *
@@ -61,7 +60,6 @@ import { type ActionContext, type RpcAction } from '../actions/action_types.js';
61
60
  import { type RoleRegistry } from './role_schema.js';
62
61
  import { type RequestContext } from './request_context.js';
63
62
  import type { RevokingActionFactoryDeps } from './deps.js';
64
- import { type NotificationSender } from './role_grant_offer_notifications.js';
65
63
  /**
66
64
  * Authorization callback for `role_grant_offer_create` and `role_grant_assign`.
67
65
  * Returns `true` to allow, `false` to reject (handler converts to `forbidden`
@@ -115,11 +113,9 @@ export interface RoleGrantOfferActionOptions {
115
113
  * Create the role-grant-offer RPC actions: the offer-lifecycle methods plus
116
114
  * `role_grant_revoke` and the immediate `role_grant_assign`.
117
115
  *
118
- * @param deps - `RevokingActionFactoryDeps` (`log`, `audit`, and the `connection_closer` a revoked global grant closes the revokee's role-gated connections through) plus optional `notification_sender` for WS fan-out — when absent, WS fan-out is silently skipped (DB-only side effects still happen). Consumers wiring `ConnectionRegistry` assign its instance directly (the registry's `send_to_account` signature accepts the broader `JsonrpcMessageFromServerToClient`, which is contravariantly compatible)
116
+ * @param deps - `RevokingActionFactoryDeps`: `log`, `audit`, and the `connection_closer` a revoked global grant closes the revokee's role-gated connections through. WS notifications go through the handler context's `notification_sender`, not a dep
119
117
  * @param options - role registry, default TTL, authorization override
120
118
  * @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
121
119
  */
122
- export declare const create_role_grant_offer_actions: (deps: RevokingActionFactoryDeps & {
123
- notification_sender?: NotificationSender | null;
124
- }, options?: RoleGrantOfferActionOptions) => Array<RpcAction>;
120
+ export declare const create_role_grant_offer_actions: (deps: RevokingActionFactoryDeps, options?: RoleGrantOfferActionOptions) => Array<RpcAction>;
125
121
  //# sourceMappingURL=role_grant_offer_actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAMN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CA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