@fuzdev/fuz_app 0.180.0 → 0.182.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/dist/actions/CLAUDE.md +38 -20
  2. package/dist/actions/action_rpc.d.ts +25 -6
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +56 -48
  5. package/dist/actions/action_types.d.ts +31 -13
  6. package/dist/actions/action_types.d.ts.map +1 -1
  7. package/dist/actions/action_types.js +1 -1
  8. package/dist/actions/notification_sender.d.ts +83 -0
  9. package/dist/actions/notification_sender.d.ts.map +1 -0
  10. package/dist/actions/notification_sender.js +85 -0
  11. package/dist/actions/perform_action.d.ts +13 -4
  12. package/dist/actions/perform_action.d.ts.map +1 -1
  13. package/dist/actions/perform_action.js +27 -18
  14. package/dist/actions/register_action_ws.d.ts +20 -2
  15. package/dist/actions/register_action_ws.d.ts.map +1 -1
  16. package/dist/actions/register_action_ws.js +17 -5
  17. package/dist/actions/ws_socket_session.d.ts +3 -0
  18. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  19. package/dist/actions/ws_socket_session.js +3 -2
  20. package/dist/auth/CLAUDE.md +84 -59
  21. package/dist/auth/account_actions.d.ts.map +1 -1
  22. package/dist/auth/account_actions.js +30 -3
  23. package/dist/auth/account_queries.d.ts +213 -2
  24. package/dist/auth/account_queries.d.ts.map +1 -1
  25. package/dist/auth/account_queries.js +255 -2
  26. package/dist/auth/account_route_schema.d.ts +26 -16
  27. package/dist/auth/account_route_schema.d.ts.map +1 -1
  28. package/dist/auth/account_route_schema.js +10 -24
  29. package/dist/auth/account_routes.d.ts +5 -7
  30. package/dist/auth/account_routes.d.ts.map +1 -1
  31. package/dist/auth/account_routes.js +110 -89
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +117 -25
  34. package/dist/auth/api_token_queries.d.ts +29 -12
  35. package/dist/auth/api_token_queries.d.ts.map +1 -1
  36. package/dist/auth/api_token_queries.js +42 -27
  37. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  38. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  41. package/dist/auth/audit_log_routes.js +10 -12
  42. package/dist/auth/audit_log_schema.js +4 -4
  43. package/dist/auth/bearer_auth.d.ts +4 -3
  44. package/dist/auth/bearer_auth.d.ts.map +1 -1
  45. package/dist/auth/bearer_auth.js +37 -32
  46. package/dist/auth/bootstrap_account.d.ts +65 -37
  47. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  48. package/dist/auth/bootstrap_account.js +115 -66
  49. package/dist/auth/bootstrap_route_schema.d.ts +6 -2
  50. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  51. package/dist/auth/bootstrap_route_schema.js +7 -2
  52. package/dist/auth/bootstrap_routes.d.ts +50 -33
  53. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  54. package/dist/auth/bootstrap_routes.js +109 -87
  55. package/dist/auth/bootstrap_token_store.d.ts +60 -0
  56. package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
  57. package/dist/auth/bootstrap_token_store.js +39 -0
  58. package/dist/auth/credential_headers.d.ts +71 -0
  59. package/dist/auth/credential_headers.d.ts.map +1 -0
  60. package/dist/auth/credential_headers.js +100 -0
  61. package/dist/auth/daemon_token.d.ts +13 -1
  62. package/dist/auth/daemon_token.d.ts.map +1 -1
  63. package/dist/auth/daemon_token.js +14 -2
  64. package/dist/auth/daemon_token_middleware.d.ts +10 -11
  65. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  66. package/dist/auth/daemon_token_middleware.js +39 -30
  67. package/dist/auth/deps.d.ts +10 -11
  68. package/dist/auth/deps.d.ts.map +1 -1
  69. package/dist/auth/invite_queries.d.ts +18 -0
  70. package/dist/auth/invite_queries.d.ts.map +1 -1
  71. package/dist/auth/invite_queries.js +24 -0
  72. package/dist/auth/request_context.d.ts +97 -76
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +93 -104
  75. package/dist/auth/resolved_auth.d.ts +10 -5
  76. package/dist/auth/resolved_auth.d.ts.map +1 -1
  77. package/dist/auth/resolved_auth.js +2 -2
  78. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  79. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  80. package/dist/auth/role_grant_offer_action_specs.js +5 -3
  81. package/dist/auth/role_grant_offer_actions.d.ts +7 -11
  82. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  83. package/dist/auth/role_grant_offer_actions.js +97 -106
  84. package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
  85. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  86. package/dist/auth/role_grant_offer_ddl.js +9 -2
  87. package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
  88. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  89. package/dist/auth/role_grant_offer_notifications.js +75 -22
  90. package/dist/auth/role_grant_offer_queries.d.ts +143 -9
  91. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  92. package/dist/auth/role_grant_offer_queries.js +266 -66
  93. package/dist/auth/role_grant_offer_schema.js +1 -1
  94. package/dist/auth/role_grant_queries.d.ts +57 -10
  95. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  96. package/dist/auth/role_grant_queries.js +81 -22
  97. package/dist/auth/role_grant_sql.d.ts +21 -0
  98. package/dist/auth/role_grant_sql.d.ts.map +1 -1
  99. package/dist/auth/role_grant_sql.js +21 -0
  100. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  101. package/dist/auth/self_service_role_actions.js +9 -2
  102. package/dist/auth/session_cookie.d.ts +105 -25
  103. package/dist/auth/session_cookie.d.ts.map +1 -1
  104. package/dist/auth/session_cookie.js +124 -15
  105. package/dist/auth/session_middleware.d.ts +83 -54
  106. package/dist/auth/session_middleware.d.ts.map +1 -1
  107. package/dist/auth/session_middleware.js +92 -66
  108. package/dist/auth/session_queries.d.ts +95 -14
  109. package/dist/auth/session_queries.d.ts.map +1 -1
  110. package/dist/auth/session_queries.js +98 -19
  111. package/dist/auth/signup_route_schema.d.ts +5 -5
  112. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  113. package/dist/auth/signup_route_schema.js +4 -4
  114. package/dist/auth/signup_routes.d.ts.map +1 -1
  115. package/dist/auth/signup_routes.js +17 -14
  116. package/dist/auth/standard_rpc_actions.d.ts +6 -19
  117. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  118. package/dist/auth/standard_rpc_actions.js +5 -6
  119. package/dist/auth/token_scope.d.ts +6 -8
  120. package/dist/auth/token_scope.d.ts.map +1 -1
  121. package/dist/auth/token_scope.js +6 -9
  122. package/dist/dev/setup.d.ts +6 -1
  123. package/dist/dev/setup.d.ts.map +1 -1
  124. package/dist/dev/setup.js +42 -34
  125. package/dist/hono_context.d.ts +21 -0
  126. package/dist/hono_context.d.ts.map +1 -1
  127. package/dist/hono_context.js +17 -0
  128. package/dist/http/CLAUDE.md +156 -48
  129. package/dist/http/auth_shape.d.ts +4 -4
  130. package/dist/http/common_routes.js +1 -1
  131. package/dist/http/db_routes.d.ts +4 -3
  132. package/dist/http/db_routes.d.ts.map +1 -1
  133. package/dist/http/db_routes.js +14 -14
  134. package/dist/http/dev_route_error_check.d.ts +6 -3
  135. package/dist/http/dev_route_error_check.d.ts.map +1 -1
  136. package/dist/http/dev_route_error_check.js +6 -3
  137. package/dist/http/dev_set_cookie_check.d.ts +53 -0
  138. package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
  139. package/dist/http/dev_set_cookie_check.js +80 -0
  140. package/dist/http/error_schemas.d.ts +45 -22
  141. package/dist/http/error_schemas.d.ts.map +1 -1
  142. package/dist/http/error_schemas.js +53 -26
  143. package/dist/http/header_lines.d.ts +42 -0
  144. package/dist/http/header_lines.d.ts.map +1 -0
  145. package/dist/http/header_lines.js +80 -0
  146. package/dist/http/host.d.ts +12 -9
  147. package/dist/http/host.d.ts.map +1 -1
  148. package/dist/http/host.js +25 -20
  149. package/dist/http/origin.d.ts +7 -22
  150. package/dist/http/origin.d.ts.map +1 -1
  151. package/dist/http/origin.js +11 -25
  152. package/dist/http/proxy.d.ts +1 -0
  153. package/dist/http/proxy.d.ts.map +1 -1
  154. package/dist/http/proxy.js +3 -0
  155. package/dist/http/request_headers.d.ts +95 -0
  156. package/dist/http/request_headers.d.ts.map +1 -0
  157. package/dist/http/request_headers.js +110 -0
  158. package/dist/http/request_target.d.ts +134 -0
  159. package/dist/http/request_target.d.ts.map +1 -0
  160. package/dist/http/request_target.js +193 -0
  161. package/dist/http/route_error_check.d.ts +4 -11
  162. package/dist/http/route_error_check.d.ts.map +1 -1
  163. package/dist/http/route_error_check.js +4 -21
  164. package/dist/http/route_result.d.ts +127 -23
  165. package/dist/http/route_result.d.ts.map +1 -1
  166. package/dist/http/route_result.js +97 -19
  167. package/dist/http/route_spec.d.ts +299 -83
  168. package/dist/http/route_spec.d.ts.map +1 -1
  169. package/dist/http/route_spec.js +548 -71
  170. package/dist/http/simple_request.d.ts +19 -14
  171. package/dist/http/simple_request.d.ts.map +1 -1
  172. package/dist/http/simple_request.js +17 -29
  173. package/dist/http/surface.d.ts +2 -0
  174. package/dist/http/surface.d.ts.map +1 -1
  175. package/dist/http/surface.js +4 -1
  176. package/dist/realtime/outbound_budget.d.ts +1 -2
  177. package/dist/realtime/outbound_budget.d.ts.map +1 -1
  178. package/dist/realtime/outbound_budget.js +1 -2
  179. package/dist/realtime/sse.d.ts +47 -17
  180. package/dist/realtime/sse.d.ts.map +1 -1
  181. package/dist/realtime/sse.js +115 -93
  182. package/dist/realtime/sse_constants.d.ts +7 -1
  183. package/dist/realtime/sse_constants.d.ts.map +1 -1
  184. package/dist/realtime/sse_constants.js +12 -1
  185. package/dist/realtime/sse_registry.d.ts +3 -3
  186. package/dist/realtime/sse_registry.js +3 -3
  187. package/dist/runtime/deps.d.ts +20 -4
  188. package/dist/runtime/deps.d.ts.map +1 -1
  189. package/dist/runtime/mock.d.ts +7 -1
  190. package/dist/runtime/mock.d.ts.map +1 -1
  191. package/dist/runtime/mock.js +33 -3
  192. package/dist/runtime/node.d.ts.map +1 -1
  193. package/dist/runtime/node.js +2 -1
  194. package/dist/runtime/secure_file.d.ts +71 -10
  195. package/dist/runtime/secure_file.d.ts.map +1 -1
  196. package/dist/runtime/secure_file.js +91 -11
  197. package/dist/server/app_backend.d.ts +0 -8
  198. package/dist/server/app_backend.d.ts.map +1 -1
  199. package/dist/server/app_backend.js +4 -4
  200. package/dist/server/app_server.d.ts +54 -33
  201. package/dist/server/app_server.d.ts.map +1 -1
  202. package/dist/server/app_server.js +69 -41
  203. package/dist/server/serve_fact_route.d.ts +3 -3
  204. package/dist/server/serve_fact_route.d.ts.map +1 -1
  205. package/dist/server/serve_fact_route.js +59 -55
  206. package/dist/server/static.d.ts +20 -0
  207. package/dist/server/static.d.ts.map +1 -1
  208. package/dist/server/static.js +56 -8
  209. package/dist/server/unmatched_route.d.ts +42 -0
  210. package/dist/server/unmatched_route.d.ts.map +1 -0
  211. package/dist/server/unmatched_route.js +64 -0
  212. package/dist/testing/CLAUDE.md +406 -1202
  213. package/dist/testing/app_server.d.ts +3 -1
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +5 -9
  216. package/dist/testing/auth_apps.d.ts.map +1 -1
  217. package/dist/testing/auth_apps.js +3 -2
  218. package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
  219. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  220. package/dist/testing/cross_backend/account_lifecycle.js +320 -6
  221. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
  222. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  223. package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
  224. package/dist/testing/cross_backend/capabilities.d.ts +68 -5
  225. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  226. package/dist/testing/cross_backend/capabilities.js +20 -4
  227. package/dist/testing/cross_backend/cell_gated_create.js +1 -1
  228. package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
  229. package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
  230. package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
  231. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  232. package/dist/testing/cross_backend/conformance_table.js +179 -23
  233. package/dist/testing/cross_backend/cookie_attributes.js +1 -1
  234. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
  235. package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
  236. package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
  237. package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
  238. package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
  239. package/dist/testing/cross_backend/credential_conformance.js +296 -0
  240. package/dist/testing/cross_backend/credential_conformance.json +1284 -0
  241. package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
  242. package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
  243. package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
  244. package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
  245. package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
  246. package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
  247. package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
  248. package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
  249. package/dist/testing/cross_backend/credential_wire.js +188 -0
  250. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  251. package/dist/testing/cross_backend/default_backend_configs.js +22 -2
  252. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
  253. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  254. package/dist/testing/cross_backend/default_spine_surface.js +3 -7
  255. package/dist/testing/cross_backend/differential.d.ts +1 -1
  256. package/dist/testing/cross_backend/differential.d.ts.map +1 -1
  257. package/dist/testing/cross_backend/differential.js +3 -2
  258. package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
  259. package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
  260. package/dist/testing/cross_backend/differential_normalize.js +11 -5
  261. package/dist/testing/cross_backend/full_spine_mount.d.ts +4 -10
  262. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  263. package/dist/testing/cross_backend/full_spine_mount.js +11 -4
  264. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  265. package/dist/testing/cross_backend/identity_parity.js +4 -0
  266. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  267. package/dist/testing/cross_backend/in_process_setup.js +78 -4
  268. package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
  269. package/dist/testing/cross_backend/login_security.js +13 -10
  270. package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
  271. package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
  272. package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
  273. package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
  274. package/dist/testing/cross_backend/request_header_conformance.js +196 -0
  275. package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
  276. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
  277. package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
  278. package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
  279. package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
  280. package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
  281. package/dist/testing/cross_backend/request_target_conformance.js +186 -0
  282. package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
  283. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
  284. package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
  285. package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
  286. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  287. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
  288. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
  289. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  290. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +185 -31
  291. package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
  292. package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
  293. package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
  294. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
  295. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  296. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
  297. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  298. package/dist/testing/cross_backend/session_cap.js +82 -34
  299. package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
  300. package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
  301. package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
  302. package/dist/testing/cross_backend/session_login.d.ts +24 -0
  303. package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
  304. package/dist/testing/cross_backend/session_login.js +31 -0
  305. package/dist/testing/cross_backend/setup.d.ts +117 -0
  306. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  307. package/dist/testing/cross_backend/setup.js +193 -9
  308. package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
  309. package/dist/testing/cross_backend/simple_request.js +5 -0
  310. package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
  311. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  312. package/dist/testing/cross_backend/spine_suites.js +88 -5
  313. package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
  314. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  315. package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
  316. package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
  317. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  318. package/dist/testing/cross_backend/sse_round_trip.js +205 -64
  319. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  320. package/dist/testing/cross_backend/testing_backdoor.js +5 -2
  321. package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
  322. package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
  323. package/dist/testing/cross_backend/testing_credential_read.js +175 -0
  324. package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
  325. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  326. package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
  327. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  328. package/dist/testing/cross_backend/token_lifetime.js +58 -2
  329. package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
  330. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  331. package/dist/testing/cross_backend/transport_composition.js +13 -10
  332. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  333. package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
  334. package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
  335. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  336. package/dist/testing/cross_backend/ws_endpoint.js +19 -2
  337. package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
  338. package/dist/testing/cross_backend/ws_role_gated.js +2 -3
  339. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  340. package/dist/testing/cross_backend/ws_round_trip.js +28 -12
  341. package/dist/testing/cross_backend/xfail.d.ts +44 -11
  342. package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
  343. package/dist/testing/cross_backend/xfail.js +68 -23
  344. package/dist/testing/data_exposure.d.ts.map +1 -1
  345. package/dist/testing/data_exposure.js +4 -3
  346. package/dist/testing/integration.d.ts +1 -2
  347. package/dist/testing/integration.d.ts.map +1 -1
  348. package/dist/testing/integration.js +14 -8
  349. package/dist/testing/integration_helpers.d.ts +50 -3
  350. package/dist/testing/integration_helpers.d.ts.map +1 -1
  351. package/dist/testing/integration_helpers.js +87 -9
  352. package/dist/testing/middleware.d.ts +3 -1
  353. package/dist/testing/middleware.d.ts.map +1 -1
  354. package/dist/testing/middleware.js +14 -7
  355. package/dist/testing/resolved_auth.d.ts +3 -1
  356. package/dist/testing/resolved_auth.d.ts.map +1 -1
  357. package/dist/testing/resolved_auth.js +4 -4
  358. package/dist/testing/round_trip.d.ts +6 -2
  359. package/dist/testing/round_trip.d.ts.map +1 -1
  360. package/dist/testing/round_trip.js +17 -6
  361. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  362. package/dist/testing/rpc_envelope_cases.js +7 -0
  363. package/dist/testing/rpc_helpers.d.ts +4 -2
  364. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  365. package/dist/testing/rpc_helpers.js +6 -1
  366. package/dist/testing/rpc_round_trip.d.ts +13 -2
  367. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  368. package/dist/testing/rpc_round_trip.js +25 -6
  369. package/dist/testing/schema_generators.d.ts +2 -2
  370. package/dist/testing/schema_generators.d.ts.map +1 -1
  371. package/dist/testing/schema_generators.js +4 -4
  372. package/dist/testing/stubs.d.ts +2 -2
  373. package/dist/testing/stubs.d.ts.map +1 -1
  374. package/dist/testing/stubs.js +13 -10
  375. package/dist/testing/transports/fetch_transport.d.ts +6 -3
  376. package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
  377. package/dist/testing/transports/fetch_transport.js +31 -19
  378. package/dist/testing/transports/raw_http.d.ts +61 -1
  379. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  380. package/dist/testing/transports/raw_http.js +61 -1
  381. package/dist/testing/transports/ws_raw_client.d.ts +20 -0
  382. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  383. package/dist/testing/transports/ws_raw_client.js +10 -4
  384. package/dist/testing/transports/ws_transport.d.ts +21 -1
  385. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  386. package/dist/testing/transports/ws_transport.js +58 -20
  387. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  388. package/dist/testing/ws_round_trip.js +8 -4
  389. package/package.json +1 -1
