@fuzdev/fuz_app 0.51.0 → 0.52.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 (320) hide show
  1. package/dist/actions/CLAUDE.md +14 -1
  2. package/dist/actions/action_bridge.d.ts +3 -1
  3. package/dist/actions/action_bridge.d.ts.map +1 -1
  4. package/dist/actions/action_bridge.js +3 -1
  5. package/dist/actions/action_codegen.d.ts +18 -8
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +18 -8
  8. package/dist/actions/action_event.d.ts +44 -1
  9. package/dist/actions/action_event.d.ts.map +1 -1
  10. package/dist/actions/action_event.js +44 -1
  11. package/dist/actions/action_event_helpers.d.ts +26 -0
  12. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  13. package/dist/actions/action_event_helpers.js +26 -1
  14. package/dist/actions/action_peer.d.ts +17 -0
  15. package/dist/actions/action_peer.d.ts.map +1 -1
  16. package/dist/actions/action_peer.js +8 -0
  17. package/dist/actions/action_registry.d.ts +1 -1
  18. package/dist/actions/action_registry.js +1 -1
  19. package/dist/actions/action_rpc.d.ts +4 -0
  20. package/dist/actions/action_rpc.d.ts.map +1 -1
  21. package/dist/actions/action_rpc.js +4 -0
  22. package/dist/actions/action_spec.d.ts +22 -2
  23. package/dist/actions/action_spec.d.ts.map +1 -1
  24. package/dist/actions/action_spec.js +16 -2
  25. package/dist/actions/register_action_ws.d.ts +3 -0
  26. package/dist/actions/register_action_ws.d.ts.map +1 -1
  27. package/dist/actions/register_action_ws.js +3 -0
  28. package/dist/actions/register_ws_endpoint.d.ts +3 -0
  29. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  30. package/dist/actions/register_ws_endpoint.js +3 -0
  31. package/dist/actions/request_tracker.svelte.d.ts +14 -1
  32. package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
  33. package/dist/actions/request_tracker.svelte.js +14 -1
  34. package/dist/actions/socket.svelte.d.ts +35 -15
  35. package/dist/actions/socket.svelte.d.ts.map +1 -1
  36. package/dist/actions/socket.svelte.js +33 -13
  37. package/dist/actions/transports.d.ts +12 -3
  38. package/dist/actions/transports.d.ts.map +1 -1
  39. package/dist/actions/transports.js +16 -7
  40. package/dist/actions/transports_http.d.ts +7 -0
  41. package/dist/actions/transports_http.d.ts.map +1 -1
  42. package/dist/actions/transports_http.js +7 -0
  43. package/dist/actions/transports_ws.d.ts +13 -0
  44. package/dist/actions/transports_ws.d.ts.map +1 -1
  45. package/dist/actions/transports_ws.js +13 -0
  46. package/dist/actions/transports_ws_auth_guard.d.ts +6 -2
  47. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  48. package/dist/actions/transports_ws_auth_guard.js +6 -2
  49. package/dist/actions/transports_ws_backend.d.ts +14 -1
  50. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  51. package/dist/actions/transports_ws_backend.js +14 -1
  52. package/dist/auth/CLAUDE.md +40 -4
  53. package/dist/auth/account_queries.d.ts +10 -0
  54. package/dist/auth/account_queries.d.ts.map +1 -1
  55. package/dist/auth/account_queries.js +10 -0
  56. package/dist/auth/admin_actions.d.ts +1 -0
  57. package/dist/auth/admin_actions.d.ts.map +1 -1
  58. package/dist/auth/admin_actions.js +1 -0
  59. package/dist/auth/api_token_queries.d.ts +7 -0
  60. package/dist/auth/api_token_queries.d.ts.map +1 -1
  61. package/dist/auth/api_token_queries.js +7 -0
  62. package/dist/auth/app_settings_queries.d.ts +4 -0
  63. package/dist/auth/app_settings_queries.d.ts.map +1 -1
  64. package/dist/auth/app_settings_queries.js +4 -0
  65. package/dist/auth/audit_log_queries.d.ts +6 -0
  66. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  67. package/dist/auth/audit_log_queries.js +6 -0
  68. package/dist/auth/audit_log_schema.d.ts +2 -0
  69. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  70. package/dist/auth/audit_log_schema.js +134 -55
  71. package/dist/auth/bearer_auth.d.ts +2 -0
  72. package/dist/auth/bearer_auth.d.ts.map +1 -1
  73. package/dist/auth/bearer_auth.js +2 -0
  74. package/dist/auth/bootstrap_account.d.ts +3 -0
  75. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  76. package/dist/auth/bootstrap_account.js +3 -0
  77. package/dist/auth/cleanup.d.ts +6 -0
  78. package/dist/auth/cleanup.d.ts.map +1 -1
  79. package/dist/auth/cleanup.js +6 -0
  80. package/dist/auth/daemon_token_middleware.d.ts +4 -0
  81. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  82. package/dist/auth/daemon_token_middleware.js +4 -0
  83. package/dist/auth/invite_queries.d.ts +4 -0
  84. package/dist/auth/invite_queries.d.ts.map +1 -1
  85. package/dist/auth/invite_queries.js +4 -0
  86. package/dist/auth/permit_offer_action_specs.d.ts +5 -0
  87. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  88. package/dist/auth/permit_offer_action_specs.js +10 -0
  89. package/dist/auth/permit_offer_queries.d.ts +19 -0
  90. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  91. package/dist/auth/permit_offer_queries.js +19 -0
  92. package/dist/auth/permit_queries.d.ts +8 -0
  93. package/dist/auth/permit_queries.d.ts.map +1 -1
  94. package/dist/auth/permit_queries.js +8 -0
  95. package/dist/auth/request_context.d.ts +1 -0
  96. package/dist/auth/request_context.d.ts.map +1 -1
  97. package/dist/auth/request_context.js +1 -0
  98. package/dist/auth/role_schema.d.ts +2 -0
  99. package/dist/auth/role_schema.d.ts.map +1 -1
  100. package/dist/auth/role_schema.js +2 -0
  101. package/dist/auth/self_service_role_actions.d.ts +1 -0
  102. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  103. package/dist/auth/self_service_role_actions.js +1 -0
  104. package/dist/auth/session_lifecycle.d.ts +3 -0
  105. package/dist/auth/session_lifecycle.d.ts.map +1 -1
  106. package/dist/auth/session_lifecycle.js +3 -0
  107. package/dist/auth/session_middleware.d.ts +5 -0
  108. package/dist/auth/session_middleware.d.ts.map +1 -1
  109. package/dist/auth/session_middleware.js +5 -0
  110. package/dist/auth/session_queries.d.ts +9 -0
  111. package/dist/auth/session_queries.d.ts.map +1 -1
  112. package/dist/auth/session_queries.js +9 -0
  113. package/dist/cli/config.d.ts +2 -0
  114. package/dist/cli/config.d.ts.map +1 -1
  115. package/dist/cli/config.js +2 -0
  116. package/dist/cli/daemon.d.ts +6 -1
  117. package/dist/cli/daemon.d.ts.map +1 -1
  118. package/dist/cli/daemon.js +6 -1
  119. package/dist/db/assert_row.d.ts +2 -1
  120. package/dist/db/assert_row.d.ts.map +1 -1
  121. package/dist/db/assert_row.js +2 -1
  122. package/dist/db/create_db.d.ts +3 -0
  123. package/dist/db/create_db.d.ts.map +1 -1
  124. package/dist/db/create_db.js +3 -0
  125. package/dist/db/db.d.ts +19 -4
  126. package/dist/db/db.d.ts.map +1 -1
  127. package/dist/db/db.js +18 -3
  128. package/dist/db/db_pg.d.ts +2 -1
  129. package/dist/db/db_pg.d.ts.map +1 -1
  130. package/dist/db/db_pg.js +5 -3
  131. package/dist/db/db_pglite.d.ts +3 -2
  132. package/dist/db/db_pglite.d.ts.map +1 -1
  133. package/dist/db/db_pglite.js +3 -2
  134. package/dist/db/migrate.d.ts +8 -4
  135. package/dist/db/migrate.d.ts.map +1 -1
  136. package/dist/db/migrate.js +6 -2
  137. package/dist/db/sql_identifier.d.ts +2 -1
  138. package/dist/db/sql_identifier.d.ts.map +1 -1
  139. package/dist/db/sql_identifier.js +2 -1
  140. package/dist/db/status.d.ts +4 -1
  141. package/dist/db/status.d.ts.map +1 -1
  142. package/dist/db/status.js +5 -2
  143. package/dist/dev/setup.d.ts +18 -2
  144. package/dist/dev/setup.d.ts.map +1 -1
  145. package/dist/dev/setup.js +18 -2
  146. package/dist/env/dotenv.d.ts +2 -1
  147. package/dist/env/dotenv.d.ts.map +1 -1
  148. package/dist/env/dotenv.js +2 -1
  149. package/dist/env/load.d.ts +1 -1
  150. package/dist/env/load.js +1 -1
  151. package/dist/env/resolve.d.ts +1 -1
  152. package/dist/env/resolve.js +1 -1
  153. package/dist/env/update_env_variable.d.ts +2 -0
  154. package/dist/env/update_env_variable.d.ts.map +1 -1
  155. package/dist/env/update_env_variable.js +2 -0
  156. package/dist/http/pending_effects.d.ts +4 -0
  157. package/dist/http/pending_effects.d.ts.map +1 -1
  158. package/dist/http/pending_effects.js +4 -0
  159. package/dist/http/proxy.d.ts +3 -0
  160. package/dist/http/proxy.d.ts.map +1 -1
  161. package/dist/http/proxy.js +3 -0
  162. package/dist/http/route_spec.d.ts +1 -0
  163. package/dist/http/route_spec.d.ts.map +1 -1
  164. package/dist/http/route_spec.js +7 -0
  165. package/dist/rate_limiter.d.ts +14 -1
  166. package/dist/rate_limiter.d.ts.map +1 -1
  167. package/dist/rate_limiter.js +14 -1
  168. package/dist/realtime/sse.d.ts +7 -1
  169. package/dist/realtime/sse.d.ts.map +1 -1
  170. package/dist/realtime/sse.js +3 -1
  171. package/dist/realtime/sse_auth_guard.d.ts +21 -21
  172. package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
  173. package/dist/realtime/sse_auth_guard.js +24 -24
  174. package/dist/realtime/subscriber_registry.d.ts +4 -2
  175. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  176. package/dist/realtime/subscriber_registry.js +4 -2
  177. package/dist/runtime/fs.d.ts +5 -0
  178. package/dist/runtime/fs.d.ts.map +1 -1
  179. package/dist/runtime/fs.js +5 -0
  180. package/dist/runtime/mock.d.ts +6 -0
  181. package/dist/runtime/mock.d.ts.map +1 -1
  182. package/dist/runtime/mock.js +6 -0
  183. package/dist/server/app_backend.d.ts +1 -0
  184. package/dist/server/app_backend.d.ts.map +1 -1
  185. package/dist/server/app_backend.js +1 -0
  186. package/dist/server/app_server.d.ts +4 -0
  187. package/dist/server/app_server.d.ts.map +1 -1
  188. package/dist/server/app_server.js +4 -0
  189. package/dist/server/validate_nginx.d.ts +3 -0
  190. package/dist/server/validate_nginx.d.ts.map +1 -1
  191. package/dist/testing/admin_integration.d.ts +5 -0
  192. package/dist/testing/admin_integration.d.ts.map +1 -1
  193. package/dist/testing/admin_integration.js +5 -0
  194. package/dist/testing/adversarial_headers.d.ts +5 -3
  195. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  196. package/dist/testing/adversarial_headers.js +5 -3
  197. package/dist/testing/adversarial_input.d.ts +4 -0
  198. package/dist/testing/adversarial_input.d.ts.map +1 -1
  199. package/dist/testing/adversarial_input.js +4 -0
  200. package/dist/testing/app_server.d.ts +3 -0
  201. package/dist/testing/app_server.d.ts.map +1 -1
  202. package/dist/testing/app_server.js +11 -0
  203. package/dist/testing/assertions.d.ts +23 -7
  204. package/dist/testing/assertions.d.ts.map +1 -1
  205. package/dist/testing/assertions.js +23 -7
  206. package/dist/testing/audit_completeness.d.ts +4 -0
  207. package/dist/testing/audit_completeness.d.ts.map +1 -1
  208. package/dist/testing/audit_completeness.js +4 -0
  209. package/dist/testing/auth_apps.d.ts +3 -0
  210. package/dist/testing/auth_apps.d.ts.map +1 -1
  211. package/dist/testing/auth_apps.js +3 -0
  212. package/dist/testing/db.d.ts +9 -1
  213. package/dist/testing/db.d.ts.map +1 -1
  214. package/dist/testing/db.js +9 -1
  215. package/dist/testing/error_coverage.d.ts +9 -0
  216. package/dist/testing/error_coverage.d.ts.map +1 -1
  217. package/dist/testing/error_coverage.js +9 -0
  218. package/dist/testing/integration.d.ts +4 -0
  219. package/dist/testing/integration.d.ts.map +1 -1
  220. package/dist/testing/integration.js +4 -0
  221. package/dist/testing/integration_helpers.d.ts +10 -4
  222. package/dist/testing/integration_helpers.d.ts.map +1 -1
  223. package/dist/testing/integration_helpers.js +10 -4
  224. package/dist/testing/middleware.d.ts +5 -0
  225. package/dist/testing/middleware.d.ts.map +1 -1
  226. package/dist/testing/middleware.js +5 -0
  227. package/dist/testing/rate_limiting.d.ts +3 -0
  228. package/dist/testing/rate_limiting.d.ts.map +1 -1
  229. package/dist/testing/rate_limiting.js +3 -0
  230. package/dist/testing/rpc_helpers.d.ts +21 -8
  231. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  232. package/dist/testing/rpc_helpers.js +21 -8
  233. package/dist/testing/schema_generators.d.ts +7 -2
  234. package/dist/testing/schema_generators.d.ts.map +1 -1
  235. package/dist/testing/schema_generators.js +7 -2
  236. package/dist/testing/sse_round_trip.d.ts +3 -0
  237. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  238. package/dist/testing/sse_round_trip.js +3 -0
  239. package/dist/testing/stubs.d.ts +7 -0
  240. package/dist/testing/stubs.d.ts.map +1 -1
  241. package/dist/testing/stubs.js +7 -0
  242. package/dist/testing/surface_invariants.d.ts +14 -0
  243. package/dist/testing/surface_invariants.d.ts.map +1 -1
  244. package/dist/testing/surface_invariants.js +14 -0
  245. package/dist/testing/ws_round_trip.d.ts +13 -1
  246. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  247. package/dist/ui/AccountSessions.svelte +9 -0
  248. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  249. package/dist/ui/AdminAccounts.svelte +10 -0
  250. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  251. package/dist/ui/AdminAuditLog.svelte +10 -0
  252. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  253. package/dist/ui/AdminInvites.svelte +9 -0
  254. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
  255. package/dist/ui/AdminOverview.svelte +10 -0
  256. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  257. package/dist/ui/AdminPermitHistory.svelte +9 -0
  258. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
  259. package/dist/ui/AdminSessions.svelte +10 -0
  260. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  261. package/dist/ui/AdminSettings.svelte +9 -0
  262. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  263. package/dist/ui/AdminSurface.svelte +9 -0
  264. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
  265. package/dist/ui/AppShell.svelte +24 -0
  266. package/dist/ui/AppShell.svelte.d.ts +23 -0
  267. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  268. package/dist/ui/BootstrapForm.svelte +17 -0
  269. package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
  270. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  271. package/dist/ui/ColumnLayout.svelte +11 -0
  272. package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
  273. package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
  274. package/dist/ui/Datatable.svelte +18 -0
  275. package/dist/ui/Datatable.svelte.d.ts +17 -0
  276. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  277. package/dist/ui/LoginForm.svelte +18 -0
  278. package/dist/ui/LoginForm.svelte.d.ts +9 -0
  279. package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
  280. package/dist/ui/LogoutButton.svelte +9 -0
  281. package/dist/ui/LogoutButton.svelte.d.ts +8 -0
  282. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
  283. package/dist/ui/MenuLink.svelte +10 -0
  284. package/dist/ui/MenuLink.svelte.d.ts +9 -0
  285. package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
  286. package/dist/ui/OpenSignupToggle.svelte +9 -0
  287. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  288. package/dist/ui/SignupForm.svelte +16 -0
  289. package/dist/ui/SignupForm.svelte.d.ts +4 -0
  290. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  291. package/dist/ui/SurfaceExplorer.svelte +9 -0
  292. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  293. package/dist/ui/audit_log_state.svelte.d.ts +6 -1
  294. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  295. package/dist/ui/audit_log_state.svelte.js +6 -1
  296. package/dist/ui/auth_state.svelte.d.ts +16 -4
  297. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  298. package/dist/ui/auth_state.svelte.js +16 -4
  299. package/dist/ui/form_state.svelte.d.ts +9 -0
  300. package/dist/ui/form_state.svelte.d.ts.map +1 -1
  301. package/dist/ui/form_state.svelte.js +9 -0
  302. package/dist/ui/loadable.svelte.d.ts +6 -1
  303. package/dist/ui/loadable.svelte.d.ts.map +1 -1
  304. package/dist/ui/loadable.svelte.js +6 -1
  305. package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
  306. package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
  307. package/dist/ui/permit_offers_state.svelte.js +2 -0
  308. package/dist/ui/popover.svelte.d.ts +17 -4
  309. package/dist/ui/popover.svelte.d.ts.map +1 -1
  310. package/dist/ui/popover.svelte.js +17 -4
  311. package/dist/ui/position_helpers.d.ts +1 -0
  312. package/dist/ui/position_helpers.d.ts.map +1 -1
  313. package/dist/ui/position_helpers.js +1 -0
  314. package/dist/ui/sidebar_state.svelte.d.ts +22 -9
  315. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
  316. package/dist/ui/sidebar_state.svelte.js +17 -2
  317. package/dist/ui/table_state.svelte.d.ts +14 -0
  318. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  319. package/dist/ui/table_state.svelte.js +14 -0
  320. package/package.json +1 -1
