@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
|
@@ -23,11 +23,15 @@ export class BackendWebsocketTransport {
|
|
|
23
23
|
/**
|
|
24
24
|
* Add a new WebSocket connection with auth info.
|
|
25
25
|
* Session connections pass a token hash for targeted revocation.
|
|
26
|
-
* Bearer token connections (api_token) pass the `api_token.id` so the
|
|
26
|
+
* Bearer token connections (`api_token`) pass the `api_token.id` so the
|
|
27
27
|
* socket can be closed when that specific token is revoked without
|
|
28
28
|
* tearing down the account's other sockets. Daemon-token connections
|
|
29
29
|
* pass `null` for both — they're only reachable via
|
|
30
30
|
* `close_sockets_for_account`.
|
|
31
|
+
*
|
|
32
|
+
* @returns the freshly assigned `connection_id` (branded `Uuid`)
|
|
33
|
+
* @mutates this - inserts into `#connections`, `#connection_ids`, and
|
|
34
|
+
* `#connection_identities`
|
|
31
35
|
*/
|
|
32
36
|
add_connection(ws, token_hash, account_id, api_token_id = null) {
|
|
33
37
|
const connection_id = create_uuid();
|
|
@@ -39,6 +43,9 @@ export class BackendWebsocketTransport {
|
|
|
39
43
|
/**
|
|
40
44
|
* Remove a WebSocket connection and its auth tracking data.
|
|
41
45
|
* Idempotent — safe to call after revocation has already cleaned up.
|
|
46
|
+
*
|
|
47
|
+
* @mutates this - deletes the connection's entries from `#connections`,
|
|
48
|
+
* `#connection_ids`, and `#connection_identities`
|
|
42
49
|
*/
|
|
43
50
|
remove_connection(ws) {
|
|
44
51
|
const connection_id = this.#connection_ids.get(ws);
|
|
@@ -68,6 +75,8 @@ export class BackendWebsocketTransport {
|
|
|
68
75
|
* Close all sockets associated with a specific session token hash.
|
|
69
76
|
*
|
|
70
77
|
* @returns the number of sockets closed
|
|
78
|
+
* @mutates this - removes matching connections from internal maps and
|
|
79
|
+
* closes their underlying `WSContext` with `WS_CLOSE_SESSION_REVOKED`
|
|
71
80
|
*/
|
|
72
81
|
close_sockets_for_session(token_hash) {
|
|
73
82
|
return this.#close_where((id) => id.token_hash === token_hash);
|
|
@@ -76,6 +85,8 @@ export class BackendWebsocketTransport {
|
|
|
76
85
|
* Close all sockets associated with a specific account.
|
|
77
86
|
*
|
|
78
87
|
* @returns the number of sockets closed
|
|
88
|
+
* @mutates this - removes matching connections from internal maps and
|
|
89
|
+
* closes their underlying `WSContext` with `WS_CLOSE_SESSION_REVOKED`
|
|
79
90
|
*/
|
|
80
91
|
close_sockets_for_account(account_id) {
|
|
81
92
|
return this.#close_where((id) => id.account_id === account_id);
|
|
@@ -88,21 +99,17 @@ export class BackendWebsocketTransport {
|
|
|
88
99
|
* tokens' sockets.
|
|
89
100
|
*
|
|
90
101
|
* @returns the number of sockets closed
|
|
102
|
+
* @mutates this - removes matching connections from internal maps and
|
|
103
|
+
* closes their underlying `WSContext` with `WS_CLOSE_SESSION_REVOKED`
|
|
91
104
|
*/
|
|
92
105
|
close_sockets_for_token(api_token_id) {
|
|
93
106
|
return this.#close_where((id) => id.api_token_id === api_token_id);
|
|
94
107
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Remove all tracking state for a connection.
|
|
97
|
-
*/
|
|
98
108
|
#cleanup_connection(connection_id, ws) {
|
|
99
109
|
this.#connections.delete(connection_id);
|
|
100
110
|
this.#connection_ids.delete(ws);
|
|
101
111
|
this.#connection_identities.delete(connection_id);
|
|
102
112
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Clean up a connection and close its socket with a revocation code.
|
|
105
|
-
*/
|
|
106
113
|
#revoke_connection(connection_id, ws) {
|
|
107
114
|
this.#cleanup_connection(connection_id, ws);
|
|
108
115
|
ws.close(WS_CLOSE_SESSION_REVOKED, 'Session revoked');
|
|
@@ -122,9 +129,6 @@ export class BackendWebsocketTransport {
|
|
|
122
129
|
return create_jsonrpc_error_response(to_jsonrpc_message_id(message), jsonrpc_error_messages.internal_error(error instanceof Error ? error.message : 'failed to broadcast notification'));
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Broadcast a message to all connected clients.
|
|
127
|
-
*/
|
|
128
132
|
#broadcast(message) {
|
|
129
133
|
const serialized = JSON.stringify(message);
|
|
130
134
|
for (const ws of this.#connections.values()) {
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -157,10 +157,39 @@ Separated from runtime types to isolate DDL concerns. Consumed by
|
|
|
157
157
|
|
|
158
158
|
### Audit log (`audit_log_schema.ts`)
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
#### Audit event types
|
|
161
|
+
|
|
162
|
+
`AUDIT_EVENT_TYPES` — 21 events covering auth + permit + offer + invite +
|
|
163
|
+
settings mutations. Offer lifecycle: `permit_offer_create` / `_accept` /
|
|
164
|
+
`_decline` / `_retract` / `_expire` / `_supersede`. `AuditEventType` is the
|
|
165
|
+
Zod enum; `AuditOutcome` is `'success' | 'failure'`.
|
|
166
|
+
|
|
167
|
+
| Event type |
|
|
168
|
+
| ------------------------ |
|
|
169
|
+
| `login` |
|
|
170
|
+
| `logout` |
|
|
171
|
+
| `bootstrap` |
|
|
172
|
+
| `signup` |
|
|
173
|
+
| `password_change` |
|
|
174
|
+
| `session_revoke` |
|
|
175
|
+
| `session_revoke_all` |
|
|
176
|
+
| `token_create` |
|
|
177
|
+
| `token_revoke` |
|
|
178
|
+
| `token_revoke_all` |
|
|
179
|
+
| `permit_grant` |
|
|
180
|
+
| `permit_revoke` |
|
|
181
|
+
| `permit_offer_create` |
|
|
182
|
+
| `permit_offer_accept` |
|
|
183
|
+
| `permit_offer_decline` |
|
|
184
|
+
| `permit_offer_retract` |
|
|
185
|
+
| `permit_offer_expire` |
|
|
186
|
+
| `permit_offer_supersede` |
|
|
187
|
+
| `invite_create` |
|
|
188
|
+
| `invite_delete` |
|
|
189
|
+
| `app_settings_update` |
|
|
190
|
+
|
|
191
|
+
#### Metadata schemas
|
|
192
|
+
|
|
164
193
|
- `AUDIT_METADATA_SCHEMAS` — per-type `z.looseObject`. Notable shapes:
|
|
165
194
|
- `permit_grant` — `scope_id`, optional `permit_id` (failed grants
|
|
166
195
|
omit — `web_grantable` denial never produces a row), optional
|
|
@@ -806,7 +835,7 @@ The 2026-04-22 RPC migration moved audit-log list + permit-history reads
|
|
|
806
835
|
(plus admin session listing) to `admin_actions.ts`. The sole remaining
|
|
807
836
|
REST concern is the optional SSE stream:
|
|
808
837
|
|
|
809
|
-
- **`GET /audit
|
|
838
|
+
- **`GET /audit/stream`** — optional, wired only when
|
|
810
839
|
`AuditLogRouteOptions.stream` is passed. Streams aren't an RPC concern.
|
|
811
840
|
Uses `AUTH_SESSION_TOKEN_HASH_KEY` for SSE `scope` identity (so
|
|
812
841
|
`session_revoke` can close only that session's stream); `groups: [account_id]`
|
|
@@ -843,19 +872,29 @@ enforces admin before the handler runs. `permit_revoke` in
|
|
|
843
872
|
sibling methods are authenticated-but-not-admin — the dispatcher checks
|
|
844
873
|
auth per-spec, so mixed-auth endpoints compose cleanly.
|
|
845
874
|
|
|
846
|
-
| Spec | Side effects | Input | Output |
|
|
847
|
-
| -------------------------------------- | ------------ | --------------------------------------------------------- | ----------------------------- |
|
|
848
|
-
| `admin_account_list_action_spec` | false | `z.void()` | `{accounts, grantable_roles}` |
|
|
849
|
-
| `admin_session_list_action_spec` | false | `z.void()` | `{sessions}` |
|
|
850
|
-
| `admin_session_revoke_all_action_spec` | true | `{account_id}` | `{ok, count}` |
|
|
851
|
-
| `admin_token_revoke_all_action_spec` | true | `{account_id}` | `{ok, count}` |
|
|
852
|
-
| `audit_log_list_action_spec` | false | `{event_type?, account_id?, limit?, offset?, since_seq?}` | `{events}` |
|
|
853
|
-
| `audit_log_permit_history_action_spec` | false | `{limit?, offset?}` | `{events}` |
|
|
854
|
-
| `invite_create_action_spec` | true | `{email?, username?}` | `{ok, invite}` |
|
|
855
|
-
| `invite_list_action_spec` | false | `z.void()` | `{invites}` |
|
|
856
|
-
| `invite_delete_action_spec` | true | `{invite_id}` | `{ok}` |
|
|
857
|
-
| `app_settings_get_action_spec` | false | `z.void()` | `{settings}` |
|
|
858
|
-
| `app_settings_update_action_spec` | true | `{open_signup}` | `{ok, settings}` |
|
|
875
|
+
| Spec | Side effects | Rate limit | Input | Output |
|
|
876
|
+
| -------------------------------------- | ------------ | ----------- | --------------------------------------------------------- | ----------------------------- |
|
|
877
|
+
| `admin_account_list_action_spec` | false | | `z.void()` | `{accounts, grantable_roles}` |
|
|
878
|
+
| `admin_session_list_action_spec` | false | | `z.void()` | `{sessions}` |
|
|
879
|
+
| `admin_session_revoke_all_action_spec` | true | `'account'` | `{account_id}` | `{ok, count}` |
|
|
880
|
+
| `admin_token_revoke_all_action_spec` | true | `'account'` | `{account_id}` | `{ok, count}` |
|
|
881
|
+
| `audit_log_list_action_spec` | false | | `{event_type?, account_id?, limit?, offset?, since_seq?}` | `{events}` |
|
|
882
|
+
| `audit_log_permit_history_action_spec` | false | | `{limit?, offset?}` | `{events}` |
|
|
883
|
+
| `invite_create_action_spec` | true | `'account'` | `{email?, username?}` | `{ok, invite}` |
|
|
884
|
+
| `invite_list_action_spec` | false | | `z.void()` | `{invites}` |
|
|
885
|
+
| `invite_delete_action_spec` | true | `'account'` | `{invite_id}` | `{ok}` |
|
|
886
|
+
| `app_settings_get_action_spec` | false | | `z.void()` | `{settings}` |
|
|
887
|
+
| `app_settings_update_action_spec` | true | `'account'` | `{open_signup}` | `{ok, settings}` |
|
|
888
|
+
|
|
889
|
+
Mutating admin specs declare `rate_limit: 'account'` — keyed on the
|
|
890
|
+
admin's `request_context.actor.id`. The dispatcher's per-action hook
|
|
891
|
+
(shared by HTTP RPC + WS) records every invocation regardless of
|
|
892
|
+
outcome so successful probes (e.g. `invite_create`'s account-existence
|
|
893
|
+
oracle on the `LOWER()` lookup in `query_account_by_username/_by_email`)
|
|
894
|
+
consume budget. Default `DEFAULT_ACTION_ACCOUNT_RATE_LIMIT` is 1200/15min
|
|
895
|
+
per actor — permissive enough for any human admin workflow, slow enough
|
|
896
|
+
that scripted oracles surface in audit. Tighten downstream via
|
|
897
|
+
`AppServerOptions.action_account_rate_limiter`.
|
|
859
898
|
|
|
860
899
|
`AUDIT_LOG_LIST_LIMIT_MAX = 200` — page size clamp (mirrors the former REST
|
|
861
900
|
route).
|
|
@@ -957,6 +996,13 @@ Plus re-uses from `../http/error_schemas.ts`: `ERROR_PERMIT_NOT_FOUND`,
|
|
|
957
996
|
`ERROR_ROLE_NOT_WEB_GRANTABLE`, `ERROR_INSUFFICIENT_PERMISSIONS`,
|
|
958
997
|
`ERROR_ACCOUNT_NOT_FOUND`.
|
|
959
998
|
|
|
999
|
+
Each spec declares the reason codes its handler may surface (see
|
|
1000
|
+
`../actions/CLAUDE.md` §Action specs for the field semantics). Only
|
|
1001
|
+
domain reasons returned via `error.data.reason` are listed; standard
|
|
1002
|
+
transport errors (validation, auth, rate-limit) stay implicit. Drift
|
|
1003
|
+
between declared reasons and handler throws is caught by
|
|
1004
|
+
`../../test/auth/permit_offer_actions.error_reasons.test.ts`.
|
|
1005
|
+
|
|
960
1006
|
Failure-outcome audit events emitted (success and failure rows both carry
|
|
961
1007
|
`ip: ctx.client_ip` — uniform with the admin and self-service surfaces):
|
|
962
1008
|
|
|
@@ -14,6 +14,7 @@ import { type Account, type Actor, type CreateAccountInput, type AdminAccountEnt
|
|
|
14
14
|
* @param deps - query dependencies
|
|
15
15
|
* @param input - the account fields
|
|
16
16
|
* @returns the created account
|
|
17
|
+
* @mutates `account` table - inserts the new row
|
|
17
18
|
*/
|
|
18
19
|
export declare const query_create_account: (deps: QueryDeps, input: CreateAccountInput) => Promise<Account>;
|
|
19
20
|
/**
|
|
@@ -42,10 +43,14 @@ export declare const query_account_by_email: (deps: QueryDeps, email: string) =>
|
|
|
42
43
|
export declare const query_account_by_username_or_email: (deps: QueryDeps, input: string) => Promise<Account | undefined>;
|
|
43
44
|
/**
|
|
44
45
|
* Update the password hash for an account.
|
|
46
|
+
*
|
|
47
|
+
* @mutates `account` row - updates `password_hash`, `updated_at`, and `updated_by`
|
|
45
48
|
*/
|
|
46
49
|
export declare const query_update_account_password: (deps: QueryDeps, id: string, password_hash: string, updated_by: string | null) => Promise<void>;
|
|
47
50
|
/**
|
|
48
51
|
* Delete an account. Cascades to actors, permits, sessions, and tokens.
|
|
52
|
+
*
|
|
53
|
+
* @mutates `account` table and downstream FK rows - DELETE cascades through actors/permits/sessions/tokens
|
|
49
54
|
*/
|
|
50
55
|
export declare const query_delete_account: (deps: QueryDeps, id: string) => Promise<boolean>;
|
|
51
56
|
/**
|
|
@@ -59,6 +64,7 @@ export declare const query_account_has_any: (deps: QueryDeps) => Promise<boolean
|
|
|
59
64
|
* @param account_id - the owning account
|
|
60
65
|
* @param name - display name (defaults to account username)
|
|
61
66
|
* @returns the created actor
|
|
67
|
+
* @mutates `actor` table - inserts the new row
|
|
62
68
|
*/
|
|
63
69
|
export declare const query_create_actor: (deps: QueryDeps, account_id: string, name: string) => Promise<Actor>;
|
|
64
70
|
/**
|
|
@@ -79,6 +85,7 @@ export declare const query_actor_by_id: (deps: QueryDeps, id: string) => Promise
|
|
|
79
85
|
* @param deps - query dependencies
|
|
80
86
|
* @param input - the account fields
|
|
81
87
|
* @returns the created account and actor
|
|
88
|
+
* @mutates `account` and `actor` tables - inserts one row in each
|
|
82
89
|
*/
|
|
83
90
|
export declare const query_create_account_with_actor: (deps: QueryDeps, input: CreateAccountInput) => Promise<{
|
|
84
91
|
account: Account;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B
|
|
1
|
+
{"version":3,"file":"account_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,OAAO,kBAAkB,KACvB,OAAO,CAAC,OAAO,CAQjB,CAAC;AAEF;;GA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CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,GAC3C,MAAM,SAAS,EACf,OAAO,kBAAkB,KACvB,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAI1C,CAAC;AAyBF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,SAAS,KACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CA+EtC,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { to_admin_account, } from './account_schema.js';
|
|
|
14
14
|
* @param deps - query dependencies
|
|
15
15
|
* @param input - the account fields
|
|
16
16
|
* @returns the created account
|
|
17
|
+
* @mutates `account` table - inserts the new row
|
|
17
18
|
*/
|
|
18
19
|
export const query_create_account = async (deps, input) => {
|
|
19
20
|
const row = await deps.db.query_one(`INSERT INTO account (username, password_hash, email)
|
|
@@ -62,12 +63,16 @@ export const query_account_by_username_or_email = async (deps, input) => {
|
|
|
62
63
|
};
|
|
63
64
|
/**
|
|
64
65
|
* Update the password hash for an account.
|
|
66
|
+
*
|
|
67
|
+
* @mutates `account` row - updates `password_hash`, `updated_at`, and `updated_by`
|
|
65
68
|
*/
|
|
66
69
|
export const query_update_account_password = async (deps, id, password_hash, updated_by) => {
|
|
67
70
|
await deps.db.query(`UPDATE account SET password_hash = $1, updated_at = NOW(), updated_by = $2 WHERE id = $3`, [password_hash, updated_by ?? null, id]);
|
|
68
71
|
};
|
|
69
72
|
/**
|
|
70
73
|
* Delete an account. Cascades to actors, permits, sessions, and tokens.
|
|
74
|
+
*
|
|
75
|
+
* @mutates `account` table and downstream FK rows - DELETE cascades through actors/permits/sessions/tokens
|
|
71
76
|
*/
|
|
72
77
|
export const query_delete_account = async (deps, id) => {
|
|
73
78
|
const rows = await deps.db.query(`DELETE FROM account WHERE id = $1 RETURNING id`, [
|
|
@@ -89,6 +94,7 @@ export const query_account_has_any = async (deps) => {
|
|
|
89
94
|
* @param account_id - the owning account
|
|
90
95
|
* @param name - display name (defaults to account username)
|
|
91
96
|
* @returns the created actor
|
|
97
|
+
* @mutates `actor` table - inserts the new row
|
|
92
98
|
*/
|
|
93
99
|
export const query_create_actor = async (deps, account_id, name) => {
|
|
94
100
|
const row = await deps.db.query_one(`INSERT INTO actor (account_id, name) VALUES ($1, $2) RETURNING *`, [account_id, name]);
|
|
@@ -116,6 +122,7 @@ export const query_actor_by_id = async (deps, id) => {
|
|
|
116
122
|
* @param deps - query dependencies
|
|
117
123
|
* @param input - the account fields
|
|
118
124
|
* @returns the created account and actor
|
|
125
|
+
* @mutates `account` and `actor` tables - inserts one row in each
|
|
119
126
|
*/
|
|
120
127
|
export const query_create_account_with_actor = async (deps, input) => {
|
|
121
128
|
const account = await query_create_account(deps, input);
|
|
@@ -325,6 +325,7 @@ export declare const admin_session_revoke_all_action_spec: {
|
|
|
325
325
|
}, z.core.$strict>;
|
|
326
326
|
async: true;
|
|
327
327
|
description: string;
|
|
328
|
+
rate_limit: "account";
|
|
328
329
|
};
|
|
329
330
|
export declare const admin_token_revoke_all_action_spec: {
|
|
330
331
|
method: string;
|
|
@@ -343,6 +344,7 @@ export declare const admin_token_revoke_all_action_spec: {
|
|
|
343
344
|
}, z.core.$strict>;
|
|
344
345
|
async: true;
|
|
345
346
|
description: string;
|
|
347
|
+
rate_limit: "account";
|
|
346
348
|
};
|
|
347
349
|
export declare const audit_log_list_action_spec: {
|
|
348
350
|
method: string;
|
|
@@ -445,6 +447,7 @@ export declare const invite_create_action_spec: {
|
|
|
445
447
|
}, z.core.$strict>;
|
|
446
448
|
async: true;
|
|
447
449
|
description: string;
|
|
450
|
+
rate_limit: "account";
|
|
448
451
|
};
|
|
449
452
|
export declare const invite_list_action_spec: {
|
|
450
453
|
method: string;
|
|
@@ -487,6 +490,7 @@ export declare const invite_delete_action_spec: {
|
|
|
487
490
|
}, z.core.$strict>;
|
|
488
491
|
async: true;
|
|
489
492
|
description: string;
|
|
493
|
+
rate_limit: "account";
|
|
490
494
|
};
|
|
491
495
|
export declare const app_settings_get_action_spec: {
|
|
492
496
|
method: string;
|
|
@@ -530,6 +534,7 @@ export declare const app_settings_update_action_spec: {
|
|
|
530
534
|
}, z.core.$strict>;
|
|
531
535
|
async: true;
|
|
532
536
|
description: string;
|
|
537
|
+
rate_limit: "account";
|
|
533
538
|
};
|
|
534
539
|
/**
|
|
535
540
|
* All admin action specs — a codegen-ready registry. Consumers spread this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAczE,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAI5C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,uCAAuC;AACvC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAGjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,mGAAmG;AACnG,eAAO,MAAM,sBAAsB;;;;;;;;;kBAEjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,4CAA4C;AAC5C,eAA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AAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAI9E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUN,CAAC;AAEtC,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;CAUN,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;CAWZ,CAAC;AAEtC,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;CAWV,CAAC;AAEtC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUF,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUZ,CAAC;AAEtC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWD,CAAC;AAEtC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAUC,CAAC;AAEtC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;CAWD,CAAC;AAEtC,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;CAUJ,CAAC;AAEtC,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;CAWP,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,yBAAyB,CAYnE,CAAC"}
|
|
@@ -177,6 +177,7 @@ export const admin_session_revoke_all_action_spec = {
|
|
|
177
177
|
output: AdminSessionRevokeAllOutput,
|
|
178
178
|
async: true,
|
|
179
179
|
description: 'Revoke all sessions for an account. Admin-only.',
|
|
180
|
+
rate_limit: 'account',
|
|
180
181
|
};
|
|
181
182
|
export const admin_token_revoke_all_action_spec = {
|
|
182
183
|
method: 'admin_token_revoke_all',
|
|
@@ -188,6 +189,7 @@ export const admin_token_revoke_all_action_spec = {
|
|
|
188
189
|
output: AdminTokenRevokeAllOutput,
|
|
189
190
|
async: true,
|
|
190
191
|
description: 'Revoke all API tokens for an account. Admin-only.',
|
|
192
|
+
rate_limit: 'account',
|
|
191
193
|
};
|
|
192
194
|
export const audit_log_list_action_spec = {
|
|
193
195
|
method: 'audit_log_list',
|
|
@@ -221,6 +223,7 @@ export const invite_create_action_spec = {
|
|
|
221
223
|
output: InviteCreateOutput,
|
|
222
224
|
async: true,
|
|
223
225
|
description: 'Create an invite addressed to an email, username, or both. Admin-only.',
|
|
226
|
+
rate_limit: 'account',
|
|
224
227
|
};
|
|
225
228
|
export const invite_list_action_spec = {
|
|
226
229
|
method: 'invite_list',
|
|
@@ -243,6 +246,7 @@ export const invite_delete_action_spec = {
|
|
|
243
246
|
output: InviteDeleteOutput,
|
|
244
247
|
async: true,
|
|
245
248
|
description: 'Delete an unclaimed invite. Admin-only.',
|
|
249
|
+
rate_limit: 'account',
|
|
246
250
|
};
|
|
247
251
|
export const app_settings_get_action_spec = {
|
|
248
252
|
method: 'app_settings_get',
|
|
@@ -265,6 +269,7 @@ export const app_settings_update_action_spec = {
|
|
|
265
269
|
output: AppSettingsUpdateOutput,
|
|
266
270
|
async: true,
|
|
267
271
|
description: 'Update global app settings (currently just the open signup toggle). Admin-only.',
|
|
272
|
+
rate_limit: 'account',
|
|
268
273
|
};
|
|
269
274
|
/**
|
|
270
275
|
* All admin action specs — a codegen-ready registry. Consumers spread this
|
|
@@ -65,6 +65,7 @@ export type AdminActionDeps = Pick<RouteFactoryDeps, 'log' | 'on_audit_event' |
|
|
|
65
65
|
* @param deps - `AdminActionDeps` slice of `AppDeps` (`log`, `on_audit_event`, optional `audit_log_config`)
|
|
66
66
|
* @param options - role schema for `grantable_roles` derivation
|
|
67
67
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
68
|
+
* @mutates `options.app_settings` ref - `app_settings_update` writes `open_signup`, `updated_at`, and `updated_by` so signup middleware reads without a DB round trip
|
|
68
69
|
*/
|
|
69
70
|
export declare const create_admin_actions: (deps: AdminActionDeps, options?: AdminActionOptions) => Array<RpcAction>;
|
|
70
71
|
//# sourceMappingURL=admin_actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAuB,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAuB7E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AA8ChD,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,kBAAkB,CAAC,CAAC;AAEpG
|
|
1
|
+
{"version":3,"file":"admin_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAuB,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAuB7E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AA8ChD,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,kBAAkB,CAAC,CAAC;AAEpG;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,eAAe,EACrB,UAAS,kBAAuB,KAC9B,KAAK,CAAC,SAAS,CAmSjB,CAAC"}
|
|
@@ -47,6 +47,7 @@ import { admin_account_list_action_spec, admin_session_list_action_spec, admin_s
|
|
|
47
47
|
* @param deps - `AdminActionDeps` slice of `AppDeps` (`log`, `on_audit_event`, optional `audit_log_config`)
|
|
48
48
|
* @param options - role schema for `grantable_roles` derivation
|
|
49
49
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
50
|
+
* @mutates `options.app_settings` ref - `app_settings_update` writes `open_signup`, `updated_at`, and `updated_by` so signup middleware reads without a DB round trip
|
|
50
51
|
*/
|
|
51
52
|
export const create_admin_actions = (deps, options = {}) => {
|
|
52
53
|
const role_options = options.roles?.role_options ?? BUILTIN_ROLE_OPTIONS;
|
|
@@ -20,6 +20,7 @@ export interface ApiTokenQueryDeps extends QueryDeps {
|
|
|
20
20
|
* @param token_hash - blake3 hash of the raw token
|
|
21
21
|
* @param expires_at - optional expiration
|
|
22
22
|
* @returns the stored token record
|
|
23
|
+
* @mutates `api_token` table - inserts the new row keyed by `id`
|
|
23
24
|
*/
|
|
24
25
|
export declare const query_create_api_token: (deps: QueryDeps, id: string, account_id: string, name: string, token_hash: string, expires_at?: Date | null) => Promise<ApiToken>;
|
|
25
26
|
/**
|
|
@@ -34,6 +35,8 @@ export declare const query_create_api_token: (deps: QueryDeps, id: string, accou
|
|
|
34
35
|
* @param ip - the client IP address (for audit)
|
|
35
36
|
* @param pending_effects - optional array to register the usage-tracking effect for later awaiting
|
|
36
37
|
* @returns the token record if valid, or `undefined`
|
|
38
|
+
* @mutates `api_token` row - fire-and-forget UPDATE of `last_used_at` / `last_used_ip` on a valid token
|
|
39
|
+
* @mutates `pending_effects` - pushes the in-flight tracking promise when provided
|
|
37
40
|
*/
|
|
38
41
|
export declare const query_validate_api_token: (deps: ApiTokenQueryDeps, raw_token: string, ip: string | undefined, pending_effects: Array<Promise<void>> | undefined) => Promise<ApiToken | undefined>;
|
|
39
42
|
/**
|
|
@@ -42,6 +45,7 @@ export declare const query_validate_api_token: (deps: ApiTokenQueryDeps, raw_tok
|
|
|
42
45
|
* @param deps - query dependencies
|
|
43
46
|
* @param account_id - the account whose tokens to revoke
|
|
44
47
|
* @returns the number of tokens revoked
|
|
48
|
+
* @mutates `api_token` table - deletes every row for `account_id`
|
|
45
49
|
*/
|
|
46
50
|
export declare const query_revoke_all_api_tokens_for_account: (deps: QueryDeps, account_id: string) => Promise<number>;
|
|
47
51
|
/**
|
|
@@ -53,6 +57,7 @@ export declare const query_revoke_all_api_tokens_for_account: (deps: QueryDeps,
|
|
|
53
57
|
* @param id - the public token id
|
|
54
58
|
* @param account_id - the account that must own the token
|
|
55
59
|
* @returns `true` if a token was revoked, `false` if not found or wrong account
|
|
60
|
+
* @mutates `api_token` table - deletes the row when account ownership matches
|
|
56
61
|
*/
|
|
57
62
|
export declare const query_revoke_api_token_for_account: (deps: QueryDeps, id: string, account_id: string) => Promise<boolean>;
|
|
58
63
|
/**
|
|
@@ -75,6 +80,7 @@ export declare const query_api_token_list_for_account: (deps: QueryDeps, account
|
|
|
75
80
|
* @param account_id - the account to enforce the limit for
|
|
76
81
|
* @param max_tokens - maximum number of tokens to keep
|
|
77
82
|
* @returns the number of tokens evicted
|
|
83
|
+
* @mutates `api_token` table - deletes the oldest rows past the cap
|
|
78
84
|
*/
|
|
79
85
|
export declare const query_api_token_enforce_limit: (deps: QueryDeps, account_id: string, max_tokens: number) => Promise<number>;
|
|
80
86
|
//# sourceMappingURL=api_token_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_token_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/api_token_queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAGlD,yEAAyE;AACzE,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IACnD,GAAG,EAAE,MAAM,CAAC;CACZ;AAED
|
|
1
|
+
{"version":3,"file":"api_token_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/api_token_queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAGlD,yEAAyE;AACzE,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IACnD,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,SAAS,EACf,IAAI,MAAM,EACV,YAAY,MAAM,EAClB,MAAM,MAAM,EACZ,YAAY,MAAM,EAClB,aAAa,IAAI,GAAG,IAAI,KACtB,OAAO,CAAC,QAAQ,CAQlB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,iBAAiB,EACvB,WAAW,MAAM,EACjB,IAAI,MAAM,GAAG,SAAS,EACtB,iBAAiB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,KAC/C,OAAO,CAAC,QAAQ,GAAG,SAAS,CAuB9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uCAAuC,GACnD,MAAM,SAAS,EACf,YAAY,MAAM,KAChB,OAAO,CAAC,MAAM,CAMhB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,SAAS,EACf,IAAI,MAAM,EACV,YAAY,MAAM,KAChB,OAAO,CAAC,OAAO,CAMjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,SAAS,EACf,YAAY,MAAM,KAChB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAM7C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,GACzC,MAAM,SAAS,EACf,YAAY,MAAM,EAClB,YAAY,MAAM,KAChB,OAAO,CAAC,MAAM,CAYhB,CAAC"}
|
|
@@ -15,6 +15,7 @@ import { hash_api_token } from './api_token.js';
|
|
|
15
15
|
* @param token_hash - blake3 hash of the raw token
|
|
16
16
|
* @param expires_at - optional expiration
|
|
17
17
|
* @returns the stored token record
|
|
18
|
+
* @mutates `api_token` table - inserts the new row keyed by `id`
|
|
18
19
|
*/
|
|
19
20
|
export const query_create_api_token = async (deps, id, account_id, name, token_hash, expires_at) => {
|
|
20
21
|
const row = await deps.db.query_one(`INSERT INTO api_token (id, account_id, name, token_hash, expires_at)
|
|
@@ -34,6 +35,8 @@ export const query_create_api_token = async (deps, id, account_id, name, token_h
|
|
|
34
35
|
* @param ip - the client IP address (for audit)
|
|
35
36
|
* @param pending_effects - optional array to register the usage-tracking effect for later awaiting
|
|
36
37
|
* @returns the token record if valid, or `undefined`
|
|
38
|
+
* @mutates `api_token` row - fire-and-forget UPDATE of `last_used_at` / `last_used_ip` on a valid token
|
|
39
|
+
* @mutates `pending_effects` - pushes the in-flight tracking promise when provided
|
|
37
40
|
*/
|
|
38
41
|
export const query_validate_api_token = async (deps, raw_token, ip, pending_effects) => {
|
|
39
42
|
const token_hash = hash_api_token(raw_token);
|
|
@@ -61,6 +64,7 @@ export const query_validate_api_token = async (deps, raw_token, ip, pending_effe
|
|
|
61
64
|
* @param deps - query dependencies
|
|
62
65
|
* @param account_id - the account whose tokens to revoke
|
|
63
66
|
* @returns the number of tokens revoked
|
|
67
|
+
* @mutates `api_token` table - deletes every row for `account_id`
|
|
64
68
|
*/
|
|
65
69
|
export const query_revoke_all_api_tokens_for_account = async (deps, account_id) => {
|
|
66
70
|
const rows = await deps.db.query(`DELETE FROM api_token WHERE account_id = $1 RETURNING id`, [account_id]);
|
|
@@ -75,6 +79,7 @@ export const query_revoke_all_api_tokens_for_account = async (deps, account_id)
|
|
|
75
79
|
* @param id - the public token id
|
|
76
80
|
* @param account_id - the account that must own the token
|
|
77
81
|
* @returns `true` if a token was revoked, `false` if not found or wrong account
|
|
82
|
+
* @mutates `api_token` table - deletes the row when account ownership matches
|
|
78
83
|
*/
|
|
79
84
|
export const query_revoke_api_token_for_account = async (deps, id, account_id) => {
|
|
80
85
|
const rows = await deps.db.query(`DELETE FROM api_token WHERE id = $1 AND account_id = $2 RETURNING id`, [id, account_id]);
|
|
@@ -103,6 +108,7 @@ export const query_api_token_list_for_account = async (deps, account_id) => {
|
|
|
103
108
|
* @param account_id - the account to enforce the limit for
|
|
104
109
|
* @param max_tokens - maximum number of tokens to keep
|
|
105
110
|
* @returns the number of tokens evicted
|
|
111
|
+
* @mutates `api_token` table - deletes the oldest rows past the cap
|
|
106
112
|
*/
|
|
107
113
|
export const query_api_token_enforce_limit = async (deps, account_id, max_tokens) => {
|
|
108
114
|
const rows = await deps.db.query(`DELETE FROM api_token
|
|
@@ -12,6 +12,7 @@ import type { AppSettings, AppSettingsWithUsernameJson } from './app_settings_sc
|
|
|
12
12
|
*
|
|
13
13
|
* @param deps - query dependencies
|
|
14
14
|
* @returns the app settings row
|
|
15
|
+
* @throws Error if the singleton `app_settings` row is missing (migration drift — should not occur in practice)
|
|
15
16
|
*/
|
|
16
17
|
export declare const query_app_settings_load: (deps: QueryDeps) => Promise<AppSettings>;
|
|
17
18
|
/**
|
|
@@ -19,6 +20,7 @@ export declare const query_app_settings_load: (deps: QueryDeps) => Promise<AppSe
|
|
|
19
20
|
*
|
|
20
21
|
* @param deps - query dependencies
|
|
21
22
|
* @returns the app settings with `updated_by_username`
|
|
23
|
+
* @throws Error if the singleton `app_settings` row is missing
|
|
22
24
|
*/
|
|
23
25
|
export declare const query_app_settings_load_with_username: (deps: QueryDeps) => Promise<AppSettingsWithUsernameJson>;
|
|
24
26
|
/**
|
|
@@ -28,6 +30,8 @@ export declare const query_app_settings_load_with_username: (deps: QueryDeps) =>
|
|
|
28
30
|
* @param open_signup - new value for the open_signup toggle
|
|
29
31
|
* @param actor_id - the actor making the change
|
|
30
32
|
* @returns the updated app settings row
|
|
33
|
+
* @mutates `app_settings` row - sets `open_signup`, `updated_at`, and `updated_by`
|
|
34
|
+
* @throws Error if the singleton `app_settings` row is missing
|
|
31
35
|
*/
|
|
32
36
|
export declare const query_app_settings_update: (deps: QueryDeps, open_signup: boolean, actor_id: string) => Promise<AppSettings>;
|
|
33
37
|
//# sourceMappingURL=app_settings_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_settings_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/app_settings_queries.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAC,WAAW,EAAE,2BAA2B,EAAC,MAAM,0BAA0B,CAAC;AAEvF
|
|
1
|
+
{"version":3,"file":"app_settings_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/app_settings_queries.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAC,WAAW,EAAE,2BAA2B,EAAC,MAAM,0BAA0B,CAAC;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAAU,MAAM,SAAS,KAAG,OAAO,CAAC,WAAW,CAQlF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,GACjD,MAAM,SAAS,KACb,OAAO,CAAC,2BAA2B,CAWrC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,SAAS,EACf,aAAa,OAAO,EACpB,UAAU,MAAM,KACd,OAAO,CAAC,WAAW,CASrB,CAAC"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @param deps - query dependencies
|
|
12
12
|
* @returns the app settings row
|
|
13
|
+
* @throws Error if the singleton `app_settings` row is missing (migration drift — should not occur in practice)
|
|
13
14
|
*/
|
|
14
15
|
export const query_app_settings_load = async (deps) => {
|
|
15
16
|
const row = await deps.db.query_one(`SELECT open_signup, updated_at, updated_by FROM app_settings WHERE id = 1`);
|
|
@@ -23,6 +24,7 @@ export const query_app_settings_load = async (deps) => {
|
|
|
23
24
|
*
|
|
24
25
|
* @param deps - query dependencies
|
|
25
26
|
* @returns the app settings with `updated_by_username`
|
|
27
|
+
* @throws Error if the singleton `app_settings` row is missing
|
|
26
28
|
*/
|
|
27
29
|
export const query_app_settings_load_with_username = async (deps) => {
|
|
28
30
|
const row = await deps.db.query_one(`SELECT s.open_signup, s.updated_at, s.updated_by, act.name AS updated_by_username
|
|
@@ -41,6 +43,8 @@ export const query_app_settings_load_with_username = async (deps) => {
|
|
|
41
43
|
* @param open_signup - new value for the open_signup toggle
|
|
42
44
|
* @param actor_id - the actor making the change
|
|
43
45
|
* @returns the updated app settings row
|
|
46
|
+
* @mutates `app_settings` row - sets `open_signup`, `updated_at`, and `updated_by`
|
|
47
|
+
* @throws Error if the singleton `app_settings` row is missing
|
|
44
48
|
*/
|
|
45
49
|
export const query_app_settings_update = async (deps, open_signup, actor_id) => {
|
|
46
50
|
const row = await deps.db.query_one(`UPDATE app_settings SET open_signup = $1, updated_at = NOW(), updated_by = $2 WHERE id = 1 RETURNING open_signup, updated_at, updated_by`, [open_signup, actor_id]);
|
|
@@ -36,6 +36,8 @@ export declare const reset_audit_unknown_event_type_failures: () => void;
|
|
|
36
36
|
* @param input - the audit event to record
|
|
37
37
|
* @param config - audit-log config. Defaults to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
38
38
|
* @returns the inserted audit log row
|
|
39
|
+
* @mutates `audit_log` table - inserts the new row
|
|
40
|
+
* @mutates drift counters - bumps `audit_unknown_event_type_failures` and/or `audit_metadata_validation_failures` on mismatch
|
|
39
41
|
*/
|
|
40
42
|
export declare const query_audit_log: <T extends string>(deps: QueryDeps, input: AuditLogInput<T>, config?: AuditLogConfig) => Promise<AuditLogEvent>;
|
|
41
43
|
/**
|
|
@@ -77,6 +79,7 @@ export declare const query_audit_log_list_permit_history: (deps: QueryDeps, limi
|
|
|
77
79
|
* @param deps - query dependencies
|
|
78
80
|
* @param before - delete entries created before this date
|
|
79
81
|
* @returns the number of entries deleted
|
|
82
|
+
* @mutates `audit_log` table - deletes every row with `created_at < before`
|
|
80
83
|
*/
|
|
81
84
|
export declare const query_audit_log_cleanup_before: (deps: QueryDeps, before: Date) => Promise<number>;
|
|
82
85
|
/**
|
|
@@ -102,6 +105,8 @@ export type AuditLogFireAndForgetDeps = Pick<AppDeps, 'log' | 'on_audit_event' |
|
|
|
102
105
|
* @param input - the audit event to record
|
|
103
106
|
* @param deps - logger, `on_audit_event` callback, and optional `audit_log_config`
|
|
104
107
|
* @returns the settled promise (callers may ignore it)
|
|
108
|
+
* @mutates `audit_log` table - inserts a row via `background_db` (independent of the request transaction)
|
|
109
|
+
* @mutates `route.pending_effects` - pushes the in-flight settled promise for test flushing
|
|
105
110
|
*/
|
|
106
111
|
export declare const audit_log_fire_and_forget: <T extends string>(route: Pick<RouteContext, "background_db" | "pending_effects">, input: AuditLogInput<T>, deps: AuditLogFireAndForgetDeps) => Promise<void>;
|
|
107
112
|
//# sourceMappingURL=audit_log_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,MAAM,uBAAuB,CAAC;AAa/B,iFAAiF;AACjF,eAAO,MAAM,sCAAsC,QAAO,MACvB,CAAC;AAEpC,0CAA0C;AAC1C,eAAO,MAAM,wCAAwC,QAAO,IAE3D,CAAC;AAYF,gFAAgF;AAChF,eAAO,MAAM,qCAAqC,QAAO,MACvB,CAAC;AAEnC,0CAA0C;AAC1C,eAAO,MAAM,uCAAuC,QAAO,IAE1D,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"audit_log_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,8BAA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IAAI,CAC3C,OAAO,EACP,KAAK,GAAG,gBAAgB,GAAG,kBAAkB,CAC7C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,MAAM,EACzD,OAAO,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,iBAAiB,CAAC,EAC9D,OAAO,aAAa,CAAC,CAAC,CAAC,EACvB,MAAM,yBAAyB,KAC7B,OAAO,CAAC,IAAI,CAed,CAAC"}
|
|
@@ -57,6 +57,8 @@ export const reset_audit_unknown_event_type_failures = () => {
|
|
|
57
57
|
* @param input - the audit event to record
|
|
58
58
|
* @param config - audit-log config. Defaults to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
59
59
|
* @returns the inserted audit log row
|
|
60
|
+
* @mutates `audit_log` table - inserts the new row
|
|
61
|
+
* @mutates drift counters - bumps `audit_unknown_event_type_failures` and/or `audit_metadata_validation_failures` on mismatch
|
|
60
62
|
*/
|
|
61
63
|
export const query_audit_log = async (deps, input, config = BUILTIN_AUDIT_LOG_CONFIG) => {
|
|
62
64
|
if (!config.event_types.includes(input.event_type)) {
|
|
@@ -204,6 +206,7 @@ export const query_audit_log_list_permit_history = async (deps, limit = AUDIT_LO
|
|
|
204
206
|
* @param deps - query dependencies
|
|
205
207
|
* @param before - delete entries created before this date
|
|
206
208
|
* @returns the number of entries deleted
|
|
209
|
+
* @mutates `audit_log` table - deletes every row with `created_at < before`
|
|
207
210
|
*/
|
|
208
211
|
export const query_audit_log_cleanup_before = async (deps, before) => {
|
|
209
212
|
const rows = await deps.db.query(`DELETE FROM audit_log WHERE created_at < $1 RETURNING id`, [before.toISOString()]);
|
|
@@ -220,6 +223,8 @@ export const query_audit_log_cleanup_before = async (deps, before) => {
|
|
|
220
223
|
* @param input - the audit event to record
|
|
221
224
|
* @param deps - logger, `on_audit_event` callback, and optional `audit_log_config`
|
|
222
225
|
* @returns the settled promise (callers may ignore it)
|
|
226
|
+
* @mutates `audit_log` table - inserts a row via `background_db` (independent of the request transaction)
|
|
227
|
+
* @mutates `route.pending_effects` - pushes the in-flight settled promise for test flushing
|
|
223
228
|
*/
|
|
224
229
|
export const audit_log_fire_and_forget = (route, input, deps) => {
|
|
225
230
|
const { log, on_audit_event, audit_log_config = BUILTIN_AUDIT_LOG_CONFIG } = deps;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The two list-reads (`audit_log_list`, `audit_log_permit_history`) moved to
|
|
5
5
|
* RPC in `auth/admin_actions.ts`, and the admin session listing moved to
|
|
6
6
|
* `admin_session_list` on the same file. What remains here is the optional
|
|
7
|
-
* `GET /audit
|
|
7
|
+
* `GET /audit/stream` SSE route — streams aren't an action-kind, so they
|
|
8
8
|
* stay on REST. The event payload broadcast on the stream surfaces via
|
|
9
9
|
* `AUDIT_LOG_EVENT_SPECS` (one `EventSpec` per audit event type) declared
|
|
10
10
|
* alongside the broadcaster in `../realtime/sse_auth_guard.ts`.
|
|
@@ -20,7 +20,7 @@ export interface AuditLogRouteOptions {
|
|
|
20
20
|
/** Role required to access audit routes. Default `'admin'`. */
|
|
21
21
|
required_role?: string;
|
|
22
22
|
/**
|
|
23
|
-
* When provided, includes an SSE route at `/audit
|
|
23
|
+
* When provided, includes an SSE route at `/audit/stream` for realtime audit events.
|
|
24
24
|
* The `subscribe` function receives the stream, channels, and the subscriber's `account_id`
|
|
25
25
|
* as an identity key — enabling `close_by_identity()` for auth revocation.
|
|
26
26
|
*/
|