@@ -42,8 +42,8 @@ export declare const query_create_account: (deps: QueryDeps, input: CreateAccoun
42
42
  /**
43
43
  * Find an **active** account by id (`deleted_at IS NULL`).
44
44
  *
45
- * This is the auth-resolution workhorse (`build_request_context` /
46
- * `build_account_context`) and the admin-target lookup, so it
45
+ * This is the auth-resolution workhorse (every credential leg reads the
46
+ * account through it) and the admin-target lookup, so it
47
47
  * deliberately excludes soft-deleted accounts: a tombstoned account must
48
48
  * not authenticate (`delete` = soft, `purge` = hard). Purge, which must operate on
49
49
  * soft-deleted rows too, uses `query_purge_account` directly.
@@ -96,6 +96,217 @@ export declare const query_account_by_username_or_email: (deps: QueryDeps, input
96
96
  * `updated_by` only when the stored hash equals `expected_hash`
97
97
  */
98
98
  export declare const query_update_account_password: (deps: QueryDeps, id: string, password_hash: string, updated_by: string | null, expected_hash: string) => Promise<boolean>;
99
+ /**
100
+ * Lock an account row for a credential mint, when the account is live and
101
+ * still holds the password hash its authorization verified.
102
+ *
103
+ * A login verifies the password outside any transaction, so a password change
104
+ * or an account delete can commit between the verify and the session insert —
105
+ * and revoke "every session" before the new one exists. Run first in the
106
+ * mint's transaction, this read waits on the row lock either writer holds and
107
+ * then rereads the row as they committed it, so the mint is refused when the
108
+ * hash changed or the tombstone landed; and once it holds the lock, either
109
+ * writer waits for the mint to commit and then revokes what it minted. Both
110
+ * writers write the account row before they revoke, which is what makes the
111
+ * lock order them.
112
+ *
113
+ * `FOR NO KEY UPDATE`, the strength of their `UPDATE`s, so it also conflicts
114
+ * with itself: the mints of one account take turns. The session cap needs
115
+ * that. A mint inserts its session and evicts the oldest past the cap in one
116
+ * transaction, and two mints running together each count without the other's
117
+ * uncommitted row — both commit above the cap — while their evictions lock
118
+ * the same old rows in orders the query plan picks, and can deadlock. Taken
119
+ * in turn, the second mint runs its statements after the first commits and
120
+ * counts its row. The foreign-key `FOR KEY SHARE` of a row inserted under the
121
+ * account does not conflict with it, so no write that merely references the
122
+ * account waits on a login. Besides the writers it orders against, it
123
+ * conflicts with `query_account_lock_live` (the token mint, the same
124
+ * strength), the `FOR SHARE` of `query_account_lock_live_many` (an offer or
125
+ * invite create), an offer accept's locks (`query_account_lock_for_offer_accept`,
126
+ * the recipient's at this strength, a grantor's shared), and the last-admin
127
+ * guard's `FOR NO KEY UPDATE`. None of
128
+ * those waits on an account row while holding a session row, and once a mint
129
+ * holds the lock it waits on nothing but the session rows its eviction
130
+ * deletes, so no cycle runs through it. Twin of the Rust
131
+ * `fuz_auth::query_account_lock_verified`.
132
+ *
133
+ * @param deps - query dependencies (must be the mint's transaction)
134
+ * @param id - the account the credential is for
135
+ * @param password_hash - the hash the password was verified against
136
+ * @returns `true` when the row is locked and current, `false` when it was deleted, tombstoned, or its hash changed
137
+ */
138
+ export declare const query_account_lock_verified: (deps: QueryDeps, id: string, password_hash: string) => Promise<boolean>;
139
+ /**
140
+ * Lock a live account row for a credential mint authorized by a credential
141
+ * the account already holds (`account_token_create`).
142
+ *
143
+ * The request's credential was resolved outside the mint's transaction, so an
144
+ * account delete can commit between that read and the insert, revoking every
145
+ * token before the new one exists. Run first in the mint's transaction, this
146
+ * read waits on the delete's row lock and then sees its tombstone; once it
147
+ * holds the lock, a delete waits for the mint to commit and then revokes the
148
+ * token. The password is not re-checked: the mint verified none. Taken
149
+ * `FOR NO KEY UPDATE` for the token cap, as the login's lock is for the session
150
+ * cap — `query_account_lock_verified` has why, and what it conflicts with; a
151
+ * token mint and a login of one account take turns too. A write that only
152
+ * needs ordering against a delete takes `query_account_lock_live_many`, which
153
+ * lets such writes run together. Twin of the Rust
154
+ * `fuz_auth::query_account_lock_live`.
155
+ *
156
+ * @param deps - query dependencies (must be the mint's transaction)
157
+ * @param id - the account the credential is for
158
+ * @returns `true` when the row is locked and not tombstoned, `false` when it was deleted or tombstoned
159
+ */
160
+ export declare const query_account_lock_live: (deps: QueryDeps, id: string) => Promise<boolean>;
161
+ /**
162
+ * Lock, for a purge, the account rows of every holder of an unrevoked global
163
+ * `admin` grant and the purged account's own, in one statement, in id order,
164
+ * `FOR NO KEY UPDATE`.
165
+ *
166
+ * A purge's cascade writes rows of other accounts: it sets null the
167
+ * `granted_by` and `revoked_by` of every grant the purged account's actors
168
+ * named, admins' grants among them, in whatever order the plan walks them. A
169
+ * last-admin guard of another removal takes admin accounts, actors and grants
170
+ * in account-id order. A purge reaching an admin's grant before the guard does
171
+ * and waiting on one the guard took could hold a row the guard waits on.
172
+ * Holding every admin's account first, in the order the guard and
173
+ * `query_account_lock_live_many` take account rows, another guard waits at its
174
+ * first account holding nothing, and two purges take turns. The purged
175
+ * account's row is taken in the same statement, so an offer create holding one
176
+ * of these rows `FOR SHARE` and waiting on another meets them in the same order.
177
+ * No `deleted_at` filter on either: a tombstoned admin's grant is written by
178
+ * the cascade as well, and a purge removes a tombstoned account. The admins
179
+ * are those the statement's snapshot sees; one made by a transaction that
180
+ * commits after it starts is not among them. Cost: a purge waits behind
181
+ * admins' logins, token creates and offers. Run first in the purge's
182
+ * transaction, before the last-admin guard (an admin target's only) and
183
+ * `query_account_lock_for_purge`.
184
+ * Twin of the Rust `fuz_auth::account_queries::query_account_lock_admins_for_purge`.
185
+ *
186
+ * @param deps - query dependencies (must be the purge's transaction)
187
+ * @param id - the account to purge
188
+ */
189
+ export declare const query_account_lock_admins_for_purge: (deps: QueryDeps, id: string) => Promise<void>;
190
+ /**
191
+ * Lock the account row of a revoke's revokee, by its actor, tombstoned or not,
192
+ * `FOR NO KEY UPDATE`.
193
+ *
194
+ * Every revoke of a grant takes it, before it locks the offers it supersedes
195
+ * and before it updates the grant. It keeps those offers from growing: an offer
196
+ * to or from the account takes the row `FOR SHARE`
197
+ * (`query_account_lock_live_many`), so none is made while the revoke runs, and
198
+ * an accept by the account takes it `FOR NO KEY UPDATE`
199
+ * (`query_account_lock_for_offer_accept`), so none claims one. And it is the
200
+ * lock an accept of an offer from the revokee is ordered by: the accept reads
201
+ * its grantor's authority under the grantor's account row, and a revoke of that
202
+ * authority takes the row here whether or not its last-admin guard ran (the
203
+ * guard runs only while the account holds an active global `admin`). A revoke
204
+ * of an admin grant takes it after the guard, which holds it already among the
205
+ * admins' rows in id order. Twin of the Rust
206
+ * `fuz_auth::account_queries::query_account_lock_for_revoke`.
207
+ *
208
+ * @param deps - query dependencies (must be the revoke's transaction)
209
+ * @param actor_id - the revokee actor
210
+ */
211
+ export declare const query_account_lock_for_revoke: (deps: QueryDeps, actor_id: string) => Promise<void>;
212
+ /**
213
+ * Lock an account row for its purge, tombstoned or not.
214
+ *
215
+ * Every writer of an account takes the account row before its other rows — a
216
+ * credential mint its lock, a password change or a delete its `UPDATE` — and a
217
+ * purge takes it first as well, ahead of the credential rows its revokes and
218
+ * its cascade delete. A purge reaching the row only at its `DELETE` would hold
219
+ * the account's sessions and tokens while waiting on a writer that holds the
220
+ * row and goes on to those same rows: a login evicting at the cap, a password
221
+ * change or a delete revoking. `FOR UPDATE`, the lock the purge's `DELETE`
222
+ * takes anyway: it conflicts with every other lock on the row, so a writer
223
+ * holding one is waited out, and a writer arriving later waits for the purge
224
+ * and then finds no row. No `deleted_at` filter — a purge removes a tombstoned
225
+ * account too. Run after `query_account_lock_admins_for_purge`, which takes the
226
+ * row `FOR NO KEY UPDATE` among every admin's in id order, and, for an admin
227
+ * target, the last-admin guard, so this only strengthens a lock the purge
228
+ * already holds. Twin of the Rust
229
+ * `fuz_auth::account_queries::query_account_lock_for_purge`.
230
+ *
231
+ * @param deps - query dependencies (must be the purge's transaction)
232
+ * @param id - the account to purge
233
+ * @returns `true` when the row is locked, `false` when there is no such account
234
+ */
235
+ export declare const query_account_lock_for_purge: (deps: QueryDeps, id: string) => Promise<boolean>;
236
+ /**
237
+ * Lock live account rows in one statement, in id order, for a write that must
238
+ * be ordered against a delete of any of them.
239
+ *
240
+ * An offer locks its two parties (`query_role_grant_offer_create`), an invite
241
+ * its issuer (`invite_create`, one id).
242
+ *
243
+ * `FOR SHARE`: the weakest lock that conflicts with a delete's `UPDATE` of the
244
+ * row, so these writes don't wait on one another. It also waits on a
245
+ * credential mint's `FOR NO KEY UPDATE` (`query_account_lock_verified`), and a
246
+ * mint waits on it — but a mint holding its lock waits on no row these writes
247
+ * hold.
248
+ *
249
+ * The rows are locked as the sort returns them, so every caller takes them in
250
+ * id order, as the last-admin guard
251
+ * (`query_count_active_accounts_with_global_role_locked`) takes its
252
+ * account rows: two transactions locking two of the same accounts never wait
253
+ * on each other in opposite orders. Taken one statement per account, an offer
254
+ * between two admins could hold one party's row while the guard held the
255
+ * other's, each waiting on the other. Ids never change, so the sort key a
256
+ * concurrent update could move is not one of them. As with
257
+ * `query_account_lock_live`, a delete committed before the read is waited for
258
+ * and its tombstone seen; one after it waits for the caller's commit. Twin of
259
+ * the Rust `fuz_auth::query_account_lock_live_many`.
260
+ *
261
+ * @param deps - query dependencies (must be the write's transaction)
262
+ * @param ids - the accounts to lock
263
+ * @returns the ids locked: those of the accounts neither deleted nor tombstoned
264
+ */
265
+ export declare const query_account_lock_live_many: (deps: QueryDeps, ids: ReadonlyArray<string>) => Promise<Set<string>>;
266
+ /**
267
+ * Lock the account rows an offer accept is ordered by, in id order: the
268
+ * recipient's `FOR NO KEY UPDATE`, and — when the offer confers the global
269
+ * `admin` its grantor must still hold — the grantor's `FOR SHARE`.
270
+ *
271
+ * The recipient's lock is a credential mint's strength
272
+ * (`query_account_lock_verified`), so it conflicts with itself: two accepts
273
+ * by one recipient take turns, and the second claims after the first has
274
+ * superseded its siblings. It conflicts with a delete's or a purge's first
275
+ * write of the account (the soft-delete `UPDATE`,
276
+ * `query_account_lock_admins_for_purge`, the last-admin guard), so a removal of
277
+ * the recipient waits here or is waited for whole, and never meets the accept
278
+ * at its offers or its actor; with a revoke's `query_account_lock_for_revoke`,
279
+ * so a revoke of the recipient's grant and the accept take turns; and with
280
+ * `query_account_lock_live_many`, so no offer to the recipient is made or
281
+ * refreshed while the accept holds it. Cost: an accept waits behind the
282
+ * recipient's own logins and token mints, which take the same lock.
283
+ *
284
+ * The grantor's share lock is what the grantor's authority is read under (an
285
+ * unlocked read after this one): every write that ends a grantor's global
286
+ * `admin` takes the grantor's account row first — a revoke of the grant through
287
+ * `query_account_lock_for_revoke` (whether or not its last-admin guard ran), a
288
+ * delete through its write of the row, a purge through
289
+ * `query_account_lock_admins_for_purge` and `query_account_lock_for_purge` — so
290
+ * it either commits before the read, which sees it, or waits for the accept to
291
+ * commit. A share lock on the account,
292
+ * not on the grant, so a purge's cascade reaching the grant (its `granted_by`
293
+ * naming an actor of the purged account) never waits on the accept.
294
+ *
295
+ * Two statements, as the two strengths can't share one locking clause, the
296
+ * lower id first — the order the last-admin guard
297
+ * (`query_count_active_accounts_with_global_role_locked`) and
298
+ * `query_account_lock_live_many` take account rows in — so an accept and a
299
+ * guard over an admin recipient and its grantor never wait on each other in
300
+ * opposite orders. Neither is filtered on the grantor's tombstone: the
301
+ * authority read judges it. Twin of the Rust
302
+ * `fuz_auth::query_account_lock_for_offer_accept`.
303
+ *
304
+ * @param deps - query dependencies (must be the accept's transaction)
305
+ * @param recipient_id - the accepting account
306
+ * @param grantor_id - the grantor's account, or `null` when the offer needs no grantor authority
307
+ * @returns `true` when the recipient's row is locked and live, `false` when it was deleted or tombstoned
308
+ */
309
+ export declare const query_account_lock_for_offer_accept: (deps: QueryDeps, recipient_id: string, grantor_id: string | null) => Promise<boolean>;
99
310
  /**
100
311
  * Identifying values snapshotted into a deletion/purge audit event so the
101
312
  * identity behind a now-orphaned `audit_log` id isn't lost. Mirrors the
@@ -1 +1 @@
1
- {"version":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AC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,SAAS,EACf,UAAU,uBAAuB,KAC/B,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAkHtC,CAAC"}
@@ -12,6 +12,7 @@ import { to_admin_account } from './account_schema.js';
12
12
  import { ADMIN_ACCOUNT_LIST_DEFAULT_LIMIT } from './admin_action_specs.js';
13
13
  import { ROLE_GRANT_COLUMNS } from './role_grant_queries.js';
14
14
  import { offer_pending_predicate, role_grant_active_sql } from './role_grant_sql.js';
15
+ import { ROLE_ADMIN } from './role_schema.js';
15
16
  /**
16
17
  * The full `account` column set, named explicitly so a row read fails loud
17
18
  * on schema drift.
@@ -84,8 +85,8 @@ export const query_create_account = async (deps, input) => {
84
85
  /**
85
86
  * Find an **active** account by id (`deleted_at IS NULL`).
86
87
  *
87
- * This is the auth-resolution workhorse (`build_request_context` /
88
- * `build_account_context`) and the admin-target lookup, so it
88
+ * This is the auth-resolution workhorse (every credential leg reads the
89
+ * account through it) and the admin-target lookup, so it
89
90
  * deliberately excludes soft-deleted accounts: a tombstoned account must
90
91
  * not authenticate (`delete` = soft, `purge` = hard). Purge, which must operate on
91
92
  * soft-deleted rows too, uses `query_purge_account` directly.
@@ -158,6 +159,258 @@ export const query_update_account_password = async (deps, id, password_hash, upd
158
159
  RETURNING id`, [password_hash, updated_by ?? null, id, expected_hash]);
159
160
  return rows.length > 0;
160
161
  };
162
+ /**
163
+ * Lock an account row for a credential mint, when the account is live and
164
+ * still holds the password hash its authorization verified.
165
+ *
166
+ * A login verifies the password outside any transaction, so a password change
167
+ * or an account delete can commit between the verify and the session insert —
168
+ * and revoke "every session" before the new one exists. Run first in the
169
+ * mint's transaction, this read waits on the row lock either writer holds and
170
+ * then rereads the row as they committed it, so the mint is refused when the
171
+ * hash changed or the tombstone landed; and once it holds the lock, either
172
+ * writer waits for the mint to commit and then revokes what it minted. Both
173
+ * writers write the account row before they revoke, which is what makes the
174
+ * lock order them.
175
+ *
176
+ * `FOR NO KEY UPDATE`, the strength of their `UPDATE`s, so it also conflicts
177
+ * with itself: the mints of one account take turns. The session cap needs
178
+ * that. A mint inserts its session and evicts the oldest past the cap in one
179
+ * transaction, and two mints running together each count without the other's
180
+ * uncommitted row — both commit above the cap — while their evictions lock
181
+ * the same old rows in orders the query plan picks, and can deadlock. Taken
182
+ * in turn, the second mint runs its statements after the first commits and
183
+ * counts its row. The foreign-key `FOR KEY SHARE` of a row inserted under the
184
+ * account does not conflict with it, so no write that merely references the
185
+ * account waits on a login. Besides the writers it orders against, it
186
+ * conflicts with `query_account_lock_live` (the token mint, the same
187
+ * strength), the `FOR SHARE` of `query_account_lock_live_many` (an offer or
188
+ * invite create), an offer accept's locks (`query_account_lock_for_offer_accept`,
189
+ * the recipient's at this strength, a grantor's shared), and the last-admin
190
+ * guard's `FOR NO KEY UPDATE`. None of
191
+ * those waits on an account row while holding a session row, and once a mint
192
+ * holds the lock it waits on nothing but the session rows its eviction
193
+ * deletes, so no cycle runs through it. Twin of the Rust
194
+ * `fuz_auth::query_account_lock_verified`.
195
+ *
196
+ * @param deps - query dependencies (must be the mint's transaction)
197
+ * @param id - the account the credential is for
198
+ * @param password_hash - the hash the password was verified against
199
+ * @returns `true` when the row is locked and current, `false` when it was deleted, tombstoned, or its hash changed
200
+ */
201
+ export const query_account_lock_verified = async (deps, id, password_hash) => {
202
+ const row = await deps.db.query_one(`SELECT id FROM account
203
+ WHERE id = $1 AND deleted_at IS NULL AND password_hash = $2
204
+ FOR NO KEY UPDATE`, [id, password_hash]);
205
+ return row !== undefined;
206
+ };
207
+ /**
208
+ * Lock a live account row for a credential mint authorized by a credential
209
+ * the account already holds (`account_token_create`).
210
+ *
211
+ * The request's credential was resolved outside the mint's transaction, so an
212
+ * account delete can commit between that read and the insert, revoking every
213
+ * token before the new one exists. Run first in the mint's transaction, this
214
+ * read waits on the delete's row lock and then sees its tombstone; once it
215
+ * holds the lock, a delete waits for the mint to commit and then revokes the
216
+ * token. The password is not re-checked: the mint verified none. Taken
217
+ * `FOR NO KEY UPDATE` for the token cap, as the login's lock is for the session
218
+ * cap — `query_account_lock_verified` has why, and what it conflicts with; a
219
+ * token mint and a login of one account take turns too. A write that only
220
+ * needs ordering against a delete takes `query_account_lock_live_many`, which
221
+ * lets such writes run together. Twin of the Rust
222
+ * `fuz_auth::query_account_lock_live`.
223
+ *
224
+ * @param deps - query dependencies (must be the mint's transaction)
225
+ * @param id - the account the credential is for
226
+ * @returns `true` when the row is locked and not tombstoned, `false` when it was deleted or tombstoned
227
+ */
228
+ export const query_account_lock_live = async (deps, id) => {
229
+ const row = await deps.db.query_one(`SELECT id FROM account WHERE id = $1 AND deleted_at IS NULL FOR NO KEY UPDATE`, [id]);
230
+ return row !== undefined;
231
+ };
232
+ /**
233
+ * Lock, for a purge, the account rows of every holder of an unrevoked global
234
+ * `admin` grant and the purged account's own, in one statement, in id order,
235
+ * `FOR NO KEY UPDATE`.
236
+ *
237
+ * A purge's cascade writes rows of other accounts: it sets null the
238
+ * `granted_by` and `revoked_by` of every grant the purged account's actors
239
+ * named, admins' grants among them, in whatever order the plan walks them. A
240
+ * last-admin guard of another removal takes admin accounts, actors and grants
241
+ * in account-id order. A purge reaching an admin's grant before the guard does
242
+ * and waiting on one the guard took could hold a row the guard waits on.
243
+ * Holding every admin's account first, in the order the guard and
244
+ * `query_account_lock_live_many` take account rows, another guard waits at its
245
+ * first account holding nothing, and two purges take turns. The purged
246
+ * account's row is taken in the same statement, so an offer create holding one
247
+ * of these rows `FOR SHARE` and waiting on another meets them in the same order.
248
+ * No `deleted_at` filter on either: a tombstoned admin's grant is written by
249
+ * the cascade as well, and a purge removes a tombstoned account. The admins
250
+ * are those the statement's snapshot sees; one made by a transaction that
251
+ * commits after it starts is not among them. Cost: a purge waits behind
252
+ * admins' logins, token creates and offers. Run first in the purge's
253
+ * transaction, before the last-admin guard (an admin target's only) and
254
+ * `query_account_lock_for_purge`.
255
+ * Twin of the Rust `fuz_auth::account_queries::query_account_lock_admins_for_purge`.
256
+ *
257
+ * @param deps - query dependencies (must be the purge's transaction)
258
+ * @param id - the account to purge
259
+ */
260
+ export const query_account_lock_admins_for_purge = async (deps, id) => {
261
+ await deps.db.query(`SELECT a.id FROM account a
262
+ WHERE a.id = $1
263
+ OR a.id IN (
264
+ SELECT act.account_id FROM actor act
265
+ JOIN role_grant rg ON rg.actor_id = act.id
266
+ WHERE rg.role = $2 AND rg.scope_id IS NULL AND rg.revoked_at IS NULL)
267
+ ORDER BY a.id
268
+ FOR NO KEY UPDATE`, [id, ROLE_ADMIN]);
269
+ };
270
+ /**
271
+ * Lock the account row of a revoke's revokee, by its actor, tombstoned or not,
272
+ * `FOR NO KEY UPDATE`.
273
+ *
274
+ * Every revoke of a grant takes it, before it locks the offers it supersedes
275
+ * and before it updates the grant. It keeps those offers from growing: an offer
276
+ * to or from the account takes the row `FOR SHARE`
277
+ * (`query_account_lock_live_many`), so none is made while the revoke runs, and
278
+ * an accept by the account takes it `FOR NO KEY UPDATE`
279
+ * (`query_account_lock_for_offer_accept`), so none claims one. And it is the
280
+ * lock an accept of an offer from the revokee is ordered by: the accept reads
281
+ * its grantor's authority under the grantor's account row, and a revoke of that
282
+ * authority takes the row here whether or not its last-admin guard ran (the
283
+ * guard runs only while the account holds an active global `admin`). A revoke
284
+ * of an admin grant takes it after the guard, which holds it already among the
285
+ * admins' rows in id order. Twin of the Rust
286
+ * `fuz_auth::account_queries::query_account_lock_for_revoke`.
287
+ *
288
+ * @param deps - query dependencies (must be the revoke's transaction)
289
+ * @param actor_id - the revokee actor
290
+ */
291
+ export const query_account_lock_for_revoke = async (deps, actor_id) => {
292
+ await deps.db.query(`SELECT a.id FROM actor act JOIN account a ON a.id = act.account_id
293
+ WHERE act.id = $1
294
+ FOR NO KEY UPDATE OF a`, [actor_id]);
295
+ };
296
+ /**
297
+ * Lock an account row for its purge, tombstoned or not.
298
+ *
299
+ * Every writer of an account takes the account row before its other rows — a
300
+ * credential mint its lock, a password change or a delete its `UPDATE` — and a
301
+ * purge takes it first as well, ahead of the credential rows its revokes and
302
+ * its cascade delete. A purge reaching the row only at its `DELETE` would hold
303
+ * the account's sessions and tokens while waiting on a writer that holds the
304
+ * row and goes on to those same rows: a login evicting at the cap, a password
305
+ * change or a delete revoking. `FOR UPDATE`, the lock the purge's `DELETE`
306
+ * takes anyway: it conflicts with every other lock on the row, so a writer
307
+ * holding one is waited out, and a writer arriving later waits for the purge
308
+ * and then finds no row. No `deleted_at` filter — a purge removes a tombstoned
309
+ * account too. Run after `query_account_lock_admins_for_purge`, which takes the
310
+ * row `FOR NO KEY UPDATE` among every admin's in id order, and, for an admin
311
+ * target, the last-admin guard, so this only strengthens a lock the purge
312
+ * already holds. Twin of the Rust
313
+ * `fuz_auth::account_queries::query_account_lock_for_purge`.
314
+ *
315
+ * @param deps - query dependencies (must be the purge's transaction)
316
+ * @param id - the account to purge
317
+ * @returns `true` when the row is locked, `false` when there is no such account
318
+ */
319
+ export const query_account_lock_for_purge = async (deps, id) => {
320
+ const row = await deps.db.query_one(`SELECT id FROM account WHERE id = $1 FOR UPDATE`, [id]);
321
+ return row !== undefined;
322
+ };
323
+ /**
324
+ * Lock live account rows in one statement, in id order, for a write that must
325
+ * be ordered against a delete of any of them.
326
+ *
327
+ * An offer locks its two parties (`query_role_grant_offer_create`), an invite
328
+ * its issuer (`invite_create`, one id).
329
+ *
330
+ * `FOR SHARE`: the weakest lock that conflicts with a delete's `UPDATE` of the
331
+ * row, so these writes don't wait on one another. It also waits on a
332
+ * credential mint's `FOR NO KEY UPDATE` (`query_account_lock_verified`), and a
333
+ * mint waits on it — but a mint holding its lock waits on no row these writes
334
+ * hold.
335
+ *
336
+ * The rows are locked as the sort returns them, so every caller takes them in
337
+ * id order, as the last-admin guard
338
+ * (`query_count_active_accounts_with_global_role_locked`) takes its
339
+ * account rows: two transactions locking two of the same accounts never wait
340
+ * on each other in opposite orders. Taken one statement per account, an offer
341
+ * between two admins could hold one party's row while the guard held the
342
+ * other's, each waiting on the other. Ids never change, so the sort key a
343
+ * concurrent update could move is not one of them. As with
344
+ * `query_account_lock_live`, a delete committed before the read is waited for
345
+ * and its tombstone seen; one after it waits for the caller's commit. Twin of
346
+ * the Rust `fuz_auth::query_account_lock_live_many`.
347
+ *
348
+ * @param deps - query dependencies (must be the write's transaction)
349
+ * @param ids - the accounts to lock
350
+ * @returns the ids locked: those of the accounts neither deleted nor tombstoned
351
+ */
352
+ export const query_account_lock_live_many = async (deps, ids) => {
353
+ if (ids.length === 0)
354
+ return new Set();
355
+ const rows = await deps.db.query(`SELECT id FROM account WHERE id = ANY($1) AND deleted_at IS NULL ORDER BY id FOR SHARE`, [ids]);
356
+ return new Set(rows.map((row) => row.id));
357
+ };
358
+ /**
359
+ * Lock the account rows an offer accept is ordered by, in id order: the
360
+ * recipient's `FOR NO KEY UPDATE`, and — when the offer confers the global
361
+ * `admin` its grantor must still hold — the grantor's `FOR SHARE`.
362
+ *
363
+ * The recipient's lock is a credential mint's strength
364
+ * (`query_account_lock_verified`), so it conflicts with itself: two accepts
365
+ * by one recipient take turns, and the second claims after the first has
366
+ * superseded its siblings. It conflicts with a delete's or a purge's first
367
+ * write of the account (the soft-delete `UPDATE`,
368
+ * `query_account_lock_admins_for_purge`, the last-admin guard), so a removal of
369
+ * the recipient waits here or is waited for whole, and never meets the accept
370
+ * at its offers or its actor; with a revoke's `query_account_lock_for_revoke`,
371
+ * so a revoke of the recipient's grant and the accept take turns; and with
372
+ * `query_account_lock_live_many`, so no offer to the recipient is made or
373
+ * refreshed while the accept holds it. Cost: an accept waits behind the
374
+ * recipient's own logins and token mints, which take the same lock.
375
+ *
376
+ * The grantor's share lock is what the grantor's authority is read under (an
377
+ * unlocked read after this one): every write that ends a grantor's global
378
+ * `admin` takes the grantor's account row first — a revoke of the grant through
379
+ * `query_account_lock_for_revoke` (whether or not its last-admin guard ran), a
380
+ * delete through its write of the row, a purge through
381
+ * `query_account_lock_admins_for_purge` and `query_account_lock_for_purge` — so
382
+ * it either commits before the read, which sees it, or waits for the accept to
383
+ * commit. A share lock on the account,
384
+ * not on the grant, so a purge's cascade reaching the grant (its `granted_by`
385
+ * naming an actor of the purged account) never waits on the accept.
386
+ *
387
+ * Two statements, as the two strengths can't share one locking clause, the
388
+ * lower id first — the order the last-admin guard
389
+ * (`query_count_active_accounts_with_global_role_locked`) and
390
+ * `query_account_lock_live_many` take account rows in — so an accept and a
391
+ * guard over an admin recipient and its grantor never wait on each other in
392
+ * opposite orders. Neither is filtered on the grantor's tombstone: the
393
+ * authority read judges it. Twin of the Rust
394
+ * `fuz_auth::query_account_lock_for_offer_accept`.
395
+ *
396
+ * @param deps - query dependencies (must be the accept's transaction)
397
+ * @param recipient_id - the accepting account
398
+ * @param grantor_id - the grantor's account, or `null` when the offer needs no grantor authority
399
+ * @returns `true` when the recipient's row is locked and live, `false` when it was deleted or tombstoned
400
+ */
401
+ export const query_account_lock_for_offer_accept = async (deps, recipient_id, grantor_id) => {
402
+ const lock_grantor = async () => {
403
+ if (grantor_id === null)
404
+ return;
405
+ await deps.db.query(`SELECT id FROM account WHERE id = $1 FOR SHARE`, [grantor_id]);
406
+ };
407
+ if (grantor_id !== null && grantor_id < recipient_id)
408
+ await lock_grantor();
409
+ const recipient = await deps.db.query_one(`SELECT id FROM account WHERE id = $1 AND deleted_at IS NULL FOR NO KEY UPDATE`, [recipient_id]);
410
+ if (grantor_id !== null && grantor_id > recipient_id)
411
+ await lock_grantor();
412
+ return recipient !== undefined;
413
+ };
161
414
  /**
162
415
  * Soft-delete an account — the reversible tombstone (`delete` = soft).
163
416
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Hono-free wire schemas + route shapes for the account REST routes.
3
3
  *
4
- * Split from `account_routes.ts` (whose handlers pull `hono/cookie` via
5
- * `session_middleware`) so cross-process test suites can build the account
4
+ * Split from `account_routes.ts` (whose handlers mint and end sessions through
5
+ * `session_middleware` and the query layer) so cross-process test suites can build the account
6
6
  * route shapes — and assert on the `POST /login` / `GET /api/account/status`
7
- * response shapes — without dragging the in-process Hono session handler, and
8
- * its optional `hono` peer, onto a backend-spawning consumer. `account_routes.ts`
7
+ * response shapes — without dragging the in-process session handlers and
8
+ * their queries onto a backend-spawning consumer. `account_routes.ts`
9
9
  * imports these back and attaches the live handlers; single source of truth
10
10
  * for the wire shape.
11
11
  *
@@ -108,13 +108,21 @@ export declare const DEFAULT_MAX_TOKENS = 10;
108
108
  * context; surface generation attaches a stub.
109
109
  *
110
110
  * The path is **relative** like the sibling account shapes (`/login`,
111
- * `/verify`), so it composes under `prefix_route_specs('/api/account', …)` into
111
+ * `/logout`), so it composes under `prefix_route_specs('/api/account', …)` into
112
112
  * `/api/account/status`. `create_account_route_specs` bundles it (so every
113
113
  * account surface serves `/status`, matching the Rust `account_router`);
114
114
  * mirror Rust by mounting it as part of the account family, not separately.
115
115
  */
116
116
  export declare const account_status_route_shape: import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "authentication_required", {
117
117
  readonly bootstrap_available: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").BooleanSchema>;
118
+ }>, import("../http/error_schemas.js").RestErrorDef<400, "invalid_query_params", {
119
+ readonly issues: import("@fuzdev/fuz_schema/schema.ts").OptionalSchema<import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").LooseObjectSchema<{
120
+ kind: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
121
+ path: import("@fuzdev/fuz_schema/schema.ts").ArraySchema<import("@fuzdev/fuz_schema/schema.ts").UnionSchema<readonly [import("@fuzdev/fuz_schema/schema.ts").StringSchema, import("@fuzdev/fuz_schema/schema.ts").NumberSchema]>>;
122
+ expected: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
123
+ received: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
124
+ message: import("@fuzdev/fuz_schema/schema.ts").StringSchema;
125
+ }>>>;
118
126
  }>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
