@fuzdev/fuz_app 0.180.0 → 0.181.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 (358) hide show
  1. package/dist/actions/CLAUDE.md +14 -14
  2. package/dist/actions/action_rpc.d.ts +14 -5
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +53 -46
  5. package/dist/actions/action_types.d.ts +15 -12
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/perform_action.d.ts +4 -4
  8. package/dist/actions/perform_action.d.ts.map +1 -1
  9. package/dist/actions/perform_action.js +6 -6
  10. package/dist/actions/register_action_ws.d.ts +6 -2
  11. package/dist/actions/register_action_ws.d.ts.map +1 -1
  12. package/dist/actions/register_action_ws.js +14 -3
  13. package/dist/actions/ws_socket_session.js +1 -1
  14. package/dist/auth/CLAUDE.md +36 -30
  15. package/dist/auth/account_actions.d.ts.map +1 -1
  16. package/dist/auth/account_actions.js +18 -1
  17. package/dist/auth/account_queries.d.ts +69 -0
  18. package/dist/auth/account_queries.d.ts.map +1 -1
  19. package/dist/auth/account_queries.js +82 -0
  20. package/dist/auth/account_route_schema.d.ts +26 -16
  21. package/dist/auth/account_route_schema.d.ts.map +1 -1
  22. package/dist/auth/account_route_schema.js +10 -24
  23. package/dist/auth/account_routes.d.ts +4 -6
  24. package/dist/auth/account_routes.d.ts.map +1 -1
  25. package/dist/auth/account_routes.js +86 -66
  26. package/dist/auth/admin_actions.d.ts.map +1 -1
  27. package/dist/auth/admin_actions.js +63 -14
  28. package/dist/auth/api_token_queries.d.ts +16 -7
  29. package/dist/auth/api_token_queries.d.ts.map +1 -1
  30. package/dist/auth/api_token_queries.js +18 -18
  31. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  32. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  33. package/dist/auth/audit_log_routes.d.ts +1 -1
  34. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  35. package/dist/auth/audit_log_routes.js +10 -12
  36. package/dist/auth/audit_log_schema.js +4 -4
  37. package/dist/auth/bearer_auth.d.ts +4 -3
  38. package/dist/auth/bearer_auth.d.ts.map +1 -1
  39. package/dist/auth/bearer_auth.js +35 -31
  40. package/dist/auth/bootstrap_account.d.ts +65 -37
  41. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  42. package/dist/auth/bootstrap_account.js +115 -66
  43. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  44. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  45. package/dist/auth/bootstrap_route_schema.js +7 -2
  46. package/dist/auth/bootstrap_routes.d.ts +50 -33
  47. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_routes.js +109 -87
  49. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  50. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  51. package/dist/auth/bootstrap_token_store.js +39 -0
  52. package/dist/auth/credential_headers.d.ts +71 -0
  53. package/dist/auth/credential_headers.d.ts.map +1 -0
  54. package/dist/auth/credential_headers.js +100 -0
  55. package/dist/auth/daemon_token.d.ts +13 -1
  56. package/dist/auth/daemon_token.d.ts.map +1 -1
  57. package/dist/auth/daemon_token.js +14 -2
  58. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  59. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  60. package/dist/auth/daemon_token_middleware.js +27 -29
  61. package/dist/auth/deps.d.ts +0 -11
  62. package/dist/auth/deps.d.ts.map +1 -1
  63. package/dist/auth/invite_queries.d.ts +18 -0
  64. package/dist/auth/invite_queries.d.ts.map +1 -1
  65. package/dist/auth/invite_queries.js +24 -0
  66. package/dist/auth/request_context.d.ts +26 -5
  67. package/dist/auth/request_context.d.ts.map +1 -1
  68. package/dist/auth/request_context.js +17 -10
  69. package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
  70. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  71. package/dist/auth/role_grant_offer_action_specs.js +3 -2
  72. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  73. package/dist/auth/role_grant_offer_actions.js +37 -14
  74. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  75. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  76. package/dist/auth/role_grant_offer_ddl.js +9 -2
  77. package/dist/auth/role_grant_offer_queries.d.ts +56 -3
  78. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  79. package/dist/auth/role_grant_offer_queries.js +93 -8
  80. package/dist/auth/role_grant_queries.d.ts +7 -0
  81. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  82. package/dist/auth/role_grant_queries.js +8 -0
  83. package/dist/auth/session_cookie.d.ts +105 -25
  84. package/dist/auth/session_cookie.d.ts.map +1 -1
  85. package/dist/auth/session_cookie.js +124 -15
  86. package/dist/auth/session_middleware.d.ts +83 -54
  87. package/dist/auth/session_middleware.d.ts.map +1 -1
  88. package/dist/auth/session_middleware.js +92 -66
  89. package/dist/auth/session_queries.d.ts +64 -4
  90. package/dist/auth/session_queries.d.ts.map +1 -1
  91. package/dist/auth/session_queries.js +53 -4
  92. package/dist/auth/signup_route_schema.d.ts +5 -5
  93. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  94. package/dist/auth/signup_route_schema.js +4 -4
  95. package/dist/auth/signup_routes.d.ts.map +1 -1
  96. package/dist/auth/signup_routes.js +17 -14
  97. package/dist/auth/token_scope.d.ts +5 -7
  98. package/dist/auth/token_scope.d.ts.map +1 -1
  99. package/dist/auth/token_scope.js +5 -8
  100. package/dist/dev/setup.d.ts +6 -1
  101. package/dist/dev/setup.d.ts.map +1 -1
  102. package/dist/dev/setup.js +42 -34
  103. package/dist/hono_context.d.ts +21 -0
  104. package/dist/hono_context.d.ts.map +1 -1
  105. package/dist/hono_context.js +17 -0
  106. package/dist/http/CLAUDE.md +150 -43
  107. package/dist/http/auth_shape.d.ts +3 -3
  108. package/dist/http/common_routes.js +1 -1
  109. package/dist/http/db_routes.d.ts +4 -3
  110. package/dist/http/db_routes.d.ts.map +1 -1
  111. package/dist/http/db_routes.js +14 -14
  112. package/dist/http/dev_route_error_check.d.ts +6 -3
  113. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  114. package/dist/http/dev_route_error_check.js +6 -3
  115. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  116. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  117. package/dist/http/dev_set_cookie_check.js +80 -0
  118. package/dist/http/error_schemas.d.ts +36 -1
  119. package/dist/http/error_schemas.d.ts.map +1 -1
  120. package/dist/http/error_schemas.js +39 -2
  121. package/dist/http/header_lines.d.ts +42 -0
  122. package/dist/http/header_lines.d.ts.map +1 -0
  123. package/dist/http/header_lines.js +80 -0
  124. package/dist/http/host.d.ts +12 -9
  125. package/dist/http/host.d.ts.map +1 -1
  126. package/dist/http/host.js +25 -20
  127. package/dist/http/origin.d.ts +7 -22
  128. package/dist/http/origin.d.ts.map +1 -1
  129. package/dist/http/origin.js +11 -25
  130. package/dist/http/proxy.d.ts +1 -0
  131. package/dist/http/proxy.d.ts.map +1 -1
  132. package/dist/http/proxy.js +3 -0
  133. package/dist/http/request_headers.d.ts +95 -0
  134. package/dist/http/request_headers.d.ts.map +1 -0
  135. package/dist/http/request_headers.js +110 -0
  136. package/dist/http/request_target.d.ts +134 -0
  137. package/dist/http/request_target.d.ts.map +1 -0
  138. package/dist/http/request_target.js +193 -0
  139. package/dist/http/route_error_check.d.ts +4 -11
  140. package/dist/http/route_error_check.d.ts.map +1 -1
  141. package/dist/http/route_error_check.js +4 -21
  142. package/dist/http/route_result.d.ts +127 -23
  143. package/dist/http/route_result.d.ts.map +1 -1
  144. package/dist/http/route_result.js +97 -19
  145. package/dist/http/route_spec.d.ts +298 -82
  146. package/dist/http/route_spec.d.ts.map +1 -1
  147. package/dist/http/route_spec.js +548 -71
  148. package/dist/http/simple_request.d.ts +19 -14
  149. package/dist/http/simple_request.d.ts.map +1 -1
  150. package/dist/http/simple_request.js +17 -29
  151. package/dist/http/surface.d.ts +2 -0
  152. package/dist/http/surface.d.ts.map +1 -1
  153. package/dist/http/surface.js +4 -1
  154. package/dist/realtime/outbound_budget.d.ts +1 -2
  155. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  156. package/dist/realtime/outbound_budget.js +1 -2
  157. package/dist/realtime/sse.d.ts +47 -17
  158. package/dist/realtime/sse.d.ts.map +1 -1
  159. package/dist/realtime/sse.js +115 -93
  160. package/dist/realtime/sse_constants.d.ts +7 -1
  161. package/dist/realtime/sse_constants.d.ts.map +1 -1
  162. package/dist/realtime/sse_constants.js +12 -1
  163. package/dist/realtime/sse_registry.d.ts +3 -3
  164. package/dist/realtime/sse_registry.js +3 -3
  165. package/dist/runtime/deps.d.ts +20 -4
  166. package/dist/runtime/deps.d.ts.map +1 -1
  167. package/dist/runtime/mock.d.ts +7 -1
  168. package/dist/runtime/mock.d.ts.map +1 -1
  169. package/dist/runtime/mock.js +33 -3
  170. package/dist/runtime/node.d.ts.map +1 -1
  171. package/dist/runtime/node.js +2 -1
  172. package/dist/runtime/secure_file.d.ts +71 -10
  173. package/dist/runtime/secure_file.d.ts.map +1 -1
  174. package/dist/runtime/secure_file.js +91 -11
  175. package/dist/server/app_backend.d.ts +0 -8
  176. package/dist/server/app_backend.d.ts.map +1 -1
  177. package/dist/server/app_backend.js +1 -3
  178. package/dist/server/app_server.d.ts +28 -17
  179. package/dist/server/app_server.d.ts.map +1 -1
  180. package/dist/server/app_server.js +52 -34
  181. package/dist/server/serve_fact_route.d.ts.map +1 -1
  182. package/dist/server/serve_fact_route.js +49 -45
  183. package/dist/server/static.d.ts +20 -0
  184. package/dist/server/static.d.ts.map +1 -1
  185. package/dist/server/static.js +56 -8
  186. package/dist/server/unmatched_route.d.ts +42 -0
  187. package/dist/server/unmatched_route.d.ts.map +1 -0
  188. package/dist/server/unmatched_route.js +64 -0
  189. package/dist/testing/CLAUDE.md +404 -1200
  190. package/dist/testing/app_server.d.ts +3 -1
  191. package/dist/testing/app_server.d.ts.map +1 -1
  192. package/dist/testing/app_server.js +4 -10
  193. package/dist/testing/auth_apps.d.ts.map +1 -1
  194. package/dist/testing/auth_apps.js +2 -1
  195. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  196. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  197. package/dist/testing/cross_backend/account_lifecycle.js +277 -6
  198. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  199. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  200. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  201. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  202. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  203. package/dist/testing/cross_backend/capabilities.js +20 -4
  204. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  205. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  206. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  207. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  208. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  209. package/dist/testing/cross_backend/conformance_table.js +179 -23
  210. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  211. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  212. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  213. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  214. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  215. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  216. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  217. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  218. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  219. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  220. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  221. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  222. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  224. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  225. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  226. package/dist/testing/cross_backend/credential_wire.js +188 -0
  227. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  228. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  229. package/dist/testing/cross_backend/default_spine_surface.js +1 -1
  230. package/dist/testing/cross_backend/differential.d.ts +1 -1
  231. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/differential.js +3 -2
  233. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  234. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  235. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  236. package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
  237. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  238. package/dist/testing/cross_backend/full_spine_mount.js +7 -0
  239. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  240. package/dist/testing/cross_backend/identity_parity.js +4 -0
  241. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  242. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  243. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  244. package/dist/testing/cross_backend/login_security.js +13 -10
  245. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  246. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  247. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  248. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  250. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  251. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  252. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  253. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  254. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  255. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  256. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  257. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  258. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  259. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  260. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  261. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  262. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  263. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  264. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
  265. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  266. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  268. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  269. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  270. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  271. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  272. package/dist/testing/cross_backend/session_cap.js +56 -29
  273. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  274. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  275. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  276. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  277. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/session_login.js +31 -0
  279. package/dist/testing/cross_backend/setup.d.ts +117 -0
  280. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  281. package/dist/testing/cross_backend/setup.js +193 -9
  282. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  283. package/dist/testing/cross_backend/simple_request.js +5 -0
  284. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  285. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  286. package/dist/testing/cross_backend/spine_suites.js +88 -5
  287. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  288. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  289. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  290. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  291. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  292. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  293. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  294. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  295. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  296. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  297. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  298. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  299. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  300. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  301. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  302. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  303. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  304. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  305. package/dist/testing/cross_backend/transport_composition.js +13 -10
  306. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  308. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  309. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  310. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  311. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  313. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  314. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  315. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  316. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  317. package/dist/testing/cross_backend/xfail.js +68 -23
  318. package/dist/testing/data_exposure.d.ts.map +1 -1
  319. package/dist/testing/data_exposure.js +4 -3
  320. package/dist/testing/integration.d.ts +1 -2
  321. package/dist/testing/integration.d.ts.map +1 -1
  322. package/dist/testing/integration.js +14 -8
  323. package/dist/testing/integration_helpers.d.ts +50 -3
  324. package/dist/testing/integration_helpers.d.ts.map +1 -1
  325. package/dist/testing/integration_helpers.js +87 -9
  326. package/dist/testing/middleware.d.ts +2 -0
  327. package/dist/testing/middleware.d.ts.map +1 -1
  328. package/dist/testing/middleware.js +9 -2
  329. package/dist/testing/round_trip.d.ts +6 -2
  330. package/dist/testing/round_trip.d.ts.map +1 -1
  331. package/dist/testing/round_trip.js +17 -6
  332. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  333. package/dist/testing/rpc_envelope_cases.js +7 -0
  334. package/dist/testing/rpc_helpers.d.ts +4 -2
  335. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  336. package/dist/testing/rpc_helpers.js +6 -1
  337. package/dist/testing/rpc_round_trip.d.ts +13 -2
  338. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  339. package/dist/testing/rpc_round_trip.js +25 -6
  340. package/dist/testing/schema_generators.d.ts +2 -2
  341. package/dist/testing/schema_generators.d.ts.map +1 -1
  342. package/dist/testing/schema_generators.js +4 -4
  343. package/dist/testing/stubs.d.ts +2 -2
  344. package/dist/testing/stubs.d.ts.map +1 -1
  345. package/dist/testing/stubs.js +8 -8
  346. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  347. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  348. package/dist/testing/transports/fetch_transport.js +31 -19
  349. package/dist/testing/transports/raw_http.d.ts +61 -1
  350. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  351. package/dist/testing/transports/raw_http.js +61 -1
  352. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  353. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  354. package/dist/testing/transports/ws_raw_client.js +10 -4
  355. package/dist/testing/transports/ws_transport.d.ts +21 -1
  356. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  357. package/dist/testing/transports/ws_transport.js +58 -20
  358. package/package.json +1 -1
