@fuzdev/fuz_app 0.50.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.
- package/dist/actions/CLAUDE.md +16 -3
- package/dist/actions/action_bridge.d.ts +3 -1
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +3 -1
- package/dist/actions/action_codegen.d.ts +44 -13
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +58 -20
- package/dist/actions/action_event.d.ts +44 -1
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +44 -1
- package/dist/actions/action_event_helpers.d.ts +26 -0
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +26 -1
- package/dist/actions/action_peer.d.ts +17 -0
- package/dist/actions/action_peer.d.ts.map +1 -1
- package/dist/actions/action_peer.js +8 -0
- package/dist/actions/action_registry.d.ts +2 -2
- package/dist/actions/action_registry.js +2 -2
- package/dist/actions/action_rpc.d.ts +4 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +4 -0
- package/dist/actions/action_spec.d.ts +23 -3
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +17 -3
- package/dist/actions/action_types.d.ts +2 -2
- package/dist/actions/action_types.js +2 -2
- package/dist/actions/cancel.d.ts +2 -2
- package/dist/actions/cancel.js +2 -2
- package/dist/actions/heartbeat.d.ts +2 -2
- package/dist/actions/heartbeat.js +2 -2
- package/dist/actions/protocol.d.ts +1 -1
- package/dist/actions/protocol.js +1 -1
- package/dist/actions/register_action_ws.d.ts +4 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +4 -1
- package/dist/actions/register_ws_endpoint.d.ts +3 -0
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +3 -0
- package/dist/actions/request_tracker.svelte.d.ts +14 -1
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +14 -1
- package/dist/actions/socket.svelte.d.ts +35 -15
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -13
- package/dist/actions/transports.d.ts +12 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +16 -7
- package/dist/actions/transports_http.d.ts +7 -0
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +7 -0
- package/dist/actions/transports_ws.d.ts +13 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +13 -0
- package/dist/actions/transports_ws_auth_guard.d.ts +6 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -2
- package/dist/actions/transports_ws_backend.d.ts +14 -1
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +14 -1
- package/dist/auth/CLAUDE.md +40 -4
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +10 -0
- package/dist/auth/account_routes.d.ts +3 -3
- package/dist/auth/account_routes.js +3 -3
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.js +1 -1
- package/dist/auth/admin_actions.d.ts +1 -0
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +1 -0
- package/dist/auth/api_token.d.ts +1 -1
- package/dist/auth/api_token.js +1 -1
- package/dist/auth/api_token_queries.d.ts +7 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +7 -0
- package/dist/auth/app_settings_queries.d.ts +4 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -1
- package/dist/auth/app_settings_queries.js +4 -0
- package/dist/auth/audit_log_queries.d.ts +6 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +6 -0
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +3 -1
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +134 -55
- package/dist/auth/bearer_auth.d.ts +2 -0
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +2 -0
- package/dist/auth/bootstrap_account.d.ts +3 -0
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +3 -0
- package/dist/auth/cleanup.d.ts +6 -0
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -0
- package/dist/auth/daemon_token.d.ts +1 -1
- package/dist/auth/daemon_token.js +1 -1
- package/dist/auth/daemon_token_middleware.d.ts +5 -1
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +5 -1
- package/dist/auth/ddl.d.ts +1 -1
- package/dist/auth/ddl.js +1 -1
- package/dist/auth/invite_queries.d.ts +4 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +4 -0
- package/dist/auth/password.d.ts +1 -1
- package/dist/auth/password.js +1 -1
- package/dist/auth/permit_offer_action_specs.d.ts +5 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +10 -0
- package/dist/auth/permit_offer_queries.d.ts +19 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +19 -0
- package/dist/auth/permit_queries.d.ts +8 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +8 -0
- package/dist/auth/request_context.d.ts +1 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +1 -0
- package/dist/auth/role_schema.d.ts +2 -0
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +2 -0
- package/dist/auth/route_guards.d.ts +1 -1
- package/dist/auth/route_guards.js +1 -1
- package/dist/auth/self_service_role_action_specs.d.ts +1 -1
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +2 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +2 -1
- package/dist/auth/session_lifecycle.d.ts +3 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +3 -0
- package/dist/auth/session_middleware.d.ts +5 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +5 -0
- package/dist/auth/session_queries.d.ts +10 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +10 -1
- package/dist/auth/signup_routes.d.ts +1 -1
- package/dist/auth/signup_routes.js +1 -1
- package/dist/cli/config.d.ts +2 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +2 -0
- package/dist/cli/daemon.d.ts +6 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +6 -1
- package/dist/cli/util.d.ts +1 -1
- package/dist/cli/util.js +1 -1
- package/dist/db/assert_row.d.ts +2 -1
- package/dist/db/assert_row.d.ts.map +1 -1
- package/dist/db/assert_row.js +2 -1
- package/dist/db/create_db.d.ts +5 -2
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +5 -2
- package/dist/db/db.d.ts +22 -7
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +21 -6
- package/dist/db/db_pg.d.ts +2 -1
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +5 -3
- package/dist/db/db_pglite.d.ts +3 -2
- package/dist/db/db_pglite.d.ts.map +1 -1
- package/dist/db/db_pglite.js +3 -2
- package/dist/db/migrate.d.ts +8 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +6 -2
- package/dist/db/sql_identifier.d.ts +2 -1
- package/dist/db/sql_identifier.d.ts.map +1 -1
- package/dist/db/sql_identifier.js +2 -1
- package/dist/db/status.d.ts +4 -1
- package/dist/db/status.d.ts.map +1 -1
- package/dist/db/status.js +5 -2
- package/dist/dev/setup.d.ts +18 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +18 -2
- package/dist/env/dotenv.d.ts +2 -1
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +2 -1
- package/dist/env/load.d.ts +1 -1
- package/dist/env/load.js +1 -1
- package/dist/env/resolve.d.ts +1 -1
- package/dist/env/resolve.js +1 -1
- package/dist/env/update_env_variable.d.ts +2 -0
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +2 -0
- package/dist/hono_context.d.ts +1 -1
- package/dist/hono_context.js +1 -1
- package/dist/http/jsonrpc_errors.d.ts +2 -2
- package/dist/http/jsonrpc_errors.js +2 -2
- package/dist/http/jsonrpc_helpers.d.ts +2 -2
- package/dist/http/jsonrpc_helpers.js +2 -2
- package/dist/http/middleware_spec.d.ts +1 -1
- package/dist/http/middleware_spec.js +1 -1
- package/dist/http/origin.d.ts +1 -1
- package/dist/http/origin.js +1 -1
- package/dist/http/pending_effects.d.ts +4 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +4 -0
- package/dist/http/proxy.d.ts +3 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/route_spec.d.ts +1 -0
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +7 -0
- package/dist/http/schema_helpers.d.ts +1 -1
- package/dist/http/schema_helpers.js +1 -1
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.js +1 -1
- package/dist/rate_limiter.d.ts +14 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +14 -1
- package/dist/realtime/sse.d.ts +7 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -1
- package/dist/realtime/sse_auth_guard.d.ts +21 -21
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
- package/dist/realtime/sse_auth_guard.js +24 -24
- package/dist/realtime/subscriber_registry.d.ts +4 -2
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -2
- package/dist/runtime/deno.d.ts +1 -1
- package/dist/runtime/deno.js +1 -1
- package/dist/runtime/fs.d.ts +5 -0
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -0
- package/dist/runtime/mock.d.ts +6 -0
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -0
- package/dist/runtime/node.d.ts +1 -1
- package/dist/runtime/node.js +1 -1
- package/dist/server/app_backend.d.ts +1 -0
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -0
- package/dist/server/app_server.d.ts +4 -0
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +4 -0
- package/dist/server/validate_nginx.d.ts +3 -0
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/testing/admin_integration.d.ts +5 -0
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +5 -0
- package/dist/testing/adversarial_headers.d.ts +5 -3
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -3
- package/dist/testing/adversarial_input.d.ts +4 -0
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -0
- package/dist/testing/app_server.d.ts +3 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -0
- package/dist/testing/assertions.d.ts +23 -7
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -7
- package/dist/testing/audit_completeness.d.ts +4 -0
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -0
- package/dist/testing/auth_apps.d.ts +3 -0
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -0
- package/dist/testing/db.d.ts +9 -1
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -1
- package/dist/testing/error_coverage.d.ts +9 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -0
- package/dist/testing/integration.d.ts +4 -0
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -0
- package/dist/testing/integration_helpers.d.ts +10 -4
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +10 -4
- package/dist/testing/middleware.d.ts +5 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -0
- package/dist/testing/rate_limiting.d.ts +3 -0
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -0
- package/dist/testing/rpc_attack_surface.js +1 -1
- package/dist/testing/rpc_helpers.d.ts +21 -8
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +22 -9
- package/dist/testing/schema_generators.d.ts +7 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +7 -2
- package/dist/testing/sse_round_trip.d.ts +3 -0
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -0
- package/dist/testing/stubs.d.ts +7 -0
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +7 -0
- package/dist/testing/surface_invariants.d.ts +14 -0
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -0
- package/dist/testing/ws_round_trip.d.ts +13 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +1 -1
- package/dist/ui/AccountSessions.svelte +9 -0
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +10 -0
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte +10 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +9 -0
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte +10 -0
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminPermitHistory.svelte +9 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte +10 -0
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte +9 -0
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte +9 -0
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/AppShell.svelte +24 -0
- package/dist/ui/AppShell.svelte.d.ts +23 -0
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte +17 -0
- package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/ColumnLayout.svelte +11 -0
- package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
- package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte +18 -0
- package/dist/ui/Datatable.svelte.d.ts +17 -0
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte +18 -0
- package/dist/ui/LoginForm.svelte.d.ts +9 -0
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte +9 -0
- package/dist/ui/LogoutButton.svelte.d.ts +8 -0
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/MenuLink.svelte +10 -0
- package/dist/ui/MenuLink.svelte.d.ts +9 -0
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +9 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +16 -0
- package/dist/ui/SignupForm.svelte.d.ts +4 -0
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +9 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/account_sessions_state.svelte.js +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +1 -1
- package/dist/ui/admin_rpc_adapters.js +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +6 -1
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +6 -1
- package/dist/ui/auth_state.svelte.d.ts +16 -4
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +16 -4
- package/dist/ui/form_state.svelte.d.ts +9 -0
- package/dist/ui/form_state.svelte.d.ts.map +1 -1
- package/dist/ui/form_state.svelte.js +9 -0
- package/dist/ui/loadable.svelte.d.ts +6 -1
- package/dist/ui/loadable.svelte.d.ts.map +1 -1
- package/dist/ui/loadable.svelte.js +6 -1
- package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
- package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/permit_offers_state.svelte.js +2 -0
- package/dist/ui/popover.svelte.d.ts +17 -4
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +17 -4
- package/dist/ui/position_helpers.d.ts +1 -0
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -0
- package/dist/ui/sidebar_state.svelte.d.ts +22 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +17 -2
- package/dist/ui/table_state.svelte.d.ts +14 -0
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +14 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_input.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAUtB,OAAO,EAEN,0BAA0B,EAC1B,uBAAuB,EAGvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AA8ChE,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,UAAU,cAAc;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAID
|
|
1
|
+
{"version":3,"file":"adversarial_input.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAUtB,OAAO,EAEN,0BAA0B,EAC1B,uBAAuB,EAGvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AA8ChE,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,UAAU,cAAc;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAID;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,KAAK,CAAC,aAAa,CAyLtF,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,cAAc,CA+B3F,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,aAAa,CA4CxF,CAAC;AAqBF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,sBAAsB,KAAG,IA4M5E,CAAC"}
|
|
@@ -68,6 +68,10 @@ const format_violation = (format) => {
|
|
|
68
68
|
* - One wrong-type value per field
|
|
69
69
|
* - Null for required non-nullable fields
|
|
70
70
|
* - One format violation per constrained field
|
|
71
|
+
*
|
|
72
|
+
* @throws Error if the seed body built by `generate_valid_value` fails
|
|
73
|
+
* `input_schema.safeParse` — surfaces broken generation logic with the
|
|
74
|
+
* Zod issues path rather than producing nonsense adversarial cases.
|
|
71
75
|
*/
|
|
72
76
|
export const generate_input_test_cases = (input_schema) => {
|
|
73
77
|
if (is_null_schema(input_schema))
|
|
@@ -51,6 +51,9 @@ export interface BootstrapTestAccountOptions {
|
|
|
51
51
|
* Creates an account with actor, grants roles, creates an API token,
|
|
52
52
|
* creates a session, and signs a session cookie. Shared by
|
|
53
53
|
* `create_test_app_server` and `TestApp.create_account`.
|
|
54
|
+
*
|
|
55
|
+
* @mutates the underlying `options.db` — inserts rows into `account`, `actor`,
|
|
56
|
+
* `permit` (one per role), `api_token`, and `auth_session`.
|
|
54
57
|
*/
|
|
55
58
|
export declare const bootstrap_test_account: (options: BootstrapTestAccountOptions) => Promise<{
|
|
56
59
|
account: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAG/B,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAA2B,KAAK,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAU1D,OAAO,EAA8B,KAAK,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAEN,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAOrD,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC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AAO,CAAC,EAAE;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACtB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3B,8DAA8D;IAC9D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,oBAAoB,KAAG,OAAO,CAAC,OAAO,CAyGpF,CAAC"}
|
|
@@ -40,6 +40,9 @@ const fallback_pglite_factory = create_pglite_factory(async (db) => {
|
|
|
40
40
|
* Creates an account with actor, grants roles, creates an API token,
|
|
41
41
|
* creates a session, and signs a session cookie. Shared by
|
|
42
42
|
* `create_test_app_server` and `TestApp.create_account`.
|
|
43
|
+
*
|
|
44
|
+
* @mutates the underlying `options.db` — inserts rows into `account`, `actor`,
|
|
45
|
+
* `permit` (one per role), `api_token`, and `auth_session`.
|
|
43
46
|
*/
|
|
44
47
|
export const bootstrap_test_account = async (options) => {
|
|
45
48
|
const { db, keyring, session_options, password, username = 'keeper', password_value = 'test-password-123', roles = [], } = options;
|
|
@@ -84,6 +87,14 @@ export const bootstrap_test_account = async (options) => {
|
|
|
84
87
|
*
|
|
85
88
|
* @param options - session options and optional overrides
|
|
86
89
|
* @returns a `TestAppServer` ready for HTTP testing
|
|
90
|
+
* @mutates the underlying database — when `db` is supplied, resets singleton
|
|
91
|
+
* state (`bootstrap_lock.bootstrapped`, `app_settings.open_signup`) before
|
|
92
|
+
* bootstrapping; in either branch inserts an account, actor, role permits,
|
|
93
|
+
* API token, and session row. When `audit_log_config` is provided, also
|
|
94
|
+
* sets `backend.deps.audit_log_config` so `create_app_server`'s shallow
|
|
95
|
+
* spread picks it up.
|
|
96
|
+
* @throws Error if `create_validated_keyring(TEST_COOKIE_SECRET)` rejects —
|
|
97
|
+
* should never happen with the literal stub but surfaced eagerly.
|
|
87
98
|
*/
|
|
88
99
|
/** Silent logger for tests — suppresses all output. */
|
|
89
100
|
const test_log = new Logger('test', { level: 'off' });
|
|
@@ -13,8 +13,15 @@ export declare const resolve_fixture_path: (filename: string, import_meta_url: s
|
|
|
13
13
|
/**
|
|
14
14
|
* Compare live surface against a committed snapshot JSON file.
|
|
15
15
|
*
|
|
16
|
+
* Failure message instructs the developer to run `gro gen` to update the
|
|
17
|
+
* snapshot — every fuz_app consumer wires the snapshot through a `*.gen.ts`
|
|
18
|
+
* file so regeneration goes through the same pipeline as the rest of the
|
|
19
|
+
* generated artifacts.
|
|
20
|
+
*
|
|
16
21
|
* @param surface - the live surface to check
|
|
17
22
|
* @param snapshot_path - absolute path to the committed JSON snapshot
|
|
23
|
+
* @throws AssertionError if the live surface does not deep-equal the snapshot,
|
|
24
|
+
* or `Error` if the snapshot file is unreadable / malformed JSON.
|
|
18
25
|
*/
|
|
19
26
|
export declare const assert_surface_matches_snapshot: (surface: AppSurface, snapshot_path: string) => void;
|
|
20
27
|
/**
|
|
@@ -28,21 +35,19 @@ export declare const assert_surface_deterministic: (build_surface: () => AppSurf
|
|
|
28
35
|
*
|
|
29
36
|
* @param surface - the app surface to check
|
|
30
37
|
* @param expected_public - format: `['GET /health', 'POST /api/account/login']`
|
|
38
|
+
* @throws AssertionError if the live surface has public routes not in
|
|
39
|
+
* `expected_public`, or if any entry in `expected_public` is missing from
|
|
40
|
+
* the live surface.
|
|
31
41
|
*/
|
|
32
42
|
export declare const assert_only_expected_public_routes: (surface: AppSurface, expected_public: Array<string>) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
35
|
-
*
|
|
36
|
-
* @param surface - the app surface to check
|
|
37
|
-
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
38
|
-
* @param expected_middleware - the exact middleware names in order
|
|
39
|
-
*/
|
|
40
43
|
/**
|
|
41
44
|
* Look up the merged error schema for a route+status from a pre-built schema lookup.
|
|
42
45
|
*
|
|
43
46
|
* @param lookup - map from `"METHOD /path"` to merged error schemas
|
|
44
47
|
* @param route - the surface route to look up
|
|
45
48
|
* @param status - HTTP status code
|
|
49
|
+
* @returns the Zod schema for that route+status, or `undefined` when no error
|
|
50
|
+
* schema is declared for the status code
|
|
46
51
|
*/
|
|
47
52
|
export declare const get_route_error_schema: (lookup: Map<string, RouteErrorSchemas>, route: AppSurfaceRoute, status: number) => z.ZodType | undefined;
|
|
48
53
|
/**
|
|
@@ -55,7 +60,18 @@ export declare const get_route_error_schema: (lookup: Map<string, RouteErrorSche
|
|
|
55
60
|
* @param route - the surface route to validate against
|
|
56
61
|
* @param status - expected HTTP status code
|
|
57
62
|
* @param body - the parsed response body to validate
|
|
63
|
+
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
64
|
+
* @throws ZodError if the body does not satisfy the declared schema.
|
|
58
65
|
*/
|
|
59
66
|
export declare const assert_error_schema_valid: (lookup: Map<string, RouteErrorSchemas>, route: AppSurfaceRoute, status: number, body: unknown) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
69
|
+
*
|
|
70
|
+
* @param surface - the app surface to check
|
|
71
|
+
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
72
|
+
* @param expected_middleware - the exact middleware names in order
|
|
73
|
+
* @throws AssertionError if no routes match `path_prefix`, or if any matching
|
|
74
|
+
* route's `applicable_middleware` does not deep-equal `expected_middleware`.
|
|
75
|
+
*/
|
|
60
76
|
export declare const assert_full_middleware_stack: (surface: AppSurface, path_prefix: string, expected_middleware: Array<string>) => void;
|
|
61
77
|
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EA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AG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACtC,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,MAAM,OAAO,KACX,IAIF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,UAAU,EACnB,aAAa,MAAM,EACnB,qBAAqB,KAAK,CAAC,MAAM,CAAC,KAChC,IAUF,CAAC"}
|
|
@@ -22,8 +22,15 @@ export const resolve_fixture_path = (filename, import_meta_url) => resolve(dirna
|
|
|
22
22
|
/**
|
|
23
23
|
* Compare live surface against a committed snapshot JSON file.
|
|
24
24
|
*
|
|
25
|
+
* Failure message instructs the developer to run `gro gen` to update the
|
|
26
|
+
* snapshot — every fuz_app consumer wires the snapshot through a `*.gen.ts`
|
|
27
|
+
* file so regeneration goes through the same pipeline as the rest of the
|
|
28
|
+
* generated artifacts.
|
|
29
|
+
*
|
|
25
30
|
* @param surface - the live surface to check
|
|
26
31
|
* @param snapshot_path - absolute path to the committed JSON snapshot
|
|
32
|
+
* @throws AssertionError if the live surface does not deep-equal the snapshot,
|
|
33
|
+
* or `Error` if the snapshot file is unreadable / malformed JSON.
|
|
27
34
|
*/
|
|
28
35
|
export const assert_surface_matches_snapshot = (surface, snapshot_path) => {
|
|
29
36
|
const committed = JSON.parse(readFileSync(snapshot_path, 'utf-8'));
|
|
@@ -42,6 +49,9 @@ export const assert_surface_deterministic = (build_surface) => {
|
|
|
42
49
|
*
|
|
43
50
|
* @param surface - the app surface to check
|
|
44
51
|
* @param expected_public - format: `['GET /health', 'POST /api/account/login']`
|
|
52
|
+
* @throws AssertionError if the live surface has public routes not in
|
|
53
|
+
* `expected_public`, or if any entry in `expected_public` is missing from
|
|
54
|
+
* the live surface.
|
|
45
55
|
*/
|
|
46
56
|
export const assert_only_expected_public_routes = (surface, expected_public) => {
|
|
47
57
|
const expected = new Set(expected_public);
|
|
@@ -53,19 +63,14 @@ export const assert_only_expected_public_routes = (surface, expected_public) =>
|
|
|
53
63
|
assert.strictEqual(unexpected.length, 0, `Unexpected public routes: ${unexpected.join(', ')}`);
|
|
54
64
|
assert.strictEqual(missing.length, 0, `Expected public routes missing: ${missing.join(', ')}`);
|
|
55
65
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
58
|
-
*
|
|
59
|
-
* @param surface - the app surface to check
|
|
60
|
-
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
61
|
-
* @param expected_middleware - the exact middleware names in order
|
|
62
|
-
*/
|
|
63
66
|
/**
|
|
64
67
|
* Look up the merged error schema for a route+status from a pre-built schema lookup.
|
|
65
68
|
*
|
|
66
69
|
* @param lookup - map from `"METHOD /path"` to merged error schemas
|
|
67
70
|
* @param route - the surface route to look up
|
|
68
71
|
* @param status - HTTP status code
|
|
72
|
+
* @returns the Zod schema for that route+status, or `undefined` when no error
|
|
73
|
+
* schema is declared for the status code
|
|
69
74
|
*/
|
|
70
75
|
export const get_route_error_schema = (lookup, route, status) => {
|
|
71
76
|
const key = `${route.method} ${route.path}`;
|
|
@@ -81,12 +86,23 @@ export const get_route_error_schema = (lookup, route, status) => {
|
|
|
81
86
|
* @param route - the surface route to validate against
|
|
82
87
|
* @param status - expected HTTP status code
|
|
83
88
|
* @param body - the parsed response body to validate
|
|
89
|
+
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
90
|
+
* @throws ZodError if the body does not satisfy the declared schema.
|
|
84
91
|
*/
|
|
85
92
|
export const assert_error_schema_valid = (lookup, route, status, body) => {
|
|
86
93
|
const schema = get_route_error_schema(lookup, route, status);
|
|
87
94
|
assert.ok(schema, `missing error schema for ${status} on ${route.method} ${route.path}`);
|
|
88
95
|
schema.parse(body);
|
|
89
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
99
|
+
*
|
|
100
|
+
* @param surface - the app surface to check
|
|
101
|
+
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
102
|
+
* @param expected_middleware - the exact middleware names in order
|
|
103
|
+
* @throws AssertionError if no routes match `path_prefix`, or if any matching
|
|
104
|
+
* route's `applicable_middleware` does not deep-equal `expected_middleware`.
|
|
105
|
+
*/
|
|
90
106
|
export const assert_full_middleware_stack = (surface, path_prefix, expected_middleware) => {
|
|
91
107
|
const routes = surface.routes.filter((r) => r.path.startsWith(path_prefix));
|
|
92
108
|
assert.ok(routes.length > 0, `No routes found under ${path_prefix}`);
|
|
@@ -39,6 +39,10 @@ export interface AuditCompletenessTestOptions {
|
|
|
39
39
|
* database, then queries the `audit_log` table to verify events.
|
|
40
40
|
*
|
|
41
41
|
* @param options - session config, route factory, and optional overrides
|
|
42
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
43
|
+
* mutation-audit tests drive permit flow, session/token revoke-all, and
|
|
44
|
+
* invite create/delete through their RPC action specs. Hard-fails via
|
|
45
|
+
* `require_rpc_endpoint_path`.
|
|
42
46
|
*/
|
|
43
47
|
export declare const describe_audit_completeness_tests: (options: AuditCompletenessTestOptions) => void;
|
|
44
48
|
//# sourceMappingURL=audit_completeness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_completeness.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/audit_completeness.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B,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;AAIrD,OAAO,EAGN,KAAK,eAAe,EAEpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAKjB,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAsB1B;;GAEG;AACH,MAAM,WA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;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC,GAAI,SAAS,4BAA4B,KAAG,IAyezF,CAAC"}
|
|
@@ -64,6 +64,10 @@ const json_session_headers = (test_app, extra) => test_app.create_session_header
|
|
|
64
64
|
* database, then queries the `audit_log` table to verify events.
|
|
65
65
|
*
|
|
66
66
|
* @param options - session config, route factory, and optional overrides
|
|
67
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
68
|
+
* mutation-audit tests drive permit flow, session/token revoke-all, and
|
|
69
|
+
* invite create/delete through their RPC action specs. Hard-fails via
|
|
70
|
+
* `require_rpc_endpoint_path`.
|
|
67
71
|
*/
|
|
68
72
|
export const describe_audit_completeness_tests = (options) => {
|
|
69
73
|
// Hard-fail early so consumers see a clear setup error instead of a
|
|
@@ -48,6 +48,9 @@ export declare const create_auth_test_apps: (route_specs: Array<RouteSpec>, role
|
|
|
48
48
|
* @param apps - the pre-built auth test apps
|
|
49
49
|
* @param auth - the route's auth options
|
|
50
50
|
* @returns the correctly-authenticated Hono app
|
|
51
|
+
* @throws Error if `auth.type === 'role'` and `auth.role` is not present in
|
|
52
|
+
* `apps.by_role` — surfaces a missing entry in the `roles` array passed to
|
|
53
|
+
* `create_auth_test_apps`.
|
|
51
54
|
*/
|
|
52
55
|
export declare const select_auth_app: (apps: AuthTestApps, auth: RouteAuth) => Hono;
|
|
53
56
|
/** Replace Hono route params (`:foo`) with dummy values for HTTP testing. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_apps.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/auth_apps.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAG1B,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAsB,KAAK,cAAc,EAAC,MAA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AC;AAEF,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAClB,YAeF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,EAAE,MAAM,SAAS,KAAG,IAcrE,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAA4C,CAAC"}
|
|
@@ -72,6 +72,9 @@ export const create_auth_test_apps = (route_specs, roles) => {
|
|
|
72
72
|
* @param apps - the pre-built auth test apps
|
|
73
73
|
* @param auth - the route's auth options
|
|
74
74
|
* @returns the correctly-authenticated Hono app
|
|
75
|
+
* @throws Error if `auth.type === 'role'` and `auth.role` is not present in
|
|
76
|
+
* `apps.by_role` — surfaces a missing entry in the `roles` array passed to
|
|
77
|
+
* `create_auth_test_apps`.
|
|
75
78
|
*/
|
|
76
79
|
export const select_auth_app = (apps, auth) => {
|
|
77
80
|
switch (auth.type) {
|
package/dist/testing/db.d.ts
CHANGED
|
@@ -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
|
/**
|
package/dist/testing/db.d.ts.map
CHANGED
|
@@ -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,E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ACf,SA2DF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,UAQhC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,UAAyC,CAAC;AAEvF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,+IAWnB,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAU,IAAI,EAAE,KAAG,OAAO,CAAC,IAAI,CAK3D,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC9B,WAAW,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,EACvC,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,KAAK,IAAI,CAwBzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,KAAK,CAAC,SAAS,CAAC,KAAG,IAMnE,CAAC"}
|
package/dist/testing/db.js
CHANGED
|
@@ -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,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,wF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AAM,CAAC,CAAa;IAE3C;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CACL,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACX,IAAI;IAUP;;;;;;;;;;;;;;;;;;;;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,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;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAsBD
|
|
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,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;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,EAAE,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
|
-
*
|
|
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
|
|
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,CAA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AgC,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
|
-
*
|
|
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,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,qBAAqB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;CAClC;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB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