119
127
  account: import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
120
128
  id: import("@fuzdev/fuz_schema/schema.ts").BrandSchema<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>, "Uuid">;
@@ -139,40 +147,39 @@ export declare const account_status_route_shape: import("../http/route_spec.js")
139
147
  }>, {
140
148
  readonly account: "none";
141
149
  readonly actor: "none";
142
- }, undefined>;
150
+ }, undefined, import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<null>, undefined, undefined>;
143
151
  /** Option inputs that shape the account route metadata (not its handlers). */
144
152
  export interface AccountRouteShapeOptions {
145
153
  /** Whether a per-account login rate limiter is wired — toggles `/password`'s `rate_limit`. */
146
154
  login_account_rate_limited: boolean;
147
155
  }
148
156
  /**
149
- * The four account route shapes (`/verify`, `/login`, `/logout`, `/password`)
157
+ * The account route shapes (`/login`, `/logout`, `/password`)
150
158
  * minus their handlers — pure hono-free data. `create_account_route_specs`
151
159
  * attaches the live handler to each (`attach_route_handler`); cross-process
152
160
  * surface builders attach stubs (`stub_route_spec`). Single source of truth —
153
161
  * the shapes can't drift between the live routes and the surface.
154
162
  *
155
- * Returns a fixed 4-tuple `[verify, login, logout, password]` so destructuring
163
+ * Returns a fixed tuple `[login, logout, password]` so destructuring
156
164
  * yields non-optional shapes under `noUncheckedIndexedAccess`, each with the
157
165
  * types `attach_route_handler` checks its handler against.
158
166
  */
