@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
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { hash_blake3 } from '@fuzdev/fuz_util/hash_blake3.ts';
10
10
  import { generate_random_base64url } from '../crypto.js';
11
+ import { create_session_cookie_value } from './session_cookie.js';
11
12
  import { columns_sql, iso8601_timestamp_expr, qualify_columns } from '../db/sql_columns.js';
12
13
  import { EXPIRES_IN_MS_SQL } from './credential_deadline.js';
13
14
  /**
@@ -90,6 +91,29 @@ const auth_session_expr = iso8601_timestamp_expr(AUTH_SESSION_COLUMNS, [
90
91
  export const query_session_get_valid = async (deps, token_hash) => {
91
92
  return deps.db.query_one(`SELECT ${columns_sql(AUTH_SESSION_COLUMNS, auth_session_expr(''))}, ${EXPIRES_IN_MS_SQL} AS expires_in_ms FROM auth_session WHERE id = $1 AND expires_at > NOW()`, [token_hash]);
92
93
  };
94
+ /**
95
+ * Whether the session that authorized a credential mint still lives, read in
96
+ * the mint's transaction after `query_account_lock_live`.
97
+ *
98
+ * The session was resolved before the transaction, so a password change can
99
+ * commit in between and revoke it. The account lock orders the two — the
100
+ * change writes the account row before it revokes — so this read either sees
101
+ * the change's revoke (it committed before the lock was granted) or runs
102
+ * ahead of it (the change then waits on the lock, and its revoke takes what
103
+ * the mint wrote). The row is not locked: a plain revoke of one session
104
+ * touches no account row, and a token minted just before a logout outlives it
105
+ * anyway, so ordering against one buys nothing. Twin of the Rust
106
+ * `fuz_auth::query_session_is_live`.
107
+ *
108
+ * @param deps - query dependencies (must be the mint's transaction)
109
+ * @param id - the session's id, its token hash
110
+ * @param account_id - the account the session must belong to
111
+ * @returns `true` when the session exists, belongs to the account, and has not expired
112
+ */
113
+ export const query_session_is_live = async (deps, id, account_id) => {
114
+ const row = await deps.db.query_one(`SELECT id FROM auth_session WHERE id = $1 AND account_id = $2 AND expires_at > NOW()`, [id, account_id]);
115
+ return row !== undefined;
116
+ };
93
117
  /**
94
118
  * Revoke (delete) a session by its token hash, with no account scoping.
95
119
  *
@@ -143,12 +167,11 @@ export const query_session_list_for_account = async (deps, account_id, limit = 5
143
167
  *
144
168
  * Race safety: this function must run inside a transaction alongside the
145
169
  * INSERT that created the new session. All callers satisfy this requirement:
146
- * - `POST /login` uses the default `transaction: true` (framework-managed
147
- * transaction wrapping in `apply_route_specs`)
148
170
  * - The `account_token_create` RPC handler runs under the dispatcher's
149
171
  * transaction path because its spec declares `side_effects: true`
150
- * - `POST /bootstrap` and `POST /signup` manage their own transactions
151
- * and pass the transaction-scoped `deps` to `create_session_and_set_cookie`
172
+ * - `POST /login`, `POST /bootstrap` and `POST /signup` manage their own
173
+ * transactions and pass the transaction-scoped `deps` to
174
+ * `create_capped_session`
152
175
  *
153
176
  * The transaction makes one creator's INSERT + enforce_limit pair atomic, but it
154
177
  * does **not** serialize concurrent creators. Under Read Committed, two
@@ -240,3 +263,29 @@ export const query_session_cleanup_expired = async (deps) => {
240
263
  const rows = await deps.db.query(`DELETE FROM auth_session WHERE expires_at <= NOW() RETURNING id`);
241
264
  return rows.map((row) => row.id);
242
265
  };
266
+ /**
267
+ * Mint an auth session: generate a token, persist its hashed row, enforce
268
+ * the per-account cap when given one, and sign the cookie value — without
269
+ * touching a response, so a caller minting inside a transaction sets the
270
+ * cookie only once that transaction has succeeded. Twin of the Rust
271
+ * `fuz_auth::create_capped_session`.
272
+ *
273
+ * The cap deletes the sessions it evicts, but not the connections they
274
+ * opened. A caller that passes `max_sessions` closes the returned sessions'
275
+ * connections once its transaction commits — `queue_connection_close` with a
276
+ * `session` target, as `POST /login` does. A caller that mints for an account
277
+ * created in the same transaction (signup, bootstrap) evicts nothing.
278
+ *
279
+ * @returns the signed cookie value and the evicted sessions' token hashes
280
+ * @mutates `auth_session` table - inserts the new session row (and evicts older rows when `max_sessions` is set)
281
+ */
282
+ export const create_capped_session = async (options) => {
283
+ const { keyring, deps, account_id, session_options, max_sessions } = options;
284
+ const session_token = generate_session_token();
285
+ const token_hash = hash_session_token(session_token);
286
+ const expires_at = new Date(Date.now() + AUTH_SESSION_LIFETIME_MS);
287
+ await query_create_session(deps, token_hash, account_id, expires_at);
288
+ const evicted = max_sessions != null ? await query_session_enforce_limit(deps, account_id, max_sessions) : [];
289
+ const cookie_value = await create_session_cookie_value(keyring, session_token, session_options);
290
+ return { cookie_value, evicted };
291
+ };
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Hono-free wire schemas + route shape for `POST /signup`.
3
3
  *
