@fuzdev/fuz_app 0.51.0 → 0.53.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 +43 -10
- 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 +28 -43
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +31 -50
- 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 -9
- package/dist/actions/action_registry.d.ts +1 -5
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +5 -11
- package/dist/actions/action_rpc.d.ts +20 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +45 -20
- package/dist/actions/action_spec.d.ts +75 -6
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +36 -6
- package/dist/actions/frontend_rpc_client.d.ts +1 -9
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +1 -9
- package/dist/actions/register_action_ws.d.ts +19 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +44 -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 +24 -16
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +24 -16
- package/dist/actions/rpc_client.d.ts +0 -1
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +3 -17
- package/dist/actions/socket.svelte.d.ts +35 -16
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -14
- package/dist/actions/transports.d.ts +15 -5
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +15 -15
- 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 -4
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -4
- 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 -10
- package/dist/auth/CLAUDE.md +64 -18
- package/dist/auth/account_queries.d.ts +7 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +7 -0
- package/dist/auth/admin_action_specs.d.ts +5 -0
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +5 -0
- 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_queries.d.ts +6 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +6 -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 +5 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +5 -0
- package/dist/auth/audit_log_routes.d.ts +2 -2
- package/dist/auth/audit_log_routes.js +2 -2
- package/dist/auth/audit_log_schema.d.ts +2 -0
- 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_middleware.d.ts +4 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +4 -0
- package/dist/auth/invite_queries.d.ts +3 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -0
- package/dist/auth/permit_offer_action_specs.d.ts +6 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +11 -0
- package/dist/auth/permit_offer_queries.d.ts +18 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +18 -0
- package/dist/auth/permit_queries.d.ts +7 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +7 -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/self_service_role_actions.d.ts +1 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -0
- package/dist/auth/session_lifecycle.d.ts +2 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +2 -0
- package/dist/auth/session_middleware.d.ts +1 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +1 -0
- package/dist/auth/session_queries.d.ts +9 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +9 -0
- package/dist/cli/config.d.ts +1 -2
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +1 -2
- 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/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 +3 -1
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +3 -1
- package/dist/db/db.d.ts +15 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +14 -3
- package/dist/db/db_pg.d.ts +4 -3
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +7 -5
- package/dist/db/db_pglite.d.ts +4 -4
- package/dist/db/db_pglite.js +4 -4
- package/dist/db/migrate.d.ts +7 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +5 -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 +15 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +15 -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 -3
- package/dist/env/load.d.ts.map +1 -1
- package/dist/env/load.js +1 -3
- 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 +2 -5
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +2 -5
- package/dist/http/common_routes.d.ts +0 -8
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +0 -8
- package/dist/http/db_routes.d.ts +0 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +0 -3
- package/dist/http/error_schemas.d.ts +12 -11
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +11 -7
- package/dist/http/jsonrpc_errors.d.ts +0 -6
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +0 -6
- package/dist/http/origin.d.ts +6 -13
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -14
- 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 -6
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -6
- package/dist/http/route_spec.d.ts +14 -35
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +17 -22
- package/dist/http/schema_helpers.d.ts +0 -4
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +0 -4
- package/dist/http/surface.d.ts +2 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +1 -12
- package/dist/rate_limiter.d.ts +30 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +40 -1
- package/dist/realtime/sse.d.ts +7 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -2
- 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 -5
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -5
- package/dist/runtime/fs.d.ts +5 -3
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -3
- package/dist/runtime/mock.d.ts +6 -3
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -3
- 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 +31 -5
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +23 -7
- package/dist/server/startup.d.ts +0 -2
- package/dist/server/startup.d.ts.map +1 -1
- package/dist/server/startup.js +0 -2
- package/dist/server/static.d.ts +0 -1
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +0 -1
- package/dist/server/validate_nginx.d.ts +3 -3
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/server/validate_nginx.js +0 -3
- package/dist/testing/CLAUDE.md +1 -1
- package/dist/testing/admin_integration.d.ts +5 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +8 -6
- package/dist/testing/adversarial_404.d.ts +0 -2
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +0 -2
- package/dist/testing/adversarial_headers.d.ts +5 -4
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -4
- package/dist/testing/adversarial_input.d.ts +4 -2
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -2
- package/dist/testing/app_server.d.ts +25 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -2
- package/dist/testing/assertions.d.ts +23 -11
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -11
- package/dist/testing/attack_surface.d.ts +0 -4
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +0 -4
- package/dist/testing/audit_completeness.d.ts +4 -1
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -1
- package/dist/testing/auth_apps.d.ts +5 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +5 -10
- package/dist/testing/data_exposure.d.ts +0 -11
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +0 -11
- package/dist/testing/db.d.ts +9 -7
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -7
- package/dist/testing/error_coverage.d.ts +9 -14
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -14
- package/dist/testing/integration.d.ts +4 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -1
- package/dist/testing/integration_helpers.d.ts +5 -34
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +5 -41
- package/dist/testing/middleware.d.ts +5 -10
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -10
- package/dist/testing/mock_fs.d.ts +0 -2
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts +3 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -1
- package/dist/testing/round_trip.d.ts +0 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +0 -2
- package/dist/testing/rpc_attack_surface.d.ts +0 -2
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +0 -2
- package/dist/testing/rpc_helpers.d.ts +21 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +21 -14
- package/dist/testing/rpc_round_trip.d.ts +0 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +0 -2
- package/dist/testing/schema_generators.d.ts +5 -3
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +22 -3
- package/dist/testing/sse_round_trip.d.ts +3 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -1
- package/dist/testing/standard.d.ts +0 -2
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +0 -2
- package/dist/testing/stubs.d.ts +8 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -3
- package/dist/testing/surface_invariants.d.ts +14 -3
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -3
- package/dist/testing/ws_round_trip.d.ts +13 -1
- package/dist/testing/ws_round_trip.d.ts.map +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/CLAUDE.md +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/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 +7 -2
- 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 -3
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -3
- package/dist/ui/sidebar_state.svelte.d.ts +21 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +16 -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/dist/ui/ui_fetch.d.ts +1 -7
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +1 -7
- package/dist/ui/ui_format.d.ts +2 -14
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +2 -14
- package/package.json +2 -2
|
@@ -72,7 +72,11 @@ const build_admin_test_app_options = (options, db, roles) => ({
|
|
|
72
72
|
* Output-schema conformance is not in scope — see the module docstring
|
|
73
73
|
* for the suites that cover it.
|
|
74
74
|
*
|
|
75
|
-
* @
|
|
75
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — admin
|
|
76
|
+
* permit grant/revoke, session/token revoke-all, and audit-log reads are
|
|
77
|
+
* all RPC-only since the 2026-04-22 migration. Hard-fails via
|
|
78
|
+
* `require_rpc_endpoint_path` so consumers see a clear setup error rather
|
|
79
|
+
* than `method not found` mid-suite.
|
|
76
80
|
*/
|
|
77
81
|
export const describe_standard_admin_integration_tests = (options) => {
|
|
78
82
|
// Hard-fail early so consumers see a clear setup error instead of a
|
|
@@ -99,16 +103,14 @@ export const describe_standard_admin_integration_tests = (options) => {
|
|
|
99
103
|
// RPC migration: account listing, session/token revoke-all,
|
|
100
104
|
// audit-log reads, and invite CRUD are RPC-only. The only
|
|
101
105
|
// admin REST route remaining is the optional
|
|
102
|
-
// `GET /audit
|
|
106
|
+
// `GET /audit/stream` SSE, plus the shared RPC endpoint
|
|
103
107
|
// path itself (admin methods live behind spec-level role auth).
|
|
104
|
-
// The `/audit
|
|
108
|
+
// The `/audit/stream` suffix tracks the hardcoded path in
|
|
105
109
|
// `auth/audit_log_routes.ts` — if consumers ever need to mount
|
|
106
110
|
// the audit SSE at a different suffix, promote this to an
|
|
107
111
|
// `audit_log_path_suffix` option on
|
|
108
112
|
// `StandardAdminIntegrationTestOptions`.
|
|
109
|
-
const admin_routes = captured_route_specs.filter((s) => s.path.endsWith('/audit
|
|
110
|
-
s.auth.type === 'role' &&
|
|
111
|
-
s.auth.role === 'admin');
|
|
113
|
+
const admin_routes = captured_route_specs.filter((s) => s.path.endsWith('/audit/stream') && s.auth.type === 'role' && s.auth.role === 'admin');
|
|
112
114
|
// Adaptive threshold: when the scoped admin REST surface is
|
|
113
115
|
// effectively empty (0–1 routes, typical post-RPC-migration),
|
|
114
116
|
// the 20% baseline is meaningless — a single SSE route that
|
|
@@ -8,8 +8,6 @@ import type { AdversarialTestOptions } from './attack_surface.js';
|
|
|
8
8
|
* 2. Fires a request with valid-format params (nil UUIDs for UUID params)
|
|
9
9
|
* 3. Validates response status is 404
|
|
10
10
|
* 4. Validates response body matches the declared 404 Zod schema
|
|
11
|
-
*
|
|
12
|
-
* @param options - the test configuration
|
|
13
11
|
*/
|
|
14
12
|
export declare const describe_adversarial_404: (options: AdversarialTestOptions) => void;
|
|
15
13
|
//# sourceMappingURL=adversarial_404.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAyBhE
|
|
1
|
+
{"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAyBhE;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IA2E1E,CAAC"}
|
|
@@ -47,8 +47,6 @@ const extract_404_error_code = (schema) => {
|
|
|
47
47
|
* 2. Fires a request with valid-format params (nil UUIDs for UUID params)
|
|
48
48
|
* 3. Validates response status is 404
|
|
49
49
|
* 4. Validates response body matches the declared 404 Zod schema
|
|
50
|
-
*
|
|
51
|
-
* @param options - the test configuration
|
|
52
50
|
*/
|
|
53
51
|
export const describe_adversarial_404 = (options) => {
|
|
54
52
|
const { build, roles } = options;
|
|
@@ -16,16 +16,17 @@ export interface AdversarialHeaderCase {
|
|
|
16
16
|
* 7 standard adversarial header cases applicable to any middleware stack.
|
|
17
17
|
*
|
|
18
18
|
* @param allowed_origin - an origin that passes the origin check
|
|
19
|
-
* @returns the standard adversarial header cases
|
|
20
19
|
*/
|
|
21
20
|
export declare const create_standard_adversarial_cases: (allowed_origin: string) => Array<AdversarialHeaderCase>;
|
|
22
21
|
/**
|
|
23
22
|
* Create a middleware stack app with standard adversarial header tests.
|
|
24
23
|
*
|
|
25
24
|
* Convenience wrapper combining `create_test_middleware_stack_app`
|
|
26
|
-
* and `create_standard_adversarial_cases`.
|
|
27
|
-
*
|
|
28
|
-
* `mock_validate`
|
|
25
|
+
* and `create_standard_adversarial_cases`. Generates one `test()` per case
|
|
26
|
+
* inside a `describe()` block — asserts body content for both error and
|
|
27
|
+
* success cases, and verifies that `mock_validate` was (or was not) reached
|
|
28
|
+
* per the case's `validate_expectation` flag, ensuring earlier middleware
|
|
29
|
+
* actually short-circuits before token validation in the rejection cases.
|
|
29
30
|
*
|
|
30
31
|
* @param suite_name - the describe block name
|
|
31
32
|
* @param options - middleware stack configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_headers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_headers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAY7B,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAG3B,OAAO,EAGN,KAAK,0BAA0B,EAC/B,MAAM,iBAAiB,CAAC;AAIzB,+DAA+D;AAC/D,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,qBAAqB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAClC,qGAAqG;IACrG,oBAAoB,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC9C;AAID
|
|
1
|
+
{"version":3,"file":"adversarial_headers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_headers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAY7B,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAG3B,OAAO,EAGN,KAAK,0BAA0B,EAC/B,MAAM,iBAAiB,CAAC;AAIzB,+DAA+D;AAC/D,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,qBAAqB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAClC,qGAAqG;IACrG,oBAAoB,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC9C;AAID;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,GAC7C,gBAAgB,MAAM,KACpB,KAAK,CAAC,qBAAqB,CA+D7B,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qCAAqC,GACjD,YAAY,MAAM,EAClB,SAAS,0BAA0B,EACnC,gBAAgB,MAAM,EACtB,cAAc,KAAK,CAAC,qBAAqB,CAAC,KACxC,IAkCF,CAAC"}
|
|
@@ -15,7 +15,6 @@ import { create_test_middleware_stack_app, TEST_MIDDLEWARE_PATH, } from './middl
|
|
|
15
15
|
* 7 standard adversarial header cases applicable to any middleware stack.
|
|
16
16
|
*
|
|
17
17
|
* @param allowed_origin - an origin that passes the origin check
|
|
18
|
-
* @returns the standard adversarial header cases
|
|
19
18
|
*/
|
|
20
19
|
export const create_standard_adversarial_cases = (allowed_origin) => [
|
|
21
20
|
{
|
|
@@ -86,9 +85,11 @@ export const create_standard_adversarial_cases = (allowed_origin) => [
|
|
|
86
85
|
* Create a middleware stack app with standard adversarial header tests.
|
|
87
86
|
*
|
|
88
87
|
* Convenience wrapper combining `create_test_middleware_stack_app`
|
|
89
|
-
* and `create_standard_adversarial_cases`.
|
|
90
|
-
*
|
|
91
|
-
* `mock_validate`
|
|
88
|
+
* and `create_standard_adversarial_cases`. Generates one `test()` per case
|
|
89
|
+
* inside a `describe()` block — asserts body content for both error and
|
|
90
|
+
* success cases, and verifies that `mock_validate` was (or was not) reached
|
|
91
|
+
* per the case's `validate_expectation` flag, ensuring earlier middleware
|
|
92
|
+
* actually short-circuits before token validation in the rejection cases.
|
|
92
93
|
*
|
|
93
94
|
* @param suite_name - the describe block name
|
|
94
95
|
* @param options - middleware stack configuration
|
|
@@ -24,6 +24,10 @@ interface QueryTestCase {
|
|
|
24
24
|
* - One wrong-type value per field
|
|
25
25
|
* - Null for required non-nullable fields
|
|
26
26
|
* - One format violation per constrained field
|
|
27
|
+
*
|
|
28
|
+
* @throws Error if the seed body built by `generate_valid_value` fails
|
|
29
|
+
* `input_schema.safeParse` — surfaces broken generation logic with the
|
|
30
|
+
* Zod issues path rather than producing nonsense adversarial cases.
|
|
27
31
|
*/
|
|
28
32
|
export declare const generate_input_test_cases: (input_schema: z.ZodType) => Array<InputTestCase>;
|
|
29
33
|
/**
|
|
@@ -48,8 +52,6 @@ export declare const generate_query_test_cases: (query_schema: z.ZodObject) => A
|
|
|
48
52
|
* Tests input body validation and params validation for all routes.
|
|
49
53
|
* Uses correct auth credentials so auth guards pass and validation
|
|
50
54
|
* middleware is actually exercised.
|
|
51
|
-
*
|
|
52
|
-
* @param options - the test configuration
|
|
53
55
|
*/
|
|
54
56
|
export declare const describe_adversarial_input: (options: AdversarialTestOptions) => void;
|
|
55
57
|
export {};
|
|
@@ -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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O,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))
|
|
@@ -351,8 +355,6 @@ const build_query_url = (path, query) => {
|
|
|
351
355
|
* Tests input body validation and params validation for all routes.
|
|
352
356
|
* Uses correct auth credentials so auth guards pass and validation
|
|
353
357
|
* middleware is actually exercised.
|
|
354
|
-
*
|
|
355
|
-
* @param options - the test configuration
|
|
356
358
|
*/
|
|
357
359
|
export const describe_adversarial_input = (options) => {
|
|
358
360
|
const { build, roles } = options;
|
|
@@ -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: {
|
|
@@ -123,6 +126,28 @@ export interface TestAppServerOptions {
|
|
|
123
126
|
*/
|
|
124
127
|
audit_log_config?: AuditLogConfig;
|
|
125
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Create an app server with a bootstrapped account for testing.
|
|
131
|
+
*
|
|
132
|
+
* Sets up:
|
|
133
|
+
* - Auth tables (via cached PGlite factory, or reuses existing `db`)
|
|
134
|
+
* - A keeper account with hashed password
|
|
135
|
+
* - Role permits for each role in `options.roles`
|
|
136
|
+
* - An API token for Bearer auth
|
|
137
|
+
* - A session with a signed cookie value
|
|
138
|
+
*
|
|
139
|
+
* Uses `stub_password_deps` by default — deterministic hashing that works
|
|
140
|
+
* correctly for login/logout tests without Argon2 overhead.
|
|
141
|
+
*
|
|
142
|
+
* @param options - session options and optional overrides
|
|
143
|
+
* @returns a `TestAppServer` ready for HTTP testing
|
|
144
|
+
* @mutates the underlying database — when `db` is supplied, resets singleton
|
|
145
|
+
* state (`bootstrap_lock.bootstrapped`, `app_settings.open_signup`) before
|
|
146
|
+
* bootstrapping; in either branch inserts an account, actor, role permits,
|
|
147
|
+
* API token, and session row. When `audit_log_config` is provided, also
|
|
148
|
+
* sets `backend.deps.audit_log_config` so `create_app_server`'s shallow
|
|
149
|
+
* spread picks it up.
|
|
150
|
+
*/
|
|
126
151
|
export declare const create_test_app_server: (options: TestAppServerOptions) => Promise<TestAppServer>;
|
|
127
152
|
/**
|
|
128
153
|
* Configuration for `create_test_app`.
|
|
@@ -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,O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,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,gEAAgE;IAChE,qBAAqB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClF,iEAAiE;IACjE,2BAA2B,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxF,qDAAqD;IACrD,cAAc,EAAE,CAAC,OAAO,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;
|
|
@@ -69,6 +72,8 @@ export const bootstrap_test_account = async (options) => {
|
|
|
69
72
|
session_cookie,
|
|
70
73
|
};
|
|
71
74
|
};
|
|
75
|
+
/** Silent logger for tests — suppresses all output. */
|
|
76
|
+
const test_log = new Logger('test', { level: 'off' });
|
|
72
77
|
/**
|
|
73
78
|
* Create an app server with a bootstrapped account for testing.
|
|
74
79
|
*
|
|
@@ -84,9 +89,13 @@ export const bootstrap_test_account = async (options) => {
|
|
|
84
89
|
*
|
|
85
90
|
* @param options - session options and optional overrides
|
|
86
91
|
* @returns a `TestAppServer` ready for HTTP testing
|
|
92
|
+
* @mutates the underlying database — when `db` is supplied, resets singleton
|
|
93
|
+
* state (`bootstrap_lock.bootstrapped`, `app_settings.open_signup`) before
|
|
94
|
+
* bootstrapping; in either branch inserts an account, actor, role permits,
|
|
95
|
+
* API token, and session row. When `audit_log_config` is provided, also
|
|
96
|
+
* sets `backend.deps.audit_log_config` so `create_app_server`'s shallow
|
|
97
|
+
* spread picks it up.
|
|
87
98
|
*/
|
|
88
|
-
/** Silent logger for tests — suppresses all output. */
|
|
89
|
-
const test_log = new Logger('test', { level: 'off' });
|
|
90
99
|
export const create_test_app_server = async (options) => {
|
|
91
100
|
const { session_options, db: existing_db, db_type = 'pglite-memory', password = stub_password_deps, username = 'keeper', password_value = 'test-password-123', roles = [ROLE_KEEPER], on_audit_event = () => { }, // eslint-disable-line @typescript-eslint/no-empty-function
|
|
92
101
|
audit_log_config, } = options;
|
|
@@ -5,22 +5,25 @@ import type { RouteErrorSchemas } from '../http/error_schemas.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Resolve an absolute path relative to the caller's module.
|
|
7
7
|
*
|
|
8
|
-
* @param filename - the filename to resolve
|
|
9
8
|
* @param import_meta_url - the caller's `import.meta.url`
|
|
10
|
-
* @returns absolute path
|
|
11
9
|
*/
|
|
12
10
|
export declare const resolve_fixture_path: (filename: string, import_meta_url: string) => string;
|
|
13
11
|
/**
|
|
14
12
|
* Compare live surface against a committed snapshot JSON file.
|
|
15
13
|
*
|
|
14
|
+
* Failure message instructs the developer to run `gro gen` to update the
|
|
15
|
+
* snapshot — every fuz_app consumer wires the snapshot through a `*.gen.ts`
|
|
16
|
+
* file so regeneration goes through the same pipeline as the rest of the
|
|
17
|
+
* generated artifacts.
|
|
18
|
+
*
|
|
16
19
|
* @param surface - the live surface to check
|
|
17
20
|
* @param snapshot_path - absolute path to the committed JSON snapshot
|
|
21
|
+
* @throws AssertionError if the live surface does not deep-equal the snapshot,
|
|
22
|
+
* or `Error` if the snapshot file is unreadable / malformed JSON.
|
|
18
23
|
*/
|
|
19
24
|
export declare const assert_surface_matches_snapshot: (surface: AppSurface, snapshot_path: string) => void;
|
|
20
25
|
/**
|
|
21
26
|
* Verify surface generation is deterministic (build twice, compare).
|
|
22
|
-
*
|
|
23
|
-
* @param build_surface - function that builds the surface
|
|
24
27
|
*/
|
|
25
28
|
export declare const assert_surface_deterministic: (build_surface: () => AppSurface) => void;
|
|
26
29
|
/**
|
|
@@ -28,21 +31,19 @@ export declare const assert_surface_deterministic: (build_surface: () => AppSurf
|
|
|
28
31
|
*
|
|
29
32
|
* @param surface - the app surface to check
|
|
30
33
|
* @param expected_public - format: `['GET /health', 'POST /api/account/login']`
|
|
34
|
+
* @throws AssertionError if the live surface has public routes not in
|
|
35
|
+
* `expected_public`, or if any entry in `expected_public` is missing from
|
|
36
|
+
* the live surface.
|
|
31
37
|
*/
|
|
32
38
|
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
39
|
/**
|
|
41
40
|
* Look up the merged error schema for a route+status from a pre-built schema lookup.
|
|
42
41
|
*
|
|
43
42
|
* @param lookup - map from `"METHOD /path"` to merged error schemas
|
|
44
43
|
* @param route - the surface route to look up
|
|
45
44
|
* @param status - HTTP status code
|
|
45
|
+
* @returns the Zod schema for that route+status, or `undefined` when no error
|
|
46
|
+
* schema is declared for the status code
|
|
46
47
|
*/
|
|
47
48
|
export declare const get_route_error_schema: (lookup: Map<string, RouteErrorSchemas>, route: AppSurfaceRoute, status: number) => z.ZodType | undefined;
|
|
48
49
|
/**
|
|
@@ -55,7 +56,18 @@ export declare const get_route_error_schema: (lookup: Map<string, RouteErrorSche
|
|
|
55
56
|
* @param route - the surface route to validate against
|
|
56
57
|
* @param status - expected HTTP status code
|
|
57
58
|
* @param body - the parsed response body to validate
|
|
59
|
+
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
60
|
+
* @throws ZodError if the body does not satisfy the declared schema.
|
|
58
61
|
*/
|
|
59
62
|
export declare const assert_error_schema_valid: (lookup: Map<string, RouteErrorSchemas>, route: AppSurfaceRoute, status: number, body: unknown) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
65
|
+
*
|
|
66
|
+
* @param surface - the app surface to check
|
|
67
|
+
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
68
|
+
* @param expected_middleware - the exact middleware names in order
|
|
69
|
+
* @throws AssertionError if no routes match `path_prefix`, or if any matching
|
|
70
|
+
* route's `applicable_middleware` does not deep-equal `expected_middleware`.
|
|
71
|
+
*/
|
|
60
72
|
export declare const assert_full_middleware_stack: (surface: AppSurface, path_prefix: string, expected_middleware: Array<string>) => void;
|
|
61
73
|
//# 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,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAA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M,EACnB,qBAAqB,KAAK,CAAC,MAAM,CAAC,KAChC,IAUF,CAAC"}
|
|
@@ -14,16 +14,21 @@ import { assert } from 'vitest';
|
|
|
14
14
|
/**
|
|
15
15
|
* Resolve an absolute path relative to the caller's module.
|
|
16
16
|
*
|
|
17
|
-
* @param filename - the filename to resolve
|
|
18
17
|
* @param import_meta_url - the caller's `import.meta.url`
|
|
19
|
-
* @returns absolute path
|
|
20
18
|
*/
|
|
21
19
|
export const resolve_fixture_path = (filename, import_meta_url) => resolve(dirname(fileURLToPath(import_meta_url)), filename);
|
|
22
20
|
/**
|
|
23
21
|
* Compare live surface against a committed snapshot JSON file.
|
|
24
22
|
*
|
|
23
|
+
* Failure message instructs the developer to run `gro gen` to update the
|
|
24
|
+
* snapshot — every fuz_app consumer wires the snapshot through a `*.gen.ts`
|
|
25
|
+
* file so regeneration goes through the same pipeline as the rest of the
|
|
26
|
+
* generated artifacts.
|
|
27
|
+
*
|
|
25
28
|
* @param surface - the live surface to check
|
|
26
29
|
* @param snapshot_path - absolute path to the committed JSON snapshot
|
|
30
|
+
* @throws AssertionError if the live surface does not deep-equal the snapshot,
|
|
31
|
+
* or `Error` if the snapshot file is unreadable / malformed JSON.
|
|
27
32
|
*/
|
|
28
33
|
export const assert_surface_matches_snapshot = (surface, snapshot_path) => {
|
|
29
34
|
const committed = JSON.parse(readFileSync(snapshot_path, 'utf-8'));
|
|
@@ -31,8 +36,6 @@ export const assert_surface_matches_snapshot = (surface, snapshot_path) => {
|
|
|
31
36
|
};
|
|
32
37
|
/**
|
|
33
38
|
* Verify surface generation is deterministic (build twice, compare).
|
|
34
|
-
*
|
|
35
|
-
* @param build_surface - function that builds the surface
|
|
36
39
|
*/
|
|
37
40
|
export const assert_surface_deterministic = (build_surface) => {
|
|
38
41
|
assert.deepStrictEqual(build_surface(), build_surface());
|
|
@@ -42,6 +45,9 @@ export const assert_surface_deterministic = (build_surface) => {
|
|
|
42
45
|
*
|
|
43
46
|
* @param surface - the app surface to check
|
|
44
47
|
* @param expected_public - format: `['GET /health', 'POST /api/account/login']`
|
|
48
|
+
* @throws AssertionError if the live surface has public routes not in
|
|
49
|
+
* `expected_public`, or if any entry in `expected_public` is missing from
|
|
50
|
+
* the live surface.
|
|
45
51
|
*/
|
|
46
52
|
export const assert_only_expected_public_routes = (surface, expected_public) => {
|
|
47
53
|
const expected = new Set(expected_public);
|
|
@@ -53,19 +59,14 @@ export const assert_only_expected_public_routes = (surface, expected_public) =>
|
|
|
53
59
|
assert.strictEqual(unexpected.length, 0, `Unexpected public routes: ${unexpected.join(', ')}`);
|
|
54
60
|
assert.strictEqual(missing.length, 0, `Expected public routes missing: ${missing.join(', ')}`);
|
|
55
61
|
};
|
|
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
62
|
/**
|
|
64
63
|
* Look up the merged error schema for a route+status from a pre-built schema lookup.
|
|
65
64
|
*
|
|
66
65
|
* @param lookup - map from `"METHOD /path"` to merged error schemas
|
|
67
66
|
* @param route - the surface route to look up
|
|
68
67
|
* @param status - HTTP status code
|
|
68
|
+
* @returns the Zod schema for that route+status, or `undefined` when no error
|
|
69
|
+
* schema is declared for the status code
|
|
69
70
|
*/
|
|
70
71
|
export const get_route_error_schema = (lookup, route, status) => {
|
|
71
72
|
const key = `${route.method} ${route.path}`;
|
|
@@ -81,12 +82,23 @@ export const get_route_error_schema = (lookup, route, status) => {
|
|
|
81
82
|
* @param route - the surface route to validate against
|
|
82
83
|
* @param status - expected HTTP status code
|
|
83
84
|
* @param body - the parsed response body to validate
|
|
85
|
+
* @throws AssertionError if no schema is declared for the route+status pair.
|
|
86
|
+
* @throws ZodError if the body does not satisfy the declared schema.
|
|
84
87
|
*/
|
|
85
88
|
export const assert_error_schema_valid = (lookup, route, status, body) => {
|
|
86
89
|
const schema = get_route_error_schema(lookup, route, status);
|
|
87
90
|
assert.ok(schema, `missing error schema for ${status} on ${route.method} ${route.path}`);
|
|
88
91
|
schema.parse(body);
|
|
89
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Verify every route under a path prefix has the exact expected middleware stack.
|
|
95
|
+
*
|
|
96
|
+
* @param surface - the app surface to check
|
|
97
|
+
* @param path_prefix - prefix to filter routes (e.g. `'/api/'`)
|
|
98
|
+
* @param expected_middleware - the exact middleware names in order
|
|
99
|
+
* @throws AssertionError if no routes match `path_prefix`, or if any matching
|
|
100
|
+
* route's `applicable_middleware` does not deep-equal `expected_middleware`.
|
|
101
|
+
*/
|
|
90
102
|
export const assert_full_middleware_stack = (surface, path_prefix, expected_middleware) => {
|
|
91
103
|
const routes = surface.routes.filter((r) => r.path.startsWith(path_prefix));
|
|
92
104
|
assert.ok(routes.length > 0, `No routes found under ${path_prefix}`);
|
|
@@ -16,8 +16,6 @@ export interface AdversarialTestOptions {
|
|
|
16
16
|
* - wrong role → 403 — every role route, tested with all non-matching roles
|
|
17
17
|
* - authenticated without role → 403 — every role route, no-role context
|
|
18
18
|
* - correct auth passes guard — every protected route, assert not 401/403
|
|
19
|
-
*
|
|
20
|
-
* @param options - the test configuration
|
|
21
19
|
*/
|
|
22
20
|
export declare const describe_adversarial_auth: (options: AdversarialTestOptions) => void;
|
|
23
21
|
/**
|
|
@@ -83,8 +81,6 @@ export interface StandardAttackSurfaceOptions {
|
|
|
83
81
|
*
|
|
84
82
|
* Consumer test files call this with project-specific options, then add
|
|
85
83
|
* any project-specific assertions in additional `describe` blocks.
|
|
86
|
-
*
|
|
87
|
-
* @param options - the test configuration
|
|
88
84
|
*/
|
|
89
85
|
export declare const describe_standard_attack_surface_tests: (options: StandardAttackSurfaceOptions) => void;
|
|
90
86
|
//# sourceMappingURL=attack_surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attack_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/attack_surface.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,EAON,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,MAAM,yBAAyB,CAAC;AAoBjC,OAAO,EAA4B,KAAK,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAsClF,oFAAoF;AACpF,MAAM,WAAW,sBAAsB;IACtC,+EAA+E;IAC/E,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,yDAAyD;IACzD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"attack_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/attack_surface.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,EAON,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,MAAM,yBAAyB,CAAC;AAoBjC,OAAO,EAA4B,KAAK,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAsClF,oFAAoF;AACpF,MAAM,WAAW,sBAAsB;IACtC,+EAA+E;IAC/E,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,yDAAyD;IACzD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,sBAAsB,KAAG,IAkH3E,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uCAAuC,GACnD,UAAU,2BAA2B,GAAG,IAAI,GAAG,SAAS,KACtD,2BAA2B,GAAG,IAWhC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,4BAA4B;IAC5C,+EAA+E;IAC/E,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,yDAAyD;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,gHAAgH;IAChH,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,yDAAyD;IACzD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,eAAe,CAAC,EAAE,4BAA4B,CAAC;IAC/C;;;;;;;;;;;OAWG;IACH,sBAAsB,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC5D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sCAAsC,GAClD,SAAS,4BAA4B,KACnC,IAuEF,CAAC"}
|
|
@@ -53,8 +53,6 @@ const build_error_schema_lookup = (route_specs, middleware_specs) => {
|
|
|
53
53
|
* - wrong role → 403 — every role route, tested with all non-matching roles
|
|
54
54
|
* - authenticated without role → 403 — every role route, no-role context
|
|
55
55
|
* - correct auth passes guard — every protected route, assert not 401/403
|
|
56
|
-
*
|
|
57
|
-
* @param options - the test configuration
|
|
58
56
|
*/
|
|
59
57
|
export const describe_adversarial_auth = (options) => {
|
|
60
58
|
const { build, roles } = options;
|
|
@@ -203,8 +201,6 @@ export const resolve_standard_error_schema_tightness = (consumer) => {
|
|
|
203
201
|
*
|
|
204
202
|
* Consumer test files call this with project-specific options, then add
|
|
205
203
|
* any project-specific assertions in additional `describe` blocks.
|
|
206
|
-
*
|
|
207
|
-
* @param options - the test configuration
|
|
208
204
|
*/
|
|
209
205
|
export const describe_standard_attack_surface_tests = (options) => {
|
|
210
206
|
const { build, snapshot_path, expected_public_routes, expected_api_middleware, roles, api_path_prefix = '/api/', security_policy, } = options;
|
|
@@ -38,7 +38,10 @@ export interface AuditCompletenessTestOptions {
|
|
|
38
38
|
* event type. Exercises routes via HTTP requests against a real PGlite
|
|
39
39
|
* database, then queries the `audit_log` table to verify events.
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
42
|
+
* mutation-audit tests drive permit flow, session/token revoke-all, and
|
|
43
|
+
* invite create/delete through their RPC action specs. Hard-fails via
|
|
44
|
+
* `require_rpc_endpoint_path`.
|
|
42
45
|
*/
|
|
43
46
|
export declare const describe_audit_completeness_tests: (options: AuditCompletenessTestOptions) => void;
|
|
44
47
|
//# 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,WAAW,4BAA4B;IAC5C,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;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAChC;AAoDD
|
|
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,WAAW,4BAA4B;IAC5C,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;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAChC;AAoDD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,GAAI,SAAS,4BAA4B,KAAG,IAyezF,CAAC"}
|
|
@@ -63,7 +63,10 @@ const json_session_headers = (test_app, extra) => test_app.create_session_header
|
|
|
63
63
|
* event type. Exercises routes via HTTP requests against a real PGlite
|
|
64
64
|
* database, then queries the `audit_log` table to verify events.
|
|
65
65
|
*
|
|
66
|
-
* @
|
|
66
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
67
|
+
* mutation-audit tests drive permit flow, session/token revoke-all, and
|
|
68
|
+
* invite create/delete through their RPC action specs. Hard-fails via
|
|
69
|
+
* `require_rpc_endpoint_path`.
|
|
67
70
|
*/
|
|
68
71
|
export const describe_audit_completeness_tests = (options) => {
|
|
69
72
|
// Hard-fail early so consumers see a clear setup error instead of a
|
|
@@ -12,10 +12,7 @@ import { type RouteSpec, type RouteAuth } from '../http/route_spec.js';
|
|
|
12
12
|
import { type RequestContext } from '../auth/request_context.js';
|
|
13
13
|
import { type CredentialType } from '../hono_context.js';
|
|
14
14
|
/**
|
|
15
|
-
* Create a mock
|
|
16
|
-
*
|
|
17
|
-
* @param role - optional role to grant
|
|
18
|
-
* @returns a valid `RequestContext`
|
|
15
|
+
* Create a mock `RequestContext` with optional role permit.
|
|
19
16
|
*/
|
|
20
17
|
export declare const create_test_request_context: (role?: string) => RequestContext;
|
|
21
18
|
/**
|
|
@@ -23,8 +20,7 @@ export declare const create_test_request_context: (role?: string) => RequestCont
|
|
|
23
20
|
*
|
|
24
21
|
* @param route_specs - the route specs to register
|
|
25
22
|
* @param auth_ctx - optional request context to inject via middleware
|
|
26
|
-
* @param credential_type - optional credential type (default: `'session'` when auth_ctx provided)
|
|
27
|
-
* @returns a configured Hono app
|
|
23
|
+
* @param credential_type - optional credential type (default: `'session'` when `auth_ctx` provided)
|
|
28
24
|
*/
|
|
29
25
|
export declare const create_test_app_from_specs: (route_specs: Array<RouteSpec>, auth_ctx?: RequestContext, credential_type?: CredentialType) => Hono;
|
|
30
26
|
/** Pre-built Hono apps for each auth level, shared across adversarial test suites. */
|
|
@@ -39,15 +35,14 @@ export interface AuthTestApps {
|
|
|
39
35
|
*
|
|
40
36
|
* @param route_specs - the route specs to register
|
|
41
37
|
* @param roles - all roles in the app
|
|
42
|
-
* @returns apps keyed by auth level
|
|
43
38
|
*/
|
|
44
39
|
export declare const create_auth_test_apps: (route_specs: Array<RouteSpec>, roles: Array<string>) => AuthTestApps;
|
|
45
40
|
/**
|
|
46
41
|
* Select the Hono test app with correct auth for a route.
|
|
47
42
|
*
|
|
48
|
-
* @
|
|
49
|
-
*
|
|
50
|
-
*
|
|
43
|
+
* @throws Error if `auth.type === 'role'` and `auth.role` is not present in
|
|
44
|
+
* `apps.by_role` — surfaces a missing entry in the `roles` array passed to
|
|
45
|
+
* `create_auth_test_apps`.
|
|
51
46
|
*/
|
|
52
47
|
export declare const select_auth_app: (apps: AuthTestApps, auth: RouteAuth) => Hono;
|
|
53
48
|
/** 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,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAI5E
|
|
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,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAI5E;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,cAI1D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACtC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,WAAW,cAAc,EACzB,kBAAkB,cAAc,KAC9B,IAkBF,CAAC;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;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAClB,YAeF,CAAC;AAEF;;;;;;GAMG;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"}
|
|
@@ -16,10 +16,7 @@ import { CREDENTIAL_TYPE_KEY } from '../hono_context.js';
|
|
|
16
16
|
import { create_stub_db } from './stubs.js';
|
|
17
17
|
import { create_test_account, create_test_actor, create_test_permit } from './entities.js';
|
|
18
18
|
/**
|
|
19
|
-
* Create a mock
|
|
20
|
-
*
|
|
21
|
-
* @param role - optional role to grant
|
|
22
|
-
* @returns a valid `RequestContext`
|
|
19
|
+
* Create a mock `RequestContext` with optional role permit.
|
|
23
20
|
*/
|
|
24
21
|
export const create_test_request_context = (role) => ({
|
|
25
22
|
account: create_test_account({ id: 'acc_1', username: 'testuser' }),
|
|
@@ -31,8 +28,7 @@ export const create_test_request_context = (role) => ({
|
|
|
31
28
|
*
|
|
32
29
|
* @param route_specs - the route specs to register
|
|
33
30
|
* @param auth_ctx - optional request context to inject via middleware
|
|
34
|
-
* @param credential_type - optional credential type (default: `'session'` when auth_ctx provided)
|
|
35
|
-
* @returns a configured Hono app
|
|
31
|
+
* @param credential_type - optional credential type (default: `'session'` when `auth_ctx` provided)
|
|
36
32
|
*/
|
|
37
33
|
export const create_test_app_from_specs = (route_specs, auth_ctx, credential_type) => {
|
|
38
34
|
const app = new Hono();
|
|
@@ -52,7 +48,6 @@ export const create_test_app_from_specs = (route_specs, auth_ctx, credential_typ
|
|
|
52
48
|
*
|
|
53
49
|
* @param route_specs - the route specs to register
|
|
54
50
|
* @param roles - all roles in the app
|
|
55
|
-
* @returns apps keyed by auth level
|
|
56
51
|
*/
|
|
57
52
|
export const create_auth_test_apps = (route_specs, roles) => {
|
|
58
53
|
const by_role = new Map();
|
|
@@ -69,9 +64,9 @@ export const create_auth_test_apps = (route_specs, roles) => {
|
|
|
69
64
|
/**
|
|
70
65
|
* Select the Hono test app with correct auth for a route.
|
|
71
66
|
*
|
|
72
|
-
* @
|
|
73
|
-
*
|
|
74
|
-
*
|
|
67
|
+
* @throws Error if `auth.type === 'role'` and `auth.role` is not present in
|
|
68
|
+
* `apps.by_role` — surfaces a missing entry in the `roles` array passed to
|
|
69
|
+
* `create_auth_test_apps`.
|
|
75
70
|
*/
|
|
76
71
|
export const select_auth_app = (apps, auth) => {
|
|
77
72
|
switch (auth.type) {
|