@fuzdev/fuz_app 0.179.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 +5 -5
@@ -97,13 +97,34 @@ export declare class RoleGrantOfferBuiltinRefusedError extends Error {
97
97
  }
98
98
  /**
99
99
  * Error thrown when `query_role_grant_offer_create` is called with a
100
- * `to_actor_id` that does not exist or does not belong to `to_account_id`.
100
+ * `to_actor_id` that is no active actor of `to_account_id` — missing,
101
+ * tombstoned, or another account's.
101
102
  * Surfaces the actor↔account binding mismatch at the boundary instead of
102
103
  * letting the FK silently disagree with the recipient field.
103
104
  */
104
105
  export declare class RoleGrantOfferActorAccountMismatchError extends Error {
105
106
  constructor();
106
107
  }
108
+ /**
109
+ * Error thrown by `query_role_grant_offer_create` when the recipient is not an
110
+ * active account: `to_account_id` names no account, a soft-deleted one, or one
111
+ * with no active actor. A deleted recipient and one that never existed are the
112
+ * one refusal, so a caller learns nothing from it that a missing id wouldn't
113
+ * tell; the handler answers it as `role_grant_assign` answers the same
114
+ * recipient. Twin of the Rust `RoleGrantOfferError::RecipientNotActive`.
115
+ */
116
+ export declare class RoleGrantOfferRecipientNotActiveError extends Error {
117
+ constructor();
118
+ }
119
+ /**
120
+ * Error thrown by `query_role_grant_offer_create` when the grantor is not an
121
+ * active account: its actor is missing or tombstoned, or its account
122
+ * soft-deleted — a delete that committed while the offer was in flight. Twin
123
+ * of the Rust `RoleGrantOfferError::GrantorNotActive`.
124
+ */
125
+ export declare class RoleGrantOfferGrantorNotActiveError extends Error {
126
+ constructor();
127
+ }
107
128
  /**
108
129
  * Create a new role_grant offer, or refresh an existing pending offer for the
109
130
  * same `(to_account_id, role, scope_id, from_actor_id)` tuple.
@@ -126,11 +147,24 @@ export declare class RoleGrantOfferActorAccountMismatchError extends Error {
126
147
  * `query_accept_offer` rejects any actor other than the named one. Closes
127
148
  * the audit hole where offer-shape events would otherwise leave
128
149
  * `target_actor_id` null even when the recipient binding is known at
129
- * offer time. The actor↔account binding is verified here in one SELECT.
150
+ * offer time. A named actor must be an active actor of `to_account_id`.
151
+ *
152
+ * Both parties must be active accounts, checked here so every caller — the
153
+ * spine's handler and a consumer creating offers on its own path — gets the
154
+ * rule. Both account rows are read under `FOR SHARE` before the insert, in one
155
+ * statement in id order (`query_account_lock_live_many`): an account delete
156
+ * writes its tombstone first, so a delete committed before the read is waited
157
+ * for and seen (the offer is refused), and one after it waits for this
158
+ * transaction to commit and then supersedes the offer with the party's
159
+ * others. Run it inside the caller's transaction, which the lock
160
+ * spans. The self-target check comes first, so an offer to one's own account
161
+ * is refused as that whatever else it names.
130
162
  *
131
163
  * @mutates `role_grant_offer` table - inserts a new offer or upserts the matching pending row
132
164
  * @throws RoleGrantOfferSelfTargetError if the offering actor belongs to `to_account_id`
133
- * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but does not belong to `to_account_id`
165
+ * @throws RoleGrantOfferRecipientNotActiveError if `to_account_id` is missing, soft-deleted, or has no active actor
166
+ * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but is no active actor of `to_account_id`
167
+ * @throws RoleGrantOfferGrantorNotActiveError if the grantor's actor or account is missing or tombstoned
134
168
  */
135
169
  export declare const query_role_grant_offer_create: (deps: QueryDeps, input: CreateRoleGrantOfferInput) => Promise<RoleGrantOffer>;
136
170
  /** Result of `query_role_grant_offer_decline` — the declined offer plus the grantor's `account_id`. */