4
- * Split from `signup_routes.ts` (whose handler pulls `hono/cookie` via
5
- * `session_middleware` to set the new session cookie) so cross-process test
4
+ * Split from `signup_routes.ts` (whose handler mints the new session through
5
+ * `session_middleware` and the query layer) so cross-process test
6
6
  * suites can build the signup route shape — and assert on the response shape
7
- * — without dragging the in-process Hono session handler, and its optional
8
- * `hono` peer, onto a backend-spawning consumer. `signup_routes.ts` imports
7
+ * — without dragging the in-process session handler and its queries
8
+ * onto a backend-spawning consumer. `signup_routes.ts` imports
9
9
  * these back and attaches the live handler; single source of truth for the
10
10
  * wire shape.
11
11
  *
@@ -58,5 +58,5 @@ export interface SignupRouteShapeOptions {
58
58
  export declare const create_signup_route_shape: (options: SignupRouteShapeOptions) => RouteShape<readonly [typeof REST_NO_MATCHING_INVITE, typeof REST_SIGNUP_CONFLICT], typeof SignupOutput, {
59
59
  account: "none";
60
60
  actor: "none";
61
- }, "both" | "ip">;
61
+ }, "both" | "ip", typeof SignupInput>;
62
62
  //# sourceMappingURL=signup_route_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAuC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAK/F,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;EAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;EAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,UAAU,CACZ,SAAS,CAAC,OAAO,uBAAuB,EAAE,OAAO,oBAAoB,CAAC,EACtE,OAAO,YAAY,EACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAClC,MAAM,GAAG,IAAI,CAaX,CAAC"}