@@ -190,7 +190,7 @@ use `auth: {account: 'none', actor: 'none'}` and `transaction: false`.
190
190
 
191
191
  The HTTP RPC dispatcher is a thin shim around `perform_action`
192
192
  (`actions/perform_action.ts`). The shim owns wire-shape concerns (envelope
193
- parsing, GET vs POST split, the envelope responses — each a `route_raw`); the
193
+ parsing, GET vs POST split, the envelope responses — each a `route_raw` data result); the
194
194
  auth/validation/dispatch pipeline is shared with the WebSocket dispatcher.
195
195
 
196
196
  **Phase order: 401 → authz → 403 → 429 → 400 → handler.** Authorize first,
@@ -205,12 +205,12 @@ spines, and an authorized one is `invalid_params`.
205
205
 
206
206
  Shim responsibilities (per-request):
207
207
 
208
- 1. Parse envelope (POST body / GET query string, each through `parse_json_text`, `http/json_text.ts`, so JSON the Rust spine refuses is refused here too); parse errors → `parse_error` 400, a `GET` `params` that is no JSON `invalid_params`. GET reads `method` / `id` / `params` via Hono's `c.req.query()` — first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
208
+ 1. Parse envelope (POST body / GET query string, each through `parse_json_text`, `http/json_text.ts`, so JSON the Rust spine refuses is refused here too); parse errors → `parse_error` 400, a `GET` `params` that is no JSON `invalid_params`. GET reads `method` / `id` / `params` with `query_first` over `route.query_pairs` (the query decoded strictly, `http/request_target.ts`) — a query holding an escape that doesn't decode is `invalid_request` on `id: null` with reason `undecodable query string` (`RPC_GET_UNDECODABLE_QUERY_REASON`), ahead of the method lookup; first occurrence wins on a duplicated key, unknown keys are ignored, and an empty value counts as missing. This is the cross-impl contract (the Rust GET dispatch mirrors it via `fuz_http`'s `query_first`, including the id numeric-vs-string normalization), pinned by the `query_shape` cross suite.
209
209
  2. Lookup method in the `compile_action_registry`-built map; unknown → `method_not_found`.
