@fuzdev/fuz_app 0.150.0 → 0.152.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/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +9 -8
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -11,7 +11,7 @@ workspace-wide DI vocabulary: Skill(fuz-stack) §Dependency Injection.
|
|
|
11
11
|
|
|
12
12
|
**CLAUDE.md is a map; TSDoc is the detail.** Per-symbol semantics
|
|
13
13
|
(parameters, error shapes, invariants, fire-and-forget contracts) live on
|
|
14
|
-
TSDoc next to the code. This file orients you across the
|
|
14
|
+
TSDoc next to the code. This file orients you across the modules and
|
|
15
15
|
documents the cross-cutting invariants that don't fit on any single symbol.
|
|
16
16
|
|
|
17
17
|
## AppDeps split
|
|
@@ -62,14 +62,15 @@ Convention — `*_schema.ts` is Zod-only; `*_ddl.ts` holds DDL strings.
|
|
|
62
62
|
- `auth/credential_type_schema.ts` — `CredentialTypeName`, `CREDENTIAL_TYPE_SESSION` / `_API_TOKEN` / `_DAEMON_TOKEN`, `create_credential_type_schema`.
|
|
63
63
|
- `auth/grant_path_schema.ts` — `GrantPathName`, `GRANT_PATH_ADMIN` / `_SELF_SERVICE` / `_SYSTEM` / `_BOOTSTRAP`, `create_grant_path_schema`.
|
|
64
64
|
- `auth/token_lifetime.ts` — the temporal axis of a minted token: `TokenLifetimeInput` (required union on `account_token_create` — `{kind:'eternal'}` or `{kind:'ttl', days}`), `token_lifetime_to_expires_at`, `TOKEN_TTL_DAYS_MAX`. No default — `expires_at IS NULL` always means "deliberately eternal".
|
|
65
|
-
- `auth/token_scope.ts` — per-credential authority narrowing stored on `api_token.scope`: `TokenScope` / `TokenScopeInput` + constructors, `parse_stored_token_scope` (fail-closed), `token_scope_admits_method` / `_non_rpc`, and the `<section>:<id>` capability vocabulary `
|
|
65
|
+
- `auth/token_scope.ts` — per-credential authority narrowing stored on `api_token.scope`: `TokenScope` / `TokenScopeInput` + constructors, `parse_stored_token_scope` (fail-closed), `token_scope_admits_method` / `_non_rpc`, and the `<section>:<id>` capability vocabulary (`token_scope_method_capability` for the dispatcher's `rpc:<method>`, `is_route_scope_capability` for the `surface:<name>` a `RouteAuth.required_scope` may declare, `token_scope_denied_body`, `TOKEN_SURFACES`). Not an open registry — see ../../../docs/security.md §Token scoping for why the identifier half is deliberately unregistered.
|
|
66
66
|
- `auth/auth_ddl.ts` — `CREATE TABLE` / index / seed strings for the core identity tables.
|
|
67
|
-
- `auth/audit_log_schema.ts` — `AUDIT_EVENT_TYPES` (
|
|
67
|
+
- `auth/audit_log_schema.ts` — `AUDIT_EVENT_TYPES` (the builtin event types), `AuditEventType` / `AuditEventTypeName`, `audit_metadata_schemas`, `AuditLogEvent`, `AuditLogInput`, `AuditLogConfig`, `create_audit_log_config`.
|
|
68
68
|
- `auth/audit_log_ddl.ts` — `audit_log` table DDL with `seq BIGSERIAL` for cursor-based gap fill (BIGSERIAL converges with the Rust spine; `create_db` registers a `pg.types` int8 parser so `seq` still reads as a JS number).
|
|
69
69
|
- `auth/invite_schema.ts` — `Invite`, `CreateInviteInput`.
|
|
70
70
|
- `auth/app_settings_schema.ts` — `AppSettings`, `UpdateAppSettingsInput` (single-row via `CHECK (id = 1)`).
|
|
71
71
|
- `auth/role_grant_offer_schema.ts` — `RoleGrantOffer`, `RoleGrantOfferJson`, `to_role_grant_offer_json`, scope-sentinel constants.
|
|
72
72
|
- `auth/role_grant_offer_ddl.ts` — `role_grant_offer` table + indexes + `ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID` / `_GLOBAL_TOKEN` + `ROLE_GRANT_OFFER_COLUMNS` and the shared `ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT` CTE tail (homed here per the placement rule in `db/sql_columns.ts`).
|
|
73
|
+
- `auth/role_grant_sql.ts` — the liveness predicates every grant and offer read shares: `role_grant_active_sql(alias)` (not revoked, not expired) and `offer_pending_predicate(alias)` (every `OFFER_TERMINAL_COLUMNS` entry null), twins of the Rust spine's. The frozen partial-index DDL keeps its literal text.
|
|
73
74
|
- `auth/role_grant_offer_notifications.ts` — six WS notification specs for the consentful-grant lifecycle.
|
|
74
75
|
|
|
75
76
|
### Queries
|
|
@@ -133,9 +134,9 @@ its registered listeners + optional `AuditLogConfig`. Its methods:
|
|
|
133
134
|
- `is_tracking_inflight()` — whether the emitter was built with `track_inflight: true`, i.e. whether `drain_inflight` can wait on anything. `_testing_drain_effects` reports it as `tracked`, and `cross_drain_effects` (every `list_audit_events` read) refuses `false` (twin of Rust `AuditEmitter::is_tracking_inflight`)
|
|
134
135
|
|
|
135
136
|
Listeners are closure-private; they change only through `add_listener` and
|
|
136
|
-
its removers. `create_app_server` registers the audit-log SSE listener
|
|
137
|
-
|
|
138
|
-
so SSE
|
|
137
|
+
its removers. `create_app_server` registers the audit-log SSE listener and the
|
|
138
|
+
one revocation guard (`create_revocation_guard`) via `add_listener`
|
|
139
|
+
so SSE fan-out and revocation closes compose on top of the consumer's `on_audit_event` callback
|
|
139
140
|
without shallow-copying `AppDeps`, and removes them when its assembly fails or
|
|
140
141
|
`AppServer.close` runs — the emitter outlives any one server on its backend.
|
|
141
142
|
`notify` iterates a snapshot so a listener registered mid-fan-out fires only on
|
|
@@ -165,8 +166,8 @@ both satisfy it.
|
|
|
165
166
|
successful row invalidates (`RevocationScope`: `none` / `session` / `token` /
|
|
166
167
|
`account` / `role`), and `to_revocation_scope(event_type)` reads it (an unknown
|
|
167
168
|
event type is `none`). Typed over `AuditEventType`, so a new event type does not
|
|
168
|
-
compile until it declares its scope.
|
|
169
|
-
(`
|
|
169
|
+
compile until it declares its scope. The revocation listener
|
|
170
|
+
(`create_revocation_guard`, `actions/connection_closer.ts`) dispatches on it. Twin of the
|
|
170
171
|
`revocation_scope` column on the Rust `AUDIT_EVENT_SPECS`.
|
|
171
172
|
|
|
172
173
|
**Drift counters** (`auth/audit_log_queries.ts`) — `audit_metadata_validation_failures`
|
|
@@ -183,7 +184,7 @@ counted, the request proceeds — so the count is how a lost row is seen.
|
|
|
183
184
|
- `auth/account_routes.ts` — `POST /login` / `/logout` / `/password`, `GET /verify` (nginx `auth_request` shim), `GET /api/account/status`. Constants: `DEFAULT_MAX_SESSIONS = 5`, `DEFAULT_MAX_TOKENS = 10`, `DEFAULT_LOGIN_FAIL_FLOOR_MS = 250`, `DEFAULT_LOGIN_FAIL_JITTER_MS = 25`.
|
|
184
185
|
- `auth/bootstrap_routes.ts` — `POST /bootstrap` + `check_bootstrap_status`; `BootstrapStatus` runtime ref.
|
|
185
186
|
- `auth/signup_routes.ts` — `POST /signup` (open or invite-gated).
|
|
186
|
-
- `auth/audit_log_routes.ts` — optional `GET /audit/stream` (SSE); list/history are on the RPC surface. Takes `stream: {registry, log}` (an `AuditLogSse` satisfies it). The handler admits the stream in two phases — register pending on the `
|
|
187
|
+
- `auth/audit_log_routes.ts` — optional `GET /audit/stream` (SSE); list/history are on the RPC surface. Takes `stream: {registry, log}` (an `AuditLogSse` satisfies it). The handler admits the stream in two phases — register pending on the `SseRegistry`, re-read the credential (`revalidate_resolved_auth`) and the acting actor's role grants, admit — so a revocation racing the request opens no stream: 401 / 403 from the re-reads, or a 200 whose body is the connect comment alone when the pending registration was closed.
|
|
187
188
|
- `auth/auth_guard_resolver.ts` — `fuz_auth_guard_resolver` injected into `apply_route_specs` so the framework stays auth-agnostic. Maps each `RouteAuth` axis to a guard and is the single site every route spec traverses, so it also carries the two invariants the schema can't (a `required_scope` that isn't a well-formed capability, and one on an unrestricted route).
|
|
188
189
|
|
|
189
190
|
**Hono-free route shapes.** Each cookie/SSE-coupled route module has a sibling
|
|
@@ -203,9 +204,13 @@ same reason (the RPC `account_actions` reads `DEFAULT_MAX_TOKENS`).
|
|
|
203
204
|
|
|
204
205
|
**`POST /login` timing floor.** Login 401s are floored to
|
|
205
206
|
`DEFAULT_LOGIN_FAIL_FLOOR_MS` (250ms) + uniform jitter (±25ms) via
|
|
206
|
-
`
|
|
207
|
+
`start_fail_floor` (`auth/fail_floor.ts`, shared with signup's 403 / 409
|
|
208
|
+
floor; twin of the Rust `fuz_auth::timing`), started before the work and
|
|
209
|
+
awaited after, so observed time is `max(work, delay)` and
|
|
207
210
|
found-wrong-password and not-found paths converge. 429 stays fast by design;
|
|
208
|
-
`verify_dummy` equalizes Argon2id timing on not-found.
|
|
211
|
+
`verify_dummy` equalizes Argon2id timing on not-found. A floor of `0` or less
|
|
212
|
+
is announced once per process on stderr by `warn_if_fail_floor_disabled`
|
|
213
|
+
(`LOGIN_` / `SIGNUP_FAIL_FLOOR_DISABLED_BANNER`, the Rust spine's text).
|
|
209
214
|
|
|
210
215
|
**`POST /password` revokes everything.** Revokes all sessions + all API
|
|
211
216
|
tokens (force re-auth everywhere), then clears the session cookie. Declares
|
|
@@ -224,13 +229,13 @@ Everything else listed under §RPC action surfaces.
|
|
|
224
229
|
|
|
225
230
|
### Middleware
|
|
226
231
|
|
|
227
|
-
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, session, request_context, bearer_auth]`
|
|
228
|
-
- `auth/request_context.ts` — `RequestContext`, `resolve_acting_actor`, `build_request_context`, predicates (`
|
|
232
|
+
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, daemon_token?, session, request_context, bearer_auth]`, the `daemon_token` layer only when given a `daemon_token_state` — the credential legs in the Rust spine's `resolve_auth_from_headers` order, daemon token → session cookie → bearer, the first that authenticates setting `ResolvedAuth` and the later ones skipping. The chain starts from a clean slate: the first leg composed — the daemon token's, else the session's (`create_request_context_middleware`'s `starts_chain`, which the stack sets `false` behind the daemon leg) — clears `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the stack can't pre-set an identity every leg would skip past, and debug-logs a clear that finds one — the trace of a hand-built chain whose session leg sits behind its own earlier leg without `starts_chain: false` (the content-type refusal isn't a middleware: `apply_route_specs` checks every `POST` route, see `http/simple_request.ts`). The origin check mounts on every path (`ORIGIN_MIDDLEWARE_PATH`, `'*'`), less its `origin_carve_outs` — each a `MiddlewareCarveOut` (`{path, reason}`, copied and frozen at assembly by `freeze_origin_carve_outs`, refused by `assert_origin_carve_outs_valid` without a reason or when it overlaps the auth scope — `middleware_paths_overlap` against `AUTH_MIDDLEWARE_PATH`, which holds every credential-reading and credential-minting route — and recorded on the origin spec so the surface leaves its `403` off the carved routes); `AUTH_MIDDLEWARE_PATH` (`'/api/*'`) is where `create_app_server` mounts the rest of the stack; assembly asserts lean on it: `assert_endpoint_in_auth_scope` (an `rpc_endpoints` / `ws_endpoints` path, or the bootstrap route under `bootstrap.route_prefix`, must sit inside it — so no carve-out can reach one), `assert_credential_routes_in_auth_scope(route_specs)` (every registered route that reads a credential — `auth.account` not `'none'`, or marked `reads_credential`, as account status is — or is marked `mints_credential` — login, signup, bootstrap — must sit inside it too, so a consumer prefixing the relative account or signup specs outside `/api/` is refused), and `assert_middleware_stack_mounted(stack_specs, middleware_specs)`, run on a `transform_middleware` result against the pre-transform stack (`[proxy, ...auth]`) — each stack spec, matched by its `handler` closure (not its spoofable `name`), mounted exactly once at its original path (`'*'` for the trusted proxy and the origin check, `AUTH_MIDDLEWARE_PATH` for the rest of auth), in its original order; other specs may sit anywhere, including before the proxy and between the auth layers. The proxy is in the stack because dropping it turns every `get_client_ip` into `'unknown'`, one shared bucket for every IP-keyed limiter. The transform receives shallow copies in a fresh array, so an in-place mutation can't rewrite the originals the check reads. The check pins where those layers sit, not what added layers do — a layer you add runs with full context access. Both run in `create_test_app_surface_spec` too.
|
|
233
|
+
- `auth/request_context.ts` — `RequestContext`, `resolve_acting_actor`, `build_request_context`, predicates (`has_scoped_role`, `has_any_scoped_role` — the dispatcher's role gate and every builtin-role check read the **global** grant via `has_scoped_role(_, role, null)` / `has_any_scoped_role(_, roles, null)`), guards (`require_auth`, `require_role`, `require_credential_types`, `require_token_scope`), `token_scope_surface_denial` (the direct-call form, for surfaces that aren't route specs), `get_public_account_id` (the account id a `reads_credential` route may read — `null` for a scope-narrowed token, which such a route answers as anonymous; twin of the Rust `AuthGate::public_request_context` downgrade), `refresh_role_grants`.
|
|
229
234
|
- `auth/session_middleware.ts` — `process_session_cookie` integration, `create_session_and_set_cookie` (shared by login / signup / bootstrap; returns the token hashes of the sessions the cap evicted, which the caller closes after its commit — only login passes a cap).
|
|
230
|
-
- `auth/resolved_auth.ts` — `ResolvedAuth
|
|
231
|
-
- `auth/credential_deadline.ts` — when a resolved credential stops authenticating, which a WebSocket or audit stream opened on it closes at (expiry writes nothing a revocation listener hears): `credential_deadline_after` (the earliest remaining lifetime, anchored to `performance.now()`), `EXPIRES_IN_MS_SQL` (a row's `expires_at - NOW()`, read on the database clock in the statement that checks it, so the session and token validation queries return `expires_in_ms`), and `schedule_credential_deadline` (a chain of timers of at most `CREDENTIAL_DEADLINE_TIMER_CAP_MS`, an hour — a 30-day session is past `setTimeout`'s ceiling — each wake-up also checking a wall-clock copy of the deadline, so a host suspend, which stops the monotonic clock, delays the close by at most one timer after the resume). The middleware sets `
|
|
232
|
-
- `auth/bearer_auth.ts` — soft-fail bearer middleware; rejects when `Origin` or `Referer` present (browser context), and soft-fails a value that is not `is_api_token_shaped` before any query. The scope it sets is the one the query parsed — there is no fallback.
|
|
233
|
-
- `auth/daemon_token_middleware.ts` — `create_daemon_token_middleware(state, deps, log)` — the credential **consumer** only (soft-fail validation, keeper account resolution). The producer (`write_daemon_token` / `start_daemon_token_rotation`) lives in `testing/daemon_token_rotation.ts` behind the dev-env guard — no production assembly mints daemon tokens, mirroring the Rust spine's `fuz_testing`-confined producer. Soft-fails — discards the credential (pass-through, no own 401/503) on **every** non-success path: browser context (`Origin`/`Referer` present), malformed/invalid token, and valid-token-but-no-keeper all `next()` through to the dispatcher's `credential_type_required` (403) gate, mirroring the bearer guard and the Rust spine's `resolve.rs`. Daemon tokens are loopback-only, so browser context never arises in practice — the discard is defense-in-depth.
|
|
235
|
+
- `auth/resolved_auth.ts` — `ResolvedAuth`, the resolved credential as one value — a union on `credential_type`, each arm carrying only its own fields: `session` (`account_id`, `session_hash`, `credential_deadline`), `api_token` (`account_id`, `api_token_id`, `scope`, `credential_deadline`), `daemon_token` (`account_id`, `credential_deadline: null`); `get_resolved_auth(c)` (reads it off `RESOLVED_AUTH_KEY`, the one context key every auth leg writes); the accessors `resolved_auth_scope` (an API token's scope, `full` for a session or daemon token, `null` for anonymous — every token-scope gate reads it), `resolved_auth_session_hash`, and `resolved_auth_api_token_id`; and `revalidate_resolved_auth(deps, resolved)`, the no-touch re-read a long-lived connection runs once it is registered: session row / token row (by id) still live and still on the account, account not soft-deleted; a daemon token re-reads its account only. Reuses the middleware's own queries and predicates. Called by the WS socket session (`actions/ws_socket_session.ts`) and the audit SSE route between registering a connection pending and admitting it. Twin of the Rust `revalidate_resolved_auth`.
|
|
236
|
+
- `auth/credential_deadline.ts` — when a resolved credential stops authenticating, which a WebSocket or audit stream opened on it closes at (expiry writes nothing a revocation listener hears): `credential_deadline_after` (the earliest remaining lifetime, anchored to `performance.now()`), `EXPIRES_IN_MS_SQL` (a row's `expires_at - NOW()`, read on the database clock in the statement that checks it, so the session and token validation queries return `expires_in_ms`), and `schedule_credential_deadline` (a chain of timers of at most `CREDENTIAL_DEADLINE_TIMER_CAP_MS`, an hour — a 30-day session is past `setTimeout`'s ceiling — each wake-up also checking a wall-clock copy of the deadline, so a host suspend, which stops the monotonic clock, delays the close by at most one timer after the resume). The middleware sets it on `ResolvedAuth.credential_deadline`: session — the earlier of the cookie's signed expiry (`SESSION_COOKIE_EXPIRES_AT_KEY`, set by the session middleware) and the row's; bearer — the row's, none for an eternal token; daemon token — none. Twin of the Rust `ResolvedAuth::credential_deadline`.
|
|
237
|
+
- `auth/bearer_auth.ts` — soft-fail bearer middleware; rejects when `Origin` or `Referer` present (browser context), and soft-fails a value that is not `is_api_token_shaped` before any query. The scope it sets is the one the query parsed — there is no fallback. The last credential leg: it skips before reading the header when the daemon token or a session already resolved the request, so a bearer sent beside one is never looked up and its `last_used_at` / `last_used_ip` never move.
|
|
238
|
+
- `auth/daemon_token_middleware.ts` — `create_daemon_token_middleware(state, deps, log)` — the credential **consumer** only (soft-fail validation, keeper account resolution). The producer (`write_daemon_token` / `start_daemon_token_rotation`) lives in `testing/daemon_token_rotation.ts` behind the dev-env guard — no production assembly mints daemon tokens, mirroring the Rust spine's `fuz_testing`-confined producer. Soft-fails — discards the credential (pass-through, no own 401/503) on **every** non-success path: browser context (`Origin`/`Referer` present), malformed/invalid token, and valid-token-but-no-keeper all `next()` through to the dispatcher's `credential_type_required` (403) gate, mirroring the bearer guard and the Rust spine's `resolve.rs`. Daemon tokens are loopback-only, so browser context never arises in practice — the discard is defense-in-depth. The first credential leg, so it clears `RESOLVED_AUTH_KEY` on entry; a valid daemon token sets the `daemon_token` arm, and the session and bearer legs after it skip, so a cookie or bearer sent beside it is never looked up — as on the Rust spine, whose resolve walk never reads the cookie. A discarded daemon token falls through to them.
|
|
234
239
|
|
|
235
240
|
See root ../../../CLAUDE.md §Middleware Ordering for canonical assembly
|
|
236
241
|
order. The auth-specific invariants are described below in §Cross-cutting
|
|
@@ -241,7 +246,8 @@ invariants.
|
|
|
241
246
|
The cell content primitive's wire schemas, RPC handlers, and authz live
|
|
242
247
|
here; the schema + queries live in `db/` (see `db/CLAUDE.md` §Cell layer).
|
|
243
248
|
Generic-only — no app vocabulary on the wire; per-kind shape is the
|
|
244
|
-
consumer's `validate_data`
|
|
249
|
+
consumer's `validate_data(kind, data)` callback on `CellActionDeps`, which
|
|
250
|
+
accepts or throws and never rewrites (the handler stores the caller's `data`).
|
|
245
251
|
|
|
246
252
|
- `auth/cell_data_schema.ts` — `CellData` base (`z.looseObject` with
|
|
247
253
|
optional `label` / `summary`); per-kind sub-API extends it. **`kind` is
|
|
@@ -262,8 +268,8 @@ moderate / policy_set`), error reasons, and `all_cell_action_specs`
|
|
|
262
268
|
verdict + the `cell_moderate` verb, never in `data`).
|
|
263
269
|
- `auth/cell_grant_action_specs.ts` / `cell_field_action_specs.ts` /
|
|
264
270
|
`cell_item_action_specs.ts` / `cell_audit_action_specs.ts` — the
|
|
265
|
-
`cell_grant_*`
|
|
266
|
-
|
|
271
|
+
`cell_grant_*` / `cell_field_*` / `cell_item_*` / `cell_audit_list`
|
|
272
|
+
specs + their wire JSON shapes.
|
|
267
273
|
- `auth/cell_authorize.ts` — pure predicates over
|
|
268
274
|
`(RequestContext | null, CellRow, grants)`: `can_view_cell`,
|
|
269
275
|
`can_edit_cell`, and `can_manage_cell` (= admin ‖ owner, where owner is
|
|
@@ -317,8 +323,8 @@ auth, ids)`: two queries for the whole id-set, the cells read through the
|
|
|
317
323
|
create — a denial is the same 403 `cell_create_forbidden`, so clone is no
|
|
318
324
|
side door past the creation policy. The optional
|
|
319
325
|
parent-aware `authorize_create` dep (`CellCreateAuthorize` — an object whose
|
|
320
|
-
`authorize` takes a wider input `{kind, data, parent_id,
|
|
321
|
-
|
|
326
|
+
`authorize` takes a wider input `{kind, data, parent_id, parent_kind,
|
|
327
|
+
root_id, root_policy}` than `validate_data` and returns a `CellCreateVerdict`
|
|
322
328
|
`{allow:false} | {allow:true, moderation_required}`, and whose optional
|
|
323
329
|
`validate_policy` accepts or refuses a root policy write)
|
|
324
330
|
gates create by capability; it runs after the validator + the parent-resolve
|
|
@@ -327,10 +333,11 @@ scope_id}` than `validate_data` and returns a `CellCreateVerdict`
|
|
|
327
333
|
A **viewable**-parent / root-creation deny is **403** `cell_create_forbidden`
|
|
328
334
|
(the create-path **404** mask is reserved for a hidden parent); `Allow` folds
|
|
329
335
|
the moderation outcome (born `pending`+private vs `approved`+author-visibility).
|
|
330
|
-
The
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
336
|
+
The handler reads the governing root in-tx and hands its `policy` column
|
|
337
|
+
over as `root_policy`, so a directory policy resolves `root_policy[kind]`
|
|
338
|
+
without a DB read; an authorizer needing more reads through its third
|
|
339
|
+
argument, the request `ctx` (`ctx.db` is the request transaction), and only
|
|
340
|
+
reads. `None`/omitted = open
|
|
334
341
|
create (the default; mirrors `validate_data`), and every non-null policy write
|
|
335
342
|
refused `cell_policy_unsupported`. A root's `policy` (a JSON object, roots only
|
|
336
343
|
by table CHECK, opaque to the spine, readable on `CellJson`) is set at a
|
|
@@ -349,6 +356,12 @@ scope_id}` than `validate_data` and returns a `CellCreateVerdict`
|
|
|
349
356
|
(visibility untouched). The write carries the from-state: approve moves only
|
|
350
357
|
a pending contribution, reject a pending or approved one (the takedown); any
|
|
351
358
|
other transition answers 400 `cell_not_pending`.
|
|
359
|
+
- `auth/cell_action_helpers.ts` — the cell verbs' shared gates, each loading
|
|
360
|
+
the cell and 404-masking a miss and a denial alike
|
|
361
|
+
(`require_viewable_cell` — `auth` may be `null`, which reads no grants —
|
|
362
|
+
`require_editable_cell`, `require_manageable_cell`), plus
|
|
363
|
+
`cell_not_found_error` and `emit_cell_audit(ctx, audit, auth, event_type,
|
|
364
|
+
metadata)`. Twins of the Rust `fuz_cell_actions` helpers.
|
|
352
365
|
- `auth/cell_ref_admission.ts` — `require_new_refs_held`, the
|
|
353
366
|
possession gate `cell_create` / `cell_update` / `cell_clone` run last before
|
|
354
367
|
their write: a non-admin write introducing a fact ref (beyond the cell's
|
|
@@ -364,6 +377,13 @@ scope_id}` than `validate_data` and returns a `CellCreateVerdict`
|
|
|
364
377
|
optional `authorize_grant_create` (`CellGrantCreateAuthorize`), asked of a
|
|
365
378
|
manager after the spine's gates and before the write (a level change too);
|
|
366
379
|
`false` is 403 `cell_grant_not_authorized`, nothing written.
|
|
380
|
+
`cell_grant_revoke` takes an optional `authorize_grant_revoke`
|
|
381
|
+
(`CellGrantRevokeAuthorize`), the steward widening: asked only of a caller
|
|
382
|
+
who neither manages the cell nor holds the grant, for a role-shaped grant
|
|
383
|
+
with a `scope_id`; `true` revokes (audit `steward: true`) with a delete
|
|
384
|
+
matching the level it saw, `false` keeps the 404 mask. Both callbacks, like
|
|
385
|
+
the create authorizer and the offer callback, take the request `ctx` last —
|
|
386
|
+
`ctx.db` is the request transaction — and must only read through it.
|
|
367
387
|
- `auth/all_cell_actions.ts` — `create_all_cell_actions(deps, {roles})`, the
|
|
368
388
|
handler-side twin of `all_cell_action_specs` and sibling of
|
|
369
389
|
`create_standard_rpc_actions`: bundles all five cell factories (CRUD + grant
|
|
@@ -392,7 +412,7 @@ The things that span multiple files and don't fit on any one symbol's TSDoc.
|
|
|
392
412
|
### Two-phase identity
|
|
393
413
|
|
|
394
414
|
**Authentication runs in middleware** (session / bearer / daemon token).
|
|
395
|
-
Sets `
|
|
415
|
+
Sets one `ResolvedAuth` (`RESOLVED_AUTH_KEY`) on a valid credential.
|
|
396
416
|
Account-only — never loads actor or role_grants, never populates
|
|
397
417
|
`REQUEST_CONTEXT_KEY`.
|
|
398
418
|
|
|
@@ -416,9 +436,8 @@ stay distinct: `no_actors_on_account` (signup invariant violation),
|
|
|
416
436
|
`account_vanished` (torn read after resolve).
|
|
417
437
|
|
|
418
438
|
**Production-middleware invariant.** No production middleware on the auth
|
|
419
|
-
path populates `REQUEST_CONTEXT_KEY`; it sets only `
|
|
420
|
-
|
|
421
|
-
`AUTH_API_TOKEN_ID_KEY`. Test harnesses pre-populate `REQUEST_CONTEXT_KEY` +
|
|
439
|
+
path populates `REQUEST_CONTEXT_KEY`; it sets only `RESOLVED_AUTH_KEY`. Test
|
|
440
|
+
harnesses pre-populate `REQUEST_CONTEXT_KEY` +
|
|
422
441
|
`TEST_CONTEXT_PRESET_KEY` to bypass DB-backed actor resolution; production
|
|
423
442
|
code that reads `REQUEST_CONTEXT_KEY` is reading test escape-hatch state.
|
|
424
443
|
|
|
@@ -505,8 +524,8 @@ list queries, the `audit_log_list` RPC, and SSE identically to builtins.
|
|
|
505
524
|
`AuditLogEvent.event_type` / `AuditLogEventJson.event_type` / the
|
|
506
525
|
`audit_log_list` filter input are all `AuditEventTypeName` (regex-validated
|
|
507
526
|
string) — widened from the closed enum so consumer rows round-trip. The
|
|
508
|
-
write side (`AuditLogInput<T>`, `AuditMetadataMap`) stays closed-enum so
|
|
509
|
-
|
|
527
|
+
write side (`AuditLogInput<T>`, `AuditMetadataMap`) stays closed-enum so a
|
|
528
|
+
builtin event's metadata narrows by its type.
|
|
510
529
|
|
|
511
530
|
### `AUDIT_EVENT_TYPES` builtins
|
|
512
531
|
|
|
@@ -561,9 +580,12 @@ in the HTTP RPC dispatcher (`actions/action_rpc.ts`), the WS dispatcher
|
|
|
561
580
|
|
|
562
581
|
Schema migrations live in `auth/migrations.ts` — a frozen, append-only chain
|
|
563
582
|
(`full_auth_schema` first, every later change its own appended entry) under
|
|
564
|
-
the single reserved namespace `
|
|
565
|
-
entry twinned byte-for-byte by name on the Rust spine.
|
|
566
|
-
`reserved_migration_namespaces
|
|
583
|
+
the single reserved namespace `'fuz_auth'` (`AUTH_MIGRATION_NS`), each
|
|
584
|
+
entry twinned byte-for-byte by name on the Rust spine. `db/migrate.ts`'s
|
|
585
|
+
`reserved_migration_namespaces` lists the spine's names (`fuz_auth`, `fuz_cell`,
|
|
586
|
+
`fuz_facts`); `run_migrations` and `baseline` refuse a namespace bearing one
|
|
587
|
+
unless it is the spine's own object (`AUTH_MIGRATION_NS`, `CELL_MIGRATION_NS`,
|
|
588
|
+
`FACT_MIGRATION_NS`, each built by `create_spine_migration_namespace`). Runner contract, error vocabulary, and
|
|
567
589
|
operator recipes (rename, mark applied, reset, baseline) are in
|
|
568
590
|
../../../docs/migrations.md.
|
|
569
591
|
|
|
@@ -609,7 +631,10 @@ are excluded.
|
|
|
609
631
|
compose `account_session_list` + N×revoke to reach the same lockout.
|
|
610
632
|
`role_grant_offer_accept` and `self_service_role_set` carry the gate for
|
|
611
633
|
the privilege-pivot shape — both move the caller's own authority, and the
|
|
612
|
-
resulting grant outlives revoking the token.
|
|
634
|
+
resulting grant outlives revoking the token. `role_grant_offer_create`
|
|
635
|
+
carries it for the same pivot onto another account (a leaked bearer offers a
|
|
636
|
+
role to an account its holder controls); scripted conferral is
|
|
637
|
+
`role_grant_assign`'s.
|
|
613
638
|
REST `POST /logout` also declares `credential_types: ['session']`, but
|
|
614
639
|
for forensic fidelity rather than a threat — a bearer / daemon token
|
|
615
640
|
holds no session to end, so the gate refuses it instead of returning a
|
|
@@ -710,10 +735,10 @@ event additionally records `credential_type` in metadata (defense in depth).
|
|
|
710
735
|
> suite assume auto-accept and have to redesign their tests when they
|
|
711
736
|
> discover otherwise.
|
|
712
737
|
|
|
713
|
-
- `role_grant_offer_create_action_spec` — input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?, message?}` (`scope_kind` + `scope_id` paired — both or neither, else `invalid_params`); output `{offer}`.
|
|
714
|
-
- `role_grant_offer_accept_action_spec` — input `{offer_id}`; output `{role_grant_id, offer, superseded_offer_ids}`. Refuses a builtin-role offer that must not mint (see below), leaving it pending.
|
|
715
|
-
- `role_grant_offer_decline_action_spec` — input `{offer_id, reason?}`; output `{
|
|
716
|
-
- `role_grant_offer_retract_action_spec` — input `{offer_id}`; output `{
|
|
738
|
+
- `role_grant_offer_create_action_spec` — session-only; input `{to_account_id, to_actor_id?, role, scope_kind?, scope_id?, message?}` (`scope_kind` + `scope_id` paired — both or neither, else `invalid_params`); output `{offer}`.
|
|
739
|
+
- `role_grant_offer_accept_action_spec` — session-only; input `{offer_id}`; output `{role_grant_id, offer, superseded_offer_ids}`. Refuses a builtin-role offer that must not mint (see below), leaving it pending.
|
|
740
|
+
- `role_grant_offer_decline_action_spec` — input `{offer_id, reason?}`; output `{offer}` (the declined offer, as accept answers its own).
|
|
741
|
+
- `role_grant_offer_retract_action_spec` — input `{offer_id}`; output `{offer}` (the retracted offer).
|
|
717
742
|
- `role_grant_offer_list_action_spec` — input `{account_id?}`; output `{offers}`.
|
|
718
743
|
- `role_grant_offer_history_action_spec` — input `{account_id?, limit?, offset?}`; output `{offers}`.
|
|
719
744
|
- `role_grant_revoke_action_spec` — input `{actor_id, role_grant_id, reason?}`; output `{ok, revoked}`.
|
|
@@ -763,7 +788,8 @@ global check (`has_scoped_role(_, ROLE_ADMIN, null)`) stops a scoped `admin`
|
|
|
763
788
|
escalating into global authority over the offer surface. A consumer needing
|
|
764
789
|
scope-aware delegation (e.g. a classroom teacher offering within their own
|
|
765
790
|
scope) supplies a custom `authorize` callback. The callback receives
|
|
766
|
-
`{to_account_id, role, scope_kind, scope_id}` and
|
|
791
|
+
`{to_account_id, role, scope_kind, scope_id}` and the request `ctx` (`ctx.db` is
|
|
792
|
+
the request transaction, for read-only checks), and also gates
|
|
767
793
|
`role_grant_assign`.
|
|
768
794
|
|
|
769
795
|
**Builtin roles (`admin` / `keeper`) are global-only**, decided by the spine
|
|
@@ -826,7 +852,7 @@ DEV-mode `create_validated_broadcaster` payload validation).
|
|
|
826
852
|
|
|
827
853
|
Deps: `ActionFactoryDeps & {notification_sender?: NotificationSender | null}`.
|
|
828
854
|
`NotificationSender` is the narrow structural capability
|
|
829
|
-
(`send_to_account(account_id, message): number`); `
|
|
855
|
+
(`send_to_account(account_id, message): number`); `ConnectionRegistry`
|
|
830
856
|
satisfies it structurally. Target account travels via the send argument, not
|
|
831
857
|
the payload — `revoked_by` is deliberately not in the `role_grant_revoke`
|
|
832
858
|
payload (the revokee doesn't need to learn the admin's identity). When
|
|
@@ -841,7 +867,7 @@ Options: `roles?: RoleSchemaResult` (drives admin-grant-path lookup),
|
|
|
841
867
|
`create_account_actions(deps, options?)` in `auth/account_actions.ts`.
|
|
842
868
|
|
|
843
869
|
- `account_verify_action_spec` — read; input `z.void()`; output `SessionAccountJson`.
|
|
844
|
-
- `account_session_list_action_spec` — read; input `z.void()`; output `{sessions}
|
|
870
|
+
- `account_session_list_action_spec` — read; input `z.void()`; output `{sessions}`, each with `is_current` (the session the request authenticated with; `false` on every row for a bearer or daemon-token caller).
|
|
845
871
|
- `account_session_revoke_action_spec` — mutation; input `{session_id}`; output `{ok, revoked}`.
|
|
846
872
|
- `account_session_revoke_all_action_spec` — mutation; input `z.void()`; output `{ok, count}`.
|
|
847
873
|
- `account_token_create_action_spec` — mutation; input `{name?, scope, lifetime}` (both `scope` and `lifetime` required — default-deny at mint on both axes; `name` at most `API_TOKEN_NAME_LENGTH_MAX` = 255 characters, since it is copied into the audit row); output `{ok, token, id, name, expires_at}`. `scope` / `lifetime` declare `invalid_reason` `ERROR_TOKEN_SCOPE_INVALID` / `ERROR_TOKEN_LIFETIME_INVALID`, so every refusal of either carries it — the handler's over-cap scope refusal included.
|
|
@@ -983,7 +1009,7 @@ own pass would have closed for.
|
|
|
983
1009
|
session, and once the sweep deletes an expired row `account_session_revoke`
|
|
984
1010
|
has nothing left to close for — so `cleanup_expired_sessions` closes each
|
|
985
1011
|
swept session's connections itself, by session id
|
|
986
|
-
(`connection_closer.
|
|
1012
|
+
(`connection_closer.close_connections` with a `session` target), which is why
|
|
987
1013
|
`query_session_cleanup_expired` returns the deleted ids. The close repeats
|
|
988
1014
|
one already made: every connection closes at its credential's deadline
|
|
989
1015
|
(`auth/credential_deadline.ts`) in the process holding it, sweep or no sweep.
|
|
@@ -22,6 +22,7 @@ export declare const SessionListOutput: z.ZodObject<{
|
|
|
22
22
|
account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
23
23
|
created_at: z.ZodString;
|
|
24
24
|
expires_at: z.ZodString;
|
|
25
|
+
is_current: z.ZodBoolean;
|
|
25
26
|
}, z.core.$strict>>;
|
|
26
27
|
}, z.core.$strict>;
|
|
27
28
|
export type SessionListOutput = z.infer<typeof SessionListOutput>;
|
|
@@ -167,6 +168,7 @@ export declare const account_session_list_action_spec: {
|
|
|
167
168
|
account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
168
169
|
created_at: z.ZodString;
|
|
169
170
|
expires_at: z.ZodString;
|
|
171
|
+
is_current: z.ZodBoolean;
|
|
170
172
|
}, z.core.$strict>>;
|
|
171
173
|
}, z.core.$strict>;
|
|
172
174
|
async: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAW3E,6EAA6E;AAC7E,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,C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;;;;;;;;;;;;CAUV,CAAC;AAGtC,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;CAUd,CAAC;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWR,CAAC;AAEtC,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;CAUN,CAAC;AAGtC,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;CAUR,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,yBAAyB,CAQrE,CAAC"}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
|
-
import { type RpcAction } from '../actions/
|
|
30
|
+
import { type RpcAction } from '../actions/action_types.js';
|
|
31
31
|
import type { RevokingActionFactoryDeps } from './deps.js';
|
|
32
32
|
/** Options for `create_account_actions`. */
|
|
33
33
|
export interface AccountActionOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"account_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAwBhG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA0B3D,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,yBAAyB,EAC/B,UAAS,oBAAyB,KAChC,KAAK,CAAC,SAAS,CA+LjB,CAAC"}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* @module
|
|
29
29
|
*/
|
|
30
30
|
import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
31
|
-
import { rpc_action } from '../actions/
|
|
31
|
+
import { rpc_action } from '../actions/action_types.js';
|
|
32
32
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
33
33
|
import { queue_connection_close } from '../actions/connection_closer.js';
|
|
34
34
|
import { to_session_account } from './account_schema.js';
|
|
@@ -59,7 +59,13 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
59
59
|
};
|
|
60
60
|
const session_list_handler = async (_input, ctx) => {
|
|
61
61
|
const sessions = await query_session_list_for_account(ctx, ctx.auth.account.id);
|
|
62
|
-
|
|
62
|
+
// no column holds it: the caller's own session is the one its credential hashes to
|
|
63
|
+
return {
|
|
64
|
+
sessions: sessions.map((session) => ({
|
|
65
|
+
...session,
|
|
66
|
+
is_current: session.id === ctx.session_hash
|
|
67
|
+
}))
|
|
68
|
+
};
|
|
63
69
|
};
|
|
64
70
|
const session_revoke_handler = async (input, ctx) => {
|
|
65
71
|
const revoked = await query_session_revoke_for_account(ctx, input.session_id, ctx.auth.account.id);
|
|
@@ -73,7 +79,7 @@ export const create_account_actions = (deps, options = {}) => {
|
|
|
73
79
|
if (revoked) {
|
|
74
80
|
queue_connection_close(ctx, connection_closer, {
|
|
75
81
|
kind: 'session',
|
|
76
|
-
|
|
82
|
+
session_hash: input.session_id
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
deps.audit.emit(ctx, {
|
|
@@ -254,6 +254,16 @@ export interface AdminAccountListOptions {
|
|
|
254
254
|
* visibility of grantor notes would expand beyond what the audit log
|
|
255
255
|
* discloses).
|
|
256
256
|
*
|
|
257
|
+
* Every list is ordered as the Rust spine orders it, on data keys rather than
|
|
258
|
+
* the random `id` alone: accounts by `created_at, username`, each entry's
|
|
259
|
+
* role_grants by `created_at, role, scope_id`, its pending offers by
|
|
260
|
+
* `expires_at, role, scope_id` (`id` last, for a tie no data key breaks). The
|
|
261
|
+
* order is deterministic on each engine, so rows written in one transaction
|
|
262
|
+
* (one `created_at`) list stably. Two backends holding the same rows list
|
|
263
|
+
* them alike only under the same text collation: a bytewise compare (pglet)
|
|
264
|
+
* and a locale one (Postgres `en_US.UTF-8`, which passes over `_` and `-` at
|
|
265
|
+
* first) can order the text keys differently.
|
|
266
|
+
*
|
|
257
267
|
* @param deps - query dependencies
|
|
258
268
|
* @param options - optional `{limit, offset}`. Default limit is
|
|
259
269
|
* `ADMIN_ACCOUNT_LIST_DEFAULT_LIMIT`; pass `limit: null` to disable.
|
|
@@ -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,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;
|
|
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,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,MAAM,qBAAqB,CAAC;AAK7B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,6JAYqB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,aAAa,6GASqB,CAAC;AAehD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F,8CAA8C;AAC9C,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,SAAS,EACf,UAAU,uBAAuB,KAC/B,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAkHtC,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { columns_sql, iso8601_timestamp_column, iso8601_timestamp_expr, omit_col
|
|
|
11
11
|
import { to_admin_account } from './account_schema.js';
|
|
12
12
|
import { ADMIN_ACCOUNT_LIST_DEFAULT_LIMIT } from './admin_action_specs.js';
|
|
13
13
|
import { ROLE_GRANT_COLUMNS } from './role_grant_queries.js';
|
|
14
|
+
import { offer_pending_predicate, role_grant_active_sql } from './role_grant_sql.js';
|
|
14
15
|
/**
|
|
15
16
|
* The full `account` column set, named explicitly so a row read fails loud
|
|
16
17
|
* on schema drift.
|
|
@@ -333,6 +334,16 @@ const admin_role_grant_expr = iso8601_timestamp_expr(ADMIN_ROLE_GRANT_COLUMNS, [
|
|
|
333
334
|
* visibility of grantor notes would expand beyond what the audit log
|
|
334
335
|
* discloses).
|
|
335
336
|
*
|
|
337
|
+
* Every list is ordered as the Rust spine orders it, on data keys rather than
|
|
338
|
+
* the random `id` alone: accounts by `created_at, username`, each entry's
|
|
339
|
+
* role_grants by `created_at, role, scope_id`, its pending offers by
|
|
340
|
+
* `expires_at, role, scope_id` (`id` last, for a tie no data key breaks). The
|
|
341
|
+
* order is deterministic on each engine, so rows written in one transaction
|
|
342
|
+
* (one `created_at`) list stably. Two backends holding the same rows list
|
|
343
|
+
* them alike only under the same text collation: a bytewise compare (pglet)
|
|
344
|
+
* and a locale one (Postgres `en_US.UTF-8`, which passes over `_` and `-` at
|
|
345
|
+
* first) can order the text keys differently.
|
|
346
|
+
*
|
|
336
347
|
* @param deps - query dependencies
|
|
337
348
|
* @param options - optional `{limit, offset}`. Default limit is
|
|
338
349
|
* `ADMIN_ACCOUNT_LIST_DEFAULT_LIMIT`; pass `limit: null` to disable.
|
|
@@ -345,19 +356,19 @@ export const query_admin_account_list = async (deps, options) => {
|
|
|
345
356
|
// `include_deleted` to surface tombstoned rows for reactivation.
|
|
346
357
|
const where = options?.include_deleted ? '' : 'WHERE deleted_at IS NULL';
|
|
347
358
|
const account_query = limit == null
|
|
348
|
-
? deps.db.query(`SELECT ${columns_sql(ACCOUNT_COLUMNS, account_actor_expr)} FROM account ${where} ORDER BY account.created_at OFFSET $1`, [offset])
|
|
349
|
-
: deps.db.query(`SELECT ${columns_sql(ACCOUNT_COLUMNS, account_actor_expr)} FROM account ${where} ORDER BY account.created_at LIMIT $1 OFFSET $2`, [limit, offset]);
|
|
359
|
+
? deps.db.query(`SELECT ${columns_sql(ACCOUNT_COLUMNS, account_actor_expr)} FROM account ${where} ORDER BY account.created_at, account.username OFFSET $1`, [offset])
|
|
360
|
+
: deps.db.query(`SELECT ${columns_sql(ACCOUNT_COLUMNS, account_actor_expr)} FROM account ${where} ORDER BY account.created_at, account.username LIMIT $1 OFFSET $2`, [limit, offset]);
|
|
350
361
|
const accounts = await account_query;
|
|
351
362
|
if (accounts.length === 0)
|
|
352
363
|
return [];
|
|
353
364
|
const account_ids = accounts.map((a) => a.id);
|
|
354
365
|
const [actors, role_grants, pending_offers] = await Promise.all([
|
|
355
|
-
deps.db.query(`SELECT ${columns_sql(ACTOR_COLUMNS, account_actor_expr)} FROM actor WHERE account_id = ANY($1::uuid[])`, [account_ids]),
|
|
366
|
+
deps.db.query(`SELECT ${columns_sql(ACTOR_COLUMNS, account_actor_expr)} FROM actor WHERE account_id = ANY($1::uuid[]) ORDER BY actor.created_at, actor.name, actor.id`, [account_ids]),
|
|
356
367
|
deps.db.query(`SELECT ${columns_sql(ADMIN_ROLE_GRANT_COLUMNS, admin_role_grant_expr)}
|
|
357
368
|
FROM role_grant
|
|
358
369
|
WHERE actor_id IN (SELECT id FROM actor WHERE account_id = ANY($1::uuid[]))
|
|
359
|
-
AND
|
|
360
|
-
|
|
370
|
+
AND ${role_grant_active_sql('')}
|
|
371
|
+
ORDER BY role_grant.created_at, role_grant.role, role_grant.scope_id, role_grant.id`, [account_ids]),
|
|
361
372
|
deps.db.query(`SELECT po.id, po.to_account_id, po.from_actor_id, po.role, po.scope_kind, po.scope_id,
|
|
362
373
|
${iso8601_timestamp_column('po', 'created_at')} AS created_at,
|
|
363
374
|
${iso8601_timestamp_column('po', 'expires_at')} AS expires_at,
|
|
@@ -366,23 +377,22 @@ export const query_admin_account_list = async (deps, options) => {
|
|
|
366
377
|
JOIN actor act ON act.id = po.from_actor_id
|
|
367
378
|
JOIN account a ON a.id = act.account_id
|
|
368
379
|
WHERE po.to_account_id = ANY($1::uuid[])
|
|
369
|
-
AND po
|
|
370
|
-
AND po.declined_at IS NULL
|
|
371
|
-
AND po.retracted_at IS NULL
|
|
372
|
-
AND po.superseded_at IS NULL
|
|
380
|
+
AND ${offer_pending_predicate('po')}
|
|
373
381
|
AND po.expires_at > NOW()
|
|
374
|
-
ORDER BY po.expires_at ASC`, [account_ids])
|
|
382
|
+
ORDER BY po.expires_at ASC, po.role ASC, po.scope_id ASC, po.id ASC`, [account_ids])
|
|
375
383
|
]);
|
|
376
|
-
// Index actors by account_id
|
|
377
|
-
//
|
|
378
|
-
//
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
//
|
|
384
|
+
// Index actors by account_id, the first one winning: actors arrive in
|
|
385
|
+
// `created_at, name, id` order, so an account's row carries its oldest actor
|
|
386
|
+
// (and that actor's grants). Multi-actor TODO: an account hosting more
|
|
387
|
+
// than one actor shows only that one — when multi-actor lands, the admin
|
|
388
|
+
// row shape must change from "account → one actor" to "account →
|
|
389
|
+
// Array<Actor>" (or split into a separate per-actor row). The JSON shape
|
|
390
|
+
// change will ripple into the admin UI; bundle that with the multi-actor
|
|
382
391
|
// session-actor-selector work.
|
|
383
392
|
const actor_by_account = new Map();
|
|
384
393
|
for (const actor of actors) {
|
|
385
|
-
actor_by_account.
|
|
394
|
+
if (!actor_by_account.has(actor.account_id))
|
|
395
|
+
actor_by_account.set(actor.account_id, actor);
|
|
386
396
|
}
|
|
387
397
|
// Group role_grants by actor_id
|
|
388
398
|
const role_grants_by_actor = new Map();
|
|
@@ -110,7 +110,8 @@ export interface AccountRouteOptions extends AuthSessionRouteOptions {
|
|
|
110
110
|
max_sessions?: number | null;
|
|
111
111
|
/**
|
|
112
112
|
* Minimum wall-clock time (ms) for login 401 responses. Set to `0` or a
|
|
113
|
-
* negative number to disable (e.g., in tests)
|
|
113
|
+
* negative number to disable (e.g., in tests) — announced once on stderr
|
|
114
|
+
* (`LOGIN_FAIL_FLOOR_DISABLED_BANNER`). Default
|
|
114
115
|
* `DEFAULT_LOGIN_FAIL_FLOOR_MS`.
|
|
115
116
|
*/
|
|
116
117
|
login_fail_floor_ms?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"account_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4B1D,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIxE,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,oBAAoB,CAAC;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