159
- export declare const create_account_route_shapes: (options: AccountRouteShapeOptions) => readonly [import("../http/route_spec.js").RouteShape<[], import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<null>, {
160
- readonly account: "required";
161
- readonly actor: "none";
162
- readonly required_scope: "surface:account_verify";
163
- }, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
167
+ export declare const create_account_route_shapes: (options: AccountRouteShapeOptions) => readonly [import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
164
168
  ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
165
169
  }>, {
166
170
  readonly account: "none";
167
171
  readonly actor: "none";
168
- }, "both">, import("../http/route_spec.js").RouteShape<[], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
172
+ }, "both", import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
173
+ username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>>;
174
+ password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
175
+ }>, undefined, undefined>, import("../http/route_spec.js").RouteShape<[], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
169
176
  ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
170
177
  username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>>;
171
178
  }>, {
172
179
  readonly account: "required";
173
180
  readonly actor: "none";
174
181
  readonly credential_types: readonly ["session"];
175
- }, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
182
+ }, undefined, import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<null>, undefined, undefined>, import("../http/route_spec.js").RouteShape<readonly [import("../http/error_schemas.js").RestErrorDef<401, "invalid_credentials", Record<never, never>>], import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
176
183
  ok: import("@fuzdev/fuz_schema/schema.ts").LiteralSchema<true>;
177
184
  sessions_revoked: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").NumberSchema>;
178
185
  tokens_revoked: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").NumberSchema>;
@@ -180,5 +187,8 @@ export declare const create_account_route_shapes: (options: AccountRouteShapeOpt
180
187
  readonly account: "required";
181
188
  readonly actor: "none";
182
189
  readonly credential_types: readonly ["session"];
183
- }, "ip" | "both">];
190
+ }, "ip" | "both", import("@fuzdev/fuz_schema/schema.ts").ObjectSchema<{
191
+ current_password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
192
+ new_password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").StringSchema>;
193
+ }>, undefined, undefined>];
184
194
  //# sourceMappingURL=account_route_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account_route_schema.d.ts","sourceRoot":"","sources":["../../src/lib/auth/account_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAWtC,mGAAmG;AACnG,eAAO,MAAM,kBAAkB,4DAAgB,CAAC;AAChD,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,UAAU;;;EAGrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OA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