210
- 3. GET read restriction — GET rejected for `side_effects: true` actions. Every response the GET handler writes, its refusals included, carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`; a pre-handler middleware refusal, like the origin 403, does not): a read answers one caller at one moment.
211
- 4. Build `PerformActionInput` from `get_resolved_auth(c)` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `has_test_context_preset(c)` + `REQUEST_CONTEXT_KEY`.
210
+ 3. GET read restriction — GET rejected for `side_effects: true` actions. Every answer of the GET route carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`), declared as the spec's `response_headers`, so the handler's refusals and the error catch's 500 carry it too; a refusal by middleware ahead of the route, like the origin 403, does not: a read answers one caller at one moment.
211
+ 4. Build `PerformActionInput` from the route context: `route.credential`, `route.client_ip`, `route.signal`. The test-preset escape hatch reads `route.has_test_context_preset` and `route.auth`.
212
212
  5. Call `perform_action` (shared core).
213
- 6. Bind result via `serialize_action_result(id, result, method, log)` (`actions/perform_action.ts`, shared with WS) → `{body, status}`, written with `c.json`'s bytes and content type and returned as a `route_raw`, as is every envelope the shim answers: no REST definition describes one.
213
+ 6. Bind result via `serialize_action_result(id, result, method, log)` (`actions/perform_action.ts`, shared with WS) → `{body, status}`, spelled with `c.json`'s bytes and content type as a `route_raw` data result, as is every envelope the shim answers: no REST definition describes one.
214
214
 