@@ -21,6 +21,8 @@ export interface DbFactory {
21
21
  * The database instance remains usable after reset.
22
22
  *
23
23
  * @param db - the database to reset
24
+ * @mutates db - drops the `public` schema and recreates it; all rows in all
25
+ * tables are gone after this returns.
24
26
  */
25
27
  export declare const reset_pglite: (db: Db) => Promise<void>;
26
28
  /**
@@ -50,7 +52,10 @@ export declare const create_pglite_factory: (init_schema: (db: Db) => Promise<vo
50
52
  *
51
53
  * @param init_schema - callback to initialize the database schema
52
54
  * @param test_url - PostgreSQL connection URL (e.g. from `TEST_DATABASE_URL`)
53
- * @returns a factory that creates pg databases
55
+ * @returns a factory that creates pg databases. The returned `create()`
56
+ * throws when `test_url` is unset (despite the `skip: true` flag — defense
57
+ * against direct invocation), and rewrites Postgres "database does not
58
+ * exist" errors into a `createdb` hint message.
54
59
  */
55
60
  export declare const create_pg_factory: (init_schema: (db: Db) => Promise<void>, test_url?: string) => DbFactory;
56
61
  /**
@@ -87,6 +92,7 @@ export declare const AUTH_DROP_TABLES: readonly ["app_settings", "invite", "audi
87
92
  * PGlite (already fresh), but harmless to call unconditionally.
88
93
  *
89
94
  * @param db - the database to clean
95
+ * @mutates db - drops every table in `AUTH_DROP_TABLES` plus `schema_version`.
90
96
  */
91
97
  export declare const drop_auth_schema: (db: Db) => Promise<void>;
92
98
  /**
@@ -100,6 +106,8 @@ export declare const drop_auth_schema: (db: Db) => Promise<void>;
100
106
  * @param factories - one or more database factories to run suites against
101
107
  * @param truncate_tables - tables to truncate between tests (children first for FK safety)
102
108
  * @returns a `describe_db` function for use in test files
109
+ * @mutates the underlying database between tests — `beforeEach` issues
110
+ * `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
103
111
  */
104
112
  export declare const create_describe_db: (factories: DbFactory | Array<DbFactory>, truncate_tables: Array<string>) => ((name: string, fn: (get_db: () => Db) => void) => void);
105
113
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA6B7B,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAKpC;;GAEG;AACH,eAAO,MAAM,KAAK,SAA4B,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,G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AAC,SAAS,CAAC,KAAG,IAMnE,CAAC"}
@@ -37,6 +37,8 @@ export const IS_CI = process.env.CI === 'true';
37
37
  * The database instance remains usable after reset.
38
38
  *
39
39
  * @param db - the database to reset
40
+ * @mutates db - drops the `public` schema and recreates it; all rows in all
41
+ * tables are gone after this returns.
40
42
  */
41
43
  export const reset_pglite = async (db) => {
42
44
  await db.query('DROP SCHEMA public CASCADE');
@@ -91,7 +93,10 @@ export const create_pglite_factory = (init_schema) => ({
91
93
  *
92
94
  * @param init_schema - callback to initialize the database schema
93
95
  * @param test_url - PostgreSQL connection URL (e.g. from `TEST_DATABASE_URL`)
94
- * @returns a factory that creates pg databases
96
+ * @returns a factory that creates pg databases. The returned `create()`
97
+ * throws when `test_url` is unset (despite the `skip: true` flag — defense
98
+ * against direct invocation), and rewrites Postgres "database does not
99
+ * exist" errors into a `createdb` hint message.
95
100
  */
96
101
  export const create_pg_factory = (init_schema, test_url) => {
97
102
  const should_skip = !test_url;
@@ -205,6 +210,7 @@ export const AUTH_DROP_TABLES = [
205
210
  * PGlite (already fresh), but harmless to call unconditionally.
206
211
  *
207
212
  * @param db - the database to clean
213
+ * @mutates db - drops every table in `AUTH_DROP_TABLES` plus `schema_version`.
208
214
  */
209
215
  export const drop_auth_schema = async (db) => {
210
216
  for (const table of AUTH_DROP_TABLES) {
@@ -223,6 +229,8 @@ export const drop_auth_schema = async (db) => {
223
229
  * @param factories - one or more database factories to run suites against
224
230
  * @param truncate_tables - tables to truncate between tests (children first for FK safety)
225
231
  * @returns a `describe_db` function for use in test files
232
+ * @mutates the underlying database between tests — `beforeEach` issues
233
+ * `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
226
234
  */
227
235
  export const create_describe_db = (factories, truncate_tables) => {
228
236
  const factory_list = Array.isArray(factories) ? factories : [factories];
@@ -77,6 +77,8 @@ export declare class ErrorCoverageCollector {
77
77
  * @param status - observed HTTP status code
78
78
  * @param code - observed body `error` code (pass when the route's error
79
79
  * schema declares specific codes via `z.literal` or `z.enum`)
80
+ * @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
81
+ * key (and the `:CODE` variant when `code` is provided).
80
82
  */
81
83
  record(route_specs: Array<RouteSpec>, method: string, path: string, status: number, code?: string): void;
82
84
  /**
@@ -95,6 +97,10 @@ export declare class ErrorCoverageCollector {
95
97
  * @param code - observed body `error` code (override; if omitted and the
96
98
  * response body is a JSON object with a string `error` field, that value
97
99
  * is auto-extracted)
100
+ * @mutates `this.observed` - via `record` after `assert_response_matches_spec`
101
+ * succeeds.
102
+ * @throws Error if the response body fails the route spec's declared
103
+ * schemas (propagated from `assert_response_matches_spec`).
98
104
  */
99
105
  assert_and_record(route_specs: Array<RouteSpec>, method: string, path: string, response: Response, code?: string): Promise<void>;
100
106
  /**
@@ -139,6 +145,9 @@ export interface ErrorCoverageOptions extends CoverageFilterOptions {
139
145
  * @param collector - the coverage collector with recorded observations
140
146
  * @param route_specs - route specs to check coverage against
141
147
  * @param options - threshold and exclusion configuration
148
+ * @throws AssertionError if `min_coverage > 0` and the covered/total ratio
149
+ * falls below the threshold — the failure message lists every uncovered
150
+ * route + status (+ code).
142
151
  */
143
152
  export declare const assert_error_coverage: (collector: ErrorCoverageCollector, route_specs: Array<RouteSpec>, options?: ErrorCoverageOptions) => void;
144
153
  //# sourceMappingURL=error_coverage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error_coverage.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/error_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAIrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAWhF,CAAC;AAEF,s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;;;;;;OAoBG;IACG,iBAAiB,CACtB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAgBhB;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC;CAKhG;AAED;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,2CAA2C;AAC3C,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAClE,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,sBAAsB,EACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,UAAU,oBAAoB,KAC5B,IAqBF,CAAC"}
@@ -119,6 +119,8 @@ export class ErrorCoverageCollector {
119
119
  * @param status - observed HTTP status code
120
120
  * @param code - observed body `error` code (pass when the route's error
121
121
  * schema declares specific codes via `z.literal` or `z.enum`)
122
+ * @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
123
+ * key (and the `:CODE` variant when `code` is provided).
122
124
  */
123
125
  record(route_specs, method, path, status, code) {
124
126
  const spec = find_route_spec(route_specs, method, path);
@@ -145,6 +147,10 @@ export class ErrorCoverageCollector {
145
147
  * @param code - observed body `error` code (override; if omitted and the
146
148
  * response body is a JSON object with a string `error` field, that value
147
149
  * is auto-extracted)
150
+ * @mutates `this.observed` - via `record` after `assert_response_matches_spec`
151
+ * succeeds.
152
+ * @throws Error if the response body fails the route spec's declared
153
+ * schemas (propagated from `assert_response_matches_spec`).
148
154
  */
149
155
  async assert_and_record(route_specs, method, path, response, code) {
150
156
  await assert_response_matches_spec(route_specs, method, path, response);
@@ -210,6 +216,9 @@ const format_uncovered = (entry) => `${entry.method} ${entry.path} → ${entry.s
210
216
  * @param collector - the coverage collector with recorded observations
211
217
  * @param route_specs - route specs to check coverage against
212
218
  * @param options - threshold and exclusion configuration
219
+ * @throws AssertionError if `min_coverage > 0` and the covered/total ratio
220
+ * falls below the threshold — the failure message lists every uncovered
221
+ * route + status (+ code).
213
222
  */
214
223
  export const assert_error_coverage = (collector, route_specs, options) => {
215
224
  const min_coverage = options?.min_coverage ?? 0;
@@ -52,6 +52,10 @@ export interface StandardIntegrationTestOptions {
52
52
  * message if the consumer's route specs are misconfigured.
53
53
  *
54
54
  * @param options - session config and route factory
55
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
56
+ * suite hard-fails via `require_rpc_endpoint_path` rather than running
57
+ * tests that would crash mid-suite trying to dispatch
58
+ * `account_verify` / `account_session_*` / `account_token_*`.
55
59
  */
56
60
  export declare const describe_standard_integration_tests: (options: StandardIntegrationTestOptions) => void;
57
61
  //# sourceMappingURL=integration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAA6C,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAqB1B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAA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uBAAuB,CAAC;CACvC;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAg8CF,CAAC"}
@@ -57,6 +57,10 @@ const build_test_app_options = (options, db) => ({
57
57
  * message if the consumer's route specs are misconfigured.
58
58
  *
59
59
  * @param options - session config and route factory
60
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
61
+ * suite hard-fails via `require_rpc_endpoint_path` rather than running
62
+ * tests that would crash mid-suite trying to dispatch
63
+ * `account_verify` / `account_session_*` / `account_token_*`.
60
64
  */
61
65
  export const describe_standard_integration_tests = (options) => {
62
66
  // Hard-fail early so consumers see a clear setup error instead of a
@@ -35,6 +35,10 @@ export type RestAuthRouteSuffix = (typeof REST_AUTH_ROUTE_SUFFIXES)[number];
35
35
  * @param suffix - REST auth path suffix
36
36
  * @param method - HTTP method
37
37
  * @returns matching route spec, or `undefined`
38
+ * @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES` — surfaces
39
+ * accidental use of a post-RPC-migration method name (e.g.
40
+ * `/sessions/revoke-all`) at the call site rather than silently returning
41
+ * `undefined`.
38
42
  */
39
43
  export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuthRouteSuffix, method: RouteMethod) => RouteSpec | undefined;
40
44
  /**
@@ -42,12 +46,14 @@ export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuth
42
46
  *
43
47
  * For 2xx responses, validates against `spec.output`.
44
48
  * For error responses, validates against the merged error schema for that status code.
45
- * Throws with details on mismatch.
46
49
  *
47
50
  * @param route_specs - route specs for schema lookup
48
51
  * @param method - HTTP method of the request
49
52
  * @param path - path of the request
50
53
  * @param response - the Response to validate
54
+ * @throws Error if no route spec matches `method` + `path`, if the response
55
+ * body fails to parse against the declared output / error schema, or if the
56
+ * response is non-JSON despite a declared schema for that status.
51
57
  */
52
58
  export declare const assert_response_matches_spec: (route_specs: Array<RouteSpec>, method: string, path: string, response: Response) => Promise<void>;
53
59
  /**
@@ -59,14 +65,14 @@ export declare const assert_response_matches_spec: (route_specs: Array<RouteSpec
59
65
  */
60
66
  export declare const create_expired_test_cookie: (keyring: Keyring, session_options: SessionOptions<string>) => Promise<string>;
61
67
  /**
62
- * Assert that an error response body contains no unexpected fields.
68
+ * List the fields in an error response body that are not in the known-safe set.
63
69
  *
64
70
  * Error schemas use `z.looseObject` (intentional — multiple producers), but
65
71
  * test responses should be checked for fields that could leak information.
66
- * Flags any field not in the known-safe set.
72
+ * Flags any field not in the known-safe set so callers can decide whether to
73
+ * fail or log.
67
74
  *
68
75
  * @param body - parsed error response JSON
69
- * @param context - description for error messages (e.g., `'POST /api/login 401'`)
70
76
  * @returns array of unexpected field names (empty = clean)
71
77
  */
72
78
  export declare const check_error_response_fields: (body: Record<string, unknown>) => Array<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"integration_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA8B,KAAK,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAE3F,OAAO,KAAK,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAC3B,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,QAAQ,MAAM,EACd,MAAM,MAAM,KACV,SAAS,GAAG,SAad,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,iFAO3B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,eAAO,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OAAO,EAChB,iBAAiB,cAAc,CAAC,MAAM,CAAC,KACrC,OAAO,CAAC,MAAM,CAGhB,CAAC;AAuCF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,KAAK,CAAC,MAAM,CAQvF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,MAAM,KACb,IAkBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,GAChD,UAAU,QAAQ,EAClB,MAAM;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,KACzB,IAUF,CAAC;AAIF,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,MAAM,CAAmC,CAAC;AAEhG,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,MAAM,CAAgC,CAAC;AAE9F;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,KAAG,GAAG,CAAC,MAAM,CAetE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,OAAO,EACb,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,MAAM,KACb,IAKF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,UAAU,OAAO,EACjB,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAcvB,CAAC"}
@@ -61,6 +61,10 @@ export const REST_AUTH_ROUTE_SUFFIXES = [
61
61
  * @param suffix - REST auth path suffix
62
62
  * @param method - HTTP method
63
63
  * @returns matching route spec, or `undefined`
64
+ * @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES` — surfaces
65
+ * accidental use of a post-RPC-migration method name (e.g.
66
+ * `/sessions/revoke-all`) at the call site rather than silently returning
67
+ * `undefined`.
64
68
  */
65
69
  export const find_auth_route = (specs, suffix, method) => {
66
70
  if (!REST_AUTH_ROUTE_SUFFIXES.includes(suffix)) {
@@ -73,12 +77,14 @@ export const find_auth_route = (specs, suffix, method) => {
73
77
  *
74
78
  * For 2xx responses, validates against `spec.output`.
75
79
  * For error responses, validates against the merged error schema for that status code.
76
- * Throws with details on mismatch.
77
80
  *
78
81
  * @param route_specs - route specs for schema lookup
79
82
  * @param method - HTTP method of the request
80
83
  * @param path - path of the request
81
84
  * @param response - the Response to validate
85
+ * @throws Error if no route spec matches `method` + `path`, if the response
86
+ * body fails to parse against the declared output / error schema, or if the
87
+ * response is non-JSON despite a declared schema for that status.
82
88
  */
83
89
  export const assert_response_matches_spec = async (route_specs, method, path, response) => {
84
90
  const spec = find_route_spec(route_specs, method, path);
@@ -171,14 +177,14 @@ const LEAKY_FIELD_PATTERNS = [
171
177
  'token',
172
178
  ];
173
179
  /**
174
- * Assert that an error response body contains no unexpected fields.
180
+ * List the fields in an error response body that are not in the known-safe set.
175
181
  *
176
182
  * Error schemas use `z.looseObject` (intentional — multiple producers), but
177
183
  * test responses should be checked for fields that could leak information.
178
- * Flags any field not in the known-safe set.
184
+ * Flags any field not in the known-safe set so callers can decide whether to
185
+ * fail or log.
179
186
  *
180
187
  * @param body - parsed error response JSON
181
- * @param context - description for error messages (e.g., `'POST /api/login 401'`)
182
188
  * @returns array of unexpected field names (empty = clean)
183
189
  */
184
190
  export const check_error_response_fields = (body) => {
@@ -65,6 +65,9 @@ export interface BearerAuthMocks {
65
65
  *
66
66
  * @param tc - the test config providing mock return values
67
67
  * @returns mocks bundle with spy references
68
+ * @mutates module-level `vi.mock` registrations for `api_token_queries`,
69
+ * `account_queries`, and `permit_queries` — each call resets and re-binds
70
+ * the four spies, so cases run in sequence without bleeding state.
68
71
  */
69
72
  export declare const create_bearer_auth_mocks: (tc: BearerAuthTestOptions) => BearerAuthMocks;
70
73
  /** Default client IP set by the proxy stub in test apps. */
@@ -122,6 +125,8 @@ export interface TestMiddlewareStackApp {
122
125
  *
123
126
  * @param options - middleware stack configuration
124
127
  * @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
128
+ * @mutates module-level `vi.mock` registrations for the four bearer-auth query
129
+ * modules — each call resets the spies before wiring the stack.
125
130
  */
126
131
  export declare const create_test_middleware_stack_app: (options?: TestMiddlewareStackOptions) => TestMiddlewareStackApp;
127
132
  //# sourceMappingURL=middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,EAAE,EAAyB,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAU3B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAqBpF,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACrC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oEAAoE;IACpE,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4CAA4C;IAC5C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,+CAA+C;IAC/C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gFAAgF;IAChF,eAAe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E,CAAC,EAAE,CAAC,CAAC;IAC/C,0BAA0B,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,GAC5C,UAAU,0BAA0B,KAClC,sBAiDF,CAAC"}
@@ -43,6 +43,9 @@ const STUB_DEPS = { db: {} };
43
43
  *
44
44
  * @param tc - the test config providing mock return values
45
45
  * @returns mocks bundle with spy references
46
+ * @mutates module-level `vi.mock` registrations for `api_token_queries`,
47
+ * `account_queries`, and `permit_queries` — each call resets and re-binds
48
+ * the four spies, so cases run in sequence without bleeding state.
46
49
  */
47
50
  export const create_bearer_auth_mocks = (tc) => {
48
51
  const mock_validate = vi.mocked(query_validate_api_token);
@@ -176,6 +179,8 @@ export const TEST_MIDDLEWARE_PATH = '/api/test';
176
179
  *
177
180
  * @param options - middleware stack configuration
178
181
  * @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
182
+ * @mutates module-level `vi.mock` registrations for the four bearer-auth query
183
+ * modules — each call resets the spies before wiring the stack.
179
184
  */
180
185
  export const create_test_middleware_stack_app = (options) => {
181
186
  const trusted_proxies = options?.trusted_proxies ?? ['10.0.0.1'];
@@ -54,6 +54,9 @@ export interface RateLimitingTestOptions {
54
54
  * message if the consumer's route specs are misconfigured.
55
55
  *
56
56
  * @param options - session config and route factory
57
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
58
+ * bearer-auth rate-limit test probes via the `account_verify` RPC action,
59
+ * so the suite hard-fails via `require_rpc_endpoint_path`.
57
60
  */
58
61
  export declare const describe_rate_limiting_tests: (options: RateLimitingTestOptions) => void;
59
62
  //# sourceMappingURL=rate_limiting.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate_limiting.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAC,cAAc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ACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAK1B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IA8P/E,CAAC"}
@@ -36,6 +36,9 @@ import { account_verify_action_spec } from '../auth/account_action_specs.js';
36
36
  * message if the consumer's route specs are misconfigured.
37
37
  *
38
38
  * @param options - session config and route factory
39
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
40
+ * bearer-auth rate-limit test probes via the `account_verify` RPC action,
41
+ * so the suite hard-fails via `require_rpc_endpoint_path`.
39
42
  */
40
43
  export const describe_rate_limiting_tests = (options) => {
41
44
  const max_attempts = options.max_attempts ?? 2;
@@ -34,6 +34,9 @@ export type RpcEndpointsSuiteOption = Array<RpcEndpointSpec> | ((ctx: AppServerC
34
34
  * etc.) are. Factories that return a different `path` based on `ctx` will
35
35
  * produce a setup/runtime mismatch; the path-purity assert below surfaces
36
36
  * that as a clear `gro check` error rather than a silent test/runtime drift.
37
+ *
38
+ * @throws Error if the factory's two stub-ctx invocations produce different
39
+ * `(path, method-list)` shapes — surfaces non-pure factories at setup time.
37
40
  */
38
41
  export declare const resolve_rpc_endpoints_for_setup: (rpc_endpoints: RpcEndpointsSuiteOption, session_options: SessionOptions<string>) => Array<RpcEndpointSpec>;
39
42
  /**
@@ -144,11 +147,10 @@ export interface RpcCallArgs {
144
147
  * caller-provided headers, fires POST (default) or GET, parses the envelope,
145
148
  * and returns a discriminated result.
146
149
  *
147
- * Throws `Error` only on envelope-shape violations (neither
148
- * `JsonrpcResponse` nor `JsonrpcErrorResponse` parses) — protocol-level
149
- * failures the caller should never tolerate. All JSON-RPC errors come back
150
- * via `{ok: false, error}` so assertions can focus on `error.code` /
151
- * `error.data.reason`.
150
+ * @throws Error if the response body is neither a valid `JsonrpcResponse`
151
+ * nor `JsonrpcErrorResponse` envelope — protocol-level failures the caller
152
+ * should never tolerate. All JSON-RPC errors come back via `{ok: false, error}`
153
+ * so assertions can focus on `error.code` / `error.data.reason`.
152
154
  */
153
155
  export declare const rpc_call: (args: RpcCallArgs) => Promise<RpcCallResult>;
154
156
  /**
@@ -196,6 +198,9 @@ export type RpcCallForSpecArgs<TSpec extends RequestResponseActionSpec> = Omit<R
196
198
  * happy-path + denial-path assertions where the error `data.reason` shape
197
199
  * is still asserted manually. For adversarial input tests that send
198
200
  * malformed params, use the untyped `rpc_call`.
201
+ *
202
+ * @throws Error if the success `result` does not parse against `spec.output`,
203
+ * or if `rpc_call` itself throws on an envelope violation.
199
204
  */
200
205
  export declare const rpc_call_for_spec: <TSpec extends RequestResponseActionSpec>(args: RpcCallForSpecArgs<TSpec>) => Promise<RpcCallResultForSpec<TSpec>>;
201
206
  /**
@@ -203,6 +208,9 @@ export declare const rpc_call_for_spec: <TSpec extends RequestResponseActionSpec
203
208
  * output schema and returns typed data. Envelope-level failures or error
204
209
  * responses throw — use the untyped `rpc_call` for tests that need to
205
210
  * assert on specific error shapes.
211
+ *
212
+ * @throws Error if the response is a JSON-RPC error, if `rpc_call` throws
213
+ * on an envelope violation, or if the result fails `output_schema.safeParse`.
206
214
  */
207
215
  export declare const rpc_call_typed: <T>(args: RpcCallArgs, output_schema: z.ZodType<T>) => Promise<T>;
208
216
  /**
@@ -225,12 +233,17 @@ export declare const find_rpc_method: (rpc_endpoints: ReadonlyArray<AppSurfaceRp
225
233
  } | undefined;
226
234
  /**
227
235
  * Resolve a single RPC endpoint path — the common case where a consumer
228
- * mounts exactly one `create_rpc_endpoint`. Throws when `rpc_endpoints` is
229
- * empty (hard-fail; see the suite options docs) or ambiguous (more than one
230
- * endpoint registered).
236
+ * mounts exactly one `create_rpc_endpoint`.
237
+ *
238
+ * Used at suite setup time to hard-fail integration suites (admin / audit /
239
+ * SSE / rate-limiting) when the consumer omitted `rpc_endpoints` rather
240
+ * than letting tests fail mid-run with confusing errors.
231
241
  *
232
242
  * Callers that need multi-endpoint support should iterate `rpc_endpoints`
233
243
  * directly.
244
+ *
245
+ * @throws Error if `rpc_endpoints` is empty (hard-fail; see the suite options
246
+ * docs) or has more than one entry (ambiguous).
234
247
  */
235
248
  export declare const require_rpc_endpoint_path: (rpc_endpoints: ReadonlyArray<RpcEndpointSpec>) => string;
236
249
  //# sourceMappingURL=rpc_helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,qBAAqB,EAAE,mBAAmB,EAAE,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAG9D;;;;;;;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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,GAAU,KAAK,SAAS,yBAAyB,EAC9E,MAAM,kBAAkB,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAarC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,EACrC,MAAM,WAAW,EACjB,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KACzB,OAAO,CAAC,CAAC,CAcX,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC3B,eAAe,aAAa,CAAC,eAAe,CAAC,EAC7C,QAAQ,MAAM,KACZ;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GAAG,SAOtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC3B,eAAe,aAAa,CAAC,qBAAqB,CAAC,EACnD,QAAQ,MAAM,KACZ;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAC,GAAG,SAOrD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GACrC,eAAe,aAAa,CAAC,eAAe,CAAC,KAC3C,MAYF,CAAC"}
@@ -30,6 +30,9 @@ import { create_stub_app_server_context } from './stubs.js';
30
30
  * etc.) are. Factories that return a different `path` based on `ctx` will
31
31
  * produce a setup/runtime mismatch; the path-purity assert below surfaces
32
32
  * that as a clear `gro check` error rather than a silent test/runtime drift.
33
+ *
34
+ * @throws Error if the factory's two stub-ctx invocations produce different
35
+ * `(path, method-list)` shapes — surfaces non-pure factories at setup time.
33
36
  */
34
37
  export const resolve_rpc_endpoints_for_setup = (rpc_endpoints, session_options) => {
35
38
  if (typeof rpc_endpoints !== 'function')
@@ -144,11 +147,10 @@ const RPC_CALL_DEFAULT_HEADERS = {
144
147
  * caller-provided headers, fires POST (default) or GET, parses the envelope,
145
148
  * and returns a discriminated result.
146
149
  *
147
- * Throws `Error` only on envelope-shape violations (neither
148
- * `JsonrpcResponse` nor `JsonrpcErrorResponse` parses) — protocol-level
149
- * failures the caller should never tolerate. All JSON-RPC errors come back
150
- * via `{ok: false, error}` so assertions can focus on `error.code` /
151
- * `error.data.reason`.
150
+ * @throws Error if the response body is neither a valid `JsonrpcResponse`
151
+ * nor `JsonrpcErrorResponse` envelope — protocol-level failures the caller
152
+ * should never tolerate. All JSON-RPC errors come back via `{ok: false, error}`
153
+ * so assertions can focus on `error.code` / `error.data.reason`.
152
154
  */
153
155
  export const rpc_call = async (args) => {
154
156
  const { app, path, method, params, headers, id = 'test', verb = 'POST', suppress_default_origin, } = args;
@@ -214,6 +216,9 @@ export const rpc_call_non_browser = (args) => rpc_call({ ...args, suppress_defau
214
216
  * happy-path + denial-path assertions where the error `data.reason` shape
215
217
  * is still asserted manually. For adversarial input tests that send
216
218
  * malformed params, use the untyped `rpc_call`.
219
+ *
220
+ * @throws Error if the success `result` does not parse against `spec.output`,
221
+ * or if `rpc_call` itself throws on an envelope violation.
217
222
  */
218
223
  export const rpc_call_for_spec = async (args) => {
219
224
  const { spec, params, ...rest } = args;
@@ -232,6 +237,9 @@ export const rpc_call_for_spec = async (args) => {
232
237
  * output schema and returns typed data. Envelope-level failures or error
233
238
  * responses throw — use the untyped `rpc_call` for tests that need to
234
239
  * assert on specific error shapes.
240
+ *
241
+ * @throws Error if the response is a JSON-RPC error, if `rpc_call` throws
242
+ * on an envelope violation, or if the result fails `output_schema.safeParse`.
235
243
  */
236
244
  export const rpc_call_typed = async (args, output_schema) => {
237
245
  const res = await rpc_call(args);
@@ -275,12 +283,17 @@ export const find_rpc_method = (rpc_endpoints, method) => {
275
283
  };
276
284
  /**
277
285
  * Resolve a single RPC endpoint path — the common case where a consumer
278
- * mounts exactly one `create_rpc_endpoint`. Throws when `rpc_endpoints` is
279
- * empty (hard-fail; see the suite options docs) or ambiguous (more than one
280
- * endpoint registered).
286
+ * mounts exactly one `create_rpc_endpoint`.
287
+ *
288
+ * Used at suite setup time to hard-fail integration suites (admin / audit /
289
+ * SSE / rate-limiting) when the consumer omitted `rpc_endpoints` rather
290
+ * than letting tests fail mid-run with confusing errors.
281
291
  *
282
292
  * Callers that need multi-endpoint support should iterate `rpc_endpoints`
283
293
  * directly.
294
+ *
295
+ * @throws Error if `rpc_endpoints` is empty (hard-fail; see the suite options
296
+ * docs) or has more than one entry (ambiguous).
284
297
  */
285
298
  export const require_rpc_endpoint_path = (rpc_endpoints) => {
286
299
  if (rpc_endpoints.length === 0) {
@@ -26,8 +26,13 @@ export declare const resolve_valid_path: (path: string, params_schema?: z.ZodObj
26
26
  * Generate a valid request body for a route's input schema.
27
27
  *
28
28
  * Returns `undefined` for null schemas or schemas that can't be unwrapped to objects.
29
- * Throws if the generated body fails validation — catches broken generation logic
30
- * early with a descriptive error instead of a confusing 400 in downstream tests.
29
+ *
30
+ * @param input_schema - the route's input Zod schema
31
+ * @returns a generated body that passes `safeParse`, or `undefined` for null /
32
+ * non-object schemas
33
+ * @throws Error if the generated body fails `input_schema.safeParse` — catches
34
+ * broken `generate_valid_value` logic early with a descriptive Zod-issues
35
+ * summary instead of a confusing 400 in downstream tests.
31
36
  */
32
37
  export declare const generate_valid_body: (input_schema: z.ZodType) => Record<string, unknown> | undefined;
33
38
  //# sourceMappingURL=schema_generators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;AA+FF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,OAAO,KAAG,OAkDnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,gBAAgB,CAAC,CAAC,SAAS,KAAG,MAa9E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC/B,cAAc,CAAC,CAAC,OAAO,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC"}
1
+ {"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;AA+FF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,OAAO,KAAG,OAkDnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,gBAAgB,CAAC,CAAC,SAAS,KAAG,MAa9E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC/B,cAAc,CAAC,CAAC,OAAO,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC"}
@@ -207,8 +207,13 @@ export const resolve_valid_path = (path, params_schema) => {
207
207
  * Generate a valid request body for a route's input schema.
208
208
  *
209
209
  * Returns `undefined` for null schemas or schemas that can't be unwrapped to objects.
210
- * Throws if the generated body fails validation — catches broken generation logic
211
- * early with a descriptive error instead of a confusing 400 in downstream tests.
210
+ *
211
+ * @param input_schema - the route's input Zod schema
212
+ * @returns a generated body that passes `safeParse`, or `undefined` for null /
213
+ * non-object schemas
214
+ * @throws Error if the generated body fails `input_schema.safeParse` — catches
215
+ * broken `generate_valid_value` logic early with a descriptive Zod-issues
216
+ * summary instead of a confusing 400 in downstream tests.
212
217
  */
213
218
  export const generate_valid_body = (input_schema) => {
214
219
  if (is_null_schema(input_schema))
@@ -75,6 +75,9 @@ export interface SseRouteTestOptions {
75
75
  * then asserts close-on-revoke (unless opted out).
76
76
  *
77
77
  * @param options - SSE test configuration
78
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
79
+ * close-on-revoke assertion dispatches `account_session_revoke_all` via
80
+ * RPC. Hard-fails via `require_rpc_endpoint_path`.
78
81
  */
79
82
  export declare const describe_sse_route_tests: (options: SseRouteTestOptions) => void;
80
83
  //# sourceMappingURL=sse_round_trip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sse_round_trip.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/sse_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAwB,KAAK,SAAS,EAAuB,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,SAAS,CAAC;AAE9D,OAAO,EAI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H,aAAa,EAAE,uBAAuB,CAAC;IACvC,8BAA8B;IAC9B,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAChC;AAyHD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,mBAAmB,KAAG,IA2HvE,CAAC"}
@@ -127,6 +127,9 @@ const parse_and_validate_sse_payload = (frame, event_specs, route_path) => {
127
127
  * then asserts close-on-revoke (unless opted out).
128
128
  *
129
129
  * @param options - SSE test configuration
130
+ * @throws Error at setup time when `options.rpc_endpoints` is empty — the
131
+ * close-on-revoke assertion dispatches `account_session_revoke_all` via
132
+ * RPC. Hard-fails via `require_rpc_endpoint_path`.
130
133
  */
131
134
  export const describe_sse_route_tests = (options) => {
132
135
  // Hard-fail early so consumers see a clear setup error instead of a
@@ -15,7 +15,14 @@ import type { EventSpec } from '../realtime/sse.js';
15
15
  * calls through to a throwing stub, the error message identifies exactly which stub
16
16
  * was hit, catching test bugs that would silently pass with `{} as any`.
17
17
  *
18
+ * JS-internal probes (`Symbol`, `then`, `constructor`, `$$typeof`) return
19
+ * `undefined` so the proxy doesn't crash framework-level identity checks;
20
+ * `toJSON` returns `"[throwing_stub:label]"` so accidental serialization
21
+ * surfaces the stub's identity in console output rather than silent `"{}"`.
22
+ *
18
23
  * @param label - descriptive name for error messages (e.g. `'keyring'`, `'db'`)
24
+ * @throws Error on any non-internal property access (`get` trap), labeled with
25
+ * the stub name and the offending property.
19
26
  */
20
27
  export declare const create_throwing_stub: <T = any>(label: string) => T;
21
28
  /**