1
+ {"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAuC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAK/F,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;EAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;EAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,UAAU,CACZ,SAAS,CAAC,OAAO,uBAAuB,EAAE,OAAO,oBAAoB,CAAC,EACtE,OAAO,YAAY,EACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAClC,MAAM,GAAG,IAAI,EACb,OAAO,WAAW,CAahB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Hono-free wire schemas + route shape for `POST /signup`.
3
3
  *
4
- * Split from `signup_routes.ts` (whose handler pulls `hono/cookie` via
5
- * `session_middleware` to set the new session cookie) so cross-process test
4
+ * Split from `signup_routes.ts` (whose handler mints the new session through
5
+ * `session_middleware` and the query layer) so cross-process test
6
6
  * suites can build the signup route shape — and assert on the response shape
7
- * — without dragging the in-process Hono session handler, and its optional
8
- * `hono` peer, onto a backend-spawning consumer. `signup_routes.ts` imports
7
+ * — without dragging the in-process session handler and its queries
8
+ * onto a backend-spawning consumer. `signup_routes.ts` imports
9
9
  * these back and attaches the live handler; single source of truth for the
10
10
  * wire shape.
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"signup_routes.d.ts","sourceRoot":"","sources":["../../src/lib/auth/signup_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GA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C;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE;;;;;;;;;OASG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,6FAA6F;IAC7F,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAID;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,gBAAgB,EACtB,SAAS,kBAAkB,KACzB,KAAK,CAAC,SAAS,CA2NjB,CAAC"}
@@ -7,14 +7,14 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { create_session_and_set_cookie } from './session_middleware.js';
11
10
  import { query_create_account_with_actor } from './account_queries.js';
11
+ import { create_capped_session } from './session_queries.js';
12
+ import { session_cookie_header } from './session_cookie.js';
12
13
  import { query_app_settings_load } from './app_settings_queries.js';
13
14
  import { query_invite_find_unclaimed_match_for_update, query_invite_claim_unscoped } from './invite_queries.js';
14
15
  import { create_signup_route_shape } from './signup_route_schema.js';
15
- import { attach_route_handler, get_route_input } from '../http/route_spec.js';
16
+ import { attach_route_handler } from '../http/route_spec.js';
16
17
  import { route_fail, route_ok } from '../http/route_result.js';
17
- import { get_client_ip } from '../http/client_ip.js';
18
18
  import { rate_limit_ip_key } from '../http/ip_canonical.js';
19
19
  import { reserve_optional } from '../rate_limiter.js';
20
20
  import { REST_NO_MATCHING_INVITE, REST_RATE_LIMIT_EXCEEDED, REST_SIGNUP_CONFLICT } from '../http/error_schemas.js';
@@ -57,27 +57,27 @@ export const create_signup_route_specs = (deps, options) => {
57
57
  return [
58
58
  attach_route_handler(create_signup_route_shape({
59
59
  signup_account_rate_limited: signup_account_rate_limiter !== null
60
- }), async (c, route) => {
60
+ }), async (route) => {
61
61
  // Per-IP rate limit (before any work). 429 stays fast. Reserved,
62
62
  // not checked: the attempt counts against the cap until it settles
63
63
  // below, so a concurrent burst can't all pass before any of it
64
64
  // records — and the Argon2 hash every attempt pays is bounded with
65
65
  // it. The `finally` releases whatever no branch recorded.
66
66
  // keyed by the address's rate-limit key (an IPv6 client's /64)
67
- const ip_key = signup_ip_rate_limiter ? rate_limit_ip_key(get_client_ip(c)) : null;
67
+ const ip_key = signup_ip_rate_limiter ? rate_limit_ip_key(route.client_ip) : null;
68
68
  const ip_reserved = await reserve_optional(signup_ip_rate_limiter, ip_key, {
69
- signal: c.req.raw.signal
69
+ signal: route.signal
70
70
  });
71
71
  if (!ip_reserved.ok) {
72
72
  return route_fail(REST_RATE_LIMIT_EXCEEDED, { retry_after: ip_reserved.retry_after });
73
73
  }
74
74
  let account_reservation = null;
75
75
  try {
76
- const { username, password: pw, email } = get_route_input(c);
76
+ const { username, password: pw, email } = route.input;
77
77
  // Per-account rate limit (after input parsing, before DB work).
78
78
  // 429 stays fast — same precedent as login.
79
79
  const account_key = username.toLowerCase();
80
- const account_reserved = await reserve_optional(signup_account_rate_limiter, account_key, { signal: c.req.raw.signal });
80
+ const account_reserved = await reserve_optional(signup_account_rate_limiter, account_key, { signal: route.signal });
81
81
  if (!account_reserved.ok) {
82
82
  return route_fail(REST_RATE_LIMIT_EXCEEDED, {
83
83
  retry_after: account_reserved.retry_after
@@ -115,7 +115,7 @@ export const create_signup_route_specs = (deps, options) => {
115
115
  await deps.audit.emit(route, {
116
116
  event_type: 'signup',
117
117
  outcome: 'failure',
118
- ip: get_client_ip(c),
118
+ ip: route.client_ip,
119
119
  metadata: {
120
120
  username,
121
121
  reason,
@@ -159,14 +159,17 @@ export const create_signup_route_specs = (deps, options) => {
159
159
  throw new Error(`invite ${invite.id} was already claimed despite the FOR UPDATE lock`);
160
160
  }
161
161
  }
162
- await create_session_and_set_cookie({
162
+ // the cookie line is formatted here, so a refused value rolls
163
+ // the account back, and rides the success, answered only
164
+ // once the commit has landed
165
+ const session = await create_capped_session({
163
166
  keyring,
164
167
  deps: tx_deps,
165
- c,
166
168
  account_id: account.id,
167
169
  session_options
168
170
  });
169
- return { account, actor };
171
+ const set_cookie = session_cookie_header(session.cookie_value, session_options);
172
+ return { account, actor, set_cookie };
170
173
  });
171
174
  }
172
175
  catch (e) {
@@ -216,14 +219,14 @@ export const create_signup_route_specs = (deps, options) => {
216
219
  await deps.audit.emit(route, {
217
220
  event_type: 'signup',
218
221
  account_id: result.account.id,
219
- ip: get_client_ip(c),
222
+ ip: route.client_ip,
220
223
  metadata: invite ? { invite_id: invite.id, username } : { open_signup: true, username }
221
224
  });
222
225
  return route_ok({
223
226
  ok: true,
224
227
  account: { id: result.account.id, username: result.account.username },
225
228
  actor: { id: result.actor.id }
226
- });
229
+ }, { set_cookie: [result.set_cookie] });
227
230
  }
228
231
  finally {
229
232
  ip_reserved.reservation.release();
@@ -22,7 +22,7 @@
22
22
  * 3. **A narrowed token is RPC-only.** `methods` denies outright every non-RPC
23
23
  * spine surface that reads account data or carries authority — the
24
24
  * db-admin browser, the bare-hash fact read, the audit SSE stream, the WS
25
- * upgrade, the surface explorer, and the `auth_request` probe. See
25
+ * upgrade, and the surface explorer. See
26
26
  * `token_scope_admits_non_rpc`, and `docs/security.md` §Token scoping for
27
27
  * the reads that answer it as anonymous and the server status read.
28
28
  *
@@ -121,11 +121,9 @@ export declare const token_scope_admits_method: (scope: TokenScope, method: stri
121
121
  export declare const token_scope_admits_non_rpc: (scope: TokenScope) => boolean;
122
122
  /**
123
123
  * The non-RPC surfaces the **spine itself** mounts (rule 3). Twin of the Rust
124
- * `TokenSurface` enum, name for name, except the two only the TS spine serves:
125
- * `app_surface`, the opt-in `GET /api/surface` explorer
126
- * (`server/surface_route.ts`), and `account_verify`, the
127
- * `GET /api/account/verify` nginx `auth_request` probe
128
- * (`auth/account_route_schema.ts`).
124
+ * `TokenSurface` enum, name for name, except `app_surface`, the opt-in
125
+ * `GET /api/surface` explorer (`server/surface_route.ts`), which only the TS
126
+ * spine serves.
129
127
  *
130
128
  * Not a registry a consumer registers into. `RouteAuth.required_scope` accepts
131
129
  * any well-formed `surface:<name>` (see `is_route_scope_capability`), so a
@@ -140,7 +138,7 @@ export declare const token_scope_admits_non_rpc: (scope: TokenScope) => boolean;
140
138
  * `rpc:<method>` value, in a dispatcher denial, carries arbitrary consumer
141
139
  * method names.
142
140
  */
143
- export declare const TOKEN_SURFACES: readonly ["db_admin", "fact_bare", "audit_stream", "ws_upgrade", "app_surface", "account_verify"];
141
+ export declare const TOKEN_SURFACES: readonly ["db_admin", "fact_bare", "audit_stream", "ws_upgrade", "app_surface"];
144
142
  export type TokenSurface = (typeof TOKEN_SURFACES)[number];
145
143
  /**
146
144
  * Is `value` one of the surfaces the spine mounts?
@@ -1 +1 @@
1
- {"version":3,"file":"token_scope.d.ts","sourceRoot":"","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;;;;;;;;;IAYrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;;IAG1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,QAAO,UAGlC,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,GAAI,SAAS,KAAK,CAAC,MAAM,CAAC,KAAG,UAI3D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,eAAe,KAAG,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AErC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,OAEG,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,YAAY,MAAM,KAChB;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAGxD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,MAGrD,CAAC;AAoBF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,UAAU,GAAG,IAU5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,MASzD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,IACc,CAAC"}
@@ -22,7 +22,7 @@
22
22
  * 3. **A narrowed token is RPC-only.** `methods` denies outright every non-RPC
23
23
  * spine surface that reads account data or carries authority — the
24
24
  * db-admin browser, the bare-hash fact read, the audit SSE stream, the WS
25
- * upgrade, the surface explorer, and the `auth_request` probe. See
25
+ * upgrade, and the surface explorer. See
26
26
  * `token_scope_admits_non_rpc`, and `docs/security.md` §Token scoping for
27
27
  * the reads that answer it as anonymous and the server status read.
28
28
  *
@@ -129,11 +129,9 @@ export const token_scope_admits_method = (scope, method) => scope.kind === 'full
129
129
  export const token_scope_admits_non_rpc = (scope) => scope.kind === 'full';
130
130
  /**
131
131
  * The non-RPC surfaces the **spine itself** mounts (rule 3). Twin of the Rust
132
- * `TokenSurface` enum, name for name, except the two only the TS spine serves:
133
- * `app_surface`, the opt-in `GET /api/surface` explorer
134
- * (`server/surface_route.ts`), and `account_verify`, the
135
- * `GET /api/account/verify` nginx `auth_request` probe
136
- * (`auth/account_route_schema.ts`).
132
+ * `TokenSurface` enum, name for name, except `app_surface`, the opt-in
133
+ * `GET /api/surface` explorer (`server/surface_route.ts`), which only the TS
134
+ * spine serves.
137
135
  *
138
136
  * Not a registry a consumer registers into. `RouteAuth.required_scope` accepts
139
137
  * any well-formed `surface:<name>` (see `is_route_scope_capability`), so a
@@ -153,8 +151,7 @@ export const TOKEN_SURFACES = [
153
151
  'fact_bare',
154
152
  'audit_stream',
155
153
  'ws_upgrade',
156
- 'app_surface',
157
- 'account_verify'
154
+ 'app_surface'
158
155
  ];
159
156
  /**
160
157
  * Is `value` one of the surfaces the spine mounts?
@@ -280,9 +280,14 @@ export interface SeedDevAccountDeps extends QueryDeps {
280
280
  * requested role grants. Never updates an existing password (rerun would
281
281
  * silently rotate it).
282
282
  *
283
+ * Flips `bootstrap_lock` in the same transaction as its writes, as a real
284
+ * bootstrap and `bootstrap_test_keeper` do: a database holding an account
285
+ * never reads as open for bootstrap, so the lock stays the single signal
286
+ * production trusts. Seed after bootstrapping, or seed the keeper itself.
287
+ *
283
288
  * Intended for a dev setup task — do not call in production.
284
289
  *
285
- * @mutates database - inserts an account/actor pair when missing and grants any requested role role_grants
290
+ * @mutates database - inserts an account/actor pair when missing, grants any requested role role_grants, and flips `bootstrap_lock.bootstrapped`
286
291
  * @throws Error if an existing account is found without an associated actor row
287
292
  */
288
293
  export declare const seed_dev_account: (deps: SeedDevAccountDeps, input: SeedDevAccountInput, options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/lib/dev/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EACX,OAAO,EACP,UAAU,EACV,YAAY,EACZ,WAAW,EACX,cAAc,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAmBrD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,C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,kDAAkD;IAClD,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,oCAAoC;AACpC,MAAM,WAAW,oBAAoB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACpD,oEAAoE;IACpE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,kBAAkB,EACxB,OAAO,mBAAmB,EAC1B,UAAU;IAAE,GAAG,CAAC,EAAE,WAAW,CAAA;CAAE,KAC7B,OAAO,CAAC,oBAAoB,CA8C9B,CAAC"}
package/dist/dev/setup.js CHANGED
@@ -396,48 +396,56 @@ export const reset_database = async (deps, database_url, options) => {
396
396
  * requested role grants. Never updates an existing password (rerun would
397
397
  * silently rotate it).
398
398
  *
399
+ * Flips `bootstrap_lock` in the same transaction as its writes, as a real
400
+ * bootstrap and `bootstrap_test_keeper` do: a database holding an account
401
+ * never reads as open for bootstrap, so the lock stays the single signal
402
+ * production trusts. Seed after bootstrapping, or seed the keeper itself.
403
+ *
399
404
  * Intended for a dev setup task — do not call in production.
400
405
  *
401
- * @mutates database - inserts an account/actor pair when missing and grants any requested role role_grants
406
+ * @mutates database - inserts an account/actor pair when missing, grants any requested role role_grants, and flips `bootstrap_lock.bootstrapped`
402
407
  * @throws Error if an existing account is found without an associated actor row
403
408
  */
404
409
  export const seed_dev_account = async (deps, input, options) => {
405
410
  const log = options?.log ?? default_setup_logger;
406
- const query_deps = { db: deps.db };
407
411
  const username = input.username.toLowerCase();
408
- const existing = await query_account_by_username(query_deps, username);
409
- if (existing) {
410
- const actors = await query_actors_by_account(query_deps, existing.id);
411
- if (actors.length === 0) {
412
- log.error(`dev account '${input.username}' exists but has no actor`);
413
- throw new Error(`dev account '${input.username}' has no actor`);
414
- }
415
- // Dev seed is single-actor by construction; pick the first.
416
- const actor = actors[0];
417
- for (const role of input.roles ?? []) {
418
- await query_create_role_grant(query_deps, {
419
- actor_id: actor.id,
420
- role,
421
- granted_by: null,
422
- expires_at: null
423
- });
412
+ const result = await deps.db.transaction(async (tx) => {
413
+ const query_deps = { db: tx };
414
+ await tx.query('UPDATE bootstrap_lock SET bootstrapped = true WHERE id = 1 AND bootstrapped = false');
415
+ const grant_roles = async (actor_id) => {
416
+ for (const role of input.roles ?? []) {
417
+ await query_create_role_grant(query_deps, {
418
+ actor_id,
419
+ role,
420
+ granted_by: null,
421
+ expires_at: null
422
+ });
423
+ }
424
+ };
425
+ const existing = await query_account_by_username(query_deps, username);
426
+ if (existing) {
427
+ const actors = await query_actors_by_account(query_deps, existing.id);
428
+ if (actors.length === 0) {
429
+ log.error(`dev account '${input.username}' exists but has no actor`);
430
+ throw new Error(`dev account '${input.username}' has no actor`);
431
+ }
432
+ // Dev seed is single-actor by construction; pick the first.
433
+ const actor = actors[0];
434
+ await grant_roles(actor.id);
435
+ return { account_id: existing.id, actor_id: actor.id, created: false };
424
436
  }
425
- log.skip(`Dev account '${input.username}' already exists`);
426
- return { account_id: existing.id, actor_id: actor.id, created: false };
427
- }
428
- const password_hash = await deps.hash_password(input.password);
429
- const { account, actor } = await query_create_account_with_actor(query_deps, {
430
- username,
431
- password_hash
432
- });
433
- for (const role of input.roles ?? []) {
434
- await query_create_role_grant(query_deps, {
435
- actor_id: actor.id,
436
- role,
437
- granted_by: null,
438
- expires_at: null
437
+ const { account, actor } = await query_create_account_with_actor(query_deps, {
438
+ username,
439
+ password_hash: await deps.hash_password(input.password)
439
440
  });
441
+ await grant_roles(actor.id);
442
+ return { account_id: account.id, actor_id: actor.id, created: true };
443
+ });
444
+ if (result.created) {
445
+ log.ok(`Seeded dev account '${input.username}'`);
446
+ }
447
+ else {
448
+ log.skip(`Dev account '${input.username}' already exists`);
440
449
  }
441
- log.ok(`Seeded dev account '${input.username}'`);
442
- return { account_id: account.id, actor_id: actor.id, created: true };
450
+ return result;
443
451
  };
@@ -40,6 +40,23 @@ export declare const SESSION_TOKEN_KEY = "auth_session_id";
40
40
  * middleware folds it into the session's `ResolvedAuth.credential_deadline`.
41
41
  */
42
42
  export declare const SESSION_COOKIE_EXPIRES_AT_KEY = "auth_session_cookie_expires_at";
43
+ /**
44
+ * Hono context variable name for the connection's peer address — what the
45
+ * trusted-proxy middleware's `get_connection_ip` returned, before any
46
+ * `X-Forwarded-For` resolution; `null` when the runtime gave none. What
47
+ * `RouteContext.connection_ip` reads.
48
+ */
49
+ export declare const CONNECTION_IP_KEY = "connection_ip";
50
+ /**
51
+ * Hono context variable name for the `Set-Cookie` line a response must lead
52
+ * with — set by a middleware that put that line on the context's prepared
53
+ * headers (the session middleware's clear of a stale cookie), so every
54
+ * response built through the context carries it first. The DEV `Set-Cookie`
55
+ * check (`http/dev_set_cookie_check.ts`) reads it after the request and logs
56
+ * a response that doesn't — one built past the context, by a layer the route
57
+ * system doesn't own.
58
+ */
59
+ export declare const EXPECTED_FIRST_SET_COOKIE_KEY = "expected_first_set_cookie";
43
60
  /**
44
61
  * Hono context variable name for the test-harness pre-baked context flag.
45
62
  *
@@ -75,6 +92,10 @@ declare module 'hono' {
75
92
  interface ContextVariableMap {
76
93
  /** Resolved client IP, set by the trusted proxy middleware. */
77
94
  client_ip: string;
95
+ /** The connection's peer address (`CONNECTION_IP_KEY`), set by the trusted proxy middleware. */
96
+ connection_ip: string | null;
97
+ /** The `Set-Cookie` line every response must lead with (`EXPECTED_FIRST_SET_COOKIE_KEY`). */
98
+ expected_first_set_cookie: string;
78
99
  /** The session token (`SESSION_TOKEN_KEY`), set by the session middleware. */
79
100
  auth_session_id: string | null;
80
101
  request_context: RequestContext | null;
@@ -1 +1 @@
1
- {"version":3,"file":"hono_context.d.ts","sourceRoot":"","s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e,EAAE,OAAO,CAAC;QACzB;;;;WAIG;QACH,aAAa,EAAE,YAAY,GAAG,IAAI,CAAC;QACnC,2FAA2F;QAC3F,8BAA8B,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9C;;;;;;;WAOG;QACH,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC;;;;;;;;;;;;WAYG;QACH,mBAAmB,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD;;;;;WAKG;QACH,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;KAChD;CACD"}
@@ -37,6 +37,23 @@ export const SESSION_TOKEN_KEY = 'auth_session_id';
37
37
  * middleware folds it into the session's `ResolvedAuth.credential_deadline`.
38
38
  */
39
39
  export const SESSION_COOKIE_EXPIRES_AT_KEY = 'auth_session_cookie_expires_at';
40
+ /**
41
+ * Hono context variable name for the connection's peer address — what the
42
+ * trusted-proxy middleware's `get_connection_ip` returned, before any
43
+ * `X-Forwarded-For` resolution; `null` when the runtime gave none. What
44
+ * `RouteContext.connection_ip` reads.
45
+ */
46
+ export const CONNECTION_IP_KEY = 'connection_ip';
47
+ /**
48
+ * Hono context variable name for the `Set-Cookie` line a response must lead
49
+ * with — set by a middleware that put that line on the context's prepared
50
+ * headers (the session middleware's clear of a stale cookie), so every
51
+ * response built through the context carries it first. The DEV `Set-Cookie`
52
+ * check (`http/dev_set_cookie_check.ts`) reads it after the request and logs
53
+ * a response that doesn't — one built past the context, by a layer the route
54
+ * system doesn't own.
55
+ */
56
+ export const EXPECTED_FIRST_SET_COOKIE_KEY = 'expected_first_set_cookie';
40
57
  /**
41
58
  * Hono context variable name for the test-harness pre-baked context flag.
42
59
  *