@fuzdev/fuz_app 0.179.0 → 0.181.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 +14 -14
- package/dist/actions/action_rpc.d.ts +14 -5
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +53 -46
- package/dist/actions/action_types.d.ts +15 -12
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/perform_action.d.ts +4 -4
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +6 -6
- package/dist/actions/register_action_ws.d.ts +6 -2
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +14 -3
- package/dist/actions/ws_socket_session.js +1 -1
- package/dist/auth/CLAUDE.md +36 -30
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +18 -1
- package/dist/auth/account_queries.d.ts +69 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +82 -0
- package/dist/auth/account_route_schema.d.ts +26 -16
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +10 -24
- package/dist/auth/account_routes.d.ts +4 -6
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +86 -66
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +63 -14
- package/dist/auth/api_token_queries.d.ts +16 -7
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +18 -18
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +10 -12
- package/dist/auth/audit_log_schema.js +4 -4
- package/dist/auth/bearer_auth.d.ts +4 -3
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +35 -31
- package/dist/auth/bootstrap_account.d.ts +65 -37
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +115 -66
- package/dist/auth/bootstrap_route_schema.d.ts +6 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +7 -2
- package/dist/auth/bootstrap_routes.d.ts +50 -33
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +109 -87
- package/dist/auth/bootstrap_token_store.d.ts +60 -0
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -0
- package/dist/auth/bootstrap_token_store.js +39 -0
- package/dist/auth/credential_headers.d.ts +71 -0
- package/dist/auth/credential_headers.d.ts.map +1 -0
- package/dist/auth/credential_headers.js +100 -0
- package/dist/auth/daemon_token.d.ts +13 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +14 -2
- package/dist/auth/daemon_token_middleware.d.ts +10 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +27 -29
- package/dist/auth/deps.d.ts +0 -11
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/invite_queries.d.ts +18 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +24 -0
- package/dist/auth/request_context.d.ts +26 -5
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +17 -10
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +3 -2
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +37 -14
- package/dist/auth/role_grant_offer_ddl.d.ts +7 -1
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +9 -2
- package/dist/auth/role_grant_offer_queries.d.ts +56 -3
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +93 -8
- package/dist/auth/role_grant_queries.d.ts +7 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +8 -0
- package/dist/auth/session_cookie.d.ts +105 -25
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +124 -15
- package/dist/auth/session_middleware.d.ts +83 -54
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +92 -66
- package/dist/auth/session_queries.d.ts +64 -4
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +53 -4
- package/dist/auth/signup_route_schema.d.ts +5 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +4 -4
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +17 -14
- package/dist/auth/token_scope.d.ts +5 -7
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +5 -8
- package/dist/dev/setup.d.ts +6 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -34
- package/dist/hono_context.d.ts +21 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +17 -0
- package/dist/http/CLAUDE.md +150 -43
- package/dist/http/auth_shape.d.ts +3 -3
- package/dist/http/common_routes.js +1 -1
- package/dist/http/db_routes.d.ts +4 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +14 -14
- package/dist/http/dev_route_error_check.d.ts +6 -3
- package/dist/http/dev_route_error_check.d.ts.map +1 -1
- package/dist/http/dev_route_error_check.js +6 -3
- package/dist/http/dev_set_cookie_check.d.ts +53 -0
- package/dist/http/dev_set_cookie_check.d.ts.map +1 -0
- package/dist/http/dev_set_cookie_check.js +80 -0
- package/dist/http/error_schemas.d.ts +36 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +39 -2
- package/dist/http/header_lines.d.ts +42 -0
- package/dist/http/header_lines.d.ts.map +1 -0
- package/dist/http/header_lines.js +80 -0
- package/dist/http/host.d.ts +12 -9
- package/dist/http/host.d.ts.map +1 -1
- package/dist/http/host.js +25 -20
- package/dist/http/origin.d.ts +7 -22
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +11 -25
- package/dist/http/proxy.d.ts +1 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/request_headers.d.ts +95 -0
- package/dist/http/request_headers.d.ts.map +1 -0
- package/dist/http/request_headers.js +110 -0
- package/dist/http/request_target.d.ts +134 -0
- package/dist/http/request_target.d.ts.map +1 -0
- package/dist/http/request_target.js +193 -0
- package/dist/http/route_error_check.d.ts +4 -11
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +4 -21
- package/dist/http/route_result.d.ts +127 -23
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_result.js +97 -19
- package/dist/http/route_spec.d.ts +298 -82
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +548 -71
- package/dist/http/simple_request.d.ts +19 -14
- package/dist/http/simple_request.d.ts.map +1 -1
- package/dist/http/simple_request.js +17 -29
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +4 -1
- package/dist/realtime/outbound_budget.d.ts +1 -2
- package/dist/realtime/outbound_budget.d.ts.map +1 -1
- package/dist/realtime/outbound_budget.js +1 -2
- package/dist/realtime/sse.d.ts +47 -17
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +115 -93
- package/dist/realtime/sse_constants.d.ts +7 -1
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +12 -1
- package/dist/realtime/sse_registry.d.ts +3 -3
- package/dist/realtime/sse_registry.js +3 -3
- package/dist/runtime/deps.d.ts +20 -4
- package/dist/runtime/deps.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +7 -1
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +33 -3
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +2 -1
- package/dist/runtime/secure_file.d.ts +71 -10
- package/dist/runtime/secure_file.d.ts.map +1 -1
- package/dist/runtime/secure_file.js +91 -11
- package/dist/server/app_backend.d.ts +0 -8
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -3
- package/dist/server/app_server.d.ts +28 -17
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -34
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +49 -45
- package/dist/server/static.d.ts +20 -0
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +56 -8
- package/dist/server/unmatched_route.d.ts +42 -0
- package/dist/server/unmatched_route.d.ts.map +1 -0
- package/dist/server/unmatched_route.js +64 -0
- package/dist/testing/CLAUDE.md +404 -1200
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +4 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts +11 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +277 -6
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +4 -1
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +68 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +20 -4
- package/dist/testing/cross_backend/cell_gated_create.js +1 -1
- package/dist/testing/cross_backend/conformance_case.d.ts +63 -21
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts +54 -12
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +179 -23
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +7 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +3 -3
- package/dist/testing/cross_backend/credential_conformance.d.ts +196 -0
- package/dist/testing/cross_backend/credential_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance.js +296 -0
- package/dist/testing/cross_backend/credential_conformance.json +1284 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts +40 -0
- package/dist/testing/cross_backend/credential_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_conformance_wire.js +293 -0
- package/dist/testing/cross_backend/credential_header_robustness.d.ts +1 -3
- package/dist/testing/cross_backend/credential_header_robustness.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_header_robustness.js +24 -55
- package/dist/testing/cross_backend/credential_wire.d.ts +112 -0
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/credential_wire.js +188 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +22 -2
- package/dist/testing/cross_backend/default_spine_surface.js +1 -1
- package/dist/testing/cross_backend/differential.d.ts +1 -1
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +3 -2
- package/dist/testing/cross_backend/differential_normalize.d.ts +23 -6
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +11 -5
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +7 -0
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +4 -0
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +78 -4
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +13 -10
- package/dist/testing/cross_backend/peer_ping_ws.d.ts +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +2 -2
- package/dist/testing/cross_backend/request_header_conformance.d.ts +174 -0
- package/dist/testing/cross_backend/request_header_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance.js +196 -0
- package/dist/testing/cross_backend/request_header_conformance.json +1158 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts +39 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_header_conformance_wire.js +284 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts +298 -0
- package/dist/testing/cross_backend/request_target_conformance.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance.js +186 -0
- package/dist/testing/cross_backend/request_target_conformance.json +3765 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +32 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -0
- package/dist/testing/cross_backend/request_target_conformance_wire.js +278 -0
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +173 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +2 -1
- package/dist/testing/cross_backend/rpc_adversarial.d.ts +6 -4
- package/dist/testing/cross_backend/rpc_adversarial.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_adversarial.js +5 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -7
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -5
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +56 -29
- package/dist/testing/cross_backend/session_cookie_effect.d.ts +43 -0
- package/dist/testing/cross_backend/session_cookie_effect.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_cookie_effect.js +103 -0
- package/dist/testing/cross_backend/session_login.d.ts +24 -0
- package/dist/testing/cross_backend/session_login.d.ts.map +1 -0
- package/dist/testing/cross_backend/session_login.js +31 -0
- package/dist/testing/cross_backend/setup.d.ts +117 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +193 -9
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -1
- package/dist/testing/cross_backend/simple_request.js +5 -0
- package/dist/testing/cross_backend/spine_suites.d.ts +9 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +88 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +8 -5
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +205 -64
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +5 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +165 -0
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_credential_read.js +175 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +19 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +22 -6
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +58 -2
- package/dist/testing/cross_backend/transport_composition.d.ts +2 -4
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +13 -10
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts +11 -1
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_endpoint.js +19 -2
- package/dist/testing/cross_backend/ws_role_gated.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_role_gated.js +2 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +28 -12
- package/dist/testing/cross_backend/xfail.d.ts +44 -11
- package/dist/testing/cross_backend/xfail.d.ts.map +1 -1
- package/dist/testing/cross_backend/xfail.js +68 -23
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +4 -3
- package/dist/testing/integration.d.ts +1 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +14 -8
- package/dist/testing/integration_helpers.d.ts +50 -3
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +87 -9
- package/dist/testing/middleware.d.ts +2 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +9 -2
- package/dist/testing/round_trip.d.ts +6 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +17 -6
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +7 -0
- package/dist/testing/rpc_helpers.d.ts +4 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +6 -1
- package/dist/testing/rpc_round_trip.d.ts +13 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +25 -6
- package/dist/testing/schema_generators.d.ts +2 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +4 -4
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +8 -8
- package/dist/testing/transports/fetch_transport.d.ts +6 -3
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +31 -19
- package/dist/testing/transports/raw_http.d.ts +61 -1
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +61 -1
- package/dist/testing/transports/ws_raw_client.d.ts +20 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +10 -4
- package/dist/testing/transports/ws_transport.d.ts +21 -1
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +58 -20
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon_token_middleware.d.ts","sourceRoot":"","sources":["../../src/lib/auth/daemon_token_middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"daemon_token_middleware.d.ts","sourceRoot":"","sources":["../../src/lib/auth/daemon_token_middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,GAAU,MAAM,SAAS,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAEtF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,8BAA8B,GAC1C,OAAO,gBAAgB,EACvB,MAAM,SAAS,EACf,KAAK,MAAM,KACT,iBA4EF,CAAC"}
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
16
|
import { DEV } from 'esm-env';
|
|
17
|
-
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
17
|
import { RESOLVED_AUTH_KEY } from '../hono_context.js';
|
|
19
18
|
import { get_resolved_auth } from './resolved_auth.js';
|
|
20
|
-
import {
|
|
19
|
+
import { get_header_lines } from '../http/header_lines.js';
|
|
20
|
+
import { is_browser_context } from '../http/request_headers.js';
|
|
21
21
|
import { query_role_grant_find_account_id_for_role } from './role_grant_queries.js';
|
|
22
22
|
import { ROLE_KEEPER } from './role_schema.js';
|
|
23
|
-
import {
|
|
23
|
+
import { read_daemon_token } from './credential_headers.js';
|
|
24
|
+
import { DAEMON_TOKEN_HEADER, validate_daemon_token } from './daemon_token.js';
|
|
24
25
|
/**
|
|
25
26
|
* Resolve the keeper account ID by querying for the account with an active
|
|
26
27
|
* keeper role_grant.
|
|
@@ -47,19 +48,18 @@ export const resolve_keeper_account_id = async (deps) => {
|
|
|
47
48
|
* `RESOLVED_AUTH_KEY` on entry, so a layer mounted before the credential legs
|
|
48
49
|
* cannot pre-set an identity that every leg would then skip past.
|
|
49
50
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* -
|
|
51
|
+
* Reads the `X-Daemon-Token` header's lines through `read_daemon_token`.
|
|
52
|
+
* Behavior:
|
|
53
|
+
* - No header, a malformed value (fails `is_daemon_token_shaped`), or the
|
|
54
|
+
* header sent as more than one line: soft-fail discard (pass through, not
|
|
55
|
+
* 401) — mirrors the bearer guard and the Rust spine's `resolve.rs`
|
|
56
|
+
* (`None`). Downstream a daemon-gated action returns
|
|
57
|
+
* `credential_type_required`; a public action proceeds anonymous.
|
|
58
|
+
* - A shaped token + `Origin` / `Referer` present: discard the credential
|
|
53
59
|
* (browser context) and pass through — daemon tokens are loopback-only and
|
|
54
60
|
* never carry an `Origin` in production, so a header-bearing request is not
|
|
55
|
-
* a legitimate daemon caller.
|
|
56
|
-
*
|
|
57
|
-
* (not a hard fail). Silent on the wire (anti-enumeration); in `DEV` only,
|
|
58
|
-
* sets `X-Fuz-Auth-Debug: daemon_token_discarded_browser_context`.
|
|
59
|
-
* - Header present + malformed (fails `DaemonToken`): soft-fail discard (pass through,
|
|
60
|
-
* not 401) — mirrors the bearer guard and the Rust spine's `resolve.rs`
|
|
61
|
-
* (`None`). Downstream a daemon-gated action returns `credential_type_required`;
|
|
62
|
-
* a public action proceeds anonymous.
|
|
61
|
+
* a legitimate daemon caller. Silent on the wire (anti-enumeration); in
|
|
62
|
+
* `DEV` only, sets `X-Fuz-Auth-Debug: daemon_token_discarded_browser_context`.
|
|
63
63
|
* - Header present + invalid value (not the current/previous token): soft-fail
|
|
64
64
|
* discard (pass through, not 401) — same downstream behavior.
|
|
65
65
|
* - Header present + valid + `keeper_account_id` null (still pre-bootstrap
|
|
@@ -90,36 +90,34 @@ export const create_daemon_token_middleware = (state, deps, log) => {
|
|
|
90
90
|
log.debug(`daemon token leg cleared a credential (${cleared.credential_type}) set before it`);
|
|
91
91
|
}
|
|
92
92
|
c.set(RESOLVED_AUTH_KEY, null);
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// The header's one shaped value, or nothing: absent, malformed, and sent
|
|
94
|
+
// as more than one line all read `null` and pass through — a soft-fail
|
|
95
|
+
// discard, not a 401, mirroring the bearer guard and the Rust spine's
|
|
96
|
+
// `resolve.rs`. On a daemon-gated action the dispatcher returns
|
|
97
|
+
// `credential_type_required` downstream; a public action proceeds
|
|
98
|
+
// anonymous.
|
|
99
|
+
const token_lines = get_header_lines(c, DAEMON_TOKEN_HEADER);
|
|
100
|
+
const token_header = read_daemon_token(token_lines);
|
|
101
|
+
if (token_header === null) {
|
|
102
|
+
if (token_lines.length > 0)
|
|
103
|
+
log.debug('daemon token auth soft-fail: malformed token');
|
|
95
104
|
await next();
|
|
96
105
|
return;
|
|
97
106
|
}
|
|
98
107
|
// Silently discard daemon tokens in browser context (`is_browser_context`
|
|
99
|
-
// — Origin or Referer present) — mirrors the bearer guard (and the Rust
|
|
108
|
+
// — an Origin or Referer line present) — mirrors the bearer guard (and the Rust
|
|
100
109
|
// spine's `resolve.rs`, which returns `None`). Daemon tokens are
|
|
101
110
|
// loopback-only and never carry an `Origin` in production, so a
|
|
102
111
|
// header-bearing request is not a legitimate daemon caller. Discards
|
|
103
112
|
// (next()) rather than 401 so the dispatcher returns
|
|
104
113
|
// `credential_type_required` downstream rather than a hard fail.
|
|
105
|
-
if (is_browser_context(c)) {
|
|
114
|
+
if (is_browser_context(get_header_lines(c, 'origin'), get_header_lines(c, 'referer'))) {
|
|
106
115
|
log.debug('daemon token auth rejected: browser context (Origin/Referer present)');
|
|
107
116
|
if (DEV)
|
|
108
117
|
c.header('X-Fuz-Auth-Debug', 'daemon_token_discarded_browser_context');
|
|
109
118
|
await next();
|
|
110
119
|
return;
|
|
111
120
|
}
|
|
112
|
-
// Validate the token format at the I/O boundary. A malformed token is
|
|
113
|
-
// a soft-fail discard (pass through), not a 401 — mirroring the bearer
|
|
114
|
-
// guard and the Rust spine's `resolve.rs`, which return `None` on an
|
|
115
|
-
// unparseable credential. The request falls through: on a daemon-gated
|
|
116
|
-
// action the dispatcher returns `credential_type_required` downstream; on
|
|
117
|
-
// a public action it proceeds anonymous.
|
|
118
|
-
if (!is(DaemonToken, token_header)) {
|
|
119
|
-
log.debug('daemon token auth soft-fail: malformed token');
|
|
120
|
-
await next();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
121
|
// Well-formed but not the current/previous token — soft-fail discard, not
|
|
124
122
|
// a 401, for the same reason: no downgrade, falls through to downstream
|
|
125
123
|
// `credential_type_required` (matching the Rust spine's `None`).
|
package/dist/auth/deps.d.ts
CHANGED
|
@@ -21,17 +21,6 @@ import type { ConnectionCloser, RealtimeCloser } from '../actions/connection_clo
|
|
|
21
21
|
* Does not contain config (static values) or runtime state (mutable refs).
|
|
22
22
|
*/
|
|
23
23
|
export interface AppDeps {
|
|
24
|
-
/**
|
|
25
|
-
* Hardened secret-file read — used for the bootstrap token (the file that
|
|
26
|
-
* mints the keeper account). Production wiring passes the runtime's
|
|
27
|
-
* `read_secure_file` (`FsSecureReadDeps`), which rejects symlinks,
|
|
28
|
-
* non-regular files, group/other-accessible modes, and oversized files; both the boot-time
|
|
29
|
-
* availability probe and the request-time read go through this one
|
|
30
|
-
* capability so the probe can never be laxer than the read it gates.
|
|
31
|
-
*/
|
|
32
|
-
read_secure_file: (path: string) => Promise<Uint8Array>;
|
|
33
|
-
/** Delete a file. */
|
|
34
|
-
delete_file: (path: string) => Promise<void>;
|
|
35
24
|
/** HMAC-SHA256 cookie signing keyring. */
|
|
36
25
|
keyring: Keyring;
|
|
37
26
|
/** Password hashing operations. Use `argon2_password_deps` in production. */
|
package/dist/auth/deps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../../src/lib/auth/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CA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AC;IAClC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,KAAK,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IACnE;;;;;;OAMG;IACH,iBAAiB,EAAE,gBAAgB,CAAC;CACpC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
9
10
|
import type { QueryDeps } from '../db/query_deps.js';
|
|
10
11
|
import type { Invite, CreateInviteInput, InviteWithUsernamesJson } from './invite_schema.js';
|
|
11
12
|
/**
|
|
@@ -87,4 +88,21 @@ export declare const query_invite_list_all_with_usernames: (deps: QueryDeps) =>
|
|
|
87
88
|
* @mutates `invite` table - deletes the row when still unclaimed
|
|
88
89
|
*/
|
|
89
90
|
export declare const query_invite_delete_unclaimed: (deps: QueryDeps, id: string) => Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Delete every unclaimed invite issued by one of `created_by_actor_ids` — the
|
|
93
|
+
* invite cascade of an account delete or purge.
|
|
94
|
+
*
|
|
95
|
+
* An invite records no authority, so one outliving its issuer's account would
|
|
96
|
+
* still admit a signup. Deleting is how an invite is revoked
|
|
97
|
+
* (`query_invite_delete_unclaimed`), so a voided invite answers a signup as a
|
|
98
|
+
* revoked or unknown one does, and an undelete has nothing to bring back. A
|
|
99
|
+
* claimed invite stays, as the record of the signup it admitted. Twin of the
|
|
100
|
+
* Rust `query_invite_delete_unclaimed_by_creators`.
|
|
101
|
+
*
|
|
102
|
+
* @param deps - query dependencies
|
|
103
|
+
* @param created_by_actor_ids - the issuing actors whose unclaimed invites end
|
|
104
|
+
* @returns the ids of the deleted invites
|
|
105
|
+
* @mutates `invite` table - deletes every unclaimed row created by `created_by_actor_ids`
|
|
106
|
+
*/
|
|
107
|
+
export declare const query_invite_delete_unclaimed_by_creators: (deps: QueryDeps, created_by_actor_ids: ReadonlyArray<Uuid>) => Promise<Array<Uuid>>;
|
|
90
108
|
//# sourceMappingURL=invite_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invite_queries.d.ts","sourceRoot":"","sources":["../../src/lib/auth/invite_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7F;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,8FAQqB,CAAC;AAKjD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,OAAO,iBAAiB,KACtB,OAAO,CAAC,MAAM,CAQhB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4CAA4C,GACxD,MAAM,SAAS,EACf,OAAO,MAAM,GAAG,IAAI,EACpB,UAAU,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,SAAS,EACf,WAAW,MAAM,EACjB,YAAY,MAAM,KAChB,OAAO,CAAC,OAAO,CAQjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,GAChD,MAAM,SAAS,KACb,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAUxC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,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C,IAAI,CAAC,KACvC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CASrB,CAAC"}
|
|
@@ -131,3 +131,27 @@ export const query_invite_delete_unclaimed = async (deps, id) => {
|
|
|
131
131
|
const rows = await deps.db.query(`DELETE FROM invite WHERE id = $1 AND claimed_at IS NULL RETURNING id`, [id]);
|
|
132
132
|
return rows.length > 0;
|
|
133
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* Delete every unclaimed invite issued by one of `created_by_actor_ids` — the
|
|
136
|
+
* invite cascade of an account delete or purge.
|
|
137
|
+
*
|
|
138
|
+
* An invite records no authority, so one outliving its issuer's account would
|
|
139
|
+
* still admit a signup. Deleting is how an invite is revoked
|
|
140
|
+
* (`query_invite_delete_unclaimed`), so a voided invite answers a signup as a
|
|
141
|
+
* revoked or unknown one does, and an undelete has nothing to bring back. A
|
|
142
|
+
* claimed invite stays, as the record of the signup it admitted. Twin of the
|
|
143
|
+
* Rust `query_invite_delete_unclaimed_by_creators`.
|
|
144
|
+
*
|
|
145
|
+
* @param deps - query dependencies
|
|
146
|
+
* @param created_by_actor_ids - the issuing actors whose unclaimed invites end
|
|
147
|
+
* @returns the ids of the deleted invites
|
|
148
|
+
* @mutates `invite` table - deletes every unclaimed row created by `created_by_actor_ids`
|
|
149
|
+
*/
|
|
150
|
+
export const query_invite_delete_unclaimed_by_creators = async (deps, created_by_actor_ids) => {
|
|
151
|
+
if (created_by_actor_ids.length === 0)
|
|
152
|
+
return [];
|
|
153
|
+
const rows = await deps.db.query(`DELETE FROM invite
|
|
154
|
+
WHERE created_by = ANY($1) AND claimed_at IS NULL
|
|
155
|
+
RETURNING id`, [created_by_actor_ids]);
|
|
156
|
+
return rows.map((row) => row.id);
|
|
157
|
+
};
|
|
@@ -39,6 +39,7 @@ import type { Context, MiddlewareHandler } from 'hono';
|
|
|
39
39
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
40
40
|
import { type Account, type Actor, type RoleGrant } from './account_schema.js';
|
|
41
41
|
import type { QueryDeps } from '../db/query_deps.js';
|
|
42
|
+
import { type ResolvedAuth } from './resolved_auth.js';
|
|
42
43
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
43
44
|
import { type RouteAuth } from '../http/auth_shape.js';
|
|
44
45
|
import { ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT, ERROR_ACCOUNT_VANISHED } from '../http/error_schemas.js';
|
|
@@ -96,6 +97,24 @@ export declare const require_request_context: (c: Context) => RequestContext;
|
|
|
96
97
|
export interface RequestActorContext extends RequestContext {
|
|
97
98
|
actor: Actor;
|
|
98
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The request context a handler of an auth shape is guaranteed — the one
|
|
102
|
+
* narrowing both handler kinds share, so a route's `route.auth`
|
|
103
|
+
* (`TypedRouteContext`) and an action's `ctx.auth` (`HandlerForSpec`) can't
|
|
104
|
+
* drift:
|
|
105
|
+
*
|
|
106
|
+
* - `actor: 'required'` → `RequestActorContext`
|
|
107
|
+
* - `account: 'required'` (with no actor) → `RequestContext`
|
|
108
|
+
* - anything else → `RequestContext | null`
|
|
109
|
+
*
|
|
110
|
+
* The bracketed form `[T] extends ['required']` keeps the conditional from
|
|
111
|
+
* distributing, so a degraded `AuthAxisState` union (a shape typed without
|
|
112
|
+
* keeping its literals) falls through to the loosest tier rather than the
|
|
113
|
+
* narrowest.
|
|
114
|
+
*/
|
|
115
|
+
export type RequestContextForAuth<TAuth extends Pick<RouteAuth, 'account' | 'actor'>> = [
|
|
116
|
+
TAuth['actor']
|
|
117
|
+
] extends ['required'] ? RequestActorContext : [TAuth['account']] extends ['required'] ? RequestContext : RequestContext | null;
|
|
99
118
|
/**
|
|
100
119
|
* Whether the request context holds an active role_grant for `role` at `scope_id`.
|
|
101
120
|
*
|
|
@@ -276,17 +295,19 @@ export declare const token_scope_surface_denial: (c: Context, capability: string
|
|
|
276
295
|
* that is a 403 (`auth.required_scope`); on one that answers them, a 403
|
|
277
296
|
* would enforce nothing — the holder drops the `Authorization` header and
|
|
278
297
|
* reads the anonymous answer anyway — so the narrowed token *is* the
|
|
279
|
-
* anonymous caller there.
|
|
280
|
-
*
|
|
281
|
-
*
|
|
298
|
+
* anonymous caller there. A `reads_credential` handler reads the account
|
|
299
|
+
* through this, never off `route.credential` directly, so the downgrade is
|
|
300
|
+
* one decision rather than an `&&` hand-rolled per handler.
|
|
282
301
|
*
|
|
283
302
|
* The RPC endpoint is the exception: its dispatcher gates each method against
|
|
284
303
|
* the scope, so it reads the full credential.
|
|
285
304
|
*
|
|
286
|
-
* @param
|
|
305
|
+
* @param route - the handler's `RouteContext`, or anything carrying its `credential`
|
|
287
306
|
* @returns the account id, or `null` for an anonymous caller or a narrowed token
|
|
288
307
|
*/
|
|
289
|
-
export declare const get_public_account_id: (
|
|
308
|
+
export declare const get_public_account_id: (route: {
|
|
309
|
+
readonly credential: ResolvedAuth | null;
|
|
310
|
+
}) => string | null;
|
|
290
311
|
/**
|
|
291
312
|
* Create middleware refusing a route to a credential whose scope does not admit
|
|
292
313
|
* `capability`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_context.d.ts","sourceRoot":"","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"request_context.d.ts","sourceRoot":"","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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,SAAS,KACb,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAO5D,CAAC"}
|
|
@@ -232,6 +232,12 @@ export const create_request_context_middleware = (deps, options = {}) => {
|
|
|
232
232
|
await next();
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
|
+
// a tombstoned account authenticates nothing — its session resolves as
|
|
236
|
+
// no credential, the anonymous caller, as on the Rust spine
|
|
237
|
+
if (!(await query_account_by_id(deps, session.account_id))) {
|
|
238
|
+
await next();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
235
241
|
// The earlier of the signed cookie's expiry (this server's wall clock,
|
|
236
242
|
// which signed it) and the row's (read on the database clock).
|
|
237
243
|
const cookie_expires_at = c.get(SESSION_COOKIE_EXPIRES_AT_KEY) ?? null;
|
|
@@ -293,18 +299,18 @@ export const token_scope_surface_denial = (c, capability) => {
|
|
|
293
299
|
* that is a 403 (`auth.required_scope`); on one that answers them, a 403
|
|
294
300
|
* would enforce nothing — the holder drops the `Authorization` header and
|
|
295
301
|
* reads the anonymous answer anyway — so the narrowed token *is* the
|
|
296
|
-
* anonymous caller there.
|
|
297
|
-
*
|
|
298
|
-
*
|
|
302
|
+
* anonymous caller there. A `reads_credential` handler reads the account
|
|
303
|
+
* through this, never off `route.credential` directly, so the downgrade is
|
|
304
|
+
* one decision rather than an `&&` hand-rolled per handler.
|
|
299
305
|
*
|
|
300
306
|
* The RPC endpoint is the exception: its dispatcher gates each method against
|
|
301
307
|
* the scope, so it reads the full credential.
|
|
302
308
|
*
|
|
303
|
-
* @param
|
|
309
|
+
* @param route - the handler's `RouteContext`, or anything carrying its `credential`
|
|
304
310
|
* @returns the account id, or `null` for an anonymous caller or a narrowed token
|
|
305
311
|
*/
|
|
306
|
-
export const get_public_account_id = (
|
|
307
|
-
const auth =
|
|
312
|
+
export const get_public_account_id = (route) => {
|
|
313
|
+
const auth = route.credential;
|
|
308
314
|
if (auth === null)
|
|
309
315
|
return null;
|
|
310
316
|
if (!token_scope_admits_non_rpc(resolved_auth_scope(auth)))
|
|
@@ -656,9 +662,10 @@ export const create_fuz_authorization_handler = (deps) => {
|
|
|
656
662
|
* authority gates (nothing about a route's body shape reaches a caller those
|
|
657
663
|
* gates refuse), so the mutation half reads the raw body instead.
|
|
658
664
|
*
|
|
659
|
-
* The raw read mirrors `create_input_validation`'s own skip
|
|
660
|
-
* —
|
|
661
|
-
*
|
|
665
|
+
* The raw read mirrors `create_input_validation`'s own skip condition exactly
|
|
666
|
+
* — a null input, which every GET has (`apply_route_specs` refuses a GET with
|
|
667
|
+
* an input) — so this never parses a body the route itself would have left
|
|
668
|
+
* alone. That matters for the routes carrying raw bytes rather
|
|
662
669
|
* than JSON (git smart-HTTP, binary uploads): they declare `input: literal(null)`,
|
|
663
670
|
* so their stream reaches the handler untouched, and they carry `acting` on
|
|
664
671
|
* `query` regardless.
|
|
@@ -674,7 +681,7 @@ const read_route_acting = async (c, spec) => {
|
|
|
674
681
|
const validated_query = c.get('validated_query');
|
|
675
682
|
if (validated_query && typeof validated_query.acting === 'string')
|
|
676
683
|
return validated_query.acting;
|
|
677
|
-
if (
|
|
684
|
+
if (is_null_schema(spec.input))
|
|
678
685
|
return undefined;
|
|
679
686
|
const read = await read_json_body(c.req);
|
|
680
687
|
// Malformed body — input validation answers with the 400.
|
|
@@ -409,7 +409,7 @@ export declare const role_grant_offer_create_action_spec: {
|
|
|
409
409
|
}>;
|
|
410
410
|
async: true;
|
|
411
411
|
description: string;
|
|
412
|
-
error_reasons: ("role_grant_offer_self_target" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_account_mismatch" | "role_grant_builtin_scoped")[];
|
|
412
|
+
error_reasons: ("role_grant_offer_self_target" | "role_grant_offer_role_not_grantable" | "role_grant_offer_not_authorized" | "role_grant_offer_actor_account_mismatch" | "role_grant_builtin_scoped" | "authentication_required")[];
|
|
413
413
|
rate_limit: "account";
|
|
414
414
|
};
|
|
415
415
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_action_specs.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_action_specs.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAkB3E,oEAAoE;AACpE,eAAO,MAAM,kCAAkC,EAAG,8BAAuC,CAAC;AAC1F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAClF,wGAAwG;AACxG,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF,uIAAuI;AACvI,eAAO,MAAM,yCAAyC,EACrD,qCAA8C,CAAC;AAChD,gKAAgK;AAChK,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,6FAA6F;AAC7F,eAAO,MAAM,qCAAqC,EAAG,iCAA0C,CAAC;AAChG,wHAAwH;AACxH,eAAO,MAAM,6CAA6C,EACzD,yCAAkD,CAAC;AACpD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAG,2BAAoC,CAAC;AACpF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,EAAG,4BAAqC,CAAC;AACtF;;;;;;GAMG;AACH,eAAO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;EAGhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIxE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBX,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBX,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWZ,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWZ,CAAC;AAEtC,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWT,CAAC;AAEtC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWZ,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;CAkBL,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBL,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,yBAAyB,CAS9E,CAAC"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
25
25
|
import { array, check, integer, literal, max_value, message, min_value, nullable, number, object, optional, pipe, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
|
|
26
26
|
import { ActingActor, Uuid, bounded_string } from '../primitive_schemas.js';
|
|
27
|
-
import { ERROR_INSUFFICIENT_PERMISSIONS, ERROR_LIMIT_INVALID, ERROR_OFFSET_INVALID, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
27
|
+
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_LIMIT_INVALID, ERROR_OFFSET_INVALID, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
28
28
|
import { NAME_LENGTH_MAX } from './name_schema.js';
|
|
29
29
|
import { RoleName } from './role_schema.js';
|
|
30
30
|
import { ScopeKindName } from './scope_kind_schema.js';
|
|
@@ -275,7 +275,8 @@ export const role_grant_offer_create_action_spec = {
|
|
|
275
275
|
ERROR_ROLE_GRANT_OFFER_ROLE_NOT_GRANTABLE,
|
|
276
276
|
ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED,
|
|
277
277
|
ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH,
|
|
278
|
-
ERROR_ROLE_GRANT_BUILTIN_SCOPED
|
|
278
|
+
ERROR_ROLE_GRANT_BUILTIN_SCOPED,
|
|
279
|
+
ERROR_AUTHENTICATION_REQUIRED
|
|
279
280
|
],
|
|
280
281
|
rate_limit: 'account'
|
|
281
282
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAMN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_actions.d.ts","sourceRoot":"","s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,2BAAgC,KACvC,KAAK,CAAC,SAAS,CAwvBjB,CAAC"}
|
|
@@ -63,12 +63,12 @@ import { queue_connection_close } from '../actions/connection_closer.js';
|
|
|
63
63
|
import { builtin_role_specs, is_builtin_role, ROLE_ADMIN, ROLE_KEEPER, role_has_grant_path } from './role_schema.js';
|
|
64
64
|
import { GRANT_PATH_ADMIN } from './grant_path_schema.js';
|
|
65
65
|
import { ROLE_GRANT_OFFER_DEFAULT_TTL_MS, to_role_grant_offer_json } from './role_grant_offer_schema.js';
|
|
66
|
-
import { query_role_grant_offer_create, query_role_grant_offer_decline, query_role_grant_offer_retract, query_role_grant_offer_list, query_role_grant_offer_history_for_account, query_accept_offer, RoleGrantOfferActorAccountMismatchError, RoleGrantOfferActorMismatchError, RoleGrantOfferAlreadyTerminalError, RoleGrantOfferBuiltinRefusedError, RoleGrantOfferExpiredError, RoleGrantOfferNotFoundError, RoleGrantOfferSelfTargetError, query_role_grant_offer_supersede_outgoing } from './role_grant_offer_queries.js';
|
|
66
|
+
import { query_role_grant_offer_create, query_role_grant_offer_decline, query_role_grant_offer_retract, query_role_grant_offer_list, query_role_grant_offer_history_for_account, query_accept_offer, RoleGrantOfferActorAccountMismatchError, RoleGrantOfferActorMismatchError, RoleGrantOfferGrantorNotActiveError, RoleGrantOfferRecipientNotActiveError, RoleGrantOfferAlreadyTerminalError, RoleGrantOfferBuiltinRefusedError, RoleGrantOfferExpiredError, RoleGrantOfferNotFoundError, RoleGrantOfferSelfTargetError, query_role_grant_offer_supersede_outgoing } from './role_grant_offer_queries.js';
|
|
67
67
|
import { query_account_has_active_global_role, query_account_has_global_role, query_count_active_accounts_with_global_role_for_update, query_create_role_grant, query_role_grant_find_active_role_for_actor, query_revoke_role_grant } from './role_grant_queries.js';
|
|
68
68
|
import { query_actor_by_id, query_active_actors_by_account } from './account_queries.js';
|
|
69
69
|
import { has_scoped_role } from './request_context.js';
|
|
70
70
|
import { build_role_grant_offer_accepted_notification, build_role_grant_offer_declined_notification, build_role_grant_offer_received_notification, build_role_grant_offer_retracted_notification, build_role_grant_offer_supersede_notification, build_role_grant_revoked_notification, create_validated_notification_sender } from './role_grant_offer_notifications.js';
|
|
71
|
-
import { ERROR_INSUFFICIENT_PERMISSIONS, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
71
|
+
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
72
72
|
import { ERROR_CANNOT_REVOKE_KEEPER_ADMIN, ERROR_CANNOT_REVOKE_LAST_ADMIN, ERROR_ROLE_GRANT_BUILTIN_SCOPED, ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH, ERROR_ROLE_GRANT_OFFER_ACTOR_MISMATCH, ERROR_ROLE_GRANT_OFFER_EXPIRED, ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED, ERROR_ROLE_GRANT_OFFER_NOT_FOUND, ERROR_ROLE_GRANT_OFFER_ROLE_NOT_GRANTABLE, ERROR_ROLE_GRANT_OFFER_SELF_TARGET, ERROR_ROLE_GRANT_OFFER_TERMINAL, role_grant_offer_create_action_spec, role_grant_offer_accept_action_spec, role_grant_offer_decline_action_spec, role_grant_offer_retract_action_spec, role_grant_offer_list_action_spec, role_grant_offer_history_action_spec, role_grant_revoke_action_spec, role_grant_assign_action_spec } from './role_grant_offer_action_specs.js';
|
|
73
73
|
// -- Helpers ----------------------------------------------------------------
|
|
74
74
|
/**
|
|
@@ -181,6 +181,26 @@ export const create_role_grant_offer_actions = (deps, options = {}) => {
|
|
|
181
181
|
});
|
|
182
182
|
return error;
|
|
183
183
|
};
|
|
184
|
+
// The refusal for a recipient that is missing or soft-deleted: an actor
|
|
185
|
+
// named that is no active actor of the account is the mismatch, else the
|
|
186
|
+
// account is not found. Offer-create and assign answer a deleted recipient
|
|
187
|
+
// exactly as a missing one, so the call says nothing a missing id wouldn't.
|
|
188
|
+
const recipient_not_found_error = (to_actor_id) => to_actor_id != null
|
|
189
|
+
? jsonrpc_errors.invalid_params('to_actor_id does not belong to to_account_id', {
|
|
190
|
+
reason: ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH
|
|
191
|
+
})
|
|
192
|
+
: jsonrpc_errors.not_found('account');
|
|
193
|
+
// The recipient's active actors, refusing a recipient that can't receive a
|
|
194
|
+
// role: a missing or soft-deleted account (no active actor), or a named
|
|
195
|
+
// actor that is not one of them. Runs after every authority gate, so a
|
|
196
|
+
// caller refused the conferral learns nothing of the recipient.
|
|
197
|
+
const require_active_recipient = async (ctx, to_account_id, to_actor_id) => {
|
|
198
|
+
const actors = await query_active_actors_by_account(ctx, to_account_id);
|
|
199
|
+
if (to_actor_id != null ? !actors.some((a) => a.id === to_actor_id) : actors.length === 0) {
|
|
200
|
+
throw recipient_not_found_error(to_actor_id);
|
|
201
|
+
}
|
|
202
|
+
return actors;
|
|
203
|
+
};
|
|
184
204
|
// Returns {offer} only — no auto-accept. Recipient must call
|
|
185
205
|
// role_grant_offer_accept; admin tests drive the full consent flow over
|
|
186
206
|
// RPC (see testing/admin_integration.ts `offer_and_accept`), or seed
|
|
@@ -224,6 +244,8 @@ export const create_role_grant_offer_actions = (deps, options = {}) => {
|
|
|
224
244
|
reason: ERROR_ROLE_GRANT_OFFER_NOT_AUTHORIZED
|
|
225
245
|
});
|
|
226
246
|
}
|
|
247
|
+
// Both parties' rules live in the query, after every authority gate above,
|
|
248
|
+
// so a caller refused the conferral learns nothing of the recipient.
|
|
227
249
|
let offer;
|
|
228
250
|
try {
|
|
229
251
|
offer = await query_role_grant_offer_create(ctx, {
|
|
@@ -244,10 +266,19 @@ export const create_role_grant_offer_actions = (deps, options = {}) => {
|
|
|
244
266
|
reason: ERROR_ROLE_GRANT_OFFER_SELF_TARGET
|
|
245
267
|
});
|
|
246
268
|
}
|
|
247
|
-
if (err instanceof RoleGrantOfferActorAccountMismatchError
|
|
269
|
+
if (err instanceof RoleGrantOfferActorAccountMismatchError ||
|
|
270
|
+
err instanceof RoleGrantOfferRecipientNotActiveError) {
|
|
248
271
|
await emit_create_failure_audit(ctx, auth, input);
|
|
249
|
-
|
|
250
|
-
|
|
272
|
+
// a named actor is the mismatch, else the account is not found —
|
|
273
|
+
// the answers `role_grant_assign` gives the same recipient
|
|
274
|
+
throw recipient_not_found_error(input.to_actor_id);
|
|
275
|
+
}
|
|
276
|
+
// The caller's own account was deleted while the request was in flight:
|
|
277
|
+
// refused as the dead credential it now is, as `account_token_create`
|
|
278
|
+
// refuses it, with no audit row from an account that is gone.
|
|
279
|
+
if (err instanceof RoleGrantOfferGrantorNotActiveError) {
|
|
280
|
+
throw jsonrpc_errors.unauthenticated('unauthenticated', {
|
|
281
|
+
reason: ERROR_AUTHENTICATION_REQUIRED
|
|
251
282
|
});
|
|
252
283
|
}
|
|
253
284
|
throw err;
|
|
@@ -655,22 +686,14 @@ export const create_role_grant_offer_actions = (deps, options = {}) => {
|
|
|
655
686
|
// active actor of `to_account_id`; otherwise the account's sole active
|
|
656
687
|
// actor is used (a multi-actor account must name one). A missing /
|
|
657
688
|
// actorless account 404-masks.
|
|
658
|
-
const actors = await
|
|
689
|
+
const actors = await require_active_recipient(ctx, input.to_account_id, input.to_actor_id);
|
|
659
690
|
let target_actor_id;
|
|
660
691
|
if (input.to_actor_id != null) {
|
|
661
|
-
if (!actors.some((a) => a.id === input.to_actor_id)) {
|
|
662
|
-
throw jsonrpc_errors.invalid_params('to_actor_id does not belong to to_account_id', {
|
|
663
|
-
reason: ERROR_ROLE_GRANT_OFFER_ACTOR_ACCOUNT_MISMATCH
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
692
|
target_actor_id = input.to_actor_id;
|
|
667
693
|
}
|
|
668
694
|
else if (actors.length === 1) {
|
|
669
695
|
target_actor_id = actors[0].id;
|
|
670
696
|
}
|
|
671
|
-
else if (actors.length === 0) {
|
|
672
|
-
throw jsonrpc_errors.not_found('account');
|
|
673
|
-
}
|
|
674
697
|
else {
|
|
675
698
|
throw jsonrpc_errors.invalid_params('to_actor_id is required for a multi-actor account');
|
|
676
699
|
}
|
|
@@ -54,7 +54,13 @@ export declare const role_grant_offer_expr: (alias: string) => import("../db/sql
|
|
|
54
54
|
* `DeclinedOffer` shape every offer-superseding cascade returns (the revoke
|
|
55
55
|
* cascades in `auth/role_grant_queries.ts`, decline + accept-supersede in
|
|
56
56
|
* `auth/role_grant_offer_queries.ts`). The CTE must be named `updated` and
|
|
57
|
-
* `RETURNING` the full offer row.
|
|
57
|
+
* `RETURNING` the full offer row, and the tail ends the statement.
|
|
58
|
+
*
|
|
59
|
+
* Ordered oldest first, by `created_at` then `id`: an `UPDATE … RETURNING`
|
|
60
|
+
* comes back in no fixed order, and the callers emit an audit row and a
|
|
61
|
+
* notification per row in the order returned, so without it two runs (or the
|
|
62
|
+
* two spines) write the same cascade in different orders. Twin of the Rust
|
|
63
|
+
* `updated_offer_select`.
|
|
58
64
|
*/
|
|
59
65
|
export declare const ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT: string;
|
|
60
66
|
export declare const ROLE_GRANT_OFFER_SCHEMA = "\nCREATE TABLE IF NOT EXISTS role_grant_offer (\n id UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n from_actor_id UUID NOT NULL REFERENCES actor(id) ON DELETE CASCADE,\n to_account_id UUID NOT NULL REFERENCES account(id) ON DELETE CASCADE,\n to_actor_id UUID NULL REFERENCES actor(id) ON DELETE CASCADE,\n role TEXT NOT NULL,\n scope_kind TEXT NULL,\n scope_id UUID NULL,\n message TEXT NULL,\n created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n expires_at TIMESTAMPTZ NOT NULL,\n accepted_at TIMESTAMPTZ NULL,\n declined_at TIMESTAMPTZ NULL,\n decline_reason TEXT NULL,\n retracted_at TIMESTAMPTZ NULL,\n superseded_at TIMESTAMPTZ NULL,\n resulting_role_grant_id UUID NULL REFERENCES role_grant(id) ON DELETE SET NULL,\n CONSTRAINT role_grant_offer_single_terminal CHECK (\n (accepted_at IS NOT NULL)::int\n + (declined_at IS NOT NULL)::int\n + (retracted_at IS NOT NULL)::int\n + (superseded_at IS NOT NULL)::int\n <= 1\n ),\n CONSTRAINT role_grant_offer_role_grant_iff_accepted CHECK (\n (accepted_at IS NOT NULL) = (resulting_role_grant_id IS NOT NULL)\n ),\n CONSTRAINT role_grant_offer_reason_iff_declined CHECK (\n decline_reason IS NULL OR declined_at IS NOT NULL\n ),\n CONSTRAINT role_grant_offer_scope_kind_paired CHECK (\n (scope_kind IS NULL) = (scope_id IS NULL)\n )\n)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_ddl.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,mHAAmH;AACnH,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC,WAAW,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,4QAkBmB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,8DAQhC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"role_grant_offer_ddl.d.ts","sourceRoot":"","sources":["../../src/lib/auth/role_grant_offer_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,mHAAmH;AACnH,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC,WAAW,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,4QAkBmB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,8DAQhC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oCAAoC,QAOnB,CAAC;AAK/B,eAAO,MAAM,uBAAuB,qzCAkClC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qCAAqC,2XAYpB,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,kOAMX,CAAC"}
|
|
@@ -81,11 +81,18 @@ export const role_grant_offer_expr = iso8601_timestamp_expr(ROLE_GRANT_OFFER_COL
|
|
|
81
81
|
* `DeclinedOffer` shape every offer-superseding cascade returns (the revoke
|
|
82
82
|
* cascades in `auth/role_grant_queries.ts`, decline + accept-supersede in
|
|
83
83
|
* `auth/role_grant_offer_queries.ts`). The CTE must be named `updated` and
|
|
84
|
-
* `RETURNING` the full offer row.
|
|
84
|
+
* `RETURNING` the full offer row, and the tail ends the statement.
|
|
85
|
+
*
|
|
86
|
+
* Ordered oldest first, by `created_at` then `id`: an `UPDATE … RETURNING`
|
|
87
|
+
* comes back in no fixed order, and the callers emit an audit row and a
|
|
88
|
+
* notification per row in the order returned, so without it two runs (or the
|
|
89
|
+
* two spines) write the same cascade in different orders. Twin of the Rust
|
|
90
|
+
* `updated_offer_select`.
|
|
85
91
|
*/
|
|
86
92
|
export const ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT = `SELECT ${qualify_columns(ROLE_GRANT_OFFER_COLUMNS, 'u', role_grant_offer_expr('u'))}, grantor.account_id AS from_account_id
|
|
87
93
|
FROM updated u
|
|
88
|
-
JOIN actor grantor ON grantor.id = u.from_actor_id
|
|
94
|
+
JOIN actor grantor ON grantor.id = u.from_actor_id
|
|
95
|
+
ORDER BY u.created_at, u.id`;
|
|
89
96
|
// Frozen v1 body — `expire_audited_at` is added by the appended
|
|
90
97
|
// `role_grant_offer_expire_audited_at` migration (with its partial sweep
|
|
91
98
|
// index), so a fresh bootstrap and an old deployed DB converge on one shape.
|