215
215
  Error paths: `ThrownJsonrpcError` (recognized through
216
216
  `to_thrown_jsonrpc_error` in `http/jsonrpc_errors.ts` by its realm-global
@@ -261,7 +261,9 @@ interface RpcAction {
261
261
  `rpc_action<TSpec extends RequestResponseActionSpec>(spec, handler)` pins
262
262
  the handler's input / output types to `Infer<TSpec['input']>` /
263
263
  `Infer<TSpec['output']>` and tightens `ctx.auth` per the conditional
264
- `HandlerForSpec<TSpec>`:
264
+ `HandlerForSpec<TSpec>`, built on `RequestContextForAuth`
265
+ (`auth/request_context.ts`) — the same narrowing a REST handler's
266
+ `route.auth` takes:
265
267
 
266
268
  - `auth.actor === 'required'` → `ctx.auth: RequestActorContext`.
267
269
  - `auth.account === 'required' && auth.actor === 'none'` → `ctx.auth: RequestContext`.
@@ -273,11 +275,9 @@ at the factory call instead of at runtime. The bracketed form
273
275
  `AuthAxisState` union (when the spec was typed without preserving its
274
276
  literal) falls through to the loosest tier instead of the narrowest.
275
277
 
276
- zzz uses a codegen-driven `Record<Method, Handler>` map for the same
277
- narrowing — ideal when handlers are stateless free functions. fuz_app's
278
- handlers close over factory-captured deps (`log`, `audit`,
279
- `options.app_settings`, `options.max_tokens`), so per-pair typing via
280
- `rpc_action()` is the right shape here.
278
+ fuz_app's handlers close over factory-captured deps (`log`, `audit`,
279
+ `options.max_tokens`), so per-pair typing via `rpc_action()` is the shape
280
+ that fits.
281
281
 
282
282
  ## Shared dispatch core (`actions/perform_action.ts`)
283
283
 
@@ -295,7 +295,7 @@ Pipeline (401 → authz → 403 → 429 → 400 → handler):
295
295
  5. Validate params (400) — first, one walk of object params (`scan_json_value` in `http/schema_helpers.ts`, iterative) refuses, on every input, an own `__proto__` key at any depth with `data.reason` `params_proto_key` (`ERROR_PARAMS_PROTO_KEY`), then U+0000 in any string or key with `params_nul` (`ERROR_PARAMS_NUL` — Postgres refuses it in `text` and `jsonb`); the Rust twin walks after its params-shape check, so a non-object `params` stays the schema's reasonless refusal; then `spec.input` parses them (`parse`) with void / `?? {}` rules; a void input (`is_void_schema`: `s.void`) reads absent, `null` (GET `?params=null`), and `{}` alike as the no-arg call (`to_input_params` in `http/schema_helpers.ts`, via `to_void_params`, the twin of the Rust `require_void_params`; the peer receive path in `ActionDispatcher` runs the same normalizer) and refuses any other shape. A refusal is `to_invalid_params_error`: the generic `invalid params`, `data.reason` when the first issue's field declares an `invalid_reason` in its `meta` and no issue sits on the input itself, such as an unknown key (`resolve_issues_invalid_reason`, `schema_meta.ts` — see ../../../docs/architecture.md §Error Schema System), and the issues DEV-only, as `WireIssue`s (`to_wire_issues`)
296
296
  6. Dispatch + DEV output validation + error normalization — `spec.side_effects` picks transaction vs pool. `ThrownJsonrpcError` preserves code + data; generic throws become `internal_error`
297
297
 
298
- `PerformActionInput` carries `auth` (the request's `ResolvedAuth`, `null` for
298
+ `PerformActionInput` carries `credential` (the request's `ResolvedAuth`, `null` for
299
299
  anonymous — the authorization phase reads its account, the post-authorization
300
300
  gates its type and scope, `ActionContext` its type and session hash),
301
301
  `client_ip`, `signal`, `notify`, optional `connection_id`, optional `preset`.
@@ -841,12 +841,12 @@ shape `{account: 'required', actor: 'required', roles?, required_scope:
841
841
  1. `verify_request_source(allowed_origins)` — 403
842
842
  2. `require_auth` — 401
843
843
  3. `require_token_scope('surface:ws_upgrade')` — a narrowed token cannot hold a socket (403 `token_scope_required`)
844
- 4. The authorization phase (`run_authorization_phase`, `auth/request_context.ts`) — resolves the acting actor (`?acting=` through `parse_acting`; malformed reads as omitted, and the route declares no query schema, so a credential-less `?acting=garbage` is still the 401), seeds `REQUEST_CONTEXT_KEY`
844
+ 4. The authorization phase (`run_authorization_phase`, `auth/request_context.ts`) — resolves the acting actor (`?acting=` through `parse_acting`; malformed reads as omitted, and the route declares no query schema, so a credential-less `?acting=garbage` is still the 401; a query holding an escape that doesn't decode is refused here, 400 `invalid_query_params`, after the 401 and the scope gate), seeds `REQUEST_CONTEXT_KEY`
845
845
  5. `require_role(required_roles)` when the endpoint is gated — any-of disjunction (coarse upgrade-time gate; per-action `auth` in each spec still applies at dispatch time)
846
846
  6. `upgradeWebSocket`
847
847
 
848
848
  Only `GET` is mounted (Hono serves `HEAD` through it, guards included), so any
849
- other method on the path is a 404. Takes
849
+ other method on the path is the app's 405 (`Allow: GET, HEAD`; `server/unmatched_route.ts`), and a `GET` asking for no upgrade its 404. Takes
850
850
  `allowed_origins` (required — `create_app_server` passes the server's), the
851
851
  required `connection_closer` and action limiters, and optional
852
852
  `required_roles`; returns `{registry}`. Most consumers reach for
@@ -17,10 +17,18 @@ import type { RpcAction } from './action_types.js';
17
17
  import { type RouteSpec } from '../http/route_spec.js';
18
18
  import type { RateLimiter } from '../rate_limiter.js';
19
19
  /**
20
- * The `Cache-Control` every response of the RPC endpoint's `GET` route carries
21
- * — a read is per caller and per moment, so nothing may store it.
20
+ * The `Cache-Control` every answer of the RPC endpoint's `GET` route carries
21
+ * — a read is per caller and per moment, so nothing may store it. Declared as
22
+ * the route's `response_headers`, so the error catch's answer carries it too.
22
23
  */
23
24
  export declare const RPC_GET_CACHE_CONTROL = "no-store";
25
+ /**
26
+ * The `data.reason` of the RPC `GET`'s `invalid_request` when an escape in
27
+ * its query string doesn't decode (`read_query_pairs`) — before any key is
28
+ * read, so the answer echoes no id. The Rust spine's `rpc_get_handler`
29
+ * answers the same literal.
30
+ */
31
+ export declare const RPC_GET_UNDECODABLE_QUERY_REASON = "undecodable query string";
24
32
  /** Options for `create_rpc_endpoint`. */
25
33
  export interface CreateRpcEndpointOptions {
26
34
  /** Mount path for the endpoint (e.g., `/api/rpc`). */
@@ -74,9 +82,10 @@ export interface CreateRpcEndpointOptions {
74
82
  * 8. **Dispatch** — acquire DB handle (transaction for mutations, pool for reads),
75
83
  * construct `ActionContext`, call handler, return JSON-RPC response.
76
84
  *
77
- * GET is restricted to `side_effects: false` actions, and every response the
78
- * GET handler writes, its refusals included, carries `Cache-Control: no-store`
79
- * (`RPC_GET_CACHE_CONTROL`) — a refusal by middleware ahead of it does not.
85
+ * GET is restricted to `side_effects: false` actions, and every answer of the
86
+ * GET route, its refusals and the error catch's included, carries
87
+ * `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`, its `response_headers`)
88
+ * — a refusal by middleware ahead of the route does not.
80
89
  * All errors use JSON-RPC format: `{jsonrpc, id, error: {code, message, data?}}`.
81
90
  *
82
91
  * The RouteSpecs use `auth: {type: 'none'}` because auth is checked per-action
@@ -1 +1 @@
1
- {"version":3,"file":"action_rpc.d.ts","sourceRoot":"","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;;OAOG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,wBAAwB,KAAG,KAAK,CAAC,SAAS,CAmOtF,CAAC"}
1
+ {"version":3,"file":"action_rpc.d.ts","sourceRoot":"","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAaxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6BAA6B,CAAC;AAE3E,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;;OAOG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,wBAAwB,KAAG,KAAK,CAAC,SAAS,CAgOtF,CAAC"}
@@ -17,28 +17,33 @@ import { literal, unknown } from '@fuzdev/fuz_schema/schema.ts';
17
17
  import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
18
18
  import { define_route } from '../http/route_spec.js';
19
19
  import { route_raw } from '../http/route_result.js';
20
- import { get_client_ip } from '../http/client_ip.js';
21
- import { get_request_context } from '../auth/request_context.js';
22
- import { get_resolved_auth } from '../auth/resolved_auth.js';
23
- import { has_test_context_preset } from '../hono_context.js';
24
20
  import { compile_action_registry } from './compile_action_registry.js';
25
21
  import { jsonrpc_error_messages, jsonrpc_error_code_to_http_status, JSONRPC_ERROR_CODES } from '../http/jsonrpc_errors.js';
26
22
  import { classify_jsonrpc_message, create_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
27
23
  import { perform_action, serialize_action_result } from './perform_action.js';
28
- import { parse_json_text, read_json_body } from '../http/json_text.js';
24
+ import { parse_json_text } from '../http/json_text.js';
25
+ import { query_first } from '../http/request_target.js';
29
26
  /**
30
- * The `Cache-Control` every response of the RPC endpoint's `GET` route carries
31
- * — a read is per caller and per moment, so nothing may store it.
27
+ * The `Cache-Control` every answer of the RPC endpoint's `GET` route carries
28
+ * — a read is per caller and per moment, so nothing may store it. Declared as
29
+ * the route's `response_headers`, so the error catch's answer carries it too.
32
30
  */
33
31
  export const RPC_GET_CACHE_CONTROL = 'no-store';
32
+ /**
33
+ * The `data.reason` of the RPC `GET`'s `invalid_request` when an escape in
34
+ * its query string doesn't decode (`read_query_pairs`) — before any key is
35
+ * read, so the answer echoes no id. The Rust spine's `rpc_get_handler`
36
+ * answers the same literal.
37
+ */
38
+ export const RPC_GET_UNDECODABLE_QUERY_REASON = 'undecodable query string';
39
+ /** The `Content-Type` `c.json` writes, which every envelope answers with. */
40
+ const JSON_CONTENT_TYPE = { 'Content-Type': 'application/json' };
34
41
  /**
35
42
  * A JSON-RPC envelope answered at `status`, with the bytes and `Content-Type`
36
43
  * `c.json` writes, as a raw result: the endpoint answers envelopes, its
37
44
  * refusals included, which no REST definition describes.
38
45
  */
39
- const envelope_response = (c, envelope, status) => route_raw(c.body(JSON.stringify(envelope), status, {
40
- 'Content-Type': 'application/json'
41
- }));
46
+ const envelope_response = (envelope, status) => route_raw({ status, headers: JSON_CONTENT_TYPE, body: JSON.stringify(envelope) });
42
47
  /**
43
48
  * Single JSON-RPC 2.0 endpoint — the canonical RPC transport binding.
44
49
  *
@@ -64,9 +69,10 @@ const envelope_response = (c, envelope, status) => route_raw(c.body(JSON.stringi
64
69
  * 8. **Dispatch** — acquire DB handle (transaction for mutations, pool for reads),
65
70
  * construct `ActionContext`, call handler, return JSON-RPC response.
66
71
  *
67
- * GET is restricted to `side_effects: false` actions, and every response the
68
- * GET handler writes, its refusals included, carries `Cache-Control: no-store`
69
- * (`RPC_GET_CACHE_CONTROL`) — a refusal by middleware ahead of it does not.
72
+ * GET is restricted to `side_effects: false` actions, and every answer of the
73
+ * GET route, its refusals and the error catch's included, carries
74
+ * `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`, its `response_headers`)
75
+ * — a refusal by middleware ahead of the route does not.
70
76
  * All errors use JSON-RPC format: `{jsonrpc, id, error: {code, message, data?}}`.
71
77
  *
72
78
  * The RouteSpecs use `auth: {type: 'none'}` because auth is checked per-action
@@ -102,13 +108,13 @@ export const create_rpc_endpoint = (options) => {
102
108
  *
103
109
  * @param restrict_to_reads - `true` for GET (rejects `side_effects: true` actions)
104
110
  */
105
- const dispatch = async (c, route, method_name, raw_params, id, restrict_to_reads) => {
111
+ const dispatch = async (route, method_name, raw_params, id, restrict_to_reads) => {
106
112
  const action = action_map.get(method_name);
107
113
  if (!action) {
108
- return envelope_response(c, create_jsonrpc_error_response(id, jsonrpc_error_messages.method_not_found(method_name)), jsonrpc_error_code_to_http_status(JSONRPC_ERROR_CODES.method_not_found));
114
+ return envelope_response(create_jsonrpc_error_response(id, jsonrpc_error_messages.method_not_found(method_name)), jsonrpc_error_code_to_http_status(JSONRPC_ERROR_CODES.method_not_found));
109
115
  }
110
116
  if (restrict_to_reads && action.spec.side_effects) {
111
- return envelope_response(c, create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_request({
117
+ return envelope_response(create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_request({
112
118
  reason: `method '${method_name}' has side effects and must use POST`
113
119
  })), jsonrpc_error_code_to_http_status(JSONRPC_ERROR_CODES.invalid_request));
114
120
  }
@@ -122,16 +128,14 @@ export const create_rpc_endpoint = (options) => {
122
128
  // set `TEST_CONTEXT_PRESET_KEY` to `TEST_CONTEXT_PRESET`. Production middleware never
123
129
  // sets the flag; the shim honors it and `perform_action` trusts the
124
130
  // pre-baked context instead of running the live authorization phase.
125
- const preset = has_test_context_preset(c)
126
- ? { request_context: get_request_context(c) }
127
- : undefined;
131
+ const preset = route.has_test_context_preset ? { request_context: route.auth } : undefined;
128
132
  const result = await perform_action({
129
133
  action,
130
134
  raw_params,
131
135
  request_id: id,
132
- auth: get_resolved_auth(c),
133
- client_ip: get_client_ip(c),
134
- signal: c.req.raw.signal,
136
+ credential: route.credential,
137
+ client_ip: route.client_ip,
138
+ signal: route.signal,
135
139
  notify,
136
140
  preset
137
141
  }, {
@@ -145,19 +149,16 @@ export const create_rpc_endpoint = (options) => {
145
149
  const { body, status } = serialize_action_result(id, result, method_name, log);
146
150
  // `status` is 200 or one of the JSON-RPC → HTTP status codes the
147
151
  // dispatcher emits (the value space is verified by
148
- // `jsonrpc_error_code_to_http_status`), which the cast to Hono's
149
- // `ContentfulStatusCode` bridges. The content type is `c.json`'s.
150
- return route_raw(c.body(body, status, {
151
- 'Content-Type': 'application/json'
152
- }));
152
+ // `jsonrpc_error_code_to_http_status`). The content type is `c.json`'s.
153
+ return route_raw({ status, headers: JSON_CONTENT_TYPE, body });
153
154
  };
154
155
  // POST handler — parse JSON-RPC envelope from body
155
- const post_handler = async (c, route) => {
156
+ const post_handler = async (route) => {
156
157
  // step 1: parse envelope
157
- const read = await read_json_body(c.req);
158
+ const read = await route.read_json_body();
158
159
  if (!read.ok) {
159
160
  const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.parse_error());
160
- return envelope_response(c, error, 400);
161
+ return envelope_response(error, 400);
161
162
  }
162
163
  const body = read.value;
163
164
  // the classifier the WS path runs; HTTP issues no server-initiated
@@ -167,40 +168,42 @@ export const create_rpc_endpoint = (options) => {
167
168
  switch (classified.kind) {
168
169
  case 'request': {
169
170
  const { method, params, id } = classified.request;
170
- return dispatch(c, route, method, params, id, false);
171
+ return dispatch(route, method, params, id, false);
171
172
  }
172
173
  case 'invalid':
173
- return envelope_response(c, create_jsonrpc_error_response(classified.id, classified.error), 400);
174
+ return envelope_response(create_jsonrpc_error_response(classified.id, classified.error), 400);
174
175
  case 'notification':
175
176
  case 'response':
176
- return envelope_response(c, create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request()), 400);
177
+ return envelope_response(create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request()), 400);
177
178
  default:
178
179
  throw new UnreachableError(classified);
179
180
  }
180
181
  };
181
182
  // GET handler — extract method and params from query string
182
- const get_handler = async (c, route) => {
183
- // A read answers for one caller at one moment: no cache — the browser's,
184
- // a proxy's — may keep it and answer a later call, or another caller,
185
- // with it. Every response of the route, errors included.
186
- c.header('Cache-Control', RPC_GET_CACHE_CONTROL);
187
- // step 1: parse from query string
188
- const method_name = c.req.query('method');
183
+ const get_handler = async (route) => {
184
+ // step 1: parse from query string, every escape in it decoded strictly
185
+ // before any key is read, so no key reads a query another would refuse
186
+ const query = route.query_pairs;
187
+ if (!query.ok) {
188
+ const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request({ reason: RPC_GET_UNDECODABLE_QUERY_REASON }));
189
+ return envelope_response(error, 400);
190
+ }
191
+ const method_name = query_first(query.value, 'method');
189
192
  if (!method_name) {
190
193
  const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request({ reason: 'missing method query parameter' }));
191
- return envelope_response(c, error, 400);
194
+ return envelope_response(error, 400);
192
195
  }
193
- const id_raw = c.req.query('id');
196
+ const id_raw = query_first(query.value, 'id');
194
197
  if (!id_raw) {
195
198
  const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request({ reason: 'missing id query parameter' }));
196
- return envelope_response(c, error, 400);
199
+ return envelope_response(error, 400);
197
200
  }
198
201
  // parse integer ids so GET ?id=42 matches POST {id: 42} behavior
199
202
  // JSON-RPC spec: "Numbers SHOULD NOT contain fractional parts"
200
203
  const id_num = Number(id_raw);
201
204
  const id = Number.isInteger(id_num) && String(id_num) === id_raw ? id_num : id_raw;
202
205
  // parse params from query string (optional — null input schemas need no params)
203
- const params_raw = c.req.query('params');
206
+ const params_raw = query_first(query.value, 'params');
204
207
  let params;
205
208
  if (params_raw !== undefined) {
206
209
  try {
@@ -208,10 +211,10 @@ export const create_rpc_endpoint = (options) => {
208
211
  }
209
212
  catch {
210
213
  const error = create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_params('params query parameter is not valid JSON'));
211
- return envelope_response(c, error, 400);
214
+ return envelope_response(error, 400);
212
215
  }
213
216
  }
214
- return dispatch(c, route, method_name, params, id, true);
217
+ return dispatch(route, method_name, params, id, true);
215
218
  };
216
219
  return [
217
220
  define_route({
@@ -236,6 +239,10 @@ export const create_rpc_endpoint = (options) => {
236
239
  reads_credential: true,
237
240
  // answers JSON-RPC envelopes, not REST bodies
238
241
  jsonrpc: true,
242
+ // a read answers for one caller at one moment: no cache — the
243
+ // browser's, a proxy's — may keep it and answer a later call, or
244
+ // another caller, with it
245
+ response_headers: { 'Cache-Control': RPC_GET_CACHE_CONTROL },
239
246
  handler: get_handler,
240
247
  description: `JSON-RPC 2.0 endpoint (side-effect-free reads) — ${actions.length} method${actions.length === 1 ? '' : 's'}`,
241
248
  input: literal(null), // params from query string, validated by dispatcher
@@ -22,7 +22,7 @@ import type { Logger } from '@fuzdev/fuz_util/log.ts';
22
22
  import type { Infer } from '@fuzdev/fuz_schema/schema.ts';
23
23
  import type { ActionSpecUnion, RequestResponseActionSpec } from './action_spec.js';
24
24
  import type { Uuid } from '../primitive_schemas.js';
25
- import type { RequestActorContext, RequestContext } from '../auth/request_context.js';
25
+ import type { RequestActorContext, RequestContext, RequestContextForAuth } from '../auth/request_context.js';
26
26
  import type { BuiltinCredentialType } from '../auth/credential_type_schema.js';
27
27
  import type { Db } from '../db/db.js';
28
28
  import type { JsonrpcRequestId } from '../http/jsonrpc.js';
@@ -196,21 +196,23 @@ export interface RpcAction {
196
196
  handler: ActionHandler;
197
197
  }
198
198
  /**
199
- * Conditional handler shape for `rpc_action` — picks the narrowest
200
- * `ctx.auth` type the dispatcher's runtime guarantee allows:
199
+ * The handler for a narrowed `auth` (`RequestContextForAuth`):
200
+ * `ActorActionHandler` for an acting actor, `AuthActionHandler` for an
201
+ * account, `ActionHandler` otherwise.
202
+ */
203
+ type HandlerForAuth<TAuth extends RequestContext | null, TInput, TOutput> = [TAuth] extends [
204
+ RequestActorContext
205
+ ] ? ActorActionHandler<TInput, TOutput> : [TAuth] extends [RequestContext] ? AuthActionHandler<TInput, TOutput> : ActionHandler<TInput, TOutput>;
206
+ /**
207
+ * Conditional handler shape for `rpc_action` — the narrowest `ctx.auth` the
208
+ * dispatcher's runtime guarantee allows, read off the spec's `auth` by
209
+ * `RequestContextForAuth`, the narrowing REST route handlers share:
201
210
  *
202
211
  * - `auth.actor === 'required'` → `ActorActionHandler` (`ctx.auth: RequestActorContext`).
203
212
  * - `auth.account === 'required' && auth.actor === 'none'` → `AuthActionHandler` (`ctx.auth: RequestContext`).
204
- * - else (public, optional axes) → `ActionHandler` (`ctx.auth: RequestContext | null`).
205
- *
206
- * The bracketed form `[T] extends ['required']` defeats distributive
207
- * conditionals so a degraded `AuthAxisState` union (when the spec was
208
- * typed without preserving its literal) falls through to the loosest
209
- * tier instead of collapsing to the narrowest.
213
+ * - else (public, optional axes, a degraded union) → `ActionHandler` (`ctx.auth: RequestContext | null`).
210
214
  */
211
- export type HandlerForSpec<TSpec extends RequestResponseActionSpec> = [
212
- TSpec['auth']['actor']
213
- ] extends ['required'] ? ActorActionHandler<Infer<TSpec['input']>, Infer<TSpec['output']>> : [TSpec['auth']['account']] extends ['required'] ? AuthActionHandler<Infer<TSpec['input']>, Infer<TSpec['output']>> : ActionHandler<Infer<TSpec['input']>, Infer<TSpec['output']>>;
215
+ export type HandlerForSpec<TSpec extends RequestResponseActionSpec> = HandlerForAuth<RequestContextForAuth<TSpec['auth']>, Infer<TSpec['input']>, Infer<TSpec['output']>>;
214
216
  /**
215
217
  * Pair a spec with a handler while preserving per-method input/output types
216
218
  * and selecting the narrowest `ctx.auth` shape the spec literal admits.
@@ -258,4 +260,5 @@ export type HandlerForSpec<TSpec extends RequestResponseActionSpec> = [
258
260
  * ```
259
261
  */
260
262
  export declare const rpc_action: <TSpec extends RequestResponseActionSpec>(spec: TSpec, handler: HandlerForSpec<TSpec>) => RpcAction;
263
+ export {};
261
264
  //# sourceMappingURL=action_types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_types.d.ts","sourceRoot":"","sources":["../../src/lib/actions/action_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,MAAM,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe;IACtE,IAAI,EAAE,KAAK,CAAC;IACZ,sJAAsJ;IACtJ,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC7B,+DAA+D;IAC/D,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,iDAAiD;IACjD,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,aA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AyB,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC;CACvB;AAED;;;;GAIG;AACH,KAAK,cAAc,CAAC,KAAK,SAAS,cAAc,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS;IAC3F,mBAAmB;CACnB,GACE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAC/B,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,yBAAyB,IAAI,cAAc,CACnF,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EACpC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EACrB,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,SAAS,yBAAyB,EACjE,MAAM,KAAK,EACX,SAAS,cAAc,CAAC,KAAK,CAAC,KAC5B,SAGD,CAAC"}
@@ -89,10 +89,10 @@ export interface PerformActionInput {
89
89
  * post-authorization gates read, and its type and session hash what the
90
90
  * handler sees on `ActionContext`.
91
91
  */
92
- auth: ResolvedAuth | null;
92
+ credential: ResolvedAuth | null;
93
93
  /** Resolved client IP (`'unknown'` if upstream couldn't resolve). */
94
94
  client_ip: string;
95
- /** Per-request abort signal. HTTP: `c.req.raw.signal`. WS: `AbortSignal.any([socket, request])`. */
95
+ /** Per-request abort signal. HTTP: `RouteContext.signal`. WS: `AbortSignal.any([socket, request])`. */
96
96
  signal: AbortSignal;
97
97
  /** Send a request-scoped notification. HTTP: DEV-warn-and-drop. WS: socket-scoped. */
98
98
  notify: (method: string, params: unknown) => void;
@@ -146,7 +146,7 @@ export interface PerformActionDeps {
146
146
  /**
147
147
  * Discriminated result of `perform_action`. Each transport binds this to
148
148
  * its wire shape: HTTP RPC folds the error into a JSON-RPC envelope and
149
- * returns it as a `route_raw` result over `c.body`; WS sends the response
149
+ * returns it as a `route_raw` result; WS sends the response
150
150
  * over the socket.
151
151
  */
152
152
  export type PerformActionResult = {
@@ -165,7 +165,7 @@ export type PerformActionResult = {
165
165
  * Phase order: 401 → authz → 403 → 429 → 400 → handler. On the test-preset path
166
166
  * the dispatcher skips the live authorization phase and uses the supplied
167
167
  * pre-baked context for post-authorization checks; the 401 still fires when
168
- * the harness omits `auth`.
168
+ * the harness omits `credential`.
169
169
  */
170
170
  export declare const perform_action: (input: PerformActionInput, deps: PerformActionDeps) => Promise<PerformActionResult>;
171
171
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"perform_action.d.ts","sourceRoot":"","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAS,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAkB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM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vD,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,uEAAuE;IACvE,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CA2L7B,CAAC;AA8BF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,SAAS,EAChB,QAAQ,aAAa,CAAC,WAAW,CAAC,EAClC,QAAQ,OAAO,KACb,kBAOF,CAAC;AA6DF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,2BAA2B,aAAa,CAAC,MAAM,CAAC,KAC9C,kBAIA,CAAC;AAqEJ,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
@@ -85,14 +85,14 @@ import { token_scope_admits_method, token_scope_method_capability } from '../aut
85
85
  * Phase order: 401 → authz → 403 → 429 → 400 → handler. On the test-preset path
86
86
  * the dispatcher skips the live authorization phase and uses the supplied
87
87
  * pre-baked context for post-authorization checks; the 401 still fires when
88
- * the harness omits `auth`.
88
+ * the harness omits `credential`.
89
89
  */
90
90
  export const perform_action = async (input, deps) => {
91
- const { action, raw_params, request_id: id, auth, client_ip, signal, notify, connection_id, request_client, preset } = input;
91
+ const { action, raw_params, request_id: id, credential, client_ip, signal, notify, connection_id, request_client, preset } = input;
92
92
  const { db, pending_effects, post_commit_effects, log, action_ip_rate_limiter, action_account_rate_limiter } = deps;
93
93
  const { spec, handler } = action;
94
94
  const action_auth = spec.auth;
95
- const account_id = auth?.account_id ?? null;
95
+ const account_id = credential?.account_id ?? null;
96
96
  // step 1: pre-authorization auth — 401 short-circuit.
97
97
  const pre = check_action_auth_pre_authorization(action_auth, account_id);
98
98
  if (pre)
@@ -133,7 +133,7 @@ export const perform_action = async (input, deps) => {
133
133
  request_context = result.request_context;
134
134
  }
135
135
  // step 3: post-authorization auth — credential gate, then scope, then role.
136
- const post = check_action_auth_post_authorization(action_auth, request_context, auth, action.spec.method);
136
+ const post = check_action_auth_post_authorization(action_auth, request_context, credential, action.spec.method);
137
137
  if (post)
138
138
  return error_result(post);
139
139
  // step 4: rate limit — throttle-requests semantics (record on every
@@ -208,8 +208,8 @@ export const perform_action = async (input, deps) => {
208
208
  pending_effects,
209
209
  post_commit_effects,
210
210
  client_ip,
211
- credential_type: auth?.credential_type ?? null,
212
- session_hash: resolved_auth_session_hash(auth),
211
+ credential_type: credential?.credential_type ?? null,
212
+ session_hash: resolved_auth_session_hash(credential),
213
213
  log,
214
214
  notify,
215
215
  signal
@@ -22,14 +22,18 @@
22
22
  * observe far more than it was granted.
23
23
  * 4. **Authorization phase** (`run_authorization_phase`) — the acting actor
24
24
  * from the `?acting=<uuid>` query string (`parse_acting`; malformed reads
25
- * as omitted), against the authenticated account, building the
25
+ * as omitted, but a query holding an escape that doesn't decode, in any
26
+ * key, is a 400 `invalid_query_params` — `read_request_query_pairs`),
27
+ * against the authenticated account, building the
26
28
  * `RequestContext` per-message dispatch reads (400s on actor selection).
27
29
  * Multi-actor accounts must supply `?acting`; single-actor accounts work
28
30
  * without it.
29
31
  * 5. `require_role(required_roles)`, for a gated endpoint (403).
30
32
  *
31
33
  * Only `GET` is mounted (Hono serves `HEAD` through it), so any other method
32
- * on the path is a 404. The guards run as middleware ahead of
34
+ * on the path is the assembled server's 405 (`server/unmatched_route.ts`),
35
+ * and a `GET` the guards admit that asks for no upgrade passes on to its
36
+ * 404. The guards run as middleware ahead of
33
37
  * `upgradeWebSocket`, whose callback must return `WSEvents` and so cannot
34
38
  * produce a refusal.
35
39
  *
@@ -1 +1 @@
1
- {"version":3,"file":"register_action_ws.d.ts","sourceRoot":"","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAGN,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD;;;;;;;GAOG;AAC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CAAC,CAAC;IACpE;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;OAMG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACxE;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC,wEAAwE;IACxE,QAAQ,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,uBAAuB,KAAG,sBAqLrE,CAAC"}
@@ -22,14 +22,18 @@
22
22
  * observe far more than it was granted.
23
23
  * 4. **Authorization phase** (`run_authorization_phase`) — the acting actor
24
24
  * from the `?acting=<uuid>` query string (`parse_acting`; malformed reads
25
- * as omitted), against the authenticated account, building the
25
+ * as omitted, but a query holding an escape that doesn't decode, in any
26
+ * key, is a 400 `invalid_query_params` — `read_request_query_pairs`),
27
+ * against the authenticated account, building the
26
28
  * `RequestContext` per-message dispatch reads (400s on actor selection).
27
29
  * Multi-actor accounts must supply `?acting`; single-actor accounts work
28
30
  * without it.
29
31
  * 5. `require_role(required_roles)`, for a gated endpoint (403).
30
32
  *
31
33
  * Only `GET` is mounted (Hono serves `HEAD` through it), so any other method
32
- * on the path is a 404. The guards run as middleware ahead of
34
+ * on the path is the assembled server's 405 (`server/unmatched_route.ts`),
35
+ * and a `GET` the guards admit that asks for no upgrade passes on to its
36
+ * 404. The guards run as middleware ahead of
33
37
  * `upgradeWebSocket`, whose callback must return `WSEvents` and so cannot
34
38
  * produce a refusal.
35
39
  *
@@ -62,6 +66,8 @@ import { get_resolved_auth } from '../auth/resolved_auth.js';
62
66
  import { verify_request_source } from '../http/origin.js';
63
67
  import { parse_acting } from '../http/auth_shape.js';
64
68
  import { get_client_ip } from '../http/client_ip.js';
69
+ import { ERROR_INVALID_QUERY_PARAMS } from '../http/error_schemas.js';
70
+ import { query_first, read_request_query_pairs } from '../http/request_target.js';
65
71
  import { has_test_context_preset } from '../hono_context.js';
66
72
  import {} from './action_types.js';
67
73
  import { compile_action_registry } from './compile_action_registry.js';
@@ -200,7 +206,12 @@ export const register_action_ws = (options) => {
200
206
  required_roles
201
207
  };
202
208
  app.get(path, verify_request_source(allowed_origins), ...pre_authorization, async (c, next) => {
203
- const refused = await run_authorization_phase(c, { db }, upgrade_auth, parse_acting(c.req.query('acting')));
209
+ // the query is decoded strictly, every key, before `acting` is read;
210
+ // a malformed but decodable `acting` still reads as omitted
211
+ const query = read_request_query_pairs(c);
212
+ if (!query.ok)
213
+ return c.json({ error: ERROR_INVALID_QUERY_PARAMS }, 400);
214
+ const refused = await run_authorization_phase(c, { db }, upgrade_auth, parse_acting(query_first(query.value, 'acting')));
204
215
  if (refused)
205
216
  return refused;
206
217
  return next();
@@ -636,7 +636,7 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
636
636
  action,
637
637
  raw_params: params,
638
638
  request_id: id,
639
- auth: resolved,
639
+ credential: resolved,
640
640
  client_ip,
641
641
  signal,
642
642
  notify,