@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
@@ -0,0 +1,296 @@
1
+ import '../assert_dev_env.js';
2
+ /**
3
+ * The credential conformance table, and the cross-backend suite that runs it
4
+ * through each backend's `_testing_credential_read` action.
5
+ *
6
+ * `credential_conformance.json` (beside this module) is the one statement of
7
+ * how both spines read the three credential headers — the session cookie in
8
+ * `Cookie`, the API token in `Authorization: Bearer`, the daemon token in
9
+ * `X-Daemon-Token` (`auth/credential_headers.ts`, the Rust
10
+ * `fuz_auth::credential_headers`). It holds two tables:
11
+ *
12
+ * - **rows** — `{name, lines, read, authenticates, clears_session_cookie}`:
13
+ * a request's credential header lines (each `Name: value`; a name may
14
+ * repeat), how each credential leg reads them (`read`), and what a request
15
+ * carrying them observably does — which credential authenticates it
16
+ * (`null` for none) and whether the response clears the session cookie.
17
+ * - **refused** — `{name, lines, reason}`: lines that are no header lines at
18
+ * all, or more or longer lines than the action reads
19
+ * (`TESTING_CREDENTIAL_READ_LINES_MAX`,
20
+ * `TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX`), which
21
+ * `_testing_credential_read` refuses with `invalid_params` and that reason.
22
+ *
23
+ * A line is bytes, one per character: a character U+0080–U+00FF is that byte
24
+ * on the wire, which a runtime hands a handler as the same character.
25
+ *
26
+ * Live values are per run, so lines and expected tokens name them with
27
+ * `{placeholders}` (`CredentialConformancePlaceholders`), which each leg fills
28
+ * from its own keyring and credentials. The legs:
29
+ *
30
+ * - the TS unit test, through the action's input schema and
31
+ * `run_testing_credential_read`;
32
+ * - the Rust unit test in `fuz_testing`, over a byte-identical copy of the
33
+ * file (fuz_app's cross-backend parity project holds the two copies
34
+ * byte-equal);
35
+ * - `describe_credential_conformance_cross_tests` here, sending every row to
36
+ * a backend's `_testing_credential_read` action;
37
+ * - `credential_conformance_wire.ts`, sending each row's lines as a real
38
+ * request and asserting `authenticates` and `clears_session_cookie`.
39
+ *
40
+ * A row may carry a `note` for the reader. Edited by hand, never generated.
41
+ *
42
+ * @module
43
+ */
44
+ import { readFileSync } from 'node:fs';
45
+ import { assert, describe, test } from 'vitest';
46
+ import { array, boolean, literal, min_length, nullable, object, one_of, optional, parse, parse_or_throw, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
47
+ import { BUILTIN_CREDENTIAL_TYPES } from '../../auth/credential_type_schema.js';
48
+ import { create_keyring } from '../../auth/keyring.js';
49
+ import { cross_rpc_call, error_reason } from './cross_rpc.js';
50
+ import { SPINE_RPC_PATH } from './spine_surface_constants.js';
51
+ import { ERROR_TESTING_CREDENTIAL_READ_LINE, TestingCredentialReadOutput, testing_credential_read_action_spec } from './testing_credential_read.js';
52
+ /**
53
+ * A read row: header lines, each leg's reading of them, and the observable
54
+ * outcome of a request carrying them.
55
+ */
56
+ export const CredentialConformanceRow = object({
57
+ name: string,
58
+ lines: array(string),
59
+ read: TestingCredentialReadOutput,
60
+ /** The credential that authenticates the request, `null` when none does. */
61
+ authenticates: nullable(one_of(BUILTIN_CREDENTIAL_TYPES)),
62
+ /** Whether the response carries the clearing session `Set-Cookie`. */
63
+ clears_session_cookie: boolean,
64
+ note: optional(string)
65
+ });
66
+ /** A refused row: lines `_testing_credential_read` refuses — no header lines, or past its caps. */
67
+ export const CredentialConformanceRefusedRow = object({
68
+ name: string,
69
+ lines: array(string),
70
+ reason: literal(ERROR_TESTING_CREDENTIAL_READ_LINE),
71
+ note: optional(string)
72
+ });
73
+ /** The conformance table, a `@fuzdev/fuz_schema` `object`. */
74
+ export const CredentialConformance = object({
75
+ rows: pipe(array(CredentialConformanceRow), min_length(1)),
76
+ refused: pipe(array(CredentialConformanceRefusedRow), min_length(1))
77
+ });
78
+ /** The committed table, resolved relative to this module. */
79
+ export const CREDENTIAL_CONFORMANCE_URL = new URL('./credential_conformance.json', import.meta.url);
80
+ /**
81
+ * Read and validate the committed conformance table.
82
+ *
83
+ * @returns the parsed table
84
+ * @throws Error when the file doesn't match `CredentialConformance`
85
+ */
86
+ export const load_credential_conformance = () => parse_or_throw(CredentialConformance, JSON.parse(readFileSync(CREDENTIAL_CONFORMANCE_URL, 'utf8')));
87
+ /** The placeholder names a row may use, each written `{name}` in the table. */
88
+ export const CREDENTIAL_CONFORMANCE_PLACEHOLDERS = [
89
+ 'cookie_name',
90
+ 'cookie_name_upper',
91
+ 'session_cookie',
92
+ 'session_cookie_percent_encoded',
93
+ 'session_cookie_bad_mac',
94
+ 'session_cookie_expired',
95
+ 'session_cookie_empty_identity',
96
+ 'session_cookie_rowless',
97
+ 'api_token',
98
+ 'daemon_token'
99
+ ];
100
+ /** The base64 alphabet's first two characters, swapped to break a MAC. */
101
+ const swap_first_signature_char = (signed) => {
102
+ const dot = signed.lastIndexOf('.');
103
+ assert.ok(dot !== -1, 'a signed cookie value holds a `.` before its signature');
104
+ const first = signed[dot + 1];
105
+ return signed.slice(0, dot + 1) + (first === 'A' ? 'B' : 'A') + signed.slice(dot + 2);
106
+ };
107
+ /**
108
+ * Build one leg's placeholder values: the given live credentials, and the
109
+ * cookie spellings derived from them or signed with the reader's keyring.
110
+ *
111
+ * - `session_cookie_percent_encoded` — `encodeURIComponent` of the valid
112
+ * cookie, what a framework's cookie serializer writes;
113
+ * - `session_cookie_bad_mac` — the valid cookie with its signature's first
114
+ * character changed;
115
+ * - `session_cookie_expired` — a signed payload whose expiry is an hour gone;
116
+ * - `session_cookie_empty_identity` — a signed payload with no identity;
117
+ * - `session_cookie_rowless` — a signed, unexpired payload naming a session
118
+ * token no row holds.
119
+ *
120
+ * @param input - the live credentials and the keyring
121
+ * @returns the value of every placeholder
122
+ * @throws Error when a derived spelling would equal the valid cookie, which would make its row vacuous
123
+ */
124
+ export const build_credential_conformance_placeholders = async (input) => {
125
+ const { cookie_name, session_cookie, api_token, daemon_token, keyring } = input;
126
+ const now = Math.floor(Date.now() / 1000);
127
+ const placeholders = {
128
+ cookie_name,
129
+ cookie_name_upper: cookie_name.toUpperCase(),
130
+ session_cookie,
131
+ session_cookie_percent_encoded: encodeURIComponent(session_cookie),
132
+ session_cookie_bad_mac: swap_first_signature_char(session_cookie),
133
+ session_cookie_expired: await keyring.sign(`credential-conformance-expired:${now - 3600}`),
134
+ session_cookie_empty_identity: await keyring.sign(`:${now + 3600}`),
135
+ session_cookie_rowless: await keyring.sign(`credential-conformance-rowless:${now + 3600}`),
136
+ api_token,
137
+ daemon_token
138
+ };
139
+ if (placeholders.cookie_name_upper === cookie_name) {
140
+ throw new Error(`cookie name '${cookie_name}' has no lowercase letter to change the case of`);
141
+ }
142
+ if (placeholders.session_cookie_percent_encoded === session_cookie) {
143
+ throw new Error('the session cookie percent-encodes to itself — its row would be vacuous');
144
+ }
145
+ return placeholders;
146
+ };
147
+ const PLACEHOLDER_REGEX = /\{([a-z_]+)\}/g;
148
+ /**
149
+ * Fill a table string's `{placeholders}`.
150
+ *
151
+ * @param text - a header line or an expected token
152
+ * @param placeholders - the leg's values
153
+ * @returns `text` with each placeholder replaced
154
+ * @throws Error on a `{name}` that is no known placeholder
155
+ */
156
+ export const fill_credential_conformance_placeholders = (text, placeholders) => text.replace(PLACEHOLDER_REGEX, (_match, name) => {
157
+ if (!Object.hasOwn(placeholders, name)) {
158
+ throw new Error(`unknown credential conformance placeholder {${name}}`);
159
+ }
160
+ return placeholders[name];
161
+ });
162
+ /**
163
+ * Fill every read row's lines and expected tokens.
164
+ *
165
+ * @param table - the conformance table
166
+ * @param placeholders - the leg's values
167
+ * @returns one check per read row, in table order
168
+ */
169
+ export const to_credential_conformance_checks = (table, placeholders) => table.rows.map((row) => {
170
+ const fill = (text) => fill_credential_conformance_placeholders(text, placeholders);
171
+ return {
172
+ label: row.name,
173
+ row,
174
+ lines: row.lines.map(fill),
175
+ expected: {
176
+ session_cookie: row.read.session_cookie,
177
+ bearer_token: row.read.bearer_token === null ? null : fill(row.read.bearer_token),
178
+ daemon_token: row.read.daemon_token === null ? null : fill(row.read.daemon_token)
179
+ }
180
+ };
181
+ });
182
+ /**
183
+ * Compare each check's reading with its expectation and fail once, listing
184
+ * every row that disagrees. Tokens are named by placeholder in the message,
185
+ * never printed.
186
+ *
187
+ * @param checks - the table's checks
188
+ * @param answers - the reading each check got, in order
189
+ * @param backend - the name the failure message gives the answerer
190
+ */
191
+ export const assert_credential_conformance = (checks, answers, backend) => {
192
+ const failures = [];
193
+ checks.forEach((check, i) => {
194
+ const got = answers[i];
195
+ try {
196
+ assert.deepStrictEqual(got, check.expected);
197
+ }
198
+ catch {
199
+ failures.push(`${check.label}: expected ${JSON.stringify(check.row.read)}, got ${describe_reading(got, check)}`);
200
+ }
201
+ });
202
+ assert.ok(failures.length === 0, `${backend}: ${failures.length} of ${checks.length} credential conformance rows disagree:\n` +
203
+ failures.join('\n'));
204
+ };
205
+ /** A reading for a failure message, its tokens reduced to whether they are the expected ones. */
206
+ const describe_reading = (got, check) => {
207
+ const reading = parse(TestingCredentialReadOutput, got);
208
+ if (!reading.ok)
209
+ return 'an answer that is no reading';
210
+ const token = (value, expected) => value === null ? null : value === expected ? 'the expected token' : 'another token';
211
+ return JSON.stringify({
212
+ session_cookie: reading.value.session_cookie,
213
+ bearer_token: token(reading.value.bearer_token, check.expected.bearer_token),
214
+ daemon_token: token(reading.value.daemon_token, check.expected.daemon_token)
215
+ });
216
+ };
217
+ /**
218
+ * Build the keyring a backend verifies cookies with, from its
219
+ * `SECRET_FUZ_COOKIE_KEYS` value.
220
+ *
221
+ * @param cookie_keys - the backend's `SECRET_FUZ_COOKIE_KEYS`
222
+ * @throws Error when the value is no valid keyring
223
+ */
224
+ export const create_credential_conformance_keyring = (cookie_keys) => {
225
+ const result = create_keyring(cookie_keys);
226
+ if (!result.ok) {
227
+ throw new Error(`cookie_keys is not a valid keyring: ${result.errors.join('; ')}`);
228
+ }
229
+ return result.keyring;
230
+ };
231
+ /**
232
+ * The placeholders of a live backend, from the fixture's keeper: its session
233
+ * cookie and API token, and the daemon token.
234
+ */
235
+ const keeper_placeholders = (fixture, options, keyring) => {
236
+ const cookie = fixture.create_session_headers().cookie ?? '';
237
+ const prefix = `${options.cookie_name}=`;
238
+ assert.ok(cookie.startsWith(prefix), `the keeper session headers carry '${options.cookie_name}'`);
239
+ const authorization = fixture.create_bearer_headers().authorization ?? '';
240
+ assert.ok(authorization.startsWith('Bearer '), 'the keeper bearer headers carry a token');
241
+ return build_credential_conformance_placeholders({
242
+ cookie_name: options.cookie_name,
243
+ session_cookie: cookie.slice(prefix.length),
244
+ api_token: authorization.slice('Bearer '.length),
245
+ daemon_token: options.daemon_token,
246
+ keyring
247
+ });
248
+ };
249
+ /**
250
+ * Register the credential conformance suite: every row of the committed
251
+ * table, sent to the backend's `_testing_credential_read` action over the
252
+ * keeper's daemon-token channel, must get the reading the table names, and
253
+ * every refused row the `invalid_params` refusal with its reason. The suite
254
+ * skips itself on a backend that doesn't declare the action.
255
+ *
256
+ * The lines travel as JSON strings, each character one byte, so a row with a
257
+ * non-ASCII byte reaches the action as it would reach a handler.
258
+ */
259
+ export const describe_credential_conformance_cross_tests = (options) => {
260
+ const { setup_test } = options;
261
+ const rpc_path = options.rpc_path ?? SPINE_RPC_PATH;
262
+ const table = load_credential_conformance();
263
+ const method = testing_credential_read_action_spec.method;
264
+ const keyring = create_credential_conformance_keyring(options.cookie_keys);
265
+ describe('credential conformance', () => {
266
+ test('every table row gets the reading it names', async () => {
267
+ const fixture = await setup_test();
268
+ const checks = to_credential_conformance_checks(table, await keeper_placeholders(fixture, options, keyring));
269
+ // Origin-free: the daemon-token middleware discards the credential in a
270
+ // browser context, and the cross-process transport adds an `Origin`
271
+ const transport = fixture.fresh_transport({ origin: null });
272
+ const headers = fixture.create_daemon_token_headers();
273
+ const answers = [];
274
+ for (const check of checks) {
275
+ const res = await cross_rpc_call(transport, rpc_path, method, { lines: check.lines }, headers);
276
+ assert.ok(res.ok, `${check.label}: RPC failed: ${JSON.stringify(res.error)}`);
277
+ const parsed = parse(TestingCredentialReadOutput, res.result);
278
+ answers.push(parsed.ok ? parsed.value : res.result);
279
+ }
280
+ assert_credential_conformance(checks, answers, 'backend');
281
+ });
282
+ test('every refused row is refused with its reason', async () => {
283
+ const fixture = await setup_test();
284
+ const placeholders = await keeper_placeholders(fixture, options, keyring);
285
+ const transport = fixture.fresh_transport({ origin: null });
286
+ const headers = fixture.create_daemon_token_headers();
287
+ for (const row of table.refused) {
288
+ const lines = row.lines.map((line) => fill_credential_conformance_placeholders(line, placeholders));
289
+ const res = await cross_rpc_call(transport, rpc_path, method, { lines }, headers);
290
+ assert.strictEqual(res.ok, false, `${row.name}: must be refused`);
291
+ assert.strictEqual(res.status, 400, `${row.name}: invalid_params`);
292
+ assert.strictEqual(error_reason(res), row.reason, row.name);
293
+ }
294
+ });
295
+ });
296
+ };