@@ -301,4 +335,23 @@ export declare const query_accept_offer: (deps: QueryDeps, input: AcceptOfferInp
301
335
  * @mutates `role_grant_offer` rows - stamps `superseded_at` on every pending offer from `from_actor_ids`
302
336
  */
303
337
  export declare const query_role_grant_offer_supersede_outgoing: (deps: QueryDeps, from_actor_ids: ReadonlyArray<Uuid>) => Promise<Array<SupersededOffer>>;
338
+ /**
339
+ * Supersede every pending offer **made to** `to_account_id` — the
340
+ * recipient-side cascade of an account delete.
341
+ *
342
+ * An undelete restores the account, so an offer left pending through the
343
+ * delete would come back with it and could then be accepted; superseding it
344
+ * in the delete's transaction makes it terminal for good. Matching on
345
+ * `to_account_id` alone covers the actor-addressed offers too: an offer's
346
+ * `to_actor_id` is bound to its `to_account_id` at create. Each row carries
347
+ * the grantor's `from_account_id`, as every supersede cascade's does; the
348
+ * caller emits a `role_grant_offer_supersede` audit event per entry. Twin of
349
+ * the Rust `query_role_grant_offer_supersede_incoming`.
350
+ *
351
+ * @param deps - query dependencies
352
+ * @param to_account_id - the recipient account whose pending offers end
353
+ * @returns the superseded offers, each with its grantor's account
354
+ * @mutates `role_grant_offer` rows - stamps `superseded_at` on every pending offer to `to_account_id`
355
+ */
356
+ export declare const query_role_grant_offer_supersede_incoming: (deps: QueryDeps, to_account_id: Uuid) => Promise<Array<SupersededOffer>>;
304
357
  //# sourceMappingURL=role_grant_offer_queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAUrD,OAAO,KAAK,EACX,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAA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D,MAAM,SAAS,KACb,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAe/B,CAAC;AAqCF,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,IAAI,CAAC;IACf,mGAAmG;IACnG,aAAa,EAAE,IAAI,CAAC;IACpB;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,gDAAgD;IAChD,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnB;AAED,6HAA6H;AAC7H,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,SAAS,CAAC;IACtB,KAAK,EAAE,cAAc,CAAC;IACtB,kOAAkO;IAClO,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,iBAAiB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC1C,yMAAyM;IACzM,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,kBAAkB,GAC9B,MAAM,SAAS,EACf,OAAO,gBAAgB,KACrB,OAAO,CAAC,iBAAiB,CAgP3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yCAAyC,GACrD,MAAM,SAAS,EACf,gBAAgB,aAAa,CAAC,IAAI,CAAC,KACjC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAchC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,yCAAyC,GACrD,MAAM,SAAS,EACf,eAAe,IAAI,KACjB,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAahC,CAAC"}
@@ -17,6 +17,7 @@ import { ROLE_GRANT_OFFER_COLUMNS, role_grant_offer_expr, ROLE_GRANT_OFFER_SCOPE
17
17
  import { query_create_role_grant, query_role_grant_by_id } from './role_grant_queries.js';
18
18
  import { offer_pending_predicate, role_grant_active_sql } from './role_grant_sql.js';
19
19
  import { query_audit_log } from './audit_log_queries.js';
20
+ import { query_account_lock_live_many } from './account_queries.js';
20
21
  import { is_builtin_role, ROLE_ADMIN, ROLE_KEEPER } from './role_schema.js';
21
22
  /**
22
23
  * Error thrown by offer-lifecycle queries when the offer is in a non-pending
@@ -101,7 +102,8 @@ export class RoleGrantOfferBuiltinRefusedError extends Error {
101
102
  }
102
103
  /**
103
104
  * Error thrown when `query_role_grant_offer_create` is called with a
104
- * `to_actor_id` that does not exist or does not belong to `to_account_id`.
105
+ * `to_actor_id` that is no active actor of `to_account_id` — missing,
106
+ * tombstoned, or another account's.
105
107
  * Surfaces the actor↔account binding mismatch at the boundary instead of
106
108
  * letting the FK silently disagree with the recipient field.
107
109
  */
@@ -111,6 +113,32 @@ export class RoleGrantOfferActorAccountMismatchError extends Error {
111
113
  this.name = 'RoleGrantOfferActorAccountMismatchError';
112
114
  }
113
115
  }
116
+ /**
117
+ * Error thrown by `query_role_grant_offer_create` when the recipient is not an
118
+ * active account: `to_account_id` names no account, a soft-deleted one, or one
119
+ * with no active actor. A deleted recipient and one that never existed are the
120
+ * one refusal, so a caller learns nothing from it that a missing id wouldn't
121
+ * tell; the handler answers it as `role_grant_assign` answers the same
122
+ * recipient. Twin of the Rust `RoleGrantOfferError::RecipientNotActive`.
123
+ */
124
+ export class RoleGrantOfferRecipientNotActiveError extends Error {
125
+ constructor() {
126
+ super('the recipient is not an active account');
127
+ this.name = 'RoleGrantOfferRecipientNotActiveError';
128
+ }
129
+ }
130
+ /**
131
+ * Error thrown by `query_role_grant_offer_create` when the grantor is not an
132
+ * active account: its actor is missing or tombstoned, or its account
133
+ * soft-deleted — a delete that committed while the offer was in flight. Twin
134
+ * of the Rust `RoleGrantOfferError::GrantorNotActive`.
135
+ */
136
+ export class RoleGrantOfferGrantorNotActiveError extends Error {
137
+ constructor() {
138
+ super('the grantor is not an active account');
139
+ this.name = 'RoleGrantOfferGrantorNotActiveError';
140
+ }
141
+ }
114
142
  /**
115
143
  * Create a new role_grant offer, or refresh an existing pending offer for the
116
144
  * same `(to_account_id, role, scope_id, from_actor_id)` tuple.
@@ -133,11 +161,24 @@ export class RoleGrantOfferActorAccountMismatchError extends Error {
133
161
  * `query_accept_offer` rejects any actor other than the named one. Closes
134
162
  * the audit hole where offer-shape events would otherwise leave
135
163
  * `target_actor_id` null even when the recipient binding is known at
136
- * offer time. The actor↔account binding is verified here in one SELECT.
164
+ * offer time. A named actor must be an active actor of `to_account_id`.
165
+ *
166
+ * Both parties must be active accounts, checked here so every caller — the
167
+ * spine's handler and a consumer creating offers on its own path — gets the
168
+ * rule. Both account rows are read under `FOR SHARE` before the insert, in one
169
+ * statement in id order (`query_account_lock_live_many`): an account delete
170
+ * writes its tombstone first, so a delete committed before the read is waited
171
+ * for and seen (the offer is refused), and one after it waits for this
172
+ * transaction to commit and then supersedes the offer with the party's
173
+ * others. Run it inside the caller's transaction, which the lock
174
+ * spans. The self-target check comes first, so an offer to one's own account
175
+ * is refused as that whatever else it names.
137
176
  *
138
177
  * @mutates `role_grant_offer` table - inserts a new offer or upserts the matching pending row
139
178
  * @throws RoleGrantOfferSelfTargetError if the offering actor belongs to `to_account_id`
140
- * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but does not belong to `to_account_id`
179
+ * @throws RoleGrantOfferRecipientNotActiveError if `to_account_id` is missing, soft-deleted, or has no active actor
180
+ * @throws RoleGrantOfferActorAccountMismatchError if `to_actor_id` is set but is no active actor of `to_account_id`
181
+ * @throws RoleGrantOfferGrantorNotActiveError if the grantor's actor or account is missing or tombstoned
141
182
  */
142
183
  export const query_role_grant_offer_create = async (deps, input) => {
143
184
  // Self-target check resolves the **grantor** actor's account and
@@ -153,11 +194,26 @@ export const query_role_grant_offer_create = async (deps, input) => {
153
194
  if (grantor && grantor.account_id === input.to_account_id) {
154
195
  throw new RoleGrantOfferSelfTargetError();
155
196
  }
156
- if (input.to_actor_id != null) {
157
- const target = await deps.db.query_one(`SELECT account_id FROM actor WHERE id = $1`, [input.to_actor_id]);
158
- if (!target || target.account_id !== input.to_account_id) {
159
- throw new RoleGrantOfferActorAccountMismatchError();
160
- }
197
+ // Both parties' account rows, locked in one statement in id order — the
198
+ // order the last-admin guard locks its rows in, so the two never wait on
199
+ // each other — then judged recipient first, grantor second.
200
+ const live = await query_account_lock_live_many(deps, grantor ? [input.to_account_id, grantor.account_id] : [input.to_account_id]);
201
+ // The recipient: a live account with an active actor (the named one, when
202
+ // an actor is named).
203
+ if (!live.has(input.to_account_id)) {
204
+ throw new RoleGrantOfferRecipientNotActiveError();
205
+ }
206
+ const recipient_actors = await deps.db.query(`SELECT id FROM actor WHERE account_id = $1 AND deleted_at IS NULL`, [input.to_account_id]);
207
+ if (recipient_actors.length === 0) {
208
+ throw new RoleGrantOfferRecipientNotActiveError();
209
+ }
210
+ if (input.to_actor_id != null && !recipient_actors.some((a) => a.id === input.to_actor_id)) {
211
+ throw new RoleGrantOfferActorAccountMismatchError();
212
+ }
213
+ // The grantor: a live actor of a live account.
214
+ const grantor_actor = await deps.db.query_one(`SELECT id FROM actor WHERE id = $1 AND deleted_at IS NULL`, [input.from_actor_id]);
215
+ if (!grantor || !grantor_actor || !live.has(grantor.account_id)) {
216
+ throw new RoleGrantOfferGrantorNotActiveError();
161
217
  }
162
218
  const row = await deps.db.query_one(`INSERT INTO role_grant_offer
163
219
  (from_actor_id, to_account_id, to_actor_id, role, scope_kind, scope_id, message, expires_at)
@@ -631,3 +687,32 @@ export const query_role_grant_offer_supersede_outgoing = async (deps, from_actor
631
687
  )
632
688
  ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [from_actor_ids]);
633
689
  };
690
+ /**
691
+ * Supersede every pending offer **made to** `to_account_id` — the
692
+ * recipient-side cascade of an account delete.
693
+ *
694
+ * An undelete restores the account, so an offer left pending through the
695
+ * delete would come back with it and could then be accepted; superseding it
696
+ * in the delete's transaction makes it terminal for good. Matching on
697
+ * `to_account_id` alone covers the actor-addressed offers too: an offer's
698
+ * `to_actor_id` is bound to its `to_account_id` at create. Each row carries
699
+ * the grantor's `from_account_id`, as every supersede cascade's does; the
700
+ * caller emits a `role_grant_offer_supersede` audit event per entry. Twin of
701
+ * the Rust `query_role_grant_offer_supersede_incoming`.
702
+ *
703
+ * @param deps - query dependencies
704
+ * @param to_account_id - the recipient account whose pending offers end
705
+ * @returns the superseded offers, each with its grantor's account
706
+ * @mutates `role_grant_offer` rows - stamps `superseded_at` on every pending offer to `to_account_id`
707
+ */
708
+ export const query_role_grant_offer_supersede_incoming = async (deps, to_account_id) => {
709
+ return deps.db.query(`WITH updated AS (
710
+ UPDATE role_grant_offer
711
+ SET superseded_at = NOW()
712
+ WHERE to_account_id = $1
713
+ AND ${offer_pending_predicate('')}
714
+ -- raw columns; the outer grantor select formats them
715
+ RETURNING ${columns_sql(ROLE_GRANT_OFFER_COLUMNS)}
716
+ )
717
+ ${ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT}`, [to_account_id]);
718
+ };
@@ -211,6 +211,13 @@ export declare const query_actor_has_active_global_role: (deps: QueryDeps, actor
211
211
  * transaction that does the removal. Twin of the Rust
212
212
  * `query_count_active_accounts_with_global_role_for_update`.
213
213
  *
214
+ * The rows are locked in id order — account, then actor, then grant — as the
215
+ * sort returns them: each account's row, its actors' and its grants' before
216
+ * the next account's. `query_account_lock_live_many` takes account rows in the
217
+ * same order, so an offer between two admins and an admin's removal never
218
+ * wait on each other's rows in opposite orders. Ids never change, so no
219
+ * concurrent update can move a row the sort has placed.
220
+ *
214
221
  * `exclude_role_grant_id` leaves one grant out of the count, so a revoke asks
215
222
  * whether any active admin account would remain without that grant — an
216
223
  * account holding the grant on two actors keeps counting through the other.
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;A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vC,OAAO,CAAC,MAAM,CAwBhB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yCAAyC,GACrD,MAAM,SAAS,EACf,MAAM,MAAM,KACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAgBvB,CAAC;AAEF,8IAA8I;AAC9I,MAAM,WAAW,oBAAoB;IACpC;;;;;;;;OAQG;IACH,OAAO,EAAE,KAAK,CAAC;QACd,aAAa,EAAE,IAAI,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KACjB,CAAC,CAAC;IACH;;;;;;;;;;OAUG;IACH,iBAAiB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,iCAAiC,GAC7C,MAAM,SAAS,EACf,UAAU,IAAI,EACd,YAAY,IAAI,GAAG,IAAI,EACvB,SAAS,MAAM,GAAG,IAAI,KACpB,OAAO,CAAC,oBAAoB,CA0C9B,CAAC"}
@@ -331,6 +331,13 @@ export const query_actor_has_active_global_role = async (deps, actor_id, role) =
331
331
  * transaction that does the removal. Twin of the Rust
332
332
  * `query_count_active_accounts_with_global_role_for_update`.
333
333
  *
334
+ * The rows are locked in id order — account, then actor, then grant — as the
335
+ * sort returns them: each account's row, its actors' and its grants' before
336
+ * the next account's. `query_account_lock_live_many` takes account rows in the
337
+ * same order, so an offer between two admins and an admin's removal never
338
+ * wait on each other's rows in opposite orders. Ids never change, so no
339
+ * concurrent update can move a row the sort has placed.
340
+ *
334
341
  * `exclude_role_grant_id` leaves one grant out of the count, so a revoke asks
335
342
  * whether any active admin account would remain without that grant — an
336
343
  * account holding the grant on two actors keeps counting through the other.
@@ -357,6 +364,7 @@ export const query_count_active_accounts_with_global_role_for_update = async (de
357
364
  AND rg.role = $1
358
365
  AND rg.scope_id IS NULL
359
366
  AND ${role_grant_active_sql('rg')}
367
+ ORDER BY a.id, act.id, rg.id
360
368
  FOR UPDATE`, [role]);
361
369
  const account_ids = new Set();
362
370
  for (const row of rows) {
@@ -20,24 +20,66 @@ import type { Keyring } from './keyring.js';
20
20
  */
21
21
  export declare const SESSION_AGE_MAX: number;
22
22
  /**
23
- * Cookie options for session cookies.
24
- */
25
- export interface SessionCookieOptions {
26
- path: string;
27
- httpOnly: boolean;
28
- secure: boolean;
29
- sameSite: 'strict' | 'lax' | 'none';
30
- maxAge: number;
31
- }
23
+ * The attributes every session `Set-Cookie` carries, in the order written —
24
+ * the Rust spine's `SESSION_COOKIE_ATTRIBUTES`, byte for byte. Fixed: the
25
+ * spine writes one cookie.
26
+ *
27
+ * - `Path=/` - sent to every path of the origin
28
+ * - `HttpOnly` - out of reach of page script
29
+ * - `Secure` - HTTPS only (Chrome and Firefox treat `localhost` as secure)
30
+ * - `SameSite=Strict` - never sent on a cross-site request
31
+ */
32
+ export declare const SESSION_COOKIE_ATTRIBUTES = "Path=/; HttpOnly; Secure; SameSite=Strict";
33
+ /**
34
+ * Whether `name` is an RFC 6265 `cookie-name` — an HTTP `token`: visible
35
+ * ASCII less the separators (`=`, `;`, `,`, space, quotes, brackets and the
36
+ * rest). Twin of the Rust spine's `is_cookie_name`.
37
+ *
38
+ * Anything but a string is refused, whatever its type says: the name is a
39
+ * consumer's option, and a regex alone would read `undefined` as the text
40
+ * `undefined`.
41
+ *
42
+ * @param name - a cookie name
43
+ */
44
+ export declare const is_cookie_name: (name: string) => boolean;
45
+ /**
46
+ * Whether `value` is an RFC 6265 `cookie-value` in its unquoted form — only
47
+ * `cookie-octet`s: visible ASCII less `"`, `,`, `;` and `\`. Such a value
48
+ * reads back out of a `Cookie` header exactly as it was written, which is
49
+ * what a reader that decodes nothing needs. Twin of the Rust spine's
50
+ * `is_cookie_value`.
51
+ *
52
+ * Anything but a string is refused, whatever its type says: the value comes
53
+ * out of a consumer's `encode_identity` and keyring, and a regex alone would
54
+ * read `undefined` as the text `undefined`.
55
+ *
56
+ * @param value - a cookie value
57
+ */
58
+ export declare const is_cookie_value: (value: string) => boolean;
59
+ /**
60
+ * Build the `Set-Cookie` header value that sets the session cookie:
61
+ * `<name>=<value>; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=<max_age>`,
62
+ * the Rust spine's string. The value is written as given — never
63
+ * percent-encoded or quoted — so the cookie either spine mints verifies on
64
+ * both.
65
+ *
66
+ * @param cookie_name - the session cookie's name
67
+ * @param value - the signed cookie value (`create_session_cookie_value`)
68
+ * @param max_age - the cookie's lifetime in seconds
69
+ * @returns the `Set-Cookie` header value
70
+ * @throws Error when the name is not an RFC 6265 `cookie-name`, the value holds anything but `cookie-octet`s (an `encode_identity` that emits a space, a `;`, or a non-ASCII character), or `max_age` is not a non-negative safe integer — a header that would read back differently is never written
71
+ */
72
+ export declare const format_session_set_cookie: (cookie_name: string, value: string, max_age: number) => string;
32
73
  /**
33
- * Default cookie options for session cookies.
74
+ * Build the `Set-Cookie` header value that clears the session cookie:
75
+ * `<name>=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`, the Rust
76
+ * spine's string.
34
77
  *
35
- * Uses strict security settings:
36
- * - `secure: true` - Works on localhost in Chrome/Firefox (treated as secure context)
37
- * - `sameSite: 'strict'` - Prevents CSRF
38
- * - `httpOnly: true` - Prevents XSS access to cookie
78
+ * @param cookie_name - the session cookie's name
79
+ * @returns the `Set-Cookie` header value
80
+ * @throws Error when the name is not an RFC 6265 `cookie-name`
39
81
  */
40
- export declare const session_cookie_options: SessionCookieOptions;
82
+ export declare const format_session_clear_cookie: (cookie_name: string) => string;
41
83
  /**
42
84
  * Configuration for a session cookie format.
43
85
  *
@@ -85,17 +127,45 @@ export interface SessionOptions<TIdentity> {
85
127
  /**
86
128
  * Cookie lifetime in seconds. Single source of truth for both the embedded
87
129
  * `expires_at` (via `create_session_cookie_value`) and the cookie's HTTP
88
- * `Max-Age` attribute (via `set_session_cookie`). Defaults to
89
- * `SESSION_AGE_MAX` (30 days). The `cookie_options` slot intentionally
90
- * cannot carry `maxAge` so the two values can't drift.
130
+ * `Max-Age` attribute (via `session_cookie_header`). Defaults to
131
+ * `SESSION_AGE_MAX` (30 days). Every other attribute is fixed
132
+ * (`SESSION_COOKIE_ATTRIBUTES`).
91
133
  */
92
134
  max_age?: number;
93
- cookie_options?: Partial<Omit<SessionCookieOptions, 'maxAge'>>;
94
- /** Encode identity into the cookie payload (before the `:expires_at` suffix). */
135
+ /**
136
+ * Encode identity into the cookie payload (before the `:expires_at` suffix).
137
+ * The payload goes into the cookie as written, so it must hold only RFC
138
+ * 6265 `cookie-octet`s (`is_cookie_value`) — `session_cookie_header` throws
139
+ * on anything else.
140
+ */
95
141
  encode_identity: (identity: TIdentity) => string;
96
142
  /** Decode identity from cookie payload. Return null if invalid. */
97
143
  decode_identity: (payload: string) => TIdentity | null;
98
144
  }
145
+ /**
146
+ * The `Set-Cookie` value that sets the session cookie to `value`, a signed
147
+ * cookie value (`create_session_cookie_value`, or the `cookie_value` of
148
+ * `create_capped_session`) — what a success carries
149
+ * (`route_ok(value, {set_cookie: [...]})`). `options.max_age` sets `Max-Age`,
150
+ * as it set the value's embedded expiry; `SESSION_AGE_MAX` when unset. Twin of
151
+ * the Rust `session_cookie_header`, which signs the token itself.
152
+ *
153
+ * @param value - the signed cookie value
154
+ * @param options - the cookie name and lifetime
155
+ * @returns the `Set-Cookie` header value (`format_session_set_cookie`)
156
+ * @throws Error when the cookie name or the value is outside the RFC 6265 grammar
157
+ */
158
+ export declare const session_cookie_header: <T>(value: string, options: SessionOptions<T>) => string;
159
+ /**
160
+ * The `Set-Cookie` value that clears the session cookie — what a logout or a
161
+ * password change carries on its success. Twin of the Rust
162
+ * `clear_session_cookie_header`.
163
+ *
164
+ * @param options - the cookie name
165
+ * @returns the `Set-Cookie` header value (`format_session_clear_cookie`)
166
+ * @throws Error when the cookie name is outside the RFC 6265 grammar
167
+ */
168
+ export declare const clear_session_cookie_header: <T>(options: SessionOptions<T>) => string;
99
169
  /**
100
170
  * Result of parsing a signed session cookie.
101
171
  */
@@ -113,13 +183,17 @@ export interface ParsedSession<TIdentity> {
113
183
  * The signed value format is `${encode(identity)}:${expires_at}`.
114
184
  * Tries all keys in order to support key rotation.
115
185
  *
116
- * @param signed_value - the raw cookie value (signed)
186
+ * An empty string is a cookie that was sent with no value (`name=`): present
187
+ * and invalid, like any other value that fails verification. Only a nullish
188
+ * `signed_value` is "no cookie".
189
+ *
190
+ * @param signed_value - the raw cookie value (signed), nullish when the request carries no session cookie
117
191
  * @param keyring - key ring for verification
118
192
  * @param options - session configuration with decode logic
119
193
  * @param now_seconds - current time in seconds (for testing)
120
- * @returns `ParsedSession` if valid, null if invalid/expired, undefined if empty/missing
194
+ * @returns `ParsedSession` if valid, null if invalid/expired (the empty string included), undefined if missing
121
195
  */
122
- export declare const parse_session: <TIdentity>(signed_value: string | undefined, keyring: Keyring, options: SessionOptions<TIdentity>, now_seconds?: number) => Promise<ParsedSession<TIdentity> | null | undefined>;
196
+ export declare const parse_session: <TIdentity>(signed_value: string | null | undefined, keyring: Keyring, options: SessionOptions<TIdentity>, now_seconds?: number) => Promise<ParsedSession<TIdentity> | null | undefined>;
123
197
  /**
124
198
  * Create a signed session cookie value.
125
199
  *
@@ -171,11 +245,17 @@ export declare const fuz_session_config: SessionOptions<string>;
171
245
  * retired keys are safe to drop after `SESSION_AGE_MAX` (see
172
246
  * `docs/security.md` §Cookie Key Rotation).
173
247
  *
174
- * @param signed_value - the raw cookie value (may be undefined)
248
+ * The three outcomes are what the cookie alone shows: no cookie (`action:
249
+ * 'none'`), a cookie that fails verification — unreadable, a bad MAC, a signed
250
+ * expiry that has passed, an empty identity, an empty value — (`action:
251
+ * 'clear'`), and a valid one. A valid cookie whose `auth_session` row is gone
252
+ * is still valid here; nothing clears it.
253
+ *
254
+ * @param signed_value - the raw cookie value, nullish when the request carries no session cookie
175
255
  * @param keyring - key ring for verification and signing
176
256
  * @param options - session configuration
177
257
  * @param now_seconds - current time in seconds (for testing)
178
258
  * @returns result with validity and action to take
179
259
  */
180
- export declare const process_session_cookie: <TIdentity>(signed_value: string | undefined, keyring: Keyring, options: SessionOptions<TIdentity>, now_seconds?: number) => Promise<ProcessSessionResult<TIdentity>>;
260
+ export declare const process_session_cookie: <TIdentity>(signed_value: string | null | undefined, keyring: Keyring, options: SessionOptions<TIdentity>, now_seconds?: number) => Promise<ProcessSessionResult<TIdentity>>;
181
261
  //# sourceMappingURL=session_cookie.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session_cookie.d.ts","sourceRoot":"","sources":["../../src/lib/auth/session_cookie.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAAoB,CAAC;AAWjD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,oBAMpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/D,iFAAiF;IACjF,eAAe